From d6ee418cdfa38bf08c743a260579a1f6437aaa9c Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 20 Jul 2021 12:03:34 -0700 Subject: [PATCH] nxp_fmuk66:Add Serial RX DMA on Console --- .../nxp/fmuk66-e/nuttx-config/nsh/defconfig | 1 + .../fmuk66-e/nuttx-config/socketcan/defconfig | 1 + boards/nxp/fmuk66-e/src/init.c | 27 ++++++++++++++++--- .../nxp/fmuk66-v3/nuttx-config/nsh/defconfig | 1 + .../nuttx-config/socketcan/defconfig | 1 + boards/nxp/fmuk66-v3/src/init.c | 27 ++++++++++++++++--- 6 files changed, 50 insertions(+), 8 deletions(-) diff --git a/boards/nxp/fmuk66-e/nuttx-config/nsh/defconfig b/boards/nxp/fmuk66-e/nuttx-config/nsh/defconfig index 49398d10bd..23d8015ebd 100644 --- a/boards/nxp/fmuk66-e/nuttx-config/nsh/defconfig +++ b/boards/nxp/fmuk66-e/nuttx-config/nsh/defconfig @@ -80,6 +80,7 @@ CONFIG_KINETIS_I2C0=y CONFIG_KINETIS_I2C1=y CONFIG_KINETIS_LPTMR0=y CONFIG_KINETIS_LPUART0=y +CONFIG_KINETIS_LPUART0_RXDMA=y CONFIG_KINETIS_MERGE_TTY=y CONFIG_KINETIS_PDB=y CONFIG_KINETIS_PIT=y diff --git a/boards/nxp/fmuk66-e/nuttx-config/socketcan/defconfig b/boards/nxp/fmuk66-e/nuttx-config/socketcan/defconfig index 35f48eea73..e1ffbe0040 100644 --- a/boards/nxp/fmuk66-e/nuttx-config/socketcan/defconfig +++ b/boards/nxp/fmuk66-e/nuttx-config/socketcan/defconfig @@ -81,6 +81,7 @@ CONFIG_KINETIS_I2C0=y CONFIG_KINETIS_I2C1=y CONFIG_KINETIS_LPTMR0=y CONFIG_KINETIS_LPUART0=y +CONFIG_KINETIS_LPUART0_RXDMA=y CONFIG_KINETIS_MERGE_TTY=y CONFIG_KINETIS_PDB=y CONFIG_KINETIS_PIT=y diff --git a/boards/nxp/fmuk66-e/src/init.c b/boards/nxp/fmuk66-e/src/init.c index 842294a86f..7dafc4fabe 100644 --- a/boards/nxp/fmuk66-e/src/init.c +++ b/boards/nxp/fmuk66-e/src/init.c @@ -64,8 +64,7 @@ #include #include -#include -#include +#include #include "board_config.h" #include "arm_arch.h" @@ -189,6 +188,26 @@ kinetis_boardinitialize(void) VDD_3V3_SPEKTRUM_POWER_EN(true); } +/**************************************************************************** + * Name: kinetis_serial_dma_poll_all + * + * Description: + * Checks receive DMA buffers for received bytes that have not accumulated + * to the point where the DMA half/full interrupt has triggered. + * + * This function should be called from a timer or other periodic context. + * + ****************************************************************************/ + +void kinetis_lpserial_dma_poll_all(void) +{ +#if defined(LPSERIAL_HAVE_DMA) + kinetis_lpserial_dma_poll(); +#endif +#if defined(SERIAL_HAVE_DMA) + kinetis_serial_dma_poll(); +#endif +} /**************************************************************************** * Name: board_app_initialize @@ -236,7 +255,7 @@ __EXPORT int board_app_initialize(uintptr_t arg) } /* set up the serial DMA polling */ -#ifdef SERIAL_HAVE_DMA +#if defined(SERIAL_HAVE_DMA) || defined(LPSERIAL_HAVE_DMA) static struct hrt_call serial_dma_call; struct timespec ts; @@ -250,7 +269,7 @@ __EXPORT int board_app_initialize(uintptr_t arg) hrt_call_every(&serial_dma_call, ts_to_abstime(&ts), ts_to_abstime(&ts), - (hrt_callout)kinetis_serial_dma_poll, + (hrt_callout)kinetis_lpserial_dma_poll_all, NULL); #endif diff --git a/boards/nxp/fmuk66-v3/nuttx-config/nsh/defconfig b/boards/nxp/fmuk66-v3/nuttx-config/nsh/defconfig index 47c84301bd..86255f3b75 100644 --- a/boards/nxp/fmuk66-v3/nuttx-config/nsh/defconfig +++ b/boards/nxp/fmuk66-v3/nuttx-config/nsh/defconfig @@ -81,6 +81,7 @@ CONFIG_KINETIS_I2C0=y CONFIG_KINETIS_I2C1=y CONFIG_KINETIS_LPTMR0=y CONFIG_KINETIS_LPUART0=y +CONFIG_KINETIS_LPUART0_RXDMA=y CONFIG_KINETIS_MERGE_TTY=y CONFIG_KINETIS_PDB=y CONFIG_KINETIS_PIT=y diff --git a/boards/nxp/fmuk66-v3/nuttx-config/socketcan/defconfig b/boards/nxp/fmuk66-v3/nuttx-config/socketcan/defconfig index c86f411cf1..c278d5c9d0 100644 --- a/boards/nxp/fmuk66-v3/nuttx-config/socketcan/defconfig +++ b/boards/nxp/fmuk66-v3/nuttx-config/socketcan/defconfig @@ -82,6 +82,7 @@ CONFIG_KINETIS_I2C0=y CONFIG_KINETIS_I2C1=y CONFIG_KINETIS_LPTMR0=y CONFIG_KINETIS_LPUART0=y +CONFIG_KINETIS_LPUART0_RXDMA=y CONFIG_KINETIS_MERGE_TTY=y CONFIG_KINETIS_PDB=y CONFIG_KINETIS_PIT=y diff --git a/boards/nxp/fmuk66-v3/src/init.c b/boards/nxp/fmuk66-v3/src/init.c index d6cc60326b..4c9dc16c56 100644 --- a/boards/nxp/fmuk66-v3/src/init.c +++ b/boards/nxp/fmuk66-v3/src/init.c @@ -64,8 +64,7 @@ #include #include -#include -#include +#include #include "board_config.h" #include "arm_arch.h" @@ -189,6 +188,26 @@ kinetis_boardinitialize(void) VDD_3V3_SPEKTRUM_POWER_EN(true); } +/**************************************************************************** + * Name: kinetis_serial_dma_poll_all + * + * Description: + * Checks receive DMA buffers for received bytes that have not accumulated + * to the point where the DMA half/full interrupt has triggered. + * + * This function should be called from a timer or other periodic context. + * + ****************************************************************************/ + +void kinetis_lpserial_dma_poll_all(void) +{ +#if defined(LPSERIAL_HAVE_DMA) + kinetis_lpserial_dma_poll(); +#endif +#if defined(SERIAL_HAVE_DMA) + kinetis_serial_dma_poll(); +#endif +} /**************************************************************************** * Name: board_app_initialize @@ -236,7 +255,7 @@ __EXPORT int board_app_initialize(uintptr_t arg) } /* set up the serial DMA polling */ -#ifdef SERIAL_HAVE_DMA +#if defined(SERIAL_HAVE_DMA) || defined(LPSERIAL_HAVE_DMA) static struct hrt_call serial_dma_call; struct timespec ts; @@ -250,7 +269,7 @@ __EXPORT int board_app_initialize(uintptr_t arg) hrt_call_every(&serial_dma_call, ts_to_abstime(&ts), ts_to_abstime(&ts), - (hrt_callout)kinetis_serial_dma_poll, + (hrt_callout)kinetis_lpserial_dma_poll_all, NULL); #endif