mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-16 06:40:11 +00:00
MSC tested with nrf52840
This commit is contained in:
parent
3e5e1f70bf
commit
e8b0500d40
@ -77,7 +77,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bDescriptorType = TUSB_DESC_CONFIGURATION,
|
||||
|
||||
.wTotalLength = sizeof(app_descriptor_configuration_t),
|
||||
.bNumInterfaces = TOTAL_INTEFACES,
|
||||
.bNumInterfaces = ITF_TOTAL,
|
||||
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = 0x00,
|
||||
@ -91,7 +91,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bLength = sizeof(tusb_desc_interface_assoc_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION,
|
||||
|
||||
.bFirstInterface = INTERFACE_NO_CDC,
|
||||
.bFirstInterface = ITF_NUM_CDC,
|
||||
.bInterfaceCount = 2,
|
||||
|
||||
.bFunctionClass = TUSB_CLASS_CDC,
|
||||
@ -105,7 +105,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NO_CDC,
|
||||
.bInterfaceNumber = ITF_NUM_CDC,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC,
|
||||
@ -128,7 +128,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT,
|
||||
.bmCapabilities = { 0 },
|
||||
.bDataInterface = INTERFACE_NO_CDC+1,
|
||||
.bDataInterface = ITF_NUM_CDC+1,
|
||||
},
|
||||
|
||||
.cdc_acm =
|
||||
@ -146,15 +146,15 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bLength = sizeof(cdc_desc_func_union_t), // plus number of
|
||||
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_UNION,
|
||||
.bControlInterface = INTERFACE_NO_CDC,
|
||||
.bSubordinateInterface = INTERFACE_NO_CDC+1,
|
||||
.bControlInterface = ITF_NUM_CDC,
|
||||
.bSubordinateInterface = ITF_NUM_CDC+1,
|
||||
},
|
||||
|
||||
.cdc_endpoint_notification =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_NOTIF,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||
.wMaxPacketSize = { .size = 0x08 },
|
||||
.bInterval = 0x10
|
||||
@ -165,7 +165,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NO_CDC+1,
|
||||
.bInterfaceNumber = ITF_NUM_CDC+1,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC_DATA,
|
||||
@ -178,9 +178,9 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_OUT,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_SIZE },
|
||||
.bInterval = 0
|
||||
},
|
||||
|
||||
@ -188,9 +188,9 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_IN,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_SIZE },
|
||||
.bInterval = 0
|
||||
},
|
||||
};
|
||||
|
@ -56,8 +56,8 @@
|
||||
PRODUCTID_BITMAP(MSC, 4) ) )
|
||||
#endif
|
||||
|
||||
#define INTERFACE_NO_CDC 0
|
||||
#define TOTAL_INTEFACES 2
|
||||
#define ITF_NUM_CDC 0
|
||||
#define ITF_TOTAL 2
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Endpoints Address & Max Packet Size
|
||||
@ -65,12 +65,12 @@
|
||||
#define EDPT_IN(x) (0x80 | (x))
|
||||
#define EDPT_OUT(x) (x)
|
||||
|
||||
#define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (1)
|
||||
#define CDC_EDPT_NOTIF EDPT_IN (1)
|
||||
#define CDC_EDPT_NOTIFICATION_PACKETSIZE 64
|
||||
|
||||
#define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(2)
|
||||
#define CDC_EDPT_DATA_IN_ADDR EDPT_IN (2)
|
||||
#define CDC_EDPT_DATA_PACKETSIZE 64
|
||||
#define CDC_EDPT_OUT EDPT_OUT(2)
|
||||
#define CDC_EDPT_IN EDPT_IN (2)
|
||||
#define CDC_EDPT_SIZE 64
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -56,6 +56,9 @@
|
||||
<file file_name="../src/tusb_config.h" />
|
||||
<file file_name="../src/tusb_descriptors.c" />
|
||||
<file file_name="../src/tusb_descriptors.h" />
|
||||
<file file_name="../src/msc_device_app.c" />
|
||||
<file file_name="../src/msc_device_app.h" />
|
||||
<file file_name="../src/msc_device_ramdisk.c" />
|
||||
</folder>
|
||||
<folder Name="hw">
|
||||
<folder Name="bsp">
|
||||
|
@ -60,7 +60,7 @@
|
||||
#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
|
||||
#define TUSB_CFG_DEVICE_HID_MOUSE 0
|
||||
#define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet
|
||||
#define TUSB_CFG_DEVICE_MSC 0
|
||||
#define TUSB_CFG_DEVICE_MSC 1
|
||||
#define TUSB_CFG_DEVICE_CDC 1
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@ -79,6 +79,15 @@
|
||||
//--------------------------------------------------------------------+
|
||||
#define TUSB_CFG_ATTR_USBRAM
|
||||
|
||||
// LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
|
||||
#if TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX
|
||||
#define ATTR_USB_MIN_ALIGNMENT ATTR_ALIGNED(64)
|
||||
#elif defined NRF52840_XXAA
|
||||
#define ATTR_USB_MIN_ALIGNMENT ATTR_ALIGNED(4)
|
||||
#else
|
||||
#define ATTR_USB_MIN_ALIGNMENT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -77,7 +77,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bDescriptorType = TUSB_DESC_CONFIGURATION,
|
||||
|
||||
.wTotalLength = sizeof(app_descriptor_configuration_t),
|
||||
.bNumInterfaces = TOTAL_INTEFACES,
|
||||
.bNumInterfaces = ITF_TOTAL,
|
||||
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = 0x00,
|
||||
@ -93,7 +93,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bLength = sizeof(tusb_desc_interface_assoc_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION,
|
||||
|
||||
.bFirstInterface = INTERFACE_NO_CDC,
|
||||
.bFirstInterface = ITF_NUM_CDC,
|
||||
.bInterfaceCount = 2,
|
||||
|
||||
.bFunctionClass = TUSB_CLASS_CDC,
|
||||
@ -107,7 +107,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NO_CDC,
|
||||
.bInterfaceNumber = ITF_NUM_CDC,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC,
|
||||
@ -130,7 +130,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT,
|
||||
.bmCapabilities = { 0 },
|
||||
.bDataInterface = INTERFACE_NO_CDC+1,
|
||||
.bDataInterface = ITF_NUM_CDC+1,
|
||||
},
|
||||
|
||||
.acm =
|
||||
@ -148,17 +148,17 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bLength = sizeof(cdc_desc_func_union_t), // plus number of
|
||||
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_UNION,
|
||||
.bControlInterface = INTERFACE_NO_CDC,
|
||||
.bSubordinateInterface = INTERFACE_NO_CDC+1,
|
||||
.bControlInterface = ITF_NUM_CDC,
|
||||
.bSubordinateInterface = ITF_NUM_CDC+1,
|
||||
},
|
||||
|
||||
.ep_notif =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_NOTIF,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||
.wMaxPacketSize = { .size = 0x08 },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_NOTIF_SIZE },
|
||||
.bInterval = 0x10
|
||||
},
|
||||
|
||||
@ -167,7 +167,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NO_CDC+1,
|
||||
.bInterfaceNumber = ITF_NUM_CDC+1,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC_DATA,
|
||||
@ -180,9 +180,9 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_OUT,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_SIZE },
|
||||
.bInterval = 0
|
||||
},
|
||||
|
||||
@ -190,11 +190,47 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_IN,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_SIZE },
|
||||
.bInterval = 0
|
||||
},
|
||||
},
|
||||
|
||||
.msc =
|
||||
{
|
||||
.interface =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = ITF_NUM_MSC,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = TUSB_CLASS_MSC,
|
||||
.bInterfaceSubClass = MSC_SUBCLASS_SCSI,
|
||||
.bInterfaceProtocol = MSC_PROTOCOL_BOT,
|
||||
.iInterface = 0x07
|
||||
},
|
||||
|
||||
.ep_out =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = MSC_EDPT_OUT,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = MSC_EDPT_SIZE},
|
||||
.bInterval = 1
|
||||
},
|
||||
|
||||
.ep_in =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = MSC_EDPT_IN,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = MSC_EDPT_SIZE},
|
||||
.bInterval = 1
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -56,8 +56,10 @@
|
||||
PRODUCTID_BITMAP(MSC, 4) ) )
|
||||
#endif
|
||||
|
||||
#define INTERFACE_NO_CDC 0
|
||||
#define TOTAL_INTEFACES 2
|
||||
#define ITF_NUM_CDC 0
|
||||
#define ITF_NUM_MSC 2
|
||||
|
||||
#define ITF_TOTAL 3 // total number of interfaces
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Endpoints Address & Max Packet Size
|
||||
@ -65,12 +67,16 @@
|
||||
#define EDPT_IN(x) (0x80 | (x))
|
||||
#define EDPT_OUT(x) (x)
|
||||
|
||||
#define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (1)
|
||||
#define CDC_EDPT_NOTIFICATION_PACKETSIZE 64
|
||||
#define CDC_EDPT_NOTIF EDPT_IN (1)
|
||||
#define CDC_EDPT_NOTIF_SIZE 8
|
||||
|
||||
#define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(2)
|
||||
#define CDC_EDPT_DATA_IN_ADDR EDPT_IN (2)
|
||||
#define CDC_EDPT_DATA_PACKETSIZE 64
|
||||
#define CDC_EDPT_OUT EDPT_OUT(2)
|
||||
#define CDC_EDPT_IN EDPT_IN (2)
|
||||
#define CDC_EDPT_SIZE 64
|
||||
|
||||
#define MSC_EDPT_OUT EDPT_OUT(3)
|
||||
#define MSC_EDPT_IN EDPT_IN(3)
|
||||
#define MSC_EDPT_SIZE 64
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@ -98,6 +104,13 @@ typedef struct ATTR_PACKED
|
||||
tusb_desc_endpoint_t ep_in;
|
||||
}cdc;
|
||||
|
||||
struct ATTR_PACKED
|
||||
{
|
||||
tusb_desc_interface_t interface;
|
||||
tusb_desc_endpoint_t ep_out;
|
||||
tusb_desc_endpoint_t ep_in;
|
||||
}msc;
|
||||
|
||||
} app_descriptor_configuration_t;
|
||||
|
||||
#endif
|
||||
|
@ -176,7 +176,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bDescriptorType = TUSB_DESC_CONFIGURATION,
|
||||
|
||||
.wTotalLength = sizeof(app_descriptor_configuration_t),
|
||||
.bNumInterfaces = TOTAL_INTEFACES,
|
||||
.bNumInterfaces = ITF_TOTAL,
|
||||
|
||||
.bConfigurationValue = 1,
|
||||
.iConfiguration = 0x00,
|
||||
@ -191,7 +191,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bLength = sizeof(tusb_desc_interface_assoc_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE_ASSOCIATION,
|
||||
|
||||
.bFirstInterface = INTERFACE_NO_CDC,
|
||||
.bFirstInterface = ITF_NUM_CDC,
|
||||
.bInterfaceCount = 2,
|
||||
|
||||
.bFunctionClass = TUSB_CLASS_CDC,
|
||||
@ -205,7 +205,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NO_CDC,
|
||||
.bInterfaceNumber = ITF_NUM_CDC,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC,
|
||||
@ -228,7 +228,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_CALL_MANAGEMENT,
|
||||
.bmCapabilities = { 0 },
|
||||
.bDataInterface = INTERFACE_NO_CDC+1,
|
||||
.bDataInterface = ITF_NUM_CDC+1,
|
||||
},
|
||||
|
||||
.cdc_acm =
|
||||
@ -246,15 +246,15 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
.bLength = sizeof(cdc_desc_func_union_t), // plus number of
|
||||
.bDescriptorType = TUSB_DESC_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = CDC_FUNC_DESC_UNION,
|
||||
.bControlInterface = INTERFACE_NO_CDC,
|
||||
.bSubordinateInterface = INTERFACE_NO_CDC+1,
|
||||
.bControlInterface = ITF_NUM_CDC,
|
||||
.bSubordinateInterface = ITF_NUM_CDC+1,
|
||||
},
|
||||
|
||||
.cdc_endpoint_notification =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_NOTIFICATION_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_NOTIF,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_INTERRUPT },
|
||||
.wMaxPacketSize = { .size = 0x08 },
|
||||
.bInterval = 0x10
|
||||
@ -265,7 +265,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NO_CDC+1,
|
||||
.bInterfaceNumber = ITF_NUM_CDC+1,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = TUSB_CLASS_CDC_DATA,
|
||||
@ -278,9 +278,9 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_DATA_OUT_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_OUT,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_SIZE },
|
||||
.bInterval = 0
|
||||
},
|
||||
|
||||
@ -288,9 +288,9 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_endpoint_t),
|
||||
.bDescriptorType = TUSB_DESC_ENDPOINT,
|
||||
.bEndpointAddress = CDC_EDPT_DATA_IN_ADDR,
|
||||
.bEndpointAddress = CDC_EDPT_IN,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_BULK },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_DATA_PACKETSIZE },
|
||||
.wMaxPacketSize = { .size = CDC_EDPT_SIZE },
|
||||
.bInterval = 0
|
||||
},
|
||||
#endif
|
||||
@ -375,7 +375,7 @@ app_descriptor_configuration_t const desc_configuration =
|
||||
{
|
||||
.bLength = sizeof(tusb_desc_interface_t),
|
||||
.bDescriptorType = TUSB_DESC_INTERFACE,
|
||||
.bInterfaceNumber = INTERFACE_NO_MSC,
|
||||
.bInterfaceNumber = ITF_NUM_MSC,
|
||||
.bAlternateSetting = 0x00,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = TUSB_CLASS_MSC,
|
||||
|
@ -56,16 +56,16 @@
|
||||
PRODUCTID_BITMAP(MSC, 4) ) )
|
||||
#endif
|
||||
|
||||
#define INTERFACE_NO_CDC 0
|
||||
#define INTERFACE_NO_HID_KEYBOARD (INTERFACE_NO_CDC + 2*(TUSB_CFG_DEVICE_CDC ? 1 : 0) )
|
||||
#define ITF_NUM_CDC 0
|
||||
#define INTERFACE_NO_HID_KEYBOARD (ITF_NUM_CDC + 2*(TUSB_CFG_DEVICE_CDC ? 1 : 0) )
|
||||
#define INTERFACE_NO_HID_MOUSE (INTERFACE_NO_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_KEYBOARD )
|
||||
#define INTERFACE_NO_HID_GENERIC (INTERFACE_NO_HID_MOUSE + TUSB_CFG_DEVICE_HID_MOUSE )
|
||||
#define INTERFACE_NO_MSC (INTERFACE_NO_HID_GENERIC + TUSB_CFG_DEVICE_HID_GENERIC )
|
||||
#define ITF_NUM_MSC (INTERFACE_NO_HID_GENERIC + TUSB_CFG_DEVICE_HID_GENERIC )
|
||||
|
||||
#define TOTAL_INTEFACES (2*TUSB_CFG_DEVICE_CDC + TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + \
|
||||
#define ITF_TOTAL (2*TUSB_CFG_DEVICE_CDC + TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + \
|
||||
TUSB_CFG_DEVICE_HID_GENERIC + TUSB_CFG_DEVICE_MSC)
|
||||
|
||||
#if (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX) && (TOTAL_INTEFACES > 4)
|
||||
#if (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX) && (ITF_TOTAL > 4)
|
||||
#error These MCUs do not have enough number of endpoints for the current configuration
|
||||
#endif
|
||||
|
||||
@ -78,12 +78,12 @@
|
||||
#if TUSB_CFG_MCU == MCU_LPC175X_6X // MCUs's endpoint number has a fixed type
|
||||
|
||||
//------------- CDC -------------//
|
||||
#define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (1)
|
||||
#define CDC_EDPT_NOTIF EDPT_IN (1)
|
||||
#define CDC_EDPT_NOTIFICATION_PACKETSIZE 64
|
||||
|
||||
#define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(2)
|
||||
#define CDC_EDPT_DATA_IN_ADDR EDPT_IN (2)
|
||||
#define CDC_EDPT_DATA_PACKETSIZE 64
|
||||
#define CDC_EDPT_OUT EDPT_OUT(2)
|
||||
#define CDC_EDPT_IN EDPT_IN (2)
|
||||
#define CDC_EDPT_SIZE 64
|
||||
|
||||
//------------- HID Keyboard -------------//
|
||||
#define HID_KEYBOARD_EDPT_ADDR EDPT_IN (4)
|
||||
@ -102,12 +102,12 @@
|
||||
#else
|
||||
|
||||
//------------- CDC -------------//
|
||||
#define CDC_EDPT_NOTIFICATION_ADDR EDPT_IN (INTERFACE_NO_CDC+1)
|
||||
#define CDC_EDPT_NOTIF EDPT_IN (ITF_NUM_CDC+1)
|
||||
#define CDC_EDPT_NOTIFICATION_PACKETSIZE 64
|
||||
|
||||
#define CDC_EDPT_DATA_OUT_ADDR EDPT_OUT(INTERFACE_NO_CDC+2)
|
||||
#define CDC_EDPT_DATA_IN_ADDR EDPT_IN (INTERFACE_NO_CDC+2)
|
||||
#define CDC_EDPT_DATA_PACKETSIZE 64
|
||||
#define CDC_EDPT_OUT EDPT_OUT(ITF_NUM_CDC+2)
|
||||
#define CDC_EDPT_IN EDPT_IN (ITF_NUM_CDC+2)
|
||||
#define CDC_EDPT_SIZE 64
|
||||
|
||||
//------------- HID Keyboard -------------//
|
||||
#define HID_KEYBOARD_EDPT_ADDR EDPT_IN (INTERFACE_NO_HID_KEYBOARD+1)
|
||||
@ -120,8 +120,8 @@
|
||||
//------------- HID Generic -------------//
|
||||
|
||||
//------------- Mass Storage -------------//
|
||||
#define MSC_EDPT_OUT_ADDR EDPT_OUT(INTERFACE_NO_MSC+1)
|
||||
#define MSC_EDPT_IN_ADDR EDPT_IN (INTERFACE_NO_MSC+1)
|
||||
#define MSC_EDPT_OUT_ADDR EDPT_OUT(ITF_NUM_MSC+1)
|
||||
#define MSC_EDPT_IN_ADDR EDPT_IN (ITF_NUM_MSC+1)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -79,7 +79,7 @@ typedef struct {
|
||||
uint16_t xferred_len; // numbered of bytes transferred so far in the Data Stage
|
||||
}mscd_interface_t;
|
||||
|
||||
TUSB_CFG_ATTR_USBRAM STATIC_VAR mscd_interface_t mscd_data;
|
||||
TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT STATIC_VAR mscd_interface_t mscd_data;
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -53,7 +53,7 @@
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
|
||||
TUSB_CFG_ATTR_USBRAM uint8_t usbd_enum_buffer[TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE];
|
||||
TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT uint8_t usbd_enum_buffer[TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE];
|
||||
|
||||
static usbd_class_driver_t const usbd_class_drivers[] =
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user