From bbfaa4694ca6b8b9769f5cd7c91aede3059aede3 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 6 Oct 2021 14:39:59 -0400 Subject: [PATCH] boards: cleanup serial RX DMA hrt_call_every - remove ts_to_abstime dependency --- boards/airmind/mindpx-v2/src/init.c | 19 ++++--------------- boards/atl/mantis-edu/src/init.c | 17 ++--------------- boards/av/x-v1/src/init.c | 19 ++++--------------- boards/bitcraze/crazyflie/src/init.c | 20 ++++---------------- boards/bitcraze/crazyflie21/src/init.c | 20 ++++---------------- boards/cubepilot/cubeyellow/src/init.c | 17 ++--------------- boards/holybro/can-gps-v1/src/init.c | 19 +++---------------- boards/holybro/durandal-v1/src/init.c | 20 +++----------------- boards/holybro/kakutef7/src/init.c | 20 ++++---------------- boards/holybro/pix32v5/src/init.c | 17 ++--------------- boards/modalai/fc-v1/src/init.c | 20 ++++---------------- boards/modalai/fc-v2/src/init.c | 20 +++----------------- boards/mro/ctrl-zero-f7-oem/src/init.c | 20 ++++---------------- boards/mro/ctrl-zero-f7/src/init.c | 20 ++++---------------- boards/mro/x21-777/src/init.c | 17 ++--------------- boards/mro/x21/src/init.c | 19 ++++--------------- boards/nxp/fmuk66-e/src/init.c | 19 +++---------------- boards/nxp/fmuk66-v3/src/init.c | 19 +++---------------- boards/nxp/fmurt1062-v1/src/init.c | 19 +++---------------- boards/omnibus/f4sd/src/init.c | 19 ++++--------------- boards/px4/fmu-v2/src/init.c | 19 ++++--------------- boards/px4/fmu-v3/src/init.c | 19 ++++--------------- boards/px4/fmu-v4/src/init.c | 19 ++++--------------- boards/px4/fmu-v4pro/src/init.c | 19 ++++--------------- boards/px4/fmu-v5/src/init.c | 17 ++--------------- boards/px4/fmu-v5x/src/init.cpp | 20 ++++---------------- boards/px4/fmu-v6u/src/init.c | 20 +++----------------- boards/px4/fmu-v6x/src/init.c | 20 +++----------------- boards/spracing/h7extreme/src/init.c | 20 +++----------------- boards/uvify/core/src/init.c | 19 ++++--------------- 30 files changed, 101 insertions(+), 471 deletions(-) diff --git a/boards/airmind/mindpx-v2/src/init.c b/boards/airmind/mindpx-v2/src/init.c index 376a98c21c..fbfe2d7661 100644 --- a/boards/airmind/mindpx-v2/src/init.c +++ b/boards/airmind/mindpx-v2/src/init.c @@ -218,22 +218,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/atl/mantis-edu/src/init.c b/boards/atl/mantis-edu/src/init.c index 585c316e28..1068983ac3 100644 --- a/boards/atl/mantis-edu/src/init.c +++ b/boards/atl/mantis-edu/src/init.c @@ -218,22 +218,9 @@ __EXPORT int board_app_initialize(uintptr_t arg) } #if defined(SERIAL_HAVE_RXDMA) - /* set up the serial DMA polling */ + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif board_pwr_init(1); diff --git a/boards/av/x-v1/src/init.c b/boards/av/x-v1/src/init.c index f53a939505..1eef35d3fb 100644 --- a/boards/av/x-v1/src/init.c +++ b/boards/av/x-v1/src/init.c @@ -161,22 +161,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif (void) board_hardfault_init(2, true); diff --git a/boards/bitcraze/crazyflie/src/init.c b/boards/bitcraze/crazyflie/src/init.c index 5304e017ce..230fd04b01 100644 --- a/boards/bitcraze/crazyflie/src/init.c +++ b/boards/bitcraze/crazyflie/src/init.c @@ -131,23 +131,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) { px4_platform_init(); - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); - + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/bitcraze/crazyflie21/src/init.c b/boards/bitcraze/crazyflie21/src/init.c index 7c85a39183..32c6c0d057 100644 --- a/boards/bitcraze/crazyflie21/src/init.c +++ b/boards/bitcraze/crazyflie21/src/init.c @@ -131,23 +131,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) { px4_platform_init(); - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); - + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/cubepilot/cubeyellow/src/init.c b/boards/cubepilot/cubeyellow/src/init.c index 88f8fc9747..5d1125b213 100644 --- a/boards/cubepilot/cubeyellow/src/init.c +++ b/boards/cubepilot/cubeyellow/src/init.c @@ -165,22 +165,9 @@ __EXPORT int board_app_initialize(uintptr_t arg) } #if defined(SERIAL_HAVE_RXDMA) - /* set up the serial DMA polling */ + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif /* initial LED state */ diff --git a/boards/holybro/can-gps-v1/src/init.c b/boards/holybro/can-gps-v1/src/init.c index 86fe2eb206..9388c92715 100644 --- a/boards/holybro/can-gps-v1/src/init.c +++ b/boards/holybro/can-gps-v1/src/init.c @@ -167,25 +167,12 @@ __EXPORT int board_app_initialize(uintptr_t arg) #endif // FLASH_BASED_PARAMS - #if defined(SERIAL_HAVE_RXDMA) - /* set up the serial DMA polling */ + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif + rgb_led(0, 255, 0, 0); return OK; } diff --git a/boards/holybro/durandal-v1/src/init.c b/boards/holybro/durandal-v1/src/init.c index 3f1eccc180..902c3a9656 100644 --- a/boards/holybro/durandal-v1/src/init.c +++ b/boards/holybro/durandal-v1/src/init.c @@ -248,26 +248,12 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } -#if 0 // serial DMA is not yet implemented in NuttX for stm32h7 - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif - /* initial LED state */ drv_led_start(); led_off(LED_RED); diff --git a/boards/holybro/kakutef7/src/init.c b/boards/holybro/kakutef7/src/init.c index df0cf6694a..781363ebf4 100644 --- a/boards/holybro/kakutef7/src/init.c +++ b/boards/holybro/kakutef7/src/init.c @@ -200,23 +200,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); - + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/holybro/pix32v5/src/init.c b/boards/holybro/pix32v5/src/init.c index d6f978aac8..c980f16550 100644 --- a/boards/holybro/pix32v5/src/init.c +++ b/boards/holybro/pix32v5/src/init.c @@ -252,22 +252,9 @@ __EXPORT int board_app_initialize(uintptr_t arg) } #if defined(SERIAL_HAVE_RXDMA) - /* set up the serial DMA polling */ + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif /* initial LED state */ diff --git a/boards/modalai/fc-v1/src/init.c b/boards/modalai/fc-v1/src/init.c index d3f62e361e..d360a3da22 100644 --- a/boards/modalai/fc-v1/src/init.c +++ b/boards/modalai/fc-v1/src/init.c @@ -256,23 +256,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); - + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/modalai/fc-v2/src/init.c b/boards/modalai/fc-v2/src/init.c index 97d757a4d9..b3bb31c9df 100644 --- a/boards/modalai/fc-v2/src/init.c +++ b/boards/modalai/fc-v2/src/init.c @@ -231,26 +231,12 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } -#if 0 // serial DMA is not yet implemented in NuttX for stm32h7 - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif - /* initial LED state */ drv_led_start(); led_off(LED_RED); diff --git a/boards/mro/ctrl-zero-f7-oem/src/init.c b/boards/mro/ctrl-zero-f7-oem/src/init.c index c21e1fa7d5..ecadc74e62 100644 --- a/boards/mro/ctrl-zero-f7-oem/src/init.c +++ b/boards/mro/ctrl-zero-f7-oem/src/init.c @@ -205,23 +205,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); - + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/mro/ctrl-zero-f7/src/init.c b/boards/mro/ctrl-zero-f7/src/init.c index c21e1fa7d5..ecadc74e62 100644 --- a/boards/mro/ctrl-zero-f7/src/init.c +++ b/boards/mro/ctrl-zero-f7/src/init.c @@ -205,23 +205,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); - + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/mro/x21-777/src/init.c b/boards/mro/x21-777/src/init.c index 3135148c63..890bad343a 100644 --- a/boards/mro/x21-777/src/init.c +++ b/boards/mro/x21-777/src/init.c @@ -195,22 +195,9 @@ __EXPORT int board_app_initialize(uintptr_t arg) } #if defined(SERIAL_HAVE_RXDMA) - /* set up the serial DMA polling */ + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif /* initial LED state */ diff --git a/boards/mro/x21/src/init.c b/boards/mro/x21/src/init.c index 09fd0e8473..8530054e99 100644 --- a/boards/mro/x21/src/init.c +++ b/boards/mro/x21/src/init.c @@ -241,22 +241,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/nxp/fmuk66-e/src/init.c b/boards/nxp/fmuk66-e/src/init.c index 7dafc4fabe..ad4c237aec 100644 --- a/boards/nxp/fmuk66-e/src/init.c +++ b/boards/nxp/fmuk66-e/src/init.c @@ -254,23 +254,10 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ -#if defined(SERIAL_HAVE_DMA) || defined(LPSERIAL_HAVE_DMA) +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)kinetis_lpserial_dma_poll_all, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)kinetis_lpserial_dma_poll_all, NULL); #endif /* initial LED state */ diff --git a/boards/nxp/fmuk66-v3/src/init.c b/boards/nxp/fmuk66-v3/src/init.c index 4c9dc16c56..a8fcc91e51 100644 --- a/boards/nxp/fmuk66-v3/src/init.c +++ b/boards/nxp/fmuk66-v3/src/init.c @@ -254,23 +254,10 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ -#if defined(SERIAL_HAVE_DMA) || defined(LPSERIAL_HAVE_DMA) +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)kinetis_lpserial_dma_poll_all, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)kinetis_lpserial_dma_poll_all, NULL); #endif /* initial LED state */ diff --git a/boards/nxp/fmurt1062-v1/src/init.c b/boards/nxp/fmurt1062-v1/src/init.c index 61803e1d27..ffa41b0460 100644 --- a/boards/nxp/fmurt1062-v1/src/init.c +++ b/boards/nxp/fmurt1062-v1/src/init.c @@ -276,23 +276,10 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ -#ifdef SERIAL_HAVE_DMA +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)imxrt_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)imxrt_serial_dma_poll, NULL); #endif /* initial LED state */ diff --git a/boards/omnibus/f4sd/src/init.c b/boards/omnibus/f4sd/src/init.c index df128028d6..dad8c28ea9 100644 --- a/boards/omnibus/f4sd/src/init.c +++ b/boards/omnibus/f4sd/src/init.c @@ -244,22 +244,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/px4/fmu-v2/src/init.c b/boards/px4/fmu-v2/src/init.c index 5792d0d8c8..9bd7d26bc6 100644 --- a/boards/px4/fmu-v2/src/init.c +++ b/boards/px4/fmu-v2/src/init.c @@ -432,22 +432,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/px4/fmu-v3/src/init.c b/boards/px4/fmu-v3/src/init.c index 5792d0d8c8..9bd7d26bc6 100644 --- a/boards/px4/fmu-v3/src/init.c +++ b/boards/px4/fmu-v3/src/init.c @@ -432,22 +432,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/px4/fmu-v4/src/init.c b/boards/px4/fmu-v4/src/init.c index c7c24e9474..fb18722297 100644 --- a/boards/px4/fmu-v4/src/init.c +++ b/boards/px4/fmu-v4/src/init.c @@ -267,22 +267,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - // Set up the serial DMA polling. +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /** - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif // Initial LED state. drv_led_start(); diff --git a/boards/px4/fmu-v4pro/src/init.c b/boards/px4/fmu-v4pro/src/init.c index 42774f6a4b..5ab9855d96 100644 --- a/boards/px4/fmu-v4pro/src/init.c +++ b/boards/px4/fmu-v4pro/src/init.c @@ -288,22 +288,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/px4/fmu-v5/src/init.c b/boards/px4/fmu-v5/src/init.c index 09826b77aa..0467a0db9b 100644 --- a/boards/px4/fmu-v5/src/init.c +++ b/boards/px4/fmu-v5/src/init.c @@ -255,22 +255,9 @@ __EXPORT int board_app_initialize(uintptr_t arg) } #if defined(SERIAL_HAVE_RXDMA) - /* set up the serial DMA polling */ + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif /* initial LED state */ diff --git a/boards/px4/fmu-v5x/src/init.cpp b/boards/px4/fmu-v5x/src/init.cpp index e4634580d2..1632e5891e 100644 --- a/boards/px4/fmu-v5x/src/init.cpp +++ b/boards/px4/fmu-v5x/src/init.cpp @@ -240,23 +240,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); - + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif /* initial LED state */ drv_led_start(); diff --git a/boards/px4/fmu-v6u/src/init.c b/boards/px4/fmu-v6u/src/init.c index 4355777b30..4e7b4a19ae 100644 --- a/boards/px4/fmu-v6u/src/init.c +++ b/boards/px4/fmu-v6u/src/init.c @@ -240,26 +240,12 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } -#if 0 // serial DMA is not yet implemented in NuttX for stm32h7 - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif - /* initial LED state */ drv_led_start(); led_off(LED_RED); diff --git a/boards/px4/fmu-v6x/src/init.c b/boards/px4/fmu-v6x/src/init.c index 3356a27855..691c150420 100644 --- a/boards/px4/fmu-v6x/src/init.c +++ b/boards/px4/fmu-v6x/src/init.c @@ -242,26 +242,12 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } -#if 0 // serial DMA is not yet implemented in NuttX for stm32h7 - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif - /* initial LED state */ drv_led_start(); led_off(LED_RED); diff --git a/boards/spracing/h7extreme/src/init.c b/boards/spracing/h7extreme/src/init.c index 9c69f93f96..7b270bc1a2 100644 --- a/boards/spracing/h7extreme/src/init.c +++ b/boards/spracing/h7extreme/src/init.c @@ -205,26 +205,12 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "[boot] DMA alloc FAILED\n"); } -#if 0 // serial DMA is not yet implemented in NuttX for stm32h7 - /* set up the serial DMA polling */ +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /* - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); #endif - /* initial LED state */ drv_led_start(); led_off(LED_RED); diff --git a/boards/uvify/core/src/init.c b/boards/uvify/core/src/init.c index f2b9202251..5c88f90d8f 100644 --- a/boards/uvify/core/src/init.c +++ b/boards/uvify/core/src/init.c @@ -267,22 +267,11 @@ __EXPORT int board_app_initialize(uintptr_t arg) syslog(LOG_ERR, "DMA alloc FAILED\n"); } - // Set up the serial DMA polling. +#if defined(SERIAL_HAVE_RXDMA) + // set up the serial DMA polling at 1ms intervals for received bytes that have not triggered a DMA event. static struct hrt_call serial_dma_call; - struct timespec ts; - - /** - * Poll at 1ms intervals for received bytes that have not triggered - * a DMA event. - */ - ts.tv_sec = 0; - ts.tv_nsec = 1000000; - - hrt_call_every(&serial_dma_call, - ts_to_abstime(&ts), - ts_to_abstime(&ts), - (hrt_callout)stm32_serial_dma_poll, - NULL); + hrt_call_every(&serial_dma_call, 1000, 1000, (hrt_callout)stm32_serial_dma_poll, NULL); +#endif // Initial LED state. drv_led_start();