Skip to content

Commit cdf7499

Browse files
authored
Merge pull request #3472 from hathach/u0_fix
fix stm32u0 data stride
2 parents 707fb52 + 26ca4e2 commit cdf7499

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

.idea/cmake.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/portable/st/stm32_fsdev/fsdev_common.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,21 @@ TU_VERIFY_STATIC(FSDEV_BTABLE_BASE % 8 == 0, "BTABLE base must be aligned to 8 b
6363

6464
// CFG_TUSB_FSDEV_PMA_SIZE is PMA buffer size in bytes.
6565
// - 512-byte devices, access with a stride of two words (use every other 16-bit address)
66-
// - 1024-byte devices, access with a stride of one word (use every 16-bit address)
66+
// - 1024-byte devices, access with a stride of one word (use every 16-bit address) or 32-bit address
6767
// - 2048-byte devices, access with 32-bit address
68-
69-
// For purposes of accessing the packet
70-
#if CFG_TUSB_FSDEV_PMA_SIZE == 512
71-
// 1x16 bit / word access scheme
72-
#define FSDEV_PMA_STRIDE 2
73-
#define pma_access_scheme TU_ATTR_ALIGNED(4)
74-
#elif CFG_TUSB_FSDEV_PMA_SIZE == 1024
75-
// 2x16 bit / word access scheme
76-
#define FSDEV_PMA_STRIDE 1
77-
#define pma_access_scheme
78-
#elif CFG_TUSB_FSDEV_PMA_SIZE == 2048
68+
#if CFG_TUSB_FSDEV_PMA_SIZE == 2048 || TU_CHECK_MCU(OPT_MCU_STM32U0)
7969
// 32 bit access scheme
8070
#define FSDEV_BUS_32BIT
8171
#define FSDEV_PMA_STRIDE 1
8272
#define pma_access_scheme
73+
#elif CFG_TUSB_FSDEV_PMA_SIZE == 1024
74+
// 2x16 bit / word access scheme
75+
#define FSDEV_PMA_STRIDE 1
76+
#define pma_access_scheme
77+
#elif CFG_TUSB_FSDEV_PMA_SIZE == 512
78+
// 1x16 bit / word access scheme
79+
#define FSDEV_PMA_STRIDE 2
80+
#define pma_access_scheme TU_ATTR_ALIGNED(4)
8381
#endif
8482

8583
// The fsdev_bus_t type can be used for both register and PMA access necessities

src/tusb_option.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,14 @@
340340
#if defined(TUP_USBIP_FSDEV)
341341
#define CFG_TUD_EDPT_DEDICATED_HWFIFO 1
342342

343-
#if CFG_TUSB_FSDEV_PMA_SIZE == 512
344-
#define CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE 2 // 16-bit data
343+
#if CFG_TUSB_FSDEV_PMA_SIZE == 2048 || TU_CHECK_MCU(OPT_MCU_STM32U0)
344+
#define CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE 4 // 32-bit data
345345
#define CFG_TUSB_FIFO_HWFIFO_ADDR_STRIDE 4 // 32-bit address increase
346346
#elif CFG_TUSB_FSDEV_PMA_SIZE == 1024
347347
#define CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE 2 // 16-bit data
348348
#define CFG_TUSB_FIFO_HWFIFO_ADDR_STRIDE 2 // 16-bit address increase
349-
#elif CFG_TUSB_FSDEV_PMA_SIZE == 2048
350-
#define CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE 4 // 32-bit data
349+
#elif CFG_TUSB_FSDEV_PMA_SIZE == 512
350+
#define CFG_TUSB_FIFO_HWFIFO_DATA_STRIDE 2 // 16-bit data
351351
#define CFG_TUSB_FIFO_HWFIFO_ADDR_STRIDE 4 // 32-bit address increase
352352
#endif
353353
#endif

0 commit comments

Comments
 (0)