Tiva C TM4C129x: correct way to add uDMA support for serial ports

324 views
Skip to first unread message

Dmitry Sharihin

unread,
Apr 9, 2018, 1:02:42 AM4/9/18
to NuttX
Hi there,
I want to try embed Nuttx in my project (TCP-UART bridge). I'm using TI TM4C1294 chip. As far as I know, there is almost complete driver support in kernel code. However, I haven't found proper DMA support for accelerating bulk operations with serial port.
Most of the peripherals on Tiva C has no embedded DMA-functionality, instead they are using common ARM PrimeCell uDMA controller, so the same DMA channel could be used for various peripherals. 

So, here's the question: what's the proper way to add DMA functionality in NuttX?
Thanks

patacongo

unread,
Apr 9, 2018, 2:34:24 PM4/9/18
to NuttX
I want to try embed Nuttx in my project (TCP-UART bridge). I'm using TI TM4C1294 chip. As far as I know, there is almost complete driver support in kernel code. However, I haven't found proper DMA support for accelerating bulk operations with serial port.
Most of the peripherals on Tiva C has no embedded DMA-functionality, instead they are using common ARM PrimeCell uDMA controller, so the same DMA channel could be used for various peripherals. 

So, here's the question: what's the proper way to add DMA functionality in NuttX?

I would look at how DMA was implemented in other ARM architectures.  There is always a C file with a name like xyz_*dma.c:

$ find arch/arm/src/ -name "*dma.c"
arch/arm/src/efm32/efm32_dma.c
arch/arm/src/kinetis/kinetis_dma.c
arch/arm/src/kinetis/kinetis_pindma.c
arch/arm/src/lc823450/lc823450_dma.c
arch/arm/src/lpc17xx/lpc17_gpdma.c
arch/arm/src/lpc43xx/lpc43_gpdma.c
arch/arm/src/lpc54xx/lpc54_dma.c
arch/arm/src/stm32/stm32f10xxx_dma.c
arch/arm/src/stm32/stm32f20xxx_dma.c
arch/arm/src/stm32/stm32f33xxx_dma.c
arch/arm/src/stm32/stm32f40xxx_dma.c
arch/arm/src/stm32/stm32_dma.c
arch/arm/src/stm32f7/stm32_dma.c
arch/arm/src/stm32l4/stm32l4x6xx_dma.c
arch/arm/src/stm32l4/stm32l4_dma.c
arch/arm/src/xmc4/xmc4_dma.c

And there always a corresponding header file that defines the DMA interface:

$ find arch/arm/src/ -name "*dma.h"
arch/arm/src/efm32/chip/efm32_dma.h
arch/arm/src/efm32/efm32_dma.h
arch/arm/src/imx1/imx_dma.h
arch/arm/src/kinetis/chip/kinetis_dma.h
arch/arm/src/kinetis/kinetis_dma.h
arch/arm/src/kl/kl_dma.h
arch/arm/src/lc823450/lc823450_dma.h
arch/arm/src/lpc17xx/chip/lpc17_gpdma.h
arch/arm/src/lpc17xx/lpc17_gpdma.h
arch/arm/src/lpc31xx/lpc31_dma.h
arch/arm/src/lpc43xx/chip/lpc43_gpdma.h
arch/arm/src/lpc43xx/lpc43_gpdma.h
arch/arm/src/lpc54xx/chip/lpc54_dma.h
arch/arm/src/lpc54xx/lpc54_dma.h
arch/arm/src/nuc1xx/chip/nuc_pdma.h
arch/arm/src/stm32/chip/stm32f10xxx_dma.h
arch/arm/src/stm32/chip/stm32f20xxx_dma.h
arch/arm/src/stm32/chip/stm32f33xxx_dma.h
arch/arm/src/stm32/chip/stm32f40xxx_dma.h
arch/arm/src/stm32/stm32_dma.h
arch/arm/src/stm32f0/chip/stm32f0_dma.h
arch/arm/src/stm32f7/chip/stm32f72xx73xx_dma.h
arch/arm/src/stm32f7/chip/stm32f74xx75xx_dma.h
arch/arm/src/stm32f7/chip/stm32f76xx77xx_dma.h
arch/arm/src/stm32f7/chip/stm32_dma.h
arch/arm/src/stm32f7/stm32_dma.h
arch/arm/src/stm32l4/chip/stm32l4x3xx_dma.h
arch/arm/src/stm32l4/chip/stm32l4x5xx_dma.h
arch/arm/src/stm32l4/chip/stm32l4x6xx_dma.h
arch/arm/src/stm32l4/stm32l4_dma.h
arch/arm/src/xmc4/xmc4_dma.h

All of the header files define a function type definition for a callback that is made at the interrupt level when the DMA completes and interfaces to

- Setup Rx and Tx DMA.
- Start DMA
- Stop or abort DMA

And that is about all there is to it.  I would look at DMA definitions in chip/subdirectories and see if I can find another architecture with similar DMA architecture.  Then I would use that as a model for the Tiva DMA.

Greg

Dmitry Sharihin

unread,
Apr 10, 2018, 12:47:48 AM4/10/18
to NuttX
On Monday, April 9, 2018 at 9:34:24 PM UTC+3, patacongo wrote:
I would look at how DMA was implemented in other ARM architectures.  There is always a C file with a name like xyz_*dma.c:

Thanks, I'll look into these files and try to implement same functionality 
Reply all
Reply to author
Forward
0 new messages