Skip to content

Commit 7360645

Browse files
Fix STM32F0 DMA interrupts
1 parent 29dd875 commit 7360645

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

drivers/usb/tests/TESTS/usb_device/msd/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ void msd_process(USBMSD *msd)
243243

244244
#define TEST_ASSERT_EQUAL_STRING_LOOP(expected, actual, loop_index) \
245245
if (strcmp(expected, actual) != 0) { \
246-
char str[255]; \
246+
char str[275]; \
247247
sprintf(str, "expected %s was %s (loop index: %lu)", expected, actual, loop_index); \
248248
TEST_ASSERT_MESSAGE(false, str); \
249249
}
250250

251251
#define TEST_ASSERT_EQUAL_LOOP(expected, actual, loop_index) \
252252
if (expected != actual) { \
253-
char str[255]; \
253+
char str[275]; \
254254
sprintf(str, "expected %d was %d (loop index: %lu)", expected, actual, loop_index); \
255255
TEST_ASSERT_MESSAGE(false, str); \
256256
}

hal/tests/TESTS/mbed_hal/ospi/main.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void _ospi_write_read_test(Ospi &ospi, ospi_bus_width_t write_inst_width,
115115
ospi_status_t ret = OSPI_STATUS_OK;
116116

117117
Timer timer;
118-
int erase_time = 0, write_time = 0, read_time = 0;
118+
std::chrono::microseconds erase_time{}, write_time{}, read_time{};
119119
size_t buf_len = data_size;
120120

121121
for (uint32_t tc = 0; tc < test_count; tc++) {
@@ -136,7 +136,7 @@ static void _ospi_write_read_test(Ospi &ospi, ospi_bus_width_t write_inst_width,
136136
WAIT_FOR(SECTOR_ERASE_MAX_TIME, ospi);
137137

138138
timer.stop();
139-
erase_time = timer.read_us();
139+
erase_time = timer.elapsed_time();
140140

141141
// switching to extended-SPI/DPI/QPI mode here for write operation
142142
// for DPI/QPI ospi.cmd is automatically switched to 2_2_2/4_4_4 mode
@@ -167,7 +167,7 @@ static void _ospi_write_read_test(Ospi &ospi, ospi_bus_width_t write_inst_width,
167167
WAIT_FOR(PAGE_PROG_MAX_TIME, ospi);
168168

169169
timer.stop();
170-
write_time = timer.read_us();
170+
write_time = timer.elapsed_time();
171171
}
172172

173173
// switching back to single channel SPI
@@ -193,7 +193,7 @@ static void _ospi_write_read_test(Ospi &ospi, ospi_bus_width_t write_inst_width,
193193
TEST_ASSERT_EQUAL(read_size, buf_len);
194194

195195
timer.stop();
196-
read_time = timer.read_us();
196+
read_time = timer.elapsed_time();
197197
}
198198
ospi.cmd.set_dummy_cycles(0);
199199

@@ -211,13 +211,13 @@ static void _ospi_write_read_test(Ospi &ospi, ospi_bus_width_t write_inst_width,
211211
if (tx_buf[i] != rx_buf[i]) {
212212
log_data("tx data", tx_buf, data_size);
213213
log_data("rx data", rx_buf, data_size);
214-
utest_printf("erase/write/read time: %d/%d/%d [us]\r\n", erase_time, write_time, read_time);
214+
utest_printf("erase/write/read time: %" PRIi64 "/%" PRIi64 "/%" PRIi64 " [us]\r\n", erase_time.count(), write_time.count(), read_time.count());
215215
TEST_ASSERT_EQUAL(tx_buf[i], rx_buf[i]);
216216
}
217217
}
218218

219219
#ifdef OSPI_TEST_LOG_FLASH_TIME
220-
utest_printf("erase/write/read time: %d/%d/%d [us]\r\n", erase_time, write_time, read_time);
220+
utest_printf("erase/write/read time: %" PRIi64 "/%" PRIi64 "/%" PRIi64 " [us]\r\n", erase_time.count(), write_time.count(), read_time.count());
221221
#endif
222222

223223
#ifdef OSPI_TEST_LOG_DATA

targets/TARGET_STM/stm_dma_utils.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,15 @@ IRQn_Type stm_get_dma_irqn(const DMALinkInfo *dmaLink)
396396
case 4:
397397
case 5:
398398
return DMA1_Ch4_7_DMA2_Ch1_5_DMAMUX1_OVR_IRQn;
399+
#elif defined(TARGET_MCU_STM32F0)
400+
// STM32F0 has a rather bespoke mapping
401+
case 1:
402+
case 2:
403+
return DMA1_Ch2_3_DMA2_Ch1_2_IRQn;
404+
case 3:
405+
case 4:
406+
case 5:
407+
return DMA1_Ch4_7_DMA2_Ch3_5_IRQn;
399408
#else
400409

401410
#ifdef DMA2_Channel1

0 commit comments

Comments
 (0)