mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
use correct NBYTES_MAX for full and high speed
This commit is contained in:
parent
c26875e70d
commit
ba90a8cb79
@ -2,6 +2,7 @@ MCU_VARIANT = LPC55S69
|
||||
MCU_CORE = LPC55S69_cm33_core0
|
||||
|
||||
CFLAGS += -DCPU_LPC55S69JBD100_cm33_core0
|
||||
PORT ?= 1
|
||||
|
||||
JLINK_DEVICE = LPC55S69
|
||||
PYOCD_TARGET = LPC55S69
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user