-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers:platform:stm32:dma Circular DMA and Trigger Support #2458
base: main
Are you sure you want to change the base?
Conversation
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s). |
1efdaf8
to
5dfc14e
Compare
PR Rev2
|
Driver uses nodes and linked list to be configure the DMA in circular mode. A transfer unit is considered as a single node in the linked list and is configured accordingly. Signed-off-by: Swaroop PrakashKumar <[email protected]>
The trigger configuration is used to start an already configured dma transaction at a later time based on a signal from a different peripheral. It uses the mode, ID and polarity to configure based on users requirement. Signed-off-by: Swaroop PrakashKumar <[email protected]>
5dfc14e
to
10da7eb
Compare
@@ -40,6 +40,13 @@ | |||
/************************ Functions Definitions *******************************/ | |||
/******************************************************************************/ | |||
|
|||
#if defined (STM32H5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I've had this comment in previous contributions to this file regarding the H5 DMA vs other devices' DMA.)
I don't like keeping track of which stm device has which kind of dma and I was assured in the past that there is no way to tell them apart other than by their part name.
But I did some digging and found that ST has 2 types of DMA called Basic DMA or BDMA found in most devices and GPDMA or General Purpose DMA, which is used on more advanced devices and is more capable (notably has these features that you're using here, nodes and list).
I think we could get rid of those #ifdef STM32H5 statements by runtime checking if GPDMA is availabe
#if defined(HAL_GPDMA_MODULE_ENABLED) and modify code accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified the HAL as well as the generated files, there is no differentiation between BDMA and GPDMA. Both are enabled using HAL_DMA_MODULE_ENABLED
. Even the function name and the handle structure name (DMA_HandleTypeDef
) are the same.
Following is my proposal for this:
- Define a macro for GPDMA initially based on the processor macro.
- Use the defined macro to separate functions for GPDMA/BDMA.
- Configure will be divided into 2 parts to configure BDMA and GPDMA separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for investigating.
If that's the case, maybe you could create your macro something like this (there must be a base address macro of the GPDMA... or a unique register):
#if defined(GPDMA1) || defined(GPDMA2) || ... whatever max number there can be
#define GPDMA_AVAILABLE
#endif
Add all these new features in a new file pair called stm32_gpdma.c and protect them with an #ifdef GPDMA_AVAILABLE to be able to build both in all cases. Perhaps you could keep the stm32_dma.h common to both implementations, that would be ideal.
Pull Request Description
Added support for circular DMA using nodes and linked lists, enabling continuous data transfer without manual intervention, which enhances efficiency for repetitive tasks. Additionally, implemented triggering support for DMA, allowing precise control over data transfer initiation based on specific events or conditions
PR Type
PR Checklist