summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-07-13 00:32:02 +0700
committerhathach <[email protected]>2018-07-13 00:32:02 +0700
commita623f0c179b49f510a206666bbe2ca52144a6458 (patch)
tree365f0d6be5e9851b660b291af26726b0087bdd60 /src/device
parenta4292e590668c30f78027573f59f1f4abca9dcb8 (diff)
better multiple interfaces support for cdc device
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c2
-rw-r--r--src/device/usbd_pvt.h10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index b1649ab4b..971f7dd05 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -528,6 +528,8 @@ void dcd_bus_event(uint8_t rhport, usbd_bus_event_type_t bus_event)
varclr_(&_usbd_dev);
osal_queue_flush(_usbd_q);
osal_semaphore_reset_isr(_usbd_ctrl_sem);
+
+ // TODO move to unplugged
for (uint8_t i = 0; i < USBD_CLASS_DRIVER_COUNT; i++)
{
if ( usbd_class_drivers[i].close ) usbd_class_drivers[i].close( rhport );
diff --git a/src/device/usbd_pvt.h b/src/device/usbd_pvt.h
index e9b8263f5..452df5934 100644
--- a/src/device/usbd_pvt.h
+++ b/src/device/usbd_pvt.h
@@ -45,6 +45,14 @@
// for used by usbd_control_xfer_st() only, must not be used directly
extern osal_semaphore_t _usbd_ctrl_sem;
+
+typedef struct
+{
+ uint8_t itf_num;
+ uint8_t ep_count;
+ uint8_t ep_arr[1];
+}usbd_itf_t;
+
//--------------------------------------------------------------------+
// INTERNAL API for stack management
//--------------------------------------------------------------------+
@@ -63,7 +71,7 @@ tusb_error_t usbd_open_edpt_pair(uint8_t rhport, tusb_desc_endpoint_t const* p_d
do {\
if (_len) { \
tusb_error_t err;\
- dcd_control_xfer(_rhport, _dir, _buffer, _len);\
+ dcd_control_xfer(_rhport, _dir, (uint8_t*) _buffer, _len);\
osal_semaphore_wait( _usbd_ctrl_sem, OSAL_TIMEOUT_CONTROL_XFER, &err );\
STASK_ASSERT_ERR( err );\
}\