diff options
| author | hathach <[email protected]> | 2019-04-17 13:43:07 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-04-17 13:43:07 +0700 |
| commit | 516964b3d3532bc8defc21336a0a7b6f69de4ecf (patch) | |
| tree | 7cd10a85488a030faee2b36c3c57805cc701b43d /src/class/msc | |
| parent | 72575534f84c815e812beb7165c98d74aaa8f487 (diff) | |
add interface descriptor template
Diffstat (limited to 'src/class/msc')
| -rw-r--r-- | src/class/msc/msc_device.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/class/msc/msc_device.h b/src/class/msc/msc_device.h index 1d223991b..e7571ba60 100644 --- a/src/class/msc/msc_device.h +++ b/src/class/msc/msc_device.h @@ -47,7 +47,7 @@ TU_VERIFY_STATIC(CFG_TUD_MSC_BUFSIZE < UINT16_MAX, "Size is not correct"); #endif
#ifndef CFG_TUD_MSC_BUFSIZE
- #error CFG_TUD_MSC_BUFSIZE must be defined, value of CFG_TUD_MSC_BLOCK_SZ should work well, the more the better
+ #error CFG_TUD_MSC_BUFSIZE must be defined, value of a block size should work well, the more the better
#endif
#ifndef CFG_TUD_MSC_VENDOR
@@ -62,6 +62,24 @@ TU_VERIFY_STATIC(CFG_TUD_MSC_BUFSIZE < UINT16_MAX, "Size is not correct"); #error CFG_TUD_MSC_PRODUCT_REV 4-byte string must be defined
#endif
+
+//--------------------------------------------------------------------+
+// Interface Descriptor Template
+//--------------------------------------------------------------------+
+
+// Length of template descriptor: 23 bytes
+#define TUD_MSC_DESC_LEN (9 + 7 + 7)
+
+// Interface Number, EP Out & EP In address
+#define TUD_MSC_DESCRIPTOR(_itfnum, _stridx, _epout, _epin, _epsize) \
+ /* Interface */\
+ 0x09, TUSB_DESC_INTERFACE, _itfnum, 0x00, 0x02, TUSB_CLASS_MSC, MSC_SUBCLASS_SCSI, MSC_PROTOCOL_BOT, _stridx,\
+ /* Endpoint Out */\
+ 0x07, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0x00,\
+ /* Endpoint In */\
+ 0x07, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0x00
+
+
/** \addtogroup ClassDriver_MSC
* @{
* \defgroup MSC_Device Device
|
