summaryrefslogtreecommitdiffstats
path: root/hid/firmware/usb_config.h
blob: 61dadf818c320e53438c4c341cce029b245859a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef USB_CONFIG_H_
#define USB_CONFIG_H_
/*
 *   Tiny USB stack
 *
 *   Static stack configuration
 */

#include "debug.h"

/* Compile minimal USB stack for bootloader code */
#ifdef IN_BOOT
# define USB_MINI		1
#else
# define USB_MINI		0
#endif

/* Enable(1)/disable(0) USB debug messages */
#define USB_MESSAGES		1


#if !USB_MINI && USB_MESSAGES

/* Print an integer (8bit or 16bit) together with a message string literal. */
# define usb_print1num(description_string, number)	print1num(description_string, number)
/* Print two integers (8bit or 16bit) together with message string literals. */
# define usb_print2num(d1, n1, d2, n2)			print2num(d1, n1, d2, n2)
/* Print a string */
# define usb_printstr(string_literal)			printstr(string_literal)
/* Dump a memory region */
# define usb_dumpmem(memory, size)			dumpmem(memory, size)
/* Assertion */
# define USB_BUG_ON(cond)				PANIC_ON(cond)

#else
# define usb_print1num(description_string, number)	do { } while (0)
# define usb_print2num(d1, n1, d2, n2)			do { } while (0)
# define usb_printstr(string_literal)			do { } while (0)
# define usb_dumpmem(memory, size)			do { } while (0)
# define USB_BUG_ON(cond)				do { if (cond) { } } while (0)
#endif

/* Maximum software packet buffer size for the endpoints. */
#define USBCFG_EP0_MAXSIZE	128
#define USBCFG_EP1_MAXSIZE	64
#define USBCFG_EP2_MAXSIZE	64

/* Power control
 * Set to 1, if the device is selfpowered.
 * Set to 0, if the device is buspowered. */
#define USBCFG_SELFPOWERED	0

/* Architecture endianness.
 * Set to 1 for BigEndian.
 * Set to 0 for LittleEndian. */
#define USBCFG_ARCH_BE		0

/* Architecture program memory annotations and access */
#define USB_PROGMEM			PROGMEM
#define USB_PROGPTR			PROGPTR
#define usb_pgm_read(addr)		pgm_read(addr)
#define usb_copy_from_pgm(t, s, l)	memcpy_P(t, s, l)

/* Endpoint configuration */
#if USB_MINI
# define USB_WITH_EP1		0
# define USB_WITH_EP2		1
#else
# define USB_WITH_EP1		1
# define USB_WITH_EP2		1
#endif


/* Application layer configuration */
#if USB_MINI
# define USB_APP_HAVE_RESET		0
# define USB_APP_HAVE_HIGHPOWER		0
# define USB_APP_HAVE_CTLSETUPRX	0
# define USB_APP_HAVE_EP1RX		0
# define USB_APP_HAVE_EP1TXPOLL		0
# define USB_APP_HAVE_EP2RX		0
# define USB_APP_HAVE_EP2TXPOLL		0
#else
# define USB_APP_HAVE_RESET		0
# define USB_APP_HAVE_HIGHPOWER		0
# define USB_APP_HAVE_CTLSETUPRX	0
# define USB_APP_HAVE_EP1RX		0
# define USB_APP_HAVE_EP1TXPOLL		0
# define USB_APP_HAVE_EP2RX		0
# define USB_APP_HAVE_EP2TXPOLL		0
#endif

#endif /* USB_CONFIG_H_ */
bues.ch cgit interface