diff options
| author | Yunhao Tian <[email protected]> | 2021-12-05 18:18:41 +0800 |
|---|---|---|
| committer | Yunhao Tian <[email protected]> | 2021-12-05 18:18:41 +0800 |
| commit | 702698ee293727d31efb0c7134a15a261d878cb9 (patch) | |
| tree | 7a971525c1d06ab590cf342138654d5d5977557e /src | |
| parent | 64b81fd4d316ff8e0390c843bdff236ed4151147 (diff) | |
Add FIFO size check
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/sunxi/dcd_sunxi_musb.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/portable/sunxi/dcd_sunxi_musb.c b/src/portable/sunxi/dcd_sunxi_musb.c index 2150403a9..ecc076658 100644 --- a/src/portable/sunxi/dcd_sunxi_musb.c +++ b/src/portable/sunxi/dcd_sunxi_musb.c @@ -388,6 +388,12 @@ static inline void print_block_list(free_block_t const *blk, unsigned num) #define print_block_list(a,b) #endif +#if CFG_TUSB_MCU == OPT_MCU_F1C100S +#define USB_FIFO_SIZE_KB 2 +#else +#error "Unsupported MCU" +#endif + static unsigned find_free_memory(uint_fast16_t size_in_log2_minus3) { free_block_t free_blocks[2 * (DCD_ATTR_ENDPOINT_MAX - 1)]; @@ -397,7 +403,7 @@ static unsigned find_free_memory(uint_fast16_t size_in_log2_minus3) /* Initialize free memory block list */ free_blocks[0].beg = 64 / 8; - free_blocks[0].end = (4 << 10) / 8; /* 4KiB / 8 bytes */ + free_blocks[0].end = (USB_FIFO_SIZE_KB << 10) / 8; /* 2KiB / 8 bytes */ for (int i = 1; i < DCD_ATTR_ENDPOINT_MAX; ++i) { uint_fast16_t addr; int num; |
