summaryrefslogtreecommitdiff
path: root/src/device/usbd.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-07-12 14:53:11 +0700
committerhathach <[email protected]>2019-07-12 14:53:11 +0700
commit164b26ee6bb0a24924e9736178808b676288845e (patch)
treee5edbb031350f6283c546e7ce76f9e143a3c9278 /src/device/usbd.h
parent3b6013e78f66551e4516db348f3d0f547731c782 (diff)
change TUD_HID_INOUT_DESCRIPTOR epout & epin order
clean up, adding template for BOS & BOS platform descriptor
Diffstat (limited to 'src/device/usbd.h')
-rw-r--r--src/device/usbd.h31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/device/usbd.h b/src/device/usbd.h
index 9959a99af..8bd6adc35 100644
--- a/src/device/usbd.h
+++ b/src/device/usbd.h
@@ -93,9 +93,21 @@ TU_ATTR_WEAK void tud_suspend_cb(bool remote_wakeup_en);
TU_ATTR_WEAK void tud_resume_cb(void);
//--------------------------------------------------------------------+
-// Interface Descriptor Template
+// Descriptor Templates
//--------------------------------------------------------------------+
+//------------- Binary Device Object Store (BOS) -------------//
+#define TUD_BOS_DESC_LEN 5
+
+// total length, number of device caps
+#define TUD_BOS_DESCRIPTOR(_total_len, _caps_num) \
+ 5, TUSB_DESC_BOS, U16_TO_U8S_LE(_total_len), _caps_num
+
+// Device Capability Platform 128-bit UUID + Data
+#define TUD_BOS_PLATFORM_DESCRIPTOR(...) \
+ 4+TU_ARGS_NUM(__VA_ARGS__), TUSB_DESC_DEVICE_CAPABILITY, DEVICE_CAPABILITY_PLATFORM, 0x00, __VA_ARGS__
+
+//------------- Configuration -------------//
#define TUD_CONFIG_DESC_LEN (9)
// Interface count, string index, total length, attribute, power in mA
@@ -164,16 +176,16 @@ TU_ATTR_WEAK void tud_resume_cb(void);
#define TUD_HID_INOUT_DESC_LEN (9 + 9 + 7 + 7)
// HID Input & Output descriptor
-// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
-#define TUD_HID_INOUT_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epin, _epout, _epsize, _ep_interval) \
+// Interface number, string index, protocol, report descriptor len, EP OUT & IN address, size & polling interval
+#define TUD_HID_INOUT_DESCRIPTOR(_itfnum, _stridx, _boot_protocol, _report_desc_len, _epout, _epin, _epsize, _ep_interval) \
/* Interface */\
9, TUSB_DESC_INTERFACE, _itfnum, 0, 2, TUSB_CLASS_HID, (_boot_protocol) ? HID_SUBCLASS_BOOT : 0, _boot_protocol, _stridx,\
/* HID descriptor */\
9, HID_DESC_TYPE_HID, U16_TO_U8S_LE(0x0111), 0, 1, HID_DESC_TYPE_REPORT, U16_TO_U8S_LE(_report_desc_len),\
- /* Endpoint In */\
- 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval,\
/* Endpoint Out */\
- 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval
+ 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval, \
+ /* Endpoint In */\
+ 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval
//------------- MIDI -------------//
@@ -209,6 +221,13 @@ TU_ATTR_WEAK void tud_resume_cb(void);
/* MS Endpoint (connected to embedded jack out) */\
5, TUSB_DESC_CS_ENDPOINT, MIDI_CS_ENDPOINT_GENERAL, 1, 3
+//------------- WebUSB -------------//
+
+#define TUD_WEBUSB_DESC_LEN
+
+// Interface number, string index, EP Out & IN address, size & polling interval
+#define TUD_WEBUSB_DESCRIPTOR()
+
#ifdef __cplusplus
}