Go to the documentation of this file.
151 #include "stm32h7xx_hal.h"
162 #ifdef HAL_MDMA_MODULE_ENABLED
169 #define HAL_TIMEOUT_MDMA_ABORT 5U
170 #define HAL_MDMA_CHANNEL_SIZE 0x40U
180 static void MDMA_SetConfig(
MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount);
260 if((
HAL_GetTick() - tickstart ) > HAL_TIMEOUT_MDMA_ABORT)
376 if(MaskAddress == 0U)
571 uint32_t addressMask;
572 uint32_t blockoffset;
575 if((pNode ==
NULL) || (pNodeConfig ==
NULL))
613 pNodeConfig->Init.DestBurst | \
615 pNodeConfig->Init.TransferTriggerMode;
643 pNode->
CBRUR = blockoffset & 0x0000FFFFU;
684 addressMask = pNodeConfig->
SrcAddress & 0xFF000000U;
685 if((addressMask == 0x20000000U) || (addressMask == 0x00000000U))
691 addressMask = pNodeConfig->
DstAddress & 0xFF000000U;
692 if((addressMask == 0x20000000U) || (addressMask == 0x00000000U))
715 uint32_t counter = 0, nodeInserted = 0;
719 if((hmdma ==
NULL) || (pNewNode ==
NULL))
735 if(pPrevNode ==
NULL)
761 while((counter < hmdma->LinkedListNodeCounter) && (hal_status ==
HAL_OK))
763 if(pNode->
CLAR == (uint32_t)pNewNode)
789 while((counter < hmdma->LinkedListNodeCounter) && (nodeInserted == 0U))
792 if(pNode == pPrevNode)
796 pNode->
CLAR = (uint32_t)pNewNode;
807 if(nodeInserted == 0U)
848 uint32_t counter = 0, nodeDeleted = 0;
852 if((hmdma ==
NULL) || (pNode ==
NULL))
905 while((counter < hmdma->LinkedListNodeCounter) && (nodeDeleted == 0U))
908 if(ptmpNode->
CLAR == ((uint32_t)pNode))
928 if(nodeDeleted == 0U)
1100 MDMA_SetConfig(hmdma, SrcAddress, DstAddress, BlockDataLength, BlockCount);
1160 MDMA_SetConfig(hmdma, SrcAddress, DstAddress, BlockDataLength, BlockCount);
1247 if( (
HAL_GetTick() - tickstart ) > HAL_TIMEOUT_MDMA_ABORT)
1318 uint32_t levelFlag, errorFlag;
1406 if(((
HAL_GetTick() - tickstart ) > Timeout) || (Timeout == 0U))
1465 uint32_t request_mode;
1510 uint32_t generalIntFlag, errorFlag;
1513 generalIntFlag = 1UL << ((((uint32_t)hmdma->
Instance - (uint32_t)(
MDMA_Channel0))/HAL_MDMA_CHANNEL_SIZE) & 0x1FU);
1514 if((
MDMA->GISR0 & generalIntFlag) == 0U)
1668 if (++
count > timeout)
1725 return hmdma->
State;
1761 static void MDMA_SetConfig(
MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount)
1763 uint32_t addressMask;
1780 addressMask = SrcAddress & 0xFF000000U;
1781 if((addressMask == 0x20000000U) || (addressMask == 0x00000000U))
1792 addressMask = DstAddress & 0xFF000000U;
1793 if((addressMask == 0x20000000U) || (addressMask == 0x00000000U))
1817 uint32_t blockoffset;
1826 hmdma->Init.DestBurst | \
1828 hmdma->Init.TransferTriggerMode;
uint32_t LinkedListNodeCounter
#define assert_param(expr)
Include module's header file.
HAL_StatusTypeDef HAL_MDMA_LinkedList_CreateNode(MDMA_LinkNodeTypeDef *pNode, MDMA_LinkNodeConfTypeDef *pNodeConfig)
@ HAL_MDMA_REPEAT_BLOCK_TRANSFER
HAL_StatusTypeDef
HAL Status structures definition
void(* XferAbortCallback)(struct __MDMA_HandleTypeDef *hmdma)
void HAL_MDMA_IRQHandler(MDMA_HandleTypeDef *hmdma)
#define __HAL_MDMA_ENABLE(__HANDLE__)
Enable the specified MDMA Channel.
void(* XferCpltCallback)(struct __MDMA_HandleTypeDef *hmdma)
#define __HAL_MDMA_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enables the specified MDMA Channel interrupts.
#define HAL_MDMA_ERROR_BUSY
@ HAL_MDMA_XFER_REPBLOCKCPLT_CB_ID
HAL MDMA linked list node configuration structure definition.
#define __HAL_MDMA_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disables the specified MDMA Channel interrupts.
#define MDMA_CTCR_TLEN_Pos
#define MDMA_CBNDTR_BRDUM
#define IS_MDMA_DESTINATION_INC(__INC__)
#define IS_MDMA_STREAM_ALL_INSTANCE(INSTANCE)
HAL MDMA linked list node structure definition.
#define IS_MDMA_SOURCE_INC(__INC__)
HAL_StatusTypeDef HAL_MDMA_DeInit(MDMA_HandleTypeDef *hmdma)
#define __HAL_MDMA_GET_FLAG(__HANDLE__, __FLAG__)
Get the MDMA Channel pending flags.
@ HAL_MDMA_XFER_ERROR_CB_ID
HAL_StatusTypeDef HAL_MDMA_GenerateSWRequest(MDMA_HandleTypeDef *hmdma)
HAL_StatusTypeDef HAL_MDMA_LinkedList_EnableCircularMode(MDMA_HandleTypeDef *hmdma)
#define IS_MDMA_BLOCK_COUNT(__COUNT__)
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
@ HAL_MDMA_XFER_CPLT_CB_ID
HAL_StatusTypeDef HAL_MDMA_LinkedList_AddNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *pNewNode, MDMA_LinkNodeTypeDef *pPrevNode)
#define MDMA_CBNDTR_BRSUM
#define IS_MDMA_DATA_ALIGNMENT(__ALIGNMENT__)
uint32_t HAL_MDMA_GetError(MDMA_HandleTypeDef *hmdma)
@ HAL_MDMA_BUFFER_TRANSFER
@ HAL_MDMA_XFER_ALL_CB_ID
void(* XferBufferCpltCallback)(struct __MDMA_HandleTypeDef *hmdma)
uint32_t PostRequestMaskData
#define HAL_MDMA_ERROR_WRITE_XFER
#define IS_MDMA_PRIORITY(__PRIORITY__)
HAL_MDMA_CallbackIDTypeDef
HAL MDMA Callbacks IDs structure definition.
#define IS_MDMA_BLOCK_ADDR_OFFSET(__BLOCK_ADD_OFFSET__)
#define HAL_MDMA_ERROR_BLOCK_SIZE
@ HAL_MDMA_XFER_ABORT_CB_ID
#define IS_MDMA_TRANSFER_TRIGGER_MODE(__MODE__)
MDMA_LinkNodeTypeDef * FirstLinkedListNodeAddress
#define HAL_MDMA_ERROR_READ_XFER
#define IS_MDMA_SOURCE_DATASIZE(__SIZE__)
#define IS_MDMA_ENDIANNESS_MODE(__ENDIANNESS__)
HAL_StatusTypeDef HAL_MDMA_Abort_IT(MDMA_HandleTypeDef *hmdma)
HAL_MDMA_LevelCompleteTypeDef
HAL MDMA Level Complete structure definition.
HAL_MDMA_StateTypeDef
HAL MDMA State structure definition.
#define __HAL_LOCK(__HANDLE__)
HAL_StatusTypeDef HAL_MDMA_Start(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount)
#define HAL_MDMA_ERROR_ALIGNMENT
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
#define HAL_MDMA_ERROR_LINKED_LIST
int32_t SourceBlockAddressOffset
#define IS_MDMA_BUFFER_TRANSFER_LENGTH(__LENGTH__)
HAL_StatusTypeDef HAL_MDMA_UnRegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef CallbackID)
@ HAL_MDMA_XFER_BLOCKCPLT_CB_ID
HAL_StatusTypeDef HAL_MDMA_Abort(MDMA_HandleTypeDef *hmdma)
HAL_MDMA_StateTypeDef HAL_MDMA_GetState(MDMA_HandleTypeDef *hmdma)
#define __HAL_UNLOCK(__HANDLE__)
MDMA handle Structure definition.
HAL_StatusTypeDef HAL_MDMA_Init(MDMA_HandleTypeDef *hmdma)
MDMA_LinkNodeTypeDef * LastLinkedListNodeAddress
void(* XferRepeatBlockCpltCallback)(struct __MDMA_HandleTypeDef *hmdma)
HAL_StatusTypeDef HAL_MDMA_LinkedList_DisableCircularMode(MDMA_HandleTypeDef *hmdma)
#define IS_MDMA_DESTINATION_DATASIZE(__SIZE__)
uint32_t TransferTriggerMode
void(* XferErrorCallback)(struct __MDMA_HandleTypeDef *hmdma)
#define HAL_MDMA_ERROR_TIMEOUT
HAL_StatusTypeDef HAL_MDMA_LinkedList_RemoveNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *pNode)
#define __HAL_MDMA_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the MDMA Stream pending flags.
HAL_StatusTypeDef HAL_MDMA_PollForTransfer(MDMA_HandleTypeDef *hmdma, HAL_MDMA_LevelCompleteTypeDef CompleteLevel, uint32_t Timeout)
#define __HAL_MDMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)
Checks whether the specified MDMA Channel interrupt is enabled or not.
#define IS_MDMA_TRANSFER_LENGTH(SIZE)
uint32_t PostRequestMaskAddress
MDMA_Channel_TypeDef * Instance
int32_t DestBlockAddressOffset
#define MDMA_CBNDTR_BRC_Pos
@ HAL_MDMA_BLOCK_TRANSFER
#define HAL_MDMA_ERROR_MASK_DATA
#define HAL_MDMA_ERROR_NO_XFER
HAL_StatusTypeDef HAL_MDMA_ConfigPostRequestMask(MDMA_HandleTypeDef *hmdma, uint32_t MaskAddress, uint32_t MaskData)
#define IS_MDMA_DESTINATION_BURST(__BURST__)
#define IS_MDMA_SOURCE_BURST(__BURST__)
#define IS_MDMA_LEVEL_COMPLETE(__LEVEL__)
void(* XferBlockCpltCallback)(struct __MDMA_HandleTypeDef *hmdma)
@ HAL_MDMA_XFER_BUFFERCPLT_CB_ID
#define HAL_MDMA_ERROR_NONE
#define __HAL_MDMA_DISABLE(__HANDLE__)
Disable the specified MDMA Channel.
__IO HAL_MDMA_StateTypeDef State
HAL_StatusTypeDef HAL_MDMA_RegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef CallbackID, void(*pCallback)(MDMA_HandleTypeDef *_hmdma))
HAL_StatusTypeDef HAL_MDMA_Start_IT(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t BlockDataLength, uint32_t BlockCount)
#define MDMA_CBRUR_DUV_Pos
#define IS_MDMA_REQUEST(__REQUEST__)
uint32_t BufferTransferLength