diff options
| author | Jerzy Kasenberg <[email protected]> | 2020-09-21 15:23:56 +0200 |
|---|---|---|
| committer | Jerzy Kasenberg <[email protected]> | 2020-10-01 09:22:49 +0200 |
| commit | b2ce7a39b0d0b941ad7edb63f527b223568caa47 (patch) | |
| tree | 80e2c5ca6edbe9a488ccc80f42298d7032a4cb04 /src/device | |
| parent | 9a0a78c52e311f7dbf904d77be118c8a789f0c45 (diff) | |
device: Make number of endpoints configurable
Currently number of endpoints was hard coded to 8.
NRF52 has 9 IN and 9 OUT endpoints.
ISO endpoints are 0x08 and 0x88 and without this change those
two ISO endpoint could not be used.
Diffstat (limited to 'src/device')
| -rw-r--r-- | src/device/usbd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index d1e984a0e..3a6ce9b6c 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -37,6 +37,10 @@ #define CFG_TUD_TASK_QUEUE_SZ 16 #endif +#ifndef CFG_TUD_EP_MAX +#define CFG_TUD_EP_MAX 9 +#endif + //--------------------------------------------------------------------+ // Device Data //--------------------------------------------------------------------+ @@ -57,7 +61,7 @@ typedef struct uint8_t speed; uint8_t itf2drv[16]; // map interface number to driver (0xff is invalid) - uint8_t ep2drv[8][2]; // map endpoint to driver ( 0xff is invalid ) + uint8_t ep2drv[CFG_TUD_EP_MAX][2]; // map endpoint to driver ( 0xff is invalid ) struct TU_ATTR_PACKED { @@ -66,7 +70,7 @@ typedef struct volatile bool claimed : 1; // TODO merge ep2drv here, 4-bit should be sufficient - }ep_status[8][2]; + }ep_status[CFG_TUD_EP_MAX][2]; }usbd_device_t; @@ -249,7 +253,7 @@ static osal_mutex_t _usbd_mutex; //--------------------------------------------------------------------+ // Prototypes //--------------------------------------------------------------------+ -static void mark_interface_endpoint(uint8_t ep2drv[8][2], uint8_t const* p_desc, uint16_t desc_len, uint8_t driver_id); +static void mark_interface_endpoint(uint8_t ep2drv[][2], uint8_t const* p_desc, uint16_t desc_len, uint8_t driver_id); static bool process_control_request(uint8_t rhport, tusb_control_request_t const * p_request); static bool process_set_config(uint8_t rhport, uint8_t cfg_num); static bool process_get_descriptor(uint8_t rhport, tusb_control_request_t const * p_request); @@ -842,7 +846,7 @@ static bool process_set_config(uint8_t rhport, uint8_t cfg_num) } // Helper marking endpoint of interface belongs to class driver -static void mark_interface_endpoint(uint8_t ep2drv[8][2], uint8_t const* p_desc, uint16_t desc_len, uint8_t driver_id) +static void mark_interface_endpoint(uint8_t ep2drv[][2], uint8_t const* p_desc, uint16_t desc_len, uint8_t driver_id) { uint16_t len = 0; |
