diff options
| author | hathach <[email protected]> | 2021-04-26 20:22:40 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-04-26 20:22:40 +0700 |
| commit | ba90a8cb793449d6562d209326ef40e00e3db983 (patch) | |
| tree | 6a511e1aec4c1dc1155eaacb6ab75f00153478f0 /src | |
| parent | c26875e70d120f564f4e68c1dc79d9e7e3642b70 (diff) | |
use correct NBYTES_MAX for full and high speed
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c b/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c index 4a009bc07..4392d1882 100644 --- a/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c +++ b/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c @@ -76,16 +76,10 @@ typedef struct { __I uint32_t EPTOGGLE; // Endpoint toggle register, offset: 0x34 } dcd_registers_t; -/* Although device controller are the same. Somehow only LPC134x can execute - * DMA with 1023 bytes for Bulk/Control. Others (11u, 51u, 54xxx) can only work - * with max 64 bytes - */ +// Max nbytes for each control/bulk/interrupt transfer enum { - #if CFG_TUSB_MCU == OPT_MCU_LPC13XX - DMA_NBYTES_MAX = 1023 - #else - DMA_NBYTES_MAX = 64 - #endif + NBYTES_CBI_FULLSPEED_MAX = 64, + NBYTES_CBI_HIGHSPEED_MAX = 32767 // can be up to all 15-bit, but only tested with 4096 }; enum { @@ -342,20 +336,23 @@ static void prepare_setup_packet(uint8_t rhport) static void prepare_ep_xfer(uint8_t rhport, uint8_t ep_id, uint16_t buf_offset, uint16_t total_bytes) { - uint16_t const nbytes = tu_min16(total_bytes, DMA_NBYTES_MAX); - - _dcd.dma[ep_id].nbytes = nbytes; + uint16_t nbytes; if (_dcd_controller[rhport].max_speed == TUSB_SPEED_FULL ) { + // TODO ISO FullSpeed can have up to 1023 bytes + nbytes = tu_min16(total_bytes, NBYTES_CBI_FULLSPEED_MAX); _dcd.ep[ep_id][0].buffer_fs.offset = buf_offset; - _dcd.ep[ep_id][0].buffer_fs.nbytes = nbytes; + _dcd.ep[ep_id][0].buffer_fs.nbytes = nbytes; }else { + nbytes = tu_min16(total_bytes, NBYTES_CBI_HIGHSPEED_MAX); _dcd.ep[ep_id][0].buffer_hs.offset = buf_offset; - _dcd.ep[ep_id][0].buffer_hs.nbytes = nbytes; + _dcd.ep[ep_id][0].buffer_hs.nbytes = nbytes; } + _dcd.dma[ep_id].nbytes = nbytes; + _dcd.ep[ep_id][0].active = 1; } |
