Enable DMA LLD when no other drivers requiring DMA are enabled Topic is solved

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
User avatar
FXCoder
Posts: 52
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 6 times
Been thanked: 10 times

Enable DMA LLD when no other drivers requiring DMA are enabled  Topic is solved

Postby FXCoder » Fri Aug 11, 2017 2:29 am

Hi Giovanni.
Currently STM32 LLD DMA driver is enabled by drivers defining STM32_DMA_REQUIRED.
Thus if no devices are selected in chconf then the LLD DMA library is not included.

However, in some cases use of the DMA library is desired for hand coded device access when no other devices are using DMA.
Currently to enable LLD DMA a define can be added to makefile.
Maybe a more obvious/general approach would be add a definition to chconf and then expand the test in LLD DMA that enables LLD DMA.

For example in chconf.c add a new section for DMA...

Code: Select all

/**
 * @brief   Enables the WDG subsystem.
 */
#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
#define HAL_USE_WDG                 TRUE
#endif
/** @} */

/**
 * @brief   Enables the DMA subsystem.
 */
#if !defined(HAL_USE_DMA) || defined(__DOXYGEN__)
#define HAL_USE_DMA                 TRUE
#endif
/** @} */


Then in stm32_dma.c modify as follows...

Code: Select all

/* The following macro is only defined if some driver requiring DMA services
   has been enabled.*/
#if defined(STM32_DMA_REQUIRED) || defined(HAL_USE_DMA) || defined(__DOXYGEN__)


What do you think?

Bob

User avatar
Giovanni
Site Admin
Posts: 10148
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 206 times
Been thanked: 184 times
Contact:

Re: Enable DMA LLD when no other drivers requiring DMA are enabled

Postby Giovanni » Fri Aug 11, 2017 6:24 am

Hi,

You could simply add -DSTM32_DMA_REQUIRED to the makefile. It has no switch because it is not meant to be a portable driver, too STM32-specific.

Giovanni

User avatar
FXCoder
Posts: 52
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 6 times
Been thanked: 10 times

Re: Enable DMA LLD when no other drivers requiring DMA are enabled

Postby FXCoder » Fri Aug 11, 2017 7:14 am

Hi Giovanni,
Adding -DSTM32_DMA_REQUIRED to the makefile is what I do right now.
I figured making the explicit enabling of the DMA Driver more visible would be a good thing.
But if this doesn't fit the portability model then no problem.
I'll just continue to use -DSTM32_DMA_REQUIRED in the makefile.

Cheers,

Bob


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 1 guest