30#include "common/tusb_common.h"
41bool tud_init (uint8_t rhport);
49void tud_task_ext(uint32_t timeout_ms,
bool in_isr);
52TU_ATTR_ALWAYS_INLINE
static inline
55 tud_task_ext(UINT32_MAX,
false);
59bool tud_task_event_ready(
void);
62extern void dcd_int_handler(uint8_t rhport);
66#define tud_int_handler dcd_int_handler
73bool tud_connected(
void);
76bool tud_mounted(
void);
79bool tud_suspended(
void);
82TU_ATTR_ALWAYS_INLINE
static inline
85 return tud_mounted() && !tud_suspended();
89bool tud_remote_wakeup(
void);
93bool tud_disconnect(
void);
97bool tud_connect(
void);
113uint8_t
const * tud_descriptor_device_cb(
void);
117uint8_t
const * tud_descriptor_configuration_cb(uint8_t index);
121uint16_t
const* tud_descriptor_string_cb(uint8_t index, uint16_t langid);
125TU_ATTR_WEAK uint8_t
const * tud_descriptor_bos_cb(
void);
131TU_ATTR_WEAK uint8_t
const* tud_descriptor_device_qualifier_cb(
void);
136TU_ATTR_WEAK uint8_t
const* tud_descriptor_other_speed_configuration_cb(uint8_t index);
139TU_ATTR_WEAK
void tud_mount_cb(
void);
142TU_ATTR_WEAK
void tud_umount_cb(
void);
146TU_ATTR_WEAK
void tud_suspend_cb(
bool remote_wakeup_en);
149TU_ATTR_WEAK
void tud_resume_cb(
void);
152TU_ATTR_WEAK
bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage,
tusb_control_request_t const * request);
158#define TUD_BOS_DESC_LEN 5
161#define TUD_BOS_DESCRIPTOR(_total_len, _caps_num) \
162 5, TUSB_DESC_BOS, U16_TO_U8S_LE(_total_len), _caps_num
165#define TUD_BOS_PLATFORM_DESCRIPTOR(...) \
166 4+TU_ARGS_NUM(__VA_ARGS__), TUSB_DESC_DEVICE_CAPABILITY, DEVICE_CAPABILITY_PLATFORM, 0x00, __VA_ARGS__
171#define TUD_BOS_WEBUSB_DESC_LEN 24
174#define TUD_BOS_WEBUSB_DESCRIPTOR(_vendor_code, _ipage) \
175 TUD_BOS_PLATFORM_DESCRIPTOR(TUD_BOS_WEBUSB_UUID, U16_TO_U8S_LE(0x0100), _vendor_code, _ipage)
177#define TUD_BOS_WEBUSB_UUID \
178 0x38, 0xB6, 0x08, 0x34, 0xA9, 0x09, 0xA0, 0x47, \
179 0x8B, 0xFD, 0xA0, 0x76, 0x88, 0x15, 0xB6, 0x65
182#define TUD_BOS_MICROSOFT_OS_DESC_LEN 28
185#define TUD_BOS_MS_OS_20_DESCRIPTOR(_desc_set_len, _vendor_code) \
186 TUD_BOS_PLATFORM_DESCRIPTOR(TUD_BOS_MS_OS_20_UUID, U32_TO_U8S_LE(0x06030000), U16_TO_U8S_LE(_desc_set_len), _vendor_code, 0)
188#define TUD_BOS_MS_OS_20_UUID \
189 0xDF, 0x60, 0xDD, 0xD8, 0x89, 0x45, 0xC7, 0x4C, \
190 0x9C, 0xD2, 0x65, 0x9D, 0x9E, 0x64, 0x8A, 0x9F
196#define TUD_CONFIG_DESC_LEN (9)
199#define TUD_CONFIG_DESCRIPTOR(config_num, _itfcount, _stridx, _total_len, _attribute, _power_ma) \
200 9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, config_num, _stridx, TU_BIT(7) | _attribute, (_power_ma)/2
207#define TUD_CDC_DESC_LEN (8+9+5+5+4+5+7+9+7+7)
211#define TUD_CDC_DESCRIPTOR(_itfnum, _stridx, _ep_notif, _ep_notif_size, _epout, _epin, _epsize) \
213 8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, CDC_COMM_PROTOCOL_NONE, 0,\
215 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL, CDC_COMM_PROTOCOL_NONE, _stridx,\
217 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_HEADER, U16_TO_U8S_LE(0x0120),\
219 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_CALL_MANAGEMENT, 0, (uint8_t)((_itfnum) + 1),\
221 4, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, 2,\
223 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_UNION, _itfnum, (uint8_t)((_itfnum) + 1),\
225 7, TUSB_DESC_ENDPOINT, _ep_notif, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_notif_size), 16,\
227 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 0, 2, TUSB_CLASS_CDC_DATA, 0, 0, 0,\
229 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\
231 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0
238#define TUD_MSC_DESC_LEN (9 + 7 + 7)
241#define TUD_MSC_DESCRIPTOR(_itfnum, _stridx, _epout, _epin, _epsize) \
243 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_MSC, MSC_SUBCLASS_SCSI, MSC_PROTOCOL_BOT, _stridx,\
245 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\
247 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0
255#define TUD_HID_DESC_LEN (9 + 9 + 7)
259#define TUD_HID_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epin, _epsize, _ep_interval) \
261 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_HID, (uint8_t)((_boot_protocol) ? (uint8_t)HID_SUBCLASS_BOOT : 0), _boot_protocol, _stridx,\
263 9, HID_DESC_TYPE_HID, U16_TO_U8S_LE(0x0111), 0, 1, HID_DESC_TYPE_REPORT, U16_TO_U8S_LE(_report_desc_len),\
265 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval
268#define TUD_HID_INOUT_DESC_LEN (9 + 9 + 7 + 7)
272#define TUD_HID_INOUT_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epout, _epin, _epsize, _ep_interval) \
274 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_HID, (uint8_t)((_boot_protocol) ? (uint8_t)HID_SUBCLASS_BOOT : 0), _boot_protocol, _stridx,\
276 9, HID_DESC_TYPE_HID, U16_TO_U8S_LE(0x0111), 0, 1, HID_DESC_TYPE_REPORT, U16_TO_U8S_LE(_report_desc_len),\
278 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval, \
280 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval
287#define TUD_MIDI_DESC_HEAD_LEN (9 + 9 + 9 + 7)
288#define TUD_MIDI_DESC_HEAD(_itfnum, _stridx, _numcables) \
290 9, TUSB_DESC_INTERFACE, _itfnum, 0, 0, TUSB_CLASS_AUDIO, AUDIO_SUBCLASS_CONTROL, AUDIO_FUNC_PROTOCOL_CODE_UNDEF, _stridx,\
292 9, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_HEADER, U16_TO_U8S_LE(0x0100), U16_TO_U8S_LE(0x0009), 1, (uint8_t)((_itfnum) + 1),\
294 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum) + 1), 0, 2, TUSB_CLASS_AUDIO, AUDIO_SUBCLASS_MIDI_STREAMING, AUDIO_FUNC_PROTOCOL_CODE_UNDEF, 0,\
296 7, TUSB_DESC_CS_INTERFACE, MIDI_CS_INTERFACE_HEADER, U16_TO_U8S_LE(0x0100), U16_TO_U8S_LE(7 + (_numcables) * TUD_MIDI_DESC_JACK_LEN + 2 * TUD_MIDI_DESC_EP_LEN(_numcables))
298#define TUD_MIDI_JACKID_IN_EMB(_cablenum) \
299 (uint8_t)(((_cablenum) - 1) * 4 + 1)
301#define TUD_MIDI_JACKID_IN_EXT(_cablenum) \
302 (uint8_t)(((_cablenum) - 1) * 4 + 2)
304#define TUD_MIDI_JACKID_OUT_EMB(_cablenum) \
305 (uint8_t)(((_cablenum) - 1) * 4 + 3)
307#define TUD_MIDI_JACKID_OUT_EXT(_cablenum) \
308 (uint8_t)(((_cablenum) - 1) * 4 + 4)
310#define TUD_MIDI_DESC_JACK_LEN (6 + 6 + 9 + 9)
311#define TUD_MIDI_DESC_JACK_DESC(_cablenum, _stridx) \
313 6, TUSB_DESC_CS_INTERFACE, MIDI_CS_INTERFACE_IN_JACK, MIDI_JACK_EMBEDDED, TUD_MIDI_JACKID_IN_EMB(_cablenum), _stridx,\
315 6, TUSB_DESC_CS_INTERFACE, MIDI_CS_INTERFACE_IN_JACK, MIDI_JACK_EXTERNAL, TUD_MIDI_JACKID_IN_EXT(_cablenum), _stridx,\
317 9, TUSB_DESC_CS_INTERFACE, MIDI_CS_INTERFACE_OUT_JACK, MIDI_JACK_EMBEDDED, TUD_MIDI_JACKID_OUT_EMB(_cablenum), 1, TUD_MIDI_JACKID_IN_EXT(_cablenum), 1, _stridx,\
319 9, TUSB_DESC_CS_INTERFACE, MIDI_CS_INTERFACE_OUT_JACK, MIDI_JACK_EXTERNAL, TUD_MIDI_JACKID_OUT_EXT(_cablenum), 1, TUD_MIDI_JACKID_IN_EMB(_cablenum), 1, _stridx
321#define TUD_MIDI_DESC_JACK(_cablenum) TUD_MIDI_DESC_JACK_DESC(_cablenum, 0)
323#define TUD_MIDI_DESC_EP_LEN(_numcables) (9 + 4 + (_numcables))
324#define TUD_MIDI_DESC_EP(_epout, _epsize, _numcables) \
326 9, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0, 0, 0, \
328 (uint8_t)(4 + (_numcables)), TUSB_DESC_CS_ENDPOINT, MIDI_CS_ENDPOINT_GENERAL, _numcables
331#define TUD_MIDI_DESC_LEN (TUD_MIDI_DESC_HEAD_LEN + TUD_MIDI_DESC_JACK_LEN + TUD_MIDI_DESC_EP_LEN(1) * 2)
336#define TUD_MIDI_DESCRIPTOR(_itfnum, _stridx, _epout, _epin, _epsize) \
337 TUD_MIDI_DESC_HEAD(_itfnum, _stridx, 1),\
338 TUD_MIDI_DESC_JACK_DESC(1, 0),\
339 TUD_MIDI_DESC_EP(_epout, _epsize, 1),\
340 TUD_MIDI_JACKID_IN_EMB(1),\
341 TUD_MIDI_DESC_EP(_epin, _epsize, 1),\
342 TUD_MIDI_JACKID_OUT_EMB(1)
349#define TUD_AUDIO_DESC_IAD_LEN 8
350#define TUD_AUDIO_DESC_IAD(_firstitf, _nitfs, _stridx) \
351 TUD_AUDIO_DESC_IAD_LEN, TUSB_DESC_INTERFACE_ASSOCIATION, _firstitf, _nitfs, TUSB_CLASS_AUDIO, AUDIO_FUNCTION_SUBCLASS_UNDEFINED, AUDIO_FUNC_PROTOCOL_CODE_V2, _stridx
354#define TUD_AUDIO_DESC_STD_AC_LEN 9
355#define TUD_AUDIO_DESC_STD_AC(_itfnum, _nEPs, _stridx) \
356 TUD_AUDIO_DESC_STD_AC_LEN, TUSB_DESC_INTERFACE, _itfnum, 0x00, _nEPs, TUSB_CLASS_AUDIO, AUDIO_SUBCLASS_CONTROL, AUDIO_INT_PROTOCOL_CODE_V2, _stridx
359#define TUD_AUDIO_DESC_CS_AC_LEN 9
360#define TUD_AUDIO_DESC_CS_AC(_bcdADC, _category, _totallen, _ctrl) \
361 TUD_AUDIO_DESC_CS_AC_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_HEADER, U16_TO_U8S_LE(_bcdADC), _category, U16_TO_U8S_LE(_totallen + TUD_AUDIO_DESC_CS_AC_LEN), _ctrl
364#define TUD_AUDIO_DESC_CLK_SRC_LEN 8
365#define TUD_AUDIO_DESC_CLK_SRC(_clkid, _attr, _ctrl, _assocTerm, _stridx) \
366 TUD_AUDIO_DESC_CLK_SRC_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_CLOCK_SOURCE, _clkid, _attr, _ctrl, _assocTerm, _stridx
369#define TUD_AUDIO_DESC_INPUT_TERM_LEN 17
370#define TUD_AUDIO_DESC_INPUT_TERM(_termid, _termtype, _assocTerm, _clkid, _nchannelslogical, _channelcfg, _idxchannelnames, _ctrl, _stridx) \
371 TUD_AUDIO_DESC_INPUT_TERM_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_INPUT_TERMINAL, _termid, U16_TO_U8S_LE(_termtype), _assocTerm, _clkid, _nchannelslogical, U32_TO_U8S_LE(_channelcfg), _idxchannelnames, U16_TO_U8S_LE(_ctrl), _stridx
374#define TUD_AUDIO_DESC_OUTPUT_TERM_LEN 12
375#define TUD_AUDIO_DESC_OUTPUT_TERM(_termid, _termtype, _assocTerm, _srcid, _clkid, _ctrl, _stridx) \
376 TUD_AUDIO_DESC_OUTPUT_TERM_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_OUTPUT_TERMINAL, _termid, U16_TO_U8S_LE(_termtype), _assocTerm, _srcid, _clkid, U16_TO_U8S_LE(_ctrl), _stridx
380#define TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN 6+(1+1)*4
381#define TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL(_unitid, _srcid, _ctrlch0master, _ctrlch1, _stridx) \
382 TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_FEATURE_UNIT, _unitid, _srcid, U32_TO_U8S_LE(_ctrlch0master), U32_TO_U8S_LE(_ctrlch1), _stridx
385#define TUD_AUDIO_DESC_FEATURE_UNIT_TWO_CHANNEL_LEN (6+(2+1)*4)
386#define TUD_AUDIO_DESC_FEATURE_UNIT_TWO_CHANNEL(_unitid, _srcid, _ctrlch0master, _ctrlch1, _ctrlch2, _stridx) \
387 TUD_AUDIO_DESC_FEATURE_UNIT_TWO_CHANNEL_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_FEATURE_UNIT, _unitid, _srcid, U32_TO_U8S_LE(_ctrlch0master), U32_TO_U8S_LE(_ctrlch1), U32_TO_U8S_LE(_ctrlch2), _stridx
389#define TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN (6+(4+1)*4)
390#define TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL(_unitid, _srcid, _ctrlch0master, _ctrlch1, _ctrlch2, _ctrlch3, _ctrlch4, _stridx) \
391 TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AC_INTERFACE_FEATURE_UNIT, _unitid, _srcid, U32_TO_U8S_LE(_ctrlch0master), U32_TO_U8S_LE(_ctrlch1), U32_TO_U8S_LE(_ctrlch2), U32_TO_U8S_LE(_ctrlch3), U32_TO_U8S_LE(_ctrlch4), _stridx
396#define TUD_AUDIO_DESC_STD_AS_INT_LEN 9
397#define TUD_AUDIO_DESC_STD_AS_INT(_itfnum, _altset, _nEPs, _stridx) \
398 TUD_AUDIO_DESC_STD_AS_INT_LEN, TUSB_DESC_INTERFACE, _itfnum, _altset, _nEPs, TUSB_CLASS_AUDIO, AUDIO_SUBCLASS_STREAMING, AUDIO_INT_PROTOCOL_CODE_V2, _stridx
401#define TUD_AUDIO_DESC_CS_AS_INT_LEN 16
402#define TUD_AUDIO_DESC_CS_AS_INT(_termid, _ctrl, _formattype, _formats, _nchannelsphysical, _channelcfg, _stridx) \
403 TUD_AUDIO_DESC_CS_AS_INT_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AS_INTERFACE_AS_GENERAL, _termid, _ctrl, _formattype, U32_TO_U8S_LE(_formats), _nchannelsphysical, U32_TO_U8S_LE(_channelcfg), _stridx
406#define TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN 6
407#define TUD_AUDIO_DESC_TYPE_I_FORMAT(_subslotsize, _bitresolution) \
408 TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN, TUSB_DESC_CS_INTERFACE, AUDIO_CS_AS_INTERFACE_FORMAT_TYPE, AUDIO_FORMAT_TYPE_I, _subslotsize, _bitresolution
411#define TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN 7
412#define TUD_AUDIO_DESC_STD_AS_ISO_EP(_ep, _attr, _maxEPsize, _interval) \
413 TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN, TUSB_DESC_ENDPOINT, _ep, _attr, U16_TO_U8S_LE(_maxEPsize), _interval
416#define TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN 8
417#define TUD_AUDIO_DESC_CS_AS_ISO_EP(_attr, _ctrl, _lockdelayunit, _lockdelay) \
418 TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN, TUSB_DESC_CS_ENDPOINT, AUDIO_CS_EP_SUBTYPE_GENERAL, _attr, _ctrl, _lockdelayunit, U16_TO_U8S_LE(_lockdelay)
421#define TUD_AUDIO_DESC_STD_AS_ISO_FB_EP_LEN 7
422#define TUD_AUDIO_DESC_STD_AS_ISO_FB_EP(_ep, _interval) \
423 TUD_AUDIO_DESC_STD_AS_ISO_FB_EP_LEN, TUSB_DESC_ENDPOINT, _ep, (uint8_t) (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_NO_SYNC | TUSB_ISO_EP_ATT_EXPLICIT_FB), U16_TO_U8S_LE(4), _interval
428#define TUD_AUDIO_MIC_ONE_CH_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN\
429 + TUD_AUDIO_DESC_STD_AC_LEN\
430 + TUD_AUDIO_DESC_CS_AC_LEN\
431 + TUD_AUDIO_DESC_CLK_SRC_LEN\
432 + TUD_AUDIO_DESC_INPUT_TERM_LEN\
433 + TUD_AUDIO_DESC_OUTPUT_TERM_LEN\
434 + TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN\
435 + TUD_AUDIO_DESC_STD_AS_INT_LEN\
436 + TUD_AUDIO_DESC_STD_AS_INT_LEN\
437 + TUD_AUDIO_DESC_CS_AS_INT_LEN\
438 + TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN\
439 + TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN\
440 + TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN)
442#define TUD_AUDIO_MIC_ONE_CH_DESC_N_AS_INT 1
444#define TUD_AUDIO_MIC_ONE_CH_DESCRIPTOR(_itfnum, _stridx, _nBytesPerSample, _nBitsUsedPerSample, _epin, _epsize) \
446 TUD_AUDIO_DESC_IAD( _itfnum, 0x02, 0x00),\
448 TUD_AUDIO_DESC_STD_AC( _itfnum, 0x00, _stridx),\
450 TUD_AUDIO_DESC_CS_AC( 0x0200, AUDIO_FUNC_MICROPHONE, TUD_AUDIO_DESC_CLK_SRC_LEN+TUD_AUDIO_DESC_INPUT_TERM_LEN+TUD_AUDIO_DESC_OUTPUT_TERM_LEN+TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN, AUDIO_CS_AS_INTERFACE_CTRL_LATENCY_POS),\
452 TUD_AUDIO_DESC_CLK_SRC( 0x04, AUDIO_CLOCK_SOURCE_ATT_INT_FIX_CLK, (AUDIO_CTRL_R << AUDIO_CLOCK_SOURCE_CTRL_CLK_FRQ_POS), 0x01, 0x00),\
454 TUD_AUDIO_DESC_INPUT_TERM( 0x01, AUDIO_TERM_TYPE_IN_GENERIC_MIC, 0x03, 0x04, 0x01, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, 0x00, AUDIO_CTRL_R << AUDIO_IN_TERM_CTRL_CONNECTOR_POS, 0x00),\
456 TUD_AUDIO_DESC_OUTPUT_TERM( 0x03, AUDIO_TERM_TYPE_USB_STREAMING, 0x01, 0x02, 0x04, 0x0000, 0x00),\
458 TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL( 0x02, 0x01, AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, 0x00),\
461 TUD_AUDIO_DESC_STD_AS_INT( (uint8_t)((_itfnum)+1), 0x00, 0x00, 0x00),\
464 TUD_AUDIO_DESC_STD_AS_INT( (uint8_t)((_itfnum)+1), 0x01, 0x01, 0x00),\
466 TUD_AUDIO_DESC_CS_AS_INT( 0x03, AUDIO_CTRL_NONE, AUDIO_FORMAT_TYPE_I, AUDIO_DATA_FORMAT_TYPE_I_PCM, 0x01, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, 0x00),\
468 TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\
470 TUD_AUDIO_DESC_STD_AS_ISO_EP( _epin, (uint8_t) (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), _epsize, TUD_OPT_HIGH_SPEED ? 0x04 : 0x01),\
472 TUD_AUDIO_DESC_CS_AS_ISO_EP( AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, AUDIO_CTRL_NONE, AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, 0x0000)
477#define TUD_AUDIO_MIC_FOUR_CH_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN\
478 + TUD_AUDIO_DESC_STD_AC_LEN\
479 + TUD_AUDIO_DESC_CS_AC_LEN\
480 + TUD_AUDIO_DESC_CLK_SRC_LEN\
481 + TUD_AUDIO_DESC_INPUT_TERM_LEN\
482 + TUD_AUDIO_DESC_OUTPUT_TERM_LEN\
483 + TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN\
484 + TUD_AUDIO_DESC_STD_AS_INT_LEN\
485 + TUD_AUDIO_DESC_STD_AS_INT_LEN\
486 + TUD_AUDIO_DESC_CS_AS_INT_LEN\
487 + TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN\
488 + TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN\
489 + TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN)
491#define TUD_AUDIO_MIC_FOUR_CH_DESC_N_AS_INT 1
493#define TUD_AUDIO_MIC_FOUR_CH_DESCRIPTOR(_itfnum, _stridx, _nBytesPerSample, _nBitsUsedPerSample, _epin, _epsize) \
495 TUD_AUDIO_DESC_IAD( _itfnum, 0x02, 0x00),\
497 TUD_AUDIO_DESC_STD_AC( _itfnum, 0x00, _stridx),\
499 TUD_AUDIO_DESC_CS_AC( 0x0200, AUDIO_FUNC_MICROPHONE, TUD_AUDIO_DESC_CLK_SRC_LEN+TUD_AUDIO_DESC_INPUT_TERM_LEN+TUD_AUDIO_DESC_OUTPUT_TERM_LEN+TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL_LEN, AUDIO_CS_AS_INTERFACE_CTRL_LATENCY_POS),\
501 TUD_AUDIO_DESC_CLK_SRC( 0x04, AUDIO_CLOCK_SOURCE_ATT_INT_FIX_CLK, (AUDIO_CTRL_R << AUDIO_CLOCK_SOURCE_CTRL_CLK_FRQ_POS), 0x01, 0x00),\
503 TUD_AUDIO_DESC_INPUT_TERM( 0x01, AUDIO_TERM_TYPE_IN_GENERIC_MIC, 0x03, 0x04, 0x04, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, 0x00, AUDIO_CTRL_R << AUDIO_IN_TERM_CTRL_CONNECTOR_POS, 0x00),\
505 TUD_AUDIO_DESC_OUTPUT_TERM( 0x03, AUDIO_TERM_TYPE_USB_STREAMING, 0x01, 0x02, 0x04, 0x0000, 0x00),\
507 TUD_AUDIO_DESC_FEATURE_UNIT_FOUR_CHANNEL( 0x02, 0x01, AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS, 0x00),\
510 TUD_AUDIO_DESC_STD_AS_INT( (uint8_t)((_itfnum)+1), 0x00, 0x00, 0x00),\
513 TUD_AUDIO_DESC_STD_AS_INT( (uint8_t)((_itfnum)+1), 0x01, 0x01, 0x00),\
515 TUD_AUDIO_DESC_CS_AS_INT( 0x03, AUDIO_CTRL_NONE, AUDIO_FORMAT_TYPE_I, AUDIO_DATA_FORMAT_TYPE_I_PCM, 0x04, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, 0x00),\
517 TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\
519 TUD_AUDIO_DESC_STD_AS_ISO_EP( _epin, (uint8_t) (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), _epsize, TUD_OPT_HIGH_SPEED ? 0x04 : 0x01),\
521 TUD_AUDIO_DESC_CS_AS_ISO_EP( AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, AUDIO_CTRL_NONE, AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, 0x0000)
526#define TUD_AUDIO_SPEAKER_MONO_FB_DESC_LEN (TUD_AUDIO_DESC_IAD_LEN\
527 + TUD_AUDIO_DESC_STD_AC_LEN\
528 + TUD_AUDIO_DESC_CS_AC_LEN\
529 + TUD_AUDIO_DESC_CLK_SRC_LEN\
530 + TUD_AUDIO_DESC_INPUT_TERM_LEN\
531 + TUD_AUDIO_DESC_OUTPUT_TERM_LEN\
532 + TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN\
533 + TUD_AUDIO_DESC_STD_AS_INT_LEN\
534 + TUD_AUDIO_DESC_STD_AS_INT_LEN\
535 + TUD_AUDIO_DESC_CS_AS_INT_LEN\
536 + TUD_AUDIO_DESC_TYPE_I_FORMAT_LEN\
537 + TUD_AUDIO_DESC_STD_AS_ISO_EP_LEN\
538 + TUD_AUDIO_DESC_CS_AS_ISO_EP_LEN\
539 + TUD_AUDIO_DESC_STD_AS_ISO_FB_EP_LEN)
541#define TUD_AUDIO_SPEAKER_MONO_FB_DESCRIPTOR(_itfnum, _stridx, _nBytesPerSample, _nBitsUsedPerSample, _epout, _epsize, _epfb) \
543 TUD_AUDIO_DESC_IAD( _itfnum, 0x02, 0x00),\
545 TUD_AUDIO_DESC_STD_AC( _itfnum, 0x00, _stridx),\
547 TUD_AUDIO_DESC_CS_AC( 0x0200, AUDIO_FUNC_DESKTOP_SPEAKER, TUD_AUDIO_DESC_CLK_SRC_LEN+TUD_AUDIO_DESC_INPUT_TERM_LEN+TUD_AUDIO_DESC_OUTPUT_TERM_LEN+TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL_LEN, AUDIO_CS_AS_INTERFACE_CTRL_LATENCY_POS),\
549 TUD_AUDIO_DESC_CLK_SRC( 0x04, AUDIO_CLOCK_SOURCE_ATT_INT_FIX_CLK, (AUDIO_CTRL_R << AUDIO_CLOCK_SOURCE_CTRL_CLK_FRQ_POS), 0x01, 0x00),\
551 TUD_AUDIO_DESC_INPUT_TERM( 0x01, AUDIO_TERM_TYPE_USB_STREAMING, 0x00, 0x04, 0x01, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, 0x00, 0 * (AUDIO_CTRL_R << AUDIO_IN_TERM_CTRL_CONNECTOR_POS), 0x00),\
553 TUD_AUDIO_DESC_OUTPUT_TERM( 0x03, AUDIO_TERM_TYPE_OUT_DESKTOP_SPEAKER, 0x01, 0x02, 0x04, 0x0000, 0x00),\
555 TUD_AUDIO_DESC_FEATURE_UNIT_ONE_CHANNEL( 0x02, 0x01, 0 * (AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS), 0 * (AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_MUTE_POS | AUDIO_CTRL_RW << AUDIO_FEATURE_UNIT_CTRL_VOLUME_POS), 0x00),\
558 TUD_AUDIO_DESC_STD_AS_INT( (uint8_t)((_itfnum) + 1), 0x00, 0x00, 0x00),\
561 TUD_AUDIO_DESC_STD_AS_INT( (uint8_t)((_itfnum) + 1), 0x01, 0x02, 0x00),\
563 TUD_AUDIO_DESC_CS_AS_INT( 0x01, AUDIO_CTRL_NONE, AUDIO_FORMAT_TYPE_I, AUDIO_DATA_FORMAT_TYPE_I_PCM, 0x01, AUDIO_CHANNEL_CONFIG_NON_PREDEFINED, 0x00),\
565 TUD_AUDIO_DESC_TYPE_I_FORMAT(_nBytesPerSample, _nBitsUsedPerSample),\
567 TUD_AUDIO_DESC_STD_AS_ISO_EP( _epout, (uint8_t) (TUSB_XFER_ISOCHRONOUS | TUSB_ISO_EP_ATT_ASYNCHRONOUS | TUSB_ISO_EP_ATT_DATA), _epsize, TUD_OPT_HIGH_SPEED ? 0x04 : 0x01),\
569 TUD_AUDIO_DESC_CS_AS_ISO_EP( AUDIO_CS_AS_ISO_DATA_EP_ATT_NON_MAX_PACKETS_OK, AUDIO_CTRL_NONE, AUDIO_CS_AS_ISO_DATA_EP_LOCK_DELAY_UNIT_UNDEFINED, 0x0000),\
571 TUD_AUDIO_DESC_STD_AS_ISO_FB_EP( _epfb, 1)\
574#define TUD_AUDIO_EP_SIZE(_maxFrequency, _nBytesPerSample, _nChannels) \
575 ((((_maxFrequency + (TUD_OPT_HIGH_SPEED ? 7999 : 999)) / (TUD_OPT_HIGH_SPEED ? 8000 : 1000)) + 1) * _nBytesPerSample * _nChannels)
582#define TUD_USBTMC_APP_CLASS (TUSB_CLASS_APPLICATION_SPECIFIC)
583#define TUD_USBTMC_APP_SUBCLASS 0x03u
585#define TUD_USBTMC_PROTOCOL_STD 0x00u
586#define TUD_USBTMC_PROTOCOL_USB488 0x01u
590#define TUD_USBTMC_IF_DESCRIPTOR(_itfnum, _bNumEndpoints, _stridx, _itfProtocol) \
592 0x09, TUSB_DESC_INTERFACE, _itfnum, 0x00, _bNumEndpoints, TUD_USBTMC_APP_CLASS, TUD_USBTMC_APP_SUBCLASS, _itfProtocol, _stridx
594#define TUD_USBTMC_IF_DESCRIPTOR_LEN 9u
596#define TUD_USBTMC_BULK_DESCRIPTORS(_epout, _epin, _bulk_epsize) \
598 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_bulk_epsize), 0u, \
600 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_bulk_epsize), 0u
602#define TUD_USBTMC_BULK_DESCRIPTORS_LEN (7u+7u)
606#define TUD_USBTMC_INT_DESCRIPTOR(_ep_interrupt, _ep_interrupt_size, _int_pollingInterval ) \
607 7, TUSB_DESC_ENDPOINT, _ep_interrupt, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_interrupt_size), _int_pollingInterval
609#define TUD_USBTMC_INT_DESCRIPTOR_LEN (7u)
615#define TUD_VENDOR_DESC_LEN (9+7+7)
618#define TUD_VENDOR_DESCRIPTOR(_itfnum, _stridx, _epout, _epin, _epsize) \
620 9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_VENDOR_SPECIFIC, 0x00, 0x00, _stridx,\
622 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\
624 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0
630#define TUD_DFU_APP_CLASS (TUSB_CLASS_APPLICATION_SPECIFIC)
631#define TUD_DFU_APP_SUBCLASS (APP_SUBCLASS_DFU_RUNTIME)
634#define TUD_DFU_RT_DESC_LEN (9 + 9)
638#define TUD_DFU_RT_DESCRIPTOR(_itfnum, _stridx, _attr, _timeout, _xfer_size) \
640 9, TUSB_DESC_INTERFACE, _itfnum, 0, 0, TUD_DFU_APP_CLASS, TUD_DFU_APP_SUBCLASS, DFU_PROTOCOL_RT, _stridx, \
642 9, DFU_DESC_FUNCTIONAL, _attr, U16_TO_U8S_LE(_timeout), U16_TO_U8S_LE(_xfer_size), U16_TO_U8S_LE(0x0101)
649#define TUD_DFU_DESC_LEN(_alt_count) (9 + (_alt_count) * 9)
653#define TUD_DFU_DESCRIPTOR(_itfnum, _alt_count, _stridx, _attr, _timeout, _xfer_size) \
654 TU_XSTRCAT(_TUD_DFU_ALT_,_alt_count)(_itfnum, 0, _stridx), \
656 9, DFU_DESC_FUNCTIONAL, _attr, U16_TO_U8S_LE(_timeout), U16_TO_U8S_LE(_xfer_size), U16_TO_U8S_LE(0x0101)
658#define _TUD_DFU_ALT(_itfnum, _alt, _stridx) \
660 9, TUSB_DESC_INTERFACE, _itfnum, _alt, 0, TUD_DFU_APP_CLASS, TUD_DFU_APP_SUBCLASS, DFU_PROTOCOL_DFU, _stridx
662#define _TUD_DFU_ALT_1(_itfnum, _alt_count, _stridx) \
663 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx)
665#define _TUD_DFU_ALT_2(_itfnum, _alt_count, _stridx) \
666 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \
667 _TUD_DFU_ALT_1(_itfnum, _alt_count+1, _stridx+1)
669#define _TUD_DFU_ALT_3(_itfnum, _alt_count, _stridx) \
670 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \
671 _TUD_DFU_ALT_2(_itfnum, _alt_count+1, _stridx+1)
673#define _TUD_DFU_ALT_4(_itfnum, _alt_count, _stridx) \
674 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \
675 _TUD_DFU_ALT_3(_itfnum, _alt_count+1, _stridx+1)
677#define _TUD_DFU_ALT_5(_itfnum, _alt_count, _stridx) \
678 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \
679 _TUD_DFU_ALT_4(_itfnum, _alt_count+1, _stridx+1)
681#define _TUD_DFU_ALT_6(_itfnum, _alt_count, _stridx) \
682 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \
683 _TUD_DFU_ALT_5(_itfnum, _alt_count+1, _stridx+1)
685#define _TUD_DFU_ALT_7(_itfnum, _alt_count, _stridx) \
686 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \
687 _TUD_DFU_ALT_6(_itfnum, _alt_count+1, _stridx+1)
689#define _TUD_DFU_ALT_8(_itfnum, _alt_count, _stridx) \
690 _TUD_DFU_ALT(_itfnum, _alt_count, _stridx), \
691 _TUD_DFU_ALT_7(_itfnum, _alt_count+1, _stridx+1)
698#define TUD_CDC_ECM_DESC_LEN (8+9+5+5+13+7+9+9+7+7)
702#define TUD_CDC_ECM_DESCRIPTOR(_itfnum, _desc_stridx, _mac_stridx, _ep_notif, _ep_notif_size, _epout, _epin, _epsize, _maxsegmentsize) \
704 8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_ETHERNET_CONTROL_MODEL, 0, 0,\
706 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_ETHERNET_CONTROL_MODEL, 0, _desc_stridx,\
708 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_HEADER, U16_TO_U8S_LE(0x0120),\
710 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_UNION, _itfnum, (uint8_t)((_itfnum) + 1),\
712 13, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_ETHERNET_NETWORKING, _mac_stridx, 0, 0, 0, 0, U16_TO_U8S_LE(_maxsegmentsize), U16_TO_U8S_LE(0), 0,\
714 7, TUSB_DESC_ENDPOINT, _ep_notif, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_notif_size), 1,\
716 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 0, 0, TUSB_CLASS_CDC_DATA, 0, 0, 0,\
718 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 1, 2, TUSB_CLASS_CDC_DATA, 0, 0, 0,\
720 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\
722 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0
730#define TUD_RNDIS_ITF_CLASS TUSB_CLASS_CDC
731#define TUD_RNDIS_ITF_SUBCLASS CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL
732#define TUD_RNDIS_ITF_PROTOCOL 0xFF
735#define TUD_RNDIS_ITF_CLASS TUSB_CLASS_WIRELESS_CONTROLLER
736#define TUD_RNDIS_ITF_SUBCLASS 0x01
737#define TUD_RNDIS_ITF_PROTOCOL 0x03
741#define TUD_RNDIS_DESC_LEN (8+9+5+5+4+5+7+9+7+7)
745#define TUD_RNDIS_DESCRIPTOR(_itfnum, _stridx, _ep_notif, _ep_notif_size, _epout, _epin, _epsize) \
747 8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUD_RNDIS_ITF_CLASS, TUD_RNDIS_ITF_SUBCLASS, TUD_RNDIS_ITF_PROTOCOL, 0,\
749 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUD_RNDIS_ITF_CLASS, TUD_RNDIS_ITF_SUBCLASS, TUD_RNDIS_ITF_PROTOCOL, _stridx,\
751 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_HEADER, U16_TO_U8S_LE(0x0110),\
753 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_CALL_MANAGEMENT, 0, (uint8_t)((_itfnum) + 1),\
755 4, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, 0,\
757 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_UNION, _itfnum, (uint8_t)((_itfnum) + 1),\
759 7, TUSB_DESC_ENDPOINT, _ep_notif, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_notif_size), 1,\
761 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 0, 2, TUSB_CLASS_CDC_DATA, 0, 0, 0,\
763 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\
765 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0
771#define TUD_BT_APP_CLASS (TUSB_CLASS_WIRELESS_CONTROLLER)
772#define TUD_BT_APP_SUBCLASS 0x01
773#define TUD_BT_PROTOCOL_PRIMARY_CONTROLLER 0x01
774#define TUD_BT_PROTOCOL_AMP_CONTROLLER 0x02
776#ifndef CFG_TUD_BTH_ISO_ALT_COUNT
777#define CFG_TUD_BTH_ISO_ALT_COUNT 0
781#define TUD_BTH_DESC_LEN (8 + 9 + 7 + 7 + 7 + (CFG_TUD_BTH_ISO_ALT_COUNT) * (9 + 7 + 7))
784#define TUD_BTH_PRI_ITF(_itfnum, _stridx, _ep_evt, _ep_evt_size, _ep_evt_interval, _ep_in, _ep_out, _ep_size) \
785 9, TUSB_DESC_INTERFACE, _itfnum, 0, 3, TUD_BT_APP_CLASS, TUD_BT_APP_SUBCLASS, TUD_BT_PROTOCOL_PRIMARY_CONTROLLER, _stridx, \
787 7, TUSB_DESC_ENDPOINT, _ep_evt, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_evt_size), _ep_evt_interval, \
789 7, TUSB_DESC_ENDPOINT, _ep_in, TUSB_XFER_BULK, U16_TO_U8S_LE(_ep_size), 1, \
791 7, TUSB_DESC_ENDPOINT, _ep_out, TUSB_XFER_BULK, U16_TO_U8S_LE(_ep_size), 1
793#define TUD_BTH_ISO_ITF(_itfnum, _alt, _ep_in, _ep_out, _n) ,\
795 9, TUSB_DESC_INTERFACE, _itfnum, _alt, 2, TUD_BT_APP_CLASS, TUD_BT_APP_SUBCLASS, TUD_BT_PROTOCOL_PRIMARY_CONTROLLER, 0, \
797 7, TUSB_DESC_ENDPOINT, _ep_in, TUSB_XFER_ISOCHRONOUS, U16_TO_U8S_LE(_n), 1, \
798 7, TUSB_DESC_ENDPOINT, _ep_out, TUSB_XFER_ISOCHRONOUS, U16_TO_U8S_LE(_n), 1
800#define _FIRST(a, ...) a
801#define _REST(a, ...) __VA_ARGS__
803#define TUD_BTH_ISO_ITF_0(_itfnum, ...)
804#define TUD_BTH_ISO_ITF_1(_itfnum, _ep_in, _ep_out, ...) TUD_BTH_ISO_ITF(_itfnum, (CFG_TUD_BTH_ISO_ALT_COUNT) - 1, _ep_in, _ep_out, _FIRST(__VA_ARGS__))
805#define TUD_BTH_ISO_ITF_2(_itfnum, _ep_in, _ep_out, ...) TUD_BTH_ISO_ITF(_itfnum, (CFG_TUD_BTH_ISO_ALT_COUNT) - 2, _ep_in, _ep_out, _FIRST(__VA_ARGS__)) \
806 TUD_BTH_ISO_ITF_1(_itfnum, _ep_in, _ep_out, _REST(__VA_ARGS__))
807#define TUD_BTH_ISO_ITF_3(_itfnum, _ep_in, _ep_out, ...) TUD_BTH_ISO_ITF(_itfnum, (CFG_TUD_BTH_ISO_ALT_COUNT) - 3, _ep_in, _ep_out, _FIRST(__VA_ARGS__)) \
808 TUD_BTH_ISO_ITF_2(_itfnum, _ep_in, _ep_out, _REST(__VA_ARGS__))
809#define TUD_BTH_ISO_ITF_4(_itfnum, _ep_in, _ep_out, ...) TUD_BTH_ISO_ITF(_itfnum, (CFG_TUD_BTH_ISO_ALT_COUNT) - 4, _ep_in, _ep_out, _FIRST(__VA_ARGS__)) \
810 TUD_BTH_ISO_ITF_3(_itfnum, _ep_in, _ep_out, _REST(__VA_ARGS__))
811#define TUD_BTH_ISO_ITF_5(_itfnum, _ep_in, _ep_out, ...) TUD_BTH_ISO_ITF(_itfnum, (CFG_TUD_BTH_ISO_ALT_COUNT) - 5, _ep_in, _ep_out, _FIRST(__VA_ARGS__)) \
812 TUD_BTH_ISO_ITF_4(_itfnum, _ep_in, _ep_out, _REST(__VA_ARGS__))
813#define TUD_BTH_ISO_ITF_6(_itfnum, _ep_in, _ep_out, ...) TUD_BTH_ISO_ITF(_itfnum, (CFG_TUD_BTH_ISO_ALT_COUNT) - 6, _ep_in, _ep_out, _FIRST(__VA_ARGS__)) \
814 TUD_BTH_ISO_ITF_5(_itfnum, _ep_in, _ep_out, _REST(__VA_ARGS__))
816#define TUD_BTH_ISO_ITFS(_itfnum, _ep_in, _ep_out, ...) \
817 TU_XSTRCAT(TUD_BTH_ISO_ITF_, CFG_TUD_BTH_ISO_ALT_COUNT)(_itfnum, _ep_in, _ep_out, __VA_ARGS__)
822#define TUD_BTH_DESCRIPTOR(_itfnum, _stridx, _ep_evt, _ep_evt_size, _ep_evt_interval, _ep_in, _ep_out, _ep_size,...) \
824 8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUD_BT_APP_CLASS, TUD_BT_APP_SUBCLASS, TUD_BT_PROTOCOL_PRIMARY_CONTROLLER, 0,\
825 TUD_BTH_PRI_ITF(_itfnum, _stridx, _ep_evt, _ep_evt_size, _ep_evt_interval, _ep_in, _ep_out, _ep_size) \
826 TUD_BTH_ISO_ITFS(_itfnum + 1, _ep_in + 1, _ep_out + 1, __VA_ARGS__)
833#define TUD_CDC_NCM_DESC_LEN (8+9+5+5+13+6+7+9+9+7+7)
837#define TUD_CDC_NCM_DESCRIPTOR(_itfnum, _desc_stridx, _mac_stridx, _ep_notif, _ep_notif_size, _epout, _epin, _epsize, _maxsegmentsize) \
839 8, TUSB_DESC_INTERFACE_ASSOCIATION, _itfnum, 2, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_NETWORK_CONTROL_MODEL, 0, 0,\
841 9, TUSB_DESC_INTERFACE, _itfnum, 0, 1, TUSB_CLASS_CDC, CDC_COMM_SUBCLASS_NETWORK_CONTROL_MODEL, 0, _desc_stridx,\
843 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_HEADER, U16_TO_U8S_LE(0x0110),\
845 5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_UNION, _itfnum, (uint8_t)((_itfnum) + 1),\
847 13, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_ETHERNET_NETWORKING, _mac_stridx, 0, 0, 0, 0, U16_TO_U8S_LE(_maxsegmentsize), U16_TO_U8S_LE(0), 0, \
849 6, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_NCM, U16_TO_U8S_LE(0x0100), 0, \
851 7, TUSB_DESC_ENDPOINT, _ep_notif, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_notif_size), 50,\
853 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 0, 0, TUSB_CLASS_CDC_DATA, 0, NCM_DATA_PROTOCOL_NETWORK_TRANSFER_BLOCK, 0,\
855 9, TUSB_DESC_INTERFACE, (uint8_t)((_itfnum)+1), 1, 2, TUSB_CLASS_CDC_DATA, 0, NCM_DATA_PROTOCOL_NETWORK_TRANSFER_BLOCK, 0,\
857 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\
859 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0
tusb_speed_t
defined base on EHCI specs value for Endpoint Speed
Definition tusb_types.h:48
AUDIO Channel Cluster Descriptor (4.1)
Definition audio.h:647