diff options
| author | Ha Thach <[email protected]> | 2021-07-22 00:49:45 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-22 00:49:45 +0700 |
| commit | e971a4332dc6dc0580e1d71e4fc8866296f8159c (patch) | |
| tree | 2b29ee375b0502bf04b62a89ad8c15681bfaf552 /src/device/usbd.c | |
| parent | c737aa6fbb12fb9ed4c6eecbac58832e4bd2d436 (diff) | |
| parent | aff7b100ca87482e9e1d29f7e854d77cadbd6b98 (diff) | |
Merge pull request #975 from hathach/max-endpoint
Add DCD Attribute for Max endpoint
Diffstat (limited to 'src/device/usbd.c')
| -rw-r--r-- | src/device/usbd.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index af4fd58c4..b724c73e8 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -33,12 +33,12 @@ #include "device/usbd_pvt.h" #include "device/dcd.h" -#ifndef CFG_TUD_TASK_QUEUE_SZ -#define CFG_TUD_TASK_QUEUE_SZ 16 -#endif +//--------------------------------------------------------------------+ +// USBD Configuration +//--------------------------------------------------------------------+ -#ifndef CFG_TUD_EP_MAX -#define CFG_TUD_EP_MAX 9 +#ifndef CFG_TUD_TASK_QUEUE_SZ + #define CFG_TUD_TASK_QUEUE_SZ 16 #endif //--------------------------------------------------------------------+ @@ -65,7 +65,7 @@ typedef struct uint8_t speed; uint8_t itf2drv[16]; // map interface number to driver (0xff is invalid) - uint8_t ep2drv[CFG_TUD_EP_MAX][2]; // map endpoint to driver ( 0xff is invalid ) + uint8_t ep2drv[CFG_TUD_ENDPPOINT_MAX][2]; // map endpoint to driver ( 0xff is invalid ) struct TU_ATTR_PACKED { @@ -74,7 +74,7 @@ typedef struct volatile bool claimed : 1; // TODO merge ep2drv here, 4-bit should be sufficient - }ep_status[CFG_TUD_EP_MAX][2]; + }ep_status[CFG_TUD_ENDPPOINT_MAX][2]; }usbd_device_t; @@ -1151,6 +1151,7 @@ void usbd_defer_func(osal_task_func_t func, void* param, bool in_isr) bool usbd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * desc_ep) { TU_LOG2(" Open EP %02X with Size = %u\r\n", desc_ep->bEndpointAddress, desc_ep->wMaxPacketSize.size); + TU_ASSERT(tu_edpt_number(desc_ep->bEndpointAddress) < DCD_ATTR_ENDPOINT_MAX); switch (desc_ep->bmAttributes.xfer) { |
