forked from nviennot/tinyusb-sys-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tusb_config.rs
194 lines (185 loc) · 7.84 KB
/
tusb_config.rs
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// Auto-generated by generate_features.py
pub fn generate_cfg() -> String {
let mut cfg = String::new();
cfg.push_str("#ifndef _TUSB_CONFIG_H_\n");
cfg.push_str("#define _TUSB_CONFIG_H_\n");
#[cfg(feature = "host")]
cfg.push_str("#define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST\n");
#[cfg(feature = "device")]
cfg.push_str("#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE\n");
cfg.push_str("#define CFG_TUSB_OS OPT_OS_NONE\n");
cfg.push_str("#define CFG_TUSB_MEM_SECTION __attribute__((section(\".data.usb\")))\n");
cfg.push_str("#define CFG_TUD_MSC_EP_BUFSIZE 512\n");
#[cfg(all(feature = "host", feature = "device"))]
compile_error!("choose only host or device");
#[cfg(not(any(feature = "host", feature ="device")))]
compile_error!("select mode host or device");
#[cfg(feature = "lpc11uxx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC11UXX\n");
#[cfg(feature = "lpc13xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC13XX\n");
#[cfg(feature = "lpc15xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC15XX\n");
#[cfg(feature = "lpc175x_6x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC175X_6X\n");
#[cfg(feature = "lpc177x_8x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC177X_8X\n");
#[cfg(feature = "lpc18xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC18XX\n");
#[cfg(feature = "lpc40xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC40XX\n");
#[cfg(feature = "lpc43xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC43XX\n");
#[cfg(feature = "lpc51uxx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC51UXX\n");
#[cfg(feature = "lpc54xxx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC54XXX\n");
#[cfg(feature = "lpc55xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_LPC55XX\n");
#[cfg(feature = "nrf5x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_NRF5X\n");
#[cfg(feature = "samd21")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAMD21\n");
#[cfg(feature = "samd51")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAMD51\n");
#[cfg(feature = "samg")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAMG\n");
#[cfg(feature = "same5x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAME5X\n");
#[cfg(feature = "samd11")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAMD11\n");
#[cfg(feature = "saml22")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAML22\n");
#[cfg(feature = "saml21")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAML21\n");
#[cfg(feature = "samx7x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_SAMX7X\n");
#[cfg(feature = "stm32f0")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32F0\n");
#[cfg(feature = "stm32f1")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32F1\n");
#[cfg(feature = "stm32f2")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32F2\n");
#[cfg(feature = "stm32f3")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32F3\n");
#[cfg(feature = "stm32f4")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32F4\n");
#[cfg(feature = "stm32f7")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32F7\n");
#[cfg(feature = "stm32h7")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32H7\n");
#[cfg(feature = "stm32l1")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32L1\n");
#[cfg(feature = "stm32l0")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32L0\n");
#[cfg(feature = "stm32l4")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32L4\n");
#[cfg(feature = "stm32g0")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32G0\n");
#[cfg(feature = "stm32g4")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_STM32G4\n");
#[cfg(feature = "cxd56")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_CXD56\n");
#[cfg(feature = "msp430x5xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_MSP430X5XX\n");
#[cfg(feature = "msp432e4")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_MSP432E4\n");
#[cfg(feature = "tm4c123")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_TM4C123\n");
#[cfg(feature = "tm4c129")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_TM4C129\n");
#[cfg(feature = "valentyusb_eptri")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_VALENTYUSB_EPTRI\n");
#[cfg(feature = "mimxrt10xx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_MIMXRT10XX\n");
#[cfg(feature = "nuc121")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_NUC121\n");
#[cfg(feature = "nuc126")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_NUC126\n");
#[cfg(feature = "nuc120")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_NUC120\n");
#[cfg(feature = "nuc505")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_NUC505\n");
#[cfg(feature = "esp32s2")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_ESP32S2\n");
#[cfg(feature = "esp32s3")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_ESP32S3\n");
#[cfg(feature = "da1469x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_DA1469X\n");
#[cfg(feature = "rp2040")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_RP2040\n");
#[cfg(feature = "mkl25zxx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_MKL25ZXX\n");
#[cfg(feature = "k32l2bxx")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_K32L2BXX\n");
#[cfg(feature = "efm32gg")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_EFM32GG\n");
#[cfg(feature = "rx63x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_RX63X\n");
#[cfg(feature = "rx65x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_RX65X\n");
#[cfg(feature = "rx72n")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_RX72N\n");
#[cfg(feature = "mm32f327x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_MM32F327X\n");
#[cfg(feature = "gd32vf103")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_GD32VF103\n");
#[cfg(feature = "bcm2711")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_BCM2711\n");
#[cfg(feature = "bcm2835")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_BCM2835\n");
#[cfg(feature = "bcm2837")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_BCM2837\n");
#[cfg(feature = "xmc4000")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_XMC4000\n");
#[cfg(feature = "pic32mz")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_PIC32MZ\n");
#[cfg(feature = "ft90x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_FT90X\n");
#[cfg(feature = "ft93x")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_FT93X\n");
#[cfg(feature = "f1c100s")]
cfg.push_str("#define CFG_TUSB_MCU OPT_MCU_F1C100S\n");
#[cfg(all(feature = "host", feature = "hub"))]
cfg.push_str("#define CFG_TUH_HUB 1\n");
#[cfg(all(feature = "host", feature = "hub"))]
cfg.push_str("#define CFG_TUH_DEVICE_MAX 4\n");
#[cfg(all(feature = "host", feature = "cdc"))]
cfg.push_str("#define CFG_TUH_CDC 1\n");
#[cfg(all(feature = "host", feature = "hid"))]
cfg.push_str("#define CFG_TUH_HID 4\n");
#[cfg(all(feature = "host", feature = "midi"))]
cfg.push_str("#define CFG_TUH_MIDI 1\n");
#[cfg(all(feature = "host", feature = "msc"))]
cfg.push_str("#define CFG_TUH_MSC 1\n");
#[cfg(all(feature = "host", feature = "vendor"))]
cfg.push_str("#define CFG_TUH_VENDOR 1\n");
#[cfg(all(feature = "device", feature = "cdc"))]
cfg.push_str("#define CFG_TUD_CDC 1\n");
#[cfg(all(feature = "device", feature = "msc"))]
cfg.push_str("#define CFG_TUD_MSC 1\n");
#[cfg(all(feature = "device", feature = "hid"))]
cfg.push_str("#define CFG_TUD_HID 1\n");
#[cfg(all(feature = "device", feature = "audio"))]
cfg.push_str("#define CFG_TUD_AUDIO 1\n");
#[cfg(all(feature = "device", feature = "video"))]
cfg.push_str("#define CFG_TUD_VIDEO 1\n");
#[cfg(all(feature = "device", feature = "midi"))]
cfg.push_str("#define CFG_TUD_MIDI 1\n");
#[cfg(all(feature = "device", feature = "vendor"))]
cfg.push_str("#define CFG_TUD_VENDOR 1\n");
#[cfg(all(feature = "device", feature = "usbtmc"))]
cfg.push_str("#define CFG_TUD_USBTMC 1\n");
#[cfg(all(feature = "device", feature = "dfu_runtime"))]
cfg.push_str("#define CFG_TUD_DFU_RUNTIME 1\n");
#[cfg(all(feature = "device", feature = "dfu"))]
cfg.push_str("#define CFG_TUD_DFU 1\n");
#[cfg(all(feature = "device", feature = "bth"))]
cfg.push_str("#define CFG_TUD_BTH 1\n");
#[cfg(all(feature = "device", feature = "ecm_rndis"))]
cfg.push_str("#define CFG_TUD_ECM_RNDIS 1\n");
#[cfg(all(feature = "device", feature = "ncm"))]
cfg.push_str("#define CFG_TUD_NCM 1\n");
cfg.push_str("#endif\n");
cfg
}