ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
tz_secure_only_usb_hs_descriptors.c
Go to the documentation of this file.
1
31
32#include <stdint.h>
33
35
36#ifndef RA8_OFF_TARGET
37#include "ux_api.h"
38
39/* -------------------------------------------------------------------------- */
40/* USB descriptors (DEVICE + CONFIG + IAD + CDC interfaces + endpoints) */
41/* -------------------------------------------------------------------------- */
42
43/* CDC-ACM composite descriptor frameworks. Two slots are required so
44 * USBX can hand the right one to the host based on the negotiated bus
45 * speed. The HS slot (s_tz_secure_only_usb_hs_device_framework_hs)
46 * carries 512-byte bulk wMaxPacketSize values, which the USB 2.0 spec
47 * MANDATES for HS bulk endpoints; the FS fallback keeps 64-byte bulk MPS
48 * for FS-only hosts. All other fields (Device, Configuration, IAD, CDC
49 * class descriptors, Interrupt EP) are identical between the two -- only
50 * the two bulk EP wMaxPacketSize bytes differ. */
52 /* Device descriptor (USB 2.0 sec 9.6.1) -- 18 bytes. */
53 0x12U,
54 0x01U,
55 0x00U,
56 0x02U,
57 0xEFU,
58 0x02U,
59 0x01U,
60 0x40U,
61 0x09U, /* idVendor lo: VID = 0x1209 (pid.codes open-source VID). */
62 0x12U, /* idVendor hi */
63 0x0CU, /* idProduct lo: PID = 0x000C (HS CDC ACM). */
64 0x00U, /* idProduct hi */
65 0x00U,
66 0x01U,
67 0x01U,
68 0x02U,
69 0x03U,
70 0x01U,
71 /* Configuration descriptor (75 bytes total). */
72 0x09U,
73 0x02U,
74 0x4BU,
75 0x00U,
76 0x02U,
77 0x01U,
78 0x00U,
79 0x80U,
80 0x32U,
81 /* Interface association (CDC). */
82 0x08U,
83 0x0BU,
84 0x00U,
85 0x02U,
86 0x02U,
87 0x02U,
88 0x01U,
89 0x00U,
90 /* Communications interface (CDC ACM). */
91 0x09U,
92 0x04U,
93 0x00U,
94 0x00U,
95 0x01U,
96 0x02U,
97 0x02U,
98 0x01U,
99 0x00U,
100 /* CDC header functional descriptor. bcdCDC = 0x0120 (CDC 1.20). */
101 0x05U,
102 0x24U,
103 0x00U,
104 0x20U,
105 0x01U,
106 /* Call-management functional descriptor. */
107 0x05U,
108 0x24U,
109 0x01U,
110 0x01U,
111 0x01U,
112 /* ACM functional descriptor. */
113 0x04U,
114 0x24U,
115 0x02U,
116 0x02U,
117 /* Union functional descriptor. */
118 0x05U,
119 0x24U,
120 0x06U,
121 0x00U,
122 0x01U,
123 /* Interrupt-IN endpoint (EP3 IN, 8-byte MPS, 255 ms poll). */
124 0x07U,
125 0x05U,
126 0x83U,
127 0x03U,
128 0x08U,
129 0x00U,
130 0xFFU,
131 /* Data-class interface. */
132 0x09U,
133 0x04U,
134 0x01U,
135 0x00U,
136 0x02U,
137 0x0AU,
138 0x00U,
139 0x00U,
140 0x00U,
141 /* Bulk-OUT endpoint (EP2 OUT, 64-byte MPS). */
142 0x07U,
143 0x05U,
144 0x02U,
145 0x02U,
146 0x40U,
147 0x00U,
148 0x00U,
149 /* Bulk-IN endpoint (EP1 IN, 64-byte MPS). */
150 0x07U,
151 0x05U,
152 0x81U,
153 0x02U,
154 0x40U,
155 0x00U,
156 0x00U,
157};
158
159static_assert(sizeof(s_tz_secure_only_usb_hs_device_framework_fs) ==
161 "FS device framework length must match the header declaration");
162
163/* HS variant: identical to s_tz_secure_only_usb_hs_device_framework_fs
164 * except the bulk endpoints carry wMaxPacketSize = 512 (0x0200) per USB
165 * 2.0 sec 5.8.3 ("HS bulk endpoints must use 512-byte MPS"). Includes a
166 * DEVICE_QUALIFIER descriptor (USB 2.0 sec 9.6.2), which is
167 * mandatory for HS-capable devices -- the host (e.g. macOS)
168 * issues GET_DESCRIPTOR(DEVICE_QUALIFIER) during enumeration to
169 * learn the device's other-speed capabilities, and a STALL
170 * response causes some hosts to abandon enumeration. */
172 /* Device descriptor (USB 2.0 sec 9.6.1) -- 18 bytes. */
173 0x12U,
174 0x01U,
175 0x00U,
176 0x02U,
177 0xEFU,
178 0x02U,
179 0x01U,
180 0x40U,
181 0x09U, /* idVendor lo: VID = 0x1209 (pid.codes open-source VID). */
182 0x12U, /* idVendor hi */
183 0x0CU, /* idProduct lo: PID = 0x000C (HS CDC ACM). */
184 0x00U, /* idProduct hi */
185 0x00U,
186 0x01U,
187 0x01U,
188 0x02U,
189 0x03U,
190 0x01U,
191 /* Device Qualifier descriptor (USB 2.0 sec 9.6.2) -- 10 bytes.
192 * Reports the device's capabilities at the OTHER speed (FS in this
193 * case). bcdUSB=0x0200, class/subclass/protocol mirror the device
194 * descriptor, MPS0=64, num-configurations=1, reserved=0. */
195 0x0AU,
196 0x06U,
197 0x00U,
198 0x02U,
199 0xEFU,
200 0x02U,
201 0x01U,
202 0x40U,
203 0x01U,
204 0x00U,
205 /* Configuration descriptor (75 bytes total). */
206 0x09U,
207 0x02U,
208 0x4BU,
209 0x00U,
210 0x02U,
211 0x01U,
212 0x00U,
213 0x80U,
214 0x32U,
215 /* Interface association (CDC). */
216 0x08U,
217 0x0BU,
218 0x00U,
219 0x02U,
220 0x02U,
221 0x02U,
222 0x01U,
223 0x00U,
224 /* Communications interface (CDC ACM). */
225 0x09U,
226 0x04U,
227 0x00U,
228 0x00U,
229 0x01U,
230 0x02U,
231 0x02U,
232 0x01U,
233 0x00U,
234 /* CDC header functional descriptor. bcdCDC = 0x0120 (CDC 1.20). */
235 0x05U,
236 0x24U,
237 0x00U,
238 0x20U,
239 0x01U,
240 /* Call-management functional descriptor. */
241 0x05U,
242 0x24U,
243 0x01U,
244 0x01U,
245 0x01U,
246 /* ACM functional descriptor. */
247 0x04U,
248 0x24U,
249 0x02U,
250 0x02U,
251 /* Union functional descriptor. */
252 0x05U,
253 0x24U,
254 0x06U,
255 0x00U,
256 0x01U,
257 /* Interrupt-IN endpoint (EP3 IN, 8-byte MPS, bInterval=8 microframes
258 * = 1 ms poll). HS uses bInterval=2^(n-1)*125us; n=8 -> 16ms. */
259 0x07U,
260 0x05U,
261 0x83U,
262 0x03U,
263 0x08U,
264 0x00U,
265 0x08U,
266 /* Data-class interface. */
267 0x09U,
268 0x04U,
269 0x01U,
270 0x00U,
271 0x02U,
272 0x0AU,
273 0x00U,
274 0x00U,
275 0x00U,
276 /* Bulk-OUT endpoint (EP2 OUT, 512-byte MPS for HS). */
277 0x07U,
278 0x05U,
279 0x02U,
280 0x02U,
281 0x00U,
282 0x02U,
283 0x00U,
284 /* Bulk-IN endpoint (EP1 IN, 512-byte MPS for HS). */
285 0x07U,
286 0x05U,
287 0x81U,
288 0x02U,
289 0x00U,
290 0x02U,
291 0x00U,
292};
293
294static_assert(sizeof(s_tz_secure_only_usb_hs_device_framework_hs) ==
296 "HS device framework length must match the header declaration");
297
304 /* idx 1: "Brighton Sikarskie" (18 ASCII bytes). */
305 0x09U,
306 0x04U,
307 0x01U,
308 0x12U,
309 'B',
310 'r',
311 'i',
312 'g',
313 'h',
314 't',
315 'o',
316 'n',
317 ' ',
318 'S',
319 'i',
320 'k',
321 'a',
322 'r',
323 's',
324 'k',
325 'i',
326 'e',
327 /* idx 2: "RA8D2 HS CDC Echo" (17 ASCII bytes). */
328 0x09U,
329 0x04U,
330 0x02U,
331 0x11U,
332 'R',
333 'A',
334 '8',
335 'D',
336 '2',
337 ' ',
338 'H',
339 'S',
340 ' ',
341 'C',
342 'D',
343 'C',
344 ' ',
345 'E',
346 'c',
347 'h',
348 'o',
349 /* idx 3: "RA8D2-CDC-002" (13 ASCII bytes). */
350 0x09U,
351 0x04U,
352 0x03U,
353 0x0DU,
354 'R',
355 'A',
356 '8',
357 'D',
358 '2',
359 '-',
360 'C',
361 'D',
362 'C',
363 '-',
364 '0',
365 '0',
366 '2',
367};
368
369static_assert(sizeof(s_tz_secure_only_usb_hs_string_framework) ==
371 "String framework length must match the header declaration");
372
373/* USBX LANGID descriptor 0x0409 (English-US), little-endian byte pair. */
374typedef enum : uint8_t {
378
386
389 "Language-id framework length must match the header declaration");
390#endif /* !RA8_OFF_TARGET */
usb_langid_byte_t
Definition main.c:358
@ k_usb_langid_en_us_lo
LANGID 0x0409 low byte.
Definition main.c:359
@ k_usb_langid_en_us_hi
LANGID 0x0409 high byte.
Definition main.c:360
examples/ek_ra8d2/hw_validated/manual/tz_secure_only_usb_hs/inc/tz_secure_only_usb_hs_steps....
UCHAR s_tz_secure_only_usb_hs_language_id_framework[k_tz_secure_only_usb_hs_language_id_framework_len]
USBX language-id table – US English (LANGID 0x0409).
@ k_tz_secure_only_usb_hs_device_framework_hs_len
HS framework bytes.
@ k_tz_secure_only_usb_hs_device_framework_fs_len
FS framework bytes.
@ k_tz_secure_only_usb_hs_language_id_framework_len
LANGID table bytes.
@ k_tz_secure_only_usb_hs_string_framework_len
String table bytes.
UCHAR s_tz_secure_only_usb_hs_device_framework_fs[k_tz_secure_only_usb_hs_device_framework_fs_len]
Full-Speed CDC-ACM composite device framework (64-byte bulk MPS).
UCHAR s_tz_secure_only_usb_hs_string_framework[k_tz_secure_only_usb_hs_string_framework_len]
USBX string descriptor table (vendor / product / serial).
UCHAR s_tz_secure_only_usb_hs_device_framework_hs[k_tz_secure_only_usb_hs_device_framework_hs_len]
High-Speed CDC-ACM composite device framework (512-byte bulk MPS).