Lines Matching refs:hmdma

180 static void MDMA_SetConfig(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uin…
181 static void MDMA_Init(MDMA_HandleTypeDef *hmdma);
219 HAL_StatusTypeDef HAL_MDMA_Init(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_Init() argument
224 if(hmdma == NULL) in HAL_MDMA_Init()
230 assert_param(IS_MDMA_STREAM_ALL_INSTANCE(hmdma->Instance)); in HAL_MDMA_Init()
231 assert_param(IS_MDMA_PRIORITY(hmdma->Init.Priority)); in HAL_MDMA_Init()
232 assert_param(IS_MDMA_ENDIANNESS_MODE(hmdma->Init.Endianness)); in HAL_MDMA_Init()
233 assert_param(IS_MDMA_REQUEST(hmdma->Init.Request)); in HAL_MDMA_Init()
234 assert_param(IS_MDMA_SOURCE_INC(hmdma->Init.SourceInc)); in HAL_MDMA_Init()
235 assert_param(IS_MDMA_DESTINATION_INC(hmdma->Init.DestinationInc)); in HAL_MDMA_Init()
236 assert_param(IS_MDMA_SOURCE_DATASIZE(hmdma->Init.SourceDataSize)); in HAL_MDMA_Init()
237 assert_param(IS_MDMA_DESTINATION_DATASIZE(hmdma->Init.DestDataSize)); in HAL_MDMA_Init()
238 assert_param(IS_MDMA_DATA_ALIGNMENT(hmdma->Init.DataAlignment)); in HAL_MDMA_Init()
239 assert_param(IS_MDMA_SOURCE_BURST(hmdma->Init.SourceBurst)); in HAL_MDMA_Init()
240 assert_param(IS_MDMA_DESTINATION_BURST(hmdma->Init.DestBurst)); in HAL_MDMA_Init()
241 assert_param(IS_MDMA_BUFFER_TRANSFER_LENGTH(hmdma->Init.BufferTransferLength)); in HAL_MDMA_Init()
242 assert_param(IS_MDMA_TRANSFER_TRIGGER_MODE(hmdma->Init.TransferTriggerMode)); in HAL_MDMA_Init()
243 assert_param(IS_MDMA_BLOCK_ADDR_OFFSET(hmdma->Init.SourceBlockAddressOffset)); in HAL_MDMA_Init()
244 assert_param(IS_MDMA_BLOCK_ADDR_OFFSET(hmdma->Init.DestBlockAddressOffset)); in HAL_MDMA_Init()
248 __HAL_UNLOCK(hmdma); in HAL_MDMA_Init()
251 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_Init()
254 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Init()
257 while((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U) in HAL_MDMA_Init()
263 hmdma->ErrorCode = HAL_MDMA_ERROR_TIMEOUT; in HAL_MDMA_Init()
266 hmdma->State = HAL_MDMA_STATE_ERROR; in HAL_MDMA_Init()
273 MDMA_Init(hmdma); in HAL_MDMA_Init()
276 hmdma->FirstLinkedListNodeAddress = 0; in HAL_MDMA_Init()
277 hmdma->LastLinkedListNodeAddress = 0; in HAL_MDMA_Init()
278 hmdma->LinkedListNodeCounter = 0; in HAL_MDMA_Init()
281 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_Init()
284 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_Init()
295 HAL_StatusTypeDef HAL_MDMA_DeInit(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_DeInit() argument
299 if(hmdma == NULL) in HAL_MDMA_DeInit()
305 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_DeInit()
308 hmdma->Instance->CCR = 0; in HAL_MDMA_DeInit()
309 hmdma->Instance->CTCR = 0; in HAL_MDMA_DeInit()
310 hmdma->Instance->CBNDTR = 0; in HAL_MDMA_DeInit()
311 hmdma->Instance->CSAR = 0; in HAL_MDMA_DeInit()
312 hmdma->Instance->CDAR = 0; in HAL_MDMA_DeInit()
313 hmdma->Instance->CBRUR = 0; in HAL_MDMA_DeInit()
314 hmdma->Instance->CLAR = 0; in HAL_MDMA_DeInit()
315 hmdma->Instance->CTBR = 0; in HAL_MDMA_DeInit()
316 hmdma->Instance->CMAR = 0; in HAL_MDMA_DeInit()
317 hmdma->Instance->CMDR = 0; in HAL_MDMA_DeInit()
320 …__HAL_MDMA_CLEAR_FLAG(hmdma,(MDMA_FLAG_TE | MDMA_FLAG_CTC | MDMA_FLAG_BRT | MDMA_FLAG_BT | MDMA_FL… in HAL_MDMA_DeInit()
323 hmdma->FirstLinkedListNodeAddress = 0; in HAL_MDMA_DeInit()
324 hmdma->LastLinkedListNodeAddress = 0; in HAL_MDMA_DeInit()
325 hmdma->LinkedListNodeCounter = 0; in HAL_MDMA_DeInit()
328 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_DeInit()
331 hmdma->State = HAL_MDMA_STATE_RESET; in HAL_MDMA_DeInit()
334 __HAL_UNLOCK(hmdma); in HAL_MDMA_DeInit()
348 HAL_StatusTypeDef HAL_MDMA_ConfigPostRequestMask(MDMA_HandleTypeDef *hmdma, uint32_t MaskAddress, u… in HAL_MDMA_ConfigPostRequestMask() argument
353 if(hmdma == NULL) in HAL_MDMA_ConfigPostRequestMask()
359 __HAL_LOCK(hmdma); in HAL_MDMA_ConfigPostRequestMask()
361 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_ConfigPostRequestMask()
364 if((hmdma->Instance->CTCR & MDMA_CTCR_SWRM) == 0U) in HAL_MDMA_ConfigPostRequestMask()
367 hmdma->Instance->CMAR = MaskAddress; in HAL_MDMA_ConfigPostRequestMask()
368 hmdma->Instance->CMDR = MaskData; in HAL_MDMA_ConfigPostRequestMask()
378 hmdma->Instance->CTCR &= ~MDMA_CTCR_BWM; in HAL_MDMA_ConfigPostRequestMask()
382 hmdma->Instance->CTCR |= MDMA_CTCR_BWM; in HAL_MDMA_ConfigPostRequestMask()
397 __HAL_UNLOCK(hmdma); in HAL_MDMA_ConfigPostRequestMask()
410 HAL_StatusTypeDef HAL_MDMA_RegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef C… in HAL_MDMA_RegisterCallback() argument
415 if(hmdma == NULL) in HAL_MDMA_RegisterCallback()
421 __HAL_LOCK(hmdma); in HAL_MDMA_RegisterCallback()
423 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_RegisterCallback()
428 hmdma->XferCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
432 hmdma->XferBufferCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
436 hmdma->XferBlockCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
440 hmdma->XferRepeatBlockCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
444 hmdma->XferErrorCallback = pCallback; in HAL_MDMA_RegisterCallback()
448 hmdma->XferAbortCallback = pCallback; in HAL_MDMA_RegisterCallback()
462 __HAL_UNLOCK(hmdma); in HAL_MDMA_RegisterCallback()
475 HAL_StatusTypeDef HAL_MDMA_UnRegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef… in HAL_MDMA_UnRegisterCallback() argument
480 if(hmdma == NULL) in HAL_MDMA_UnRegisterCallback()
486 __HAL_LOCK(hmdma); in HAL_MDMA_UnRegisterCallback()
488 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_UnRegisterCallback()
493 hmdma->XferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
497 hmdma->XferBufferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
501 hmdma->XferBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
505 hmdma->XferRepeatBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
509 hmdma->XferErrorCallback = NULL; in HAL_MDMA_UnRegisterCallback()
513 hmdma->XferAbortCallback = NULL; in HAL_MDMA_UnRegisterCallback()
517 hmdma->XferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
518 hmdma->XferBufferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
519 hmdma->XferBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
520 hmdma->XferRepeatBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
521 hmdma->XferErrorCallback = NULL; in HAL_MDMA_UnRegisterCallback()
522 hmdma->XferAbortCallback = NULL; in HAL_MDMA_UnRegisterCallback()
536 __HAL_UNLOCK(hmdma); in HAL_MDMA_UnRegisterCallback()
712 HAL_StatusTypeDef HAL_MDMA_LinkedList_AddNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *pNew… in HAL_MDMA_LinkedList_AddNode() argument
719 if((hmdma == NULL) || (pNewNode == NULL)) in HAL_MDMA_LinkedList_AddNode()
725 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_AddNode()
727 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_AddNode()
730 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_AddNode()
733 if((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) in HAL_MDMA_LinkedList_AddNode()
740 hmdma->Instance->CLAR = (uint32_t)pNewNode; in HAL_MDMA_LinkedList_AddNode()
742 hmdma->FirstLinkedListNodeAddress = pNewNode; in HAL_MDMA_LinkedList_AddNode()
748 hmdma->LastLinkedListNodeAddress = pNewNode; in HAL_MDMA_LinkedList_AddNode()
750 hmdma->LinkedListNodeCounter = 1; in HAL_MDMA_LinkedList_AddNode()
757 else if(hmdma->FirstLinkedListNodeAddress != pNewNode) in HAL_MDMA_LinkedList_AddNode()
760 pNode = hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_AddNode()
761 while((counter < hmdma->LinkedListNodeCounter) && (hal_status == HAL_OK)) in HAL_MDMA_LinkedList_AddNode()
774 if((pPrevNode == hmdma->LastLinkedListNodeAddress) || (pPrevNode == NULL)) in HAL_MDMA_LinkedList_AddNode()
777 pNewNode->CLAR = hmdma->LastLinkedListNodeAddress->CLAR; in HAL_MDMA_LinkedList_AddNode()
778 hmdma->LastLinkedListNodeAddress->CLAR = (uint32_t)pNewNode; in HAL_MDMA_LinkedList_AddNode()
780 hmdma->LastLinkedListNodeAddress = pNewNode; in HAL_MDMA_LinkedList_AddNode()
782 hmdma->LinkedListNodeCounter++; in HAL_MDMA_LinkedList_AddNode()
787 pNode = hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_AddNode()
789 while((counter < hmdma->LinkedListNodeCounter) && (nodeInserted == 0U)) in HAL_MDMA_LinkedList_AddNode()
798 hmdma->LinkedListNodeCounter++; in HAL_MDMA_LinkedList_AddNode()
820 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_AddNode()
822 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_AddNode()
829 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_AddNode()
845 HAL_StatusTypeDef HAL_MDMA_LinkedList_RemoveNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *p… in HAL_MDMA_LinkedList_RemoveNode() argument
852 if((hmdma == NULL) || (pNode == NULL)) in HAL_MDMA_LinkedList_RemoveNode()
858 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_RemoveNode()
860 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_RemoveNode()
863 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_RemoveNode()
866 …if(((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) || ((uint32_t)hmdma->LastLinkedListNodeAddr… in HAL_MDMA_LinkedList_RemoveNode()
870 else if(hmdma->FirstLinkedListNodeAddress == pNode) /* Deleting first node */ in HAL_MDMA_LinkedList_RemoveNode()
873 if(hmdma->LastLinkedListNodeAddress == pNode) in HAL_MDMA_LinkedList_RemoveNode()
878 hmdma->FirstLinkedListNodeAddress = 0; in HAL_MDMA_LinkedList_RemoveNode()
879 hmdma->LastLinkedListNodeAddress = 0; in HAL_MDMA_LinkedList_RemoveNode()
880 hmdma->LinkedListNodeCounter = 0; in HAL_MDMA_LinkedList_RemoveNode()
882 hmdma->Instance->CLAR = 0; in HAL_MDMA_LinkedList_RemoveNode()
886 if((uint32_t)hmdma->FirstLinkedListNodeAddress == hmdma->LastLinkedListNodeAddress->CLAR) in HAL_MDMA_LinkedList_RemoveNode()
889 hmdma->LastLinkedListNodeAddress->CLAR = pNode->CLAR; in HAL_MDMA_LinkedList_RemoveNode()
895 hmdma->Instance->CLAR = pNode->CLAR; in HAL_MDMA_LinkedList_RemoveNode()
896 hmdma->FirstLinkedListNodeAddress = (MDMA_LinkNodeTypeDef *)hmdma->Instance->CLAR; in HAL_MDMA_LinkedList_RemoveNode()
898 hmdma->LinkedListNodeCounter--; in HAL_MDMA_LinkedList_RemoveNode()
904 ptmpNode = hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_RemoveNode()
905 while((counter < hmdma->LinkedListNodeCounter) && (nodeDeleted == 0U)) in HAL_MDMA_LinkedList_RemoveNode()
911 if(pNode == hmdma->LastLinkedListNodeAddress) in HAL_MDMA_LinkedList_RemoveNode()
914 hmdma->LastLinkedListNodeAddress = ptmpNode; in HAL_MDMA_LinkedList_RemoveNode()
920 hmdma->LinkedListNodeCounter--; in HAL_MDMA_LinkedList_RemoveNode()
936 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_RemoveNode()
938 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_RemoveNode()
945 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_RemoveNode()
958 HAL_StatusTypeDef HAL_MDMA_LinkedList_EnableCircularMode(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_LinkedList_EnableCircularMode() argument
963 if(hmdma == NULL) in HAL_MDMA_LinkedList_EnableCircularMode()
969 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_EnableCircularMode()
971 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_EnableCircularMode()
974 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_EnableCircularMode()
977 …if(((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) || ((uint32_t)hmdma->LastLinkedListNodeAddr… in HAL_MDMA_LinkedList_EnableCircularMode()
984 hmdma->LastLinkedListNodeAddress->CLAR = (uint32_t)hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_EnableCircularMode()
989 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_EnableCircularMode()
991 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_EnableCircularMode()
1002 HAL_StatusTypeDef HAL_MDMA_LinkedList_DisableCircularMode(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_LinkedList_DisableCircularMode() argument
1007 if(hmdma == NULL) in HAL_MDMA_LinkedList_DisableCircularMode()
1013 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_DisableCircularMode()
1015 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_DisableCircularMode()
1018 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_DisableCircularMode()
1021 …if(((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) || ((uint32_t)hmdma->LastLinkedListNodeAddr… in HAL_MDMA_LinkedList_DisableCircularMode()
1028 hmdma->LastLinkedListNodeAddress->CLAR = 0; in HAL_MDMA_LinkedList_DisableCircularMode()
1033 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_DisableCircularMode()
1035 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_DisableCircularMode()
1073 HAL_StatusTypeDef HAL_MDMA_Start(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddres… in HAL_MDMA_Start() argument
1080 if(hmdma == NULL) in HAL_MDMA_Start()
1086 __HAL_LOCK(hmdma); in HAL_MDMA_Start()
1088 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_Start()
1091 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_Start()
1094 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_Start()
1097 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Start()
1100 MDMA_SetConfig(hmdma, SrcAddress, DstAddress, BlockDataLength, BlockCount); in HAL_MDMA_Start()
1103 __HAL_MDMA_ENABLE(hmdma); in HAL_MDMA_Start()
1105 if(hmdma->Init.Request == MDMA_REQUEST_SW) in HAL_MDMA_Start()
1108 hmdma->Instance->CCR |= MDMA_CCR_SWRQ; in HAL_MDMA_Start()
1114 __HAL_UNLOCK(hmdma); in HAL_MDMA_Start()
1133 HAL_StatusTypeDef HAL_MDMA_Start_IT(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAdd… in HAL_MDMA_Start_IT() argument
1140 if(hmdma == NULL) in HAL_MDMA_Start_IT()
1146 __HAL_LOCK(hmdma); in HAL_MDMA_Start_IT()
1148 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_Start_IT()
1151 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_Start_IT()
1154 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_Start_IT()
1157 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Start_IT()
1160 MDMA_SetConfig(hmdma, SrcAddress, DstAddress, BlockDataLength, BlockCount); in HAL_MDMA_Start_IT()
1163 __HAL_MDMA_ENABLE_IT(hmdma, (MDMA_IT_TE | MDMA_IT_CTC)); in HAL_MDMA_Start_IT()
1165 if(hmdma->XferBlockCpltCallback != NULL) in HAL_MDMA_Start_IT()
1168 __HAL_MDMA_ENABLE_IT(hmdma, MDMA_IT_BT); in HAL_MDMA_Start_IT()
1171 if(hmdma->XferRepeatBlockCpltCallback != NULL) in HAL_MDMA_Start_IT()
1174 __HAL_MDMA_ENABLE_IT(hmdma, MDMA_IT_BRT); in HAL_MDMA_Start_IT()
1177 if(hmdma->XferBufferCpltCallback != NULL) in HAL_MDMA_Start_IT()
1180 __HAL_MDMA_ENABLE_IT(hmdma, MDMA_IT_BFTC); in HAL_MDMA_Start_IT()
1184 __HAL_MDMA_ENABLE(hmdma); in HAL_MDMA_Start_IT()
1186 if(hmdma->Init.Request == MDMA_REQUEST_SW) in HAL_MDMA_Start_IT()
1189 hmdma->Instance->CCR |= MDMA_CCR_SWRQ; in HAL_MDMA_Start_IT()
1195 __HAL_UNLOCK(hmdma); in HAL_MDMA_Start_IT()
1216 HAL_StatusTypeDef HAL_MDMA_Abort(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_Abort() argument
1221 if(hmdma == NULL) in HAL_MDMA_Abort()
1226 if(HAL_MDMA_STATE_BUSY != hmdma->State) in HAL_MDMA_Abort()
1228 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_Abort()
1231 __HAL_UNLOCK(hmdma); in HAL_MDMA_Abort()
1238 …__HAL_MDMA_DISABLE_IT(hmdma, (MDMA_IT_TE | MDMA_IT_CTC | MDMA_IT_BT | MDMA_IT_BRT | MDMA_IT_BFTC)); in HAL_MDMA_Abort()
1241 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Abort()
1244 while((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U) in HAL_MDMA_Abort()
1250 hmdma->ErrorCode |= HAL_MDMA_ERROR_TIMEOUT; in HAL_MDMA_Abort()
1253 __HAL_UNLOCK(hmdma); in HAL_MDMA_Abort()
1256 hmdma->State = HAL_MDMA_STATE_ERROR; in HAL_MDMA_Abort()
1263 …__HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_TE | MDMA_FLAG_CTC | MDMA_FLAG_BT | MDMA_FLAG_BRT | MDMA_F… in HAL_MDMA_Abort()
1266 __HAL_UNLOCK(hmdma); in HAL_MDMA_Abort()
1269 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_Abort()
1281 HAL_StatusTypeDef HAL_MDMA_Abort_IT(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_Abort_IT() argument
1284 if(hmdma == NULL) in HAL_MDMA_Abort_IT()
1289 if(HAL_MDMA_STATE_BUSY != hmdma->State) in HAL_MDMA_Abort_IT()
1292 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_Abort_IT()
1299 hmdma->State = HAL_MDMA_STATE_ABORT; in HAL_MDMA_Abort_IT()
1302 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Abort_IT()
1316 HAL_StatusTypeDef HAL_MDMA_PollForTransfer(MDMA_HandleTypeDef *hmdma, HAL_MDMA_LevelCompleteTypeDef… in HAL_MDMA_PollForTransfer() argument
1325 if(hmdma == NULL) in HAL_MDMA_PollForTransfer()
1330 if(HAL_MDMA_STATE_BUSY != hmdma->State) in HAL_MDMA_PollForTransfer()
1333 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_PollForTransfer()
1348 while(__HAL_MDMA_GET_FLAG(hmdma, levelFlag) == 0U) in HAL_MDMA_PollForTransfer()
1350 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_TE) != 0U)) in HAL_MDMA_PollForTransfer()
1353 errorFlag = hmdma->Instance->CESR; in HAL_MDMA_PollForTransfer()
1358 hmdma->ErrorCode |= HAL_MDMA_ERROR_READ_XFER; in HAL_MDMA_PollForTransfer()
1363 hmdma->ErrorCode |= HAL_MDMA_ERROR_WRITE_XFER; in HAL_MDMA_PollForTransfer()
1369 hmdma->ErrorCode |= HAL_MDMA_ERROR_MASK_DATA; in HAL_MDMA_PollForTransfer()
1375 hmdma->ErrorCode |= HAL_MDMA_ERROR_LINKED_LIST; in HAL_MDMA_PollForTransfer()
1381 hmdma->ErrorCode |= HAL_MDMA_ERROR_ALIGNMENT; in HAL_MDMA_PollForTransfer()
1387 hmdma->ErrorCode |= HAL_MDMA_ERROR_BLOCK_SIZE; in HAL_MDMA_PollForTransfer()
1390 (void) HAL_MDMA_Abort(hmdma); /* if error then abort the current transfer */ in HAL_MDMA_PollForTransfer()
1409 hmdma->ErrorCode |= HAL_MDMA_ERROR_TIMEOUT; in HAL_MDMA_PollForTransfer()
1411 (void) HAL_MDMA_Abort(hmdma); /* if timeout then abort the current transfer */ in HAL_MDMA_PollForTransfer()
1428 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BFTC); in HAL_MDMA_PollForTransfer()
1433 __HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_BFTC | MDMA_FLAG_BT)); in HAL_MDMA_PollForTransfer()
1438 __HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_BFTC | MDMA_FLAG_BT | MDMA_FLAG_BRT)); in HAL_MDMA_PollForTransfer()
1442 __HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_BRT | MDMA_FLAG_BT | MDMA_FLAG_BFTC | MDMA_FLAG_CTC)); in HAL_MDMA_PollForTransfer()
1445 __HAL_UNLOCK(hmdma); in HAL_MDMA_PollForTransfer()
1447 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_PollForTransfer()
1463 HAL_StatusTypeDef HAL_MDMA_GenerateSWRequest(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_GenerateSWRequest() argument
1468 if(hmdma == NULL) in HAL_MDMA_GenerateSWRequest()
1474 request_mode = hmdma->Instance->CTCR & MDMA_CTCR_SWRM; in HAL_MDMA_GenerateSWRequest()
1476 if((hmdma->Instance->CCR & MDMA_CCR_EN) == 0U) in HAL_MDMA_GenerateSWRequest()
1479 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_GenerateSWRequest()
1483 else if(((hmdma->Instance->CISR & MDMA_CISR_CRQA) != 0U) || (request_mode == 0U)) in HAL_MDMA_GenerateSWRequest()
1486 hmdma->ErrorCode = HAL_MDMA_ERROR_BUSY; in HAL_MDMA_GenerateSWRequest()
1493 hmdma->Instance->CCR |= MDMA_CCR_SWRQ; in HAL_MDMA_GenerateSWRequest()
1505 void HAL_MDMA_IRQHandler(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_IRQHandler() argument
1513 …generalIntFlag = 1UL << ((((uint32_t)hmdma->Instance - (uint32_t)(MDMA_Channel0))/HAL_MDMA_CHANNE… in HAL_MDMA_IRQHandler()
1520 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_TE) != 0U)) in HAL_MDMA_IRQHandler()
1522 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_TE) != 0U) in HAL_MDMA_IRQHandler()
1525 __HAL_MDMA_DISABLE_IT(hmdma, MDMA_IT_TE); in HAL_MDMA_IRQHandler()
1528 errorFlag = hmdma->Instance->CESR; in HAL_MDMA_IRQHandler()
1533 hmdma->ErrorCode |= HAL_MDMA_ERROR_READ_XFER; in HAL_MDMA_IRQHandler()
1538 hmdma->ErrorCode |= HAL_MDMA_ERROR_WRITE_XFER; in HAL_MDMA_IRQHandler()
1544 hmdma->ErrorCode |= HAL_MDMA_ERROR_MASK_DATA; in HAL_MDMA_IRQHandler()
1550 hmdma->ErrorCode |= HAL_MDMA_ERROR_LINKED_LIST; in HAL_MDMA_IRQHandler()
1556 hmdma->ErrorCode |= HAL_MDMA_ERROR_ALIGNMENT; in HAL_MDMA_IRQHandler()
1562 hmdma->ErrorCode |= HAL_MDMA_ERROR_BLOCK_SIZE; in HAL_MDMA_IRQHandler()
1566 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_TE); in HAL_MDMA_IRQHandler()
1571 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_BFTC) != 0U)) in HAL_MDMA_IRQHandler()
1573 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_BFTC) != 0U) in HAL_MDMA_IRQHandler()
1576 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BFTC); in HAL_MDMA_IRQHandler()
1578 if(hmdma->XferBufferCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1581 hmdma->XferBufferCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1587 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_BT) != 0U)) in HAL_MDMA_IRQHandler()
1589 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_BT) != 0U) in HAL_MDMA_IRQHandler()
1592 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BT); in HAL_MDMA_IRQHandler()
1594 if(hmdma->XferBlockCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1597 hmdma->XferBlockCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1603 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_BRT) != 0U)) in HAL_MDMA_IRQHandler()
1605 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_BRT) != 0U) in HAL_MDMA_IRQHandler()
1608 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BRT); in HAL_MDMA_IRQHandler()
1610 if(hmdma->XferRepeatBlockCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1613 hmdma->XferRepeatBlockCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1619 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_CTC) != 0U)) in HAL_MDMA_IRQHandler()
1621 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_CTC) != 0U) in HAL_MDMA_IRQHandler()
1624 …__HAL_MDMA_DISABLE_IT(hmdma, (MDMA_IT_TE | MDMA_IT_CTC | MDMA_IT_BT | MDMA_IT_BRT | MDMA_IT_BFTC)); in HAL_MDMA_IRQHandler()
1626 if(HAL_MDMA_STATE_ABORT == hmdma->State) in HAL_MDMA_IRQHandler()
1629 __HAL_UNLOCK(hmdma); in HAL_MDMA_IRQHandler()
1632 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_IRQHandler()
1634 if(hmdma->XferAbortCallback != NULL) in HAL_MDMA_IRQHandler()
1636 hmdma->XferAbortCallback(hmdma); in HAL_MDMA_IRQHandler()
1642 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_CTC); in HAL_MDMA_IRQHandler()
1645 __HAL_UNLOCK(hmdma); in HAL_MDMA_IRQHandler()
1648 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_IRQHandler()
1650 if(hmdma->XferCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1653 hmdma->XferCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1659 if(hmdma->ErrorCode != HAL_MDMA_ERROR_NONE) in HAL_MDMA_IRQHandler()
1661 hmdma->State = HAL_MDMA_STATE_ABORT; in HAL_MDMA_IRQHandler()
1664 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_IRQHandler()
1673 while((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U); in HAL_MDMA_IRQHandler()
1676 __HAL_UNLOCK(hmdma); in HAL_MDMA_IRQHandler()
1678 if((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U) in HAL_MDMA_IRQHandler()
1681 hmdma->State = HAL_MDMA_STATE_ERROR; in HAL_MDMA_IRQHandler()
1686 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_IRQHandler()
1690 if (hmdma->XferErrorCallback != NULL) in HAL_MDMA_IRQHandler()
1693 hmdma->XferErrorCallback(hmdma); in HAL_MDMA_IRQHandler()
1723 HAL_MDMA_StateTypeDef HAL_MDMA_GetState(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_GetState() argument
1725 return hmdma->State; in HAL_MDMA_GetState()
1734 uint32_t HAL_MDMA_GetError(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_GetError() argument
1736 return hmdma->ErrorCode; in HAL_MDMA_GetError()
1761 static void MDMA_SetConfig(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uin… in MDMA_SetConfig() argument
1766 MODIFY_REG(hmdma->Instance->CBNDTR ,MDMA_CBNDTR_BNDT, (BlockDataLength & MDMA_CBNDTR_BNDT)); in MDMA_SetConfig()
1769 …MODIFY_REG(hmdma->Instance->CBNDTR , MDMA_CBNDTR_BRC , ((BlockCount - 1U) << MDMA_CBNDTR_BRC_Pos) … in MDMA_SetConfig()
1772 …__HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_TE | MDMA_FLAG_CTC | MDMA_CISR_BRTIF | MDMA_CISR_BTIF | MDM… in MDMA_SetConfig()
1775 hmdma->Instance->CDAR = DstAddress; in MDMA_SetConfig()
1778 hmdma->Instance->CSAR = SrcAddress; in MDMA_SetConfig()
1784 hmdma->Instance->CTBR |= MDMA_CTBR_SBUS; in MDMA_SetConfig()
1789 hmdma->Instance->CTBR &= (~MDMA_CTBR_SBUS); in MDMA_SetConfig()
1796 hmdma->Instance->CTBR |= MDMA_CTBR_DBUS; in MDMA_SetConfig()
1801 hmdma->Instance->CTBR &= (~MDMA_CTBR_DBUS); in MDMA_SetConfig()
1805 hmdma->Instance->CLAR = (uint32_t)hmdma->FirstLinkedListNodeAddress; in MDMA_SetConfig()
1815 static void MDMA_Init(MDMA_HandleTypeDef *hmdma) in MDMA_Init() argument
1820 hmdma->Instance->CCR = hmdma->Init.Priority | hmdma->Init.Endianness; in MDMA_Init()
1823 hmdma->Instance->CTCR = hmdma->Init.SourceInc | hmdma->Init.DestinationInc | \ in MDMA_Init()
1824 hmdma->Init.SourceDataSize | hmdma->Init.DestDataSize | \ in MDMA_Init()
1825 hmdma->Init.DataAlignment | hmdma->Init.SourceBurst | \ in MDMA_Init()
1826 hmdma->Init.DestBurst | \ in MDMA_Init()
1827 ((hmdma->Init.BufferTransferLength - 1U) << MDMA_CTCR_TLEN_Pos) | \ in MDMA_Init()
1828 hmdma->Init.TransferTriggerMode; in MDMA_Init()
1831 if(hmdma->Init.Request == MDMA_REQUEST_SW) in MDMA_Init()
1839 hmdma->Instance->CTCR |= (MDMA_CTCR_SWRM | MDMA_CTCR_BWM); in MDMA_Init()
1843 hmdma->Instance->CBNDTR = 0; in MDMA_Init()
1846 if(hmdma->Init.SourceBlockAddressOffset < 0) in MDMA_Init()
1848 hmdma->Instance->CBNDTR |= MDMA_CBNDTR_BRSUM; in MDMA_Init()
1850 blockoffset = (uint32_t)(- hmdma->Init.SourceBlockAddressOffset); in MDMA_Init()
1851 hmdma->Instance->CBRUR = (blockoffset & 0x0000FFFFU); in MDMA_Init()
1856 hmdma->Instance->CBRUR = (((uint32_t)hmdma->Init.SourceBlockAddressOffset) & 0x0000FFFFU); in MDMA_Init()
1860 if(hmdma->Init.DestBlockAddressOffset < 0) in MDMA_Init()
1862 hmdma->Instance->CBNDTR |= MDMA_CBNDTR_BRDUM; in MDMA_Init()
1864 blockoffset = (uint32_t)(- hmdma->Init.DestBlockAddressOffset); in MDMA_Init()
1865 hmdma->Instance->CBRUR |= ((blockoffset & 0x0000FFFFU) << MDMA_CBRUR_DUV_Pos); in MDMA_Init()
1870hmdma->Instance->CBRUR |= ((((uint32_t)hmdma->Init.DestBlockAddressOffset) & 0x0000FFFFU) << MDMA_… in MDMA_Init()
1874 if(hmdma->Init.Request != MDMA_REQUEST_SW) in MDMA_Init()
1877 hmdma->Instance->CTBR = hmdma->Init.Request & MDMA_CTBR_TSEL; in MDMA_Init()
1881 hmdma->Instance->CTBR = 0; in MDMA_Init()
1885 hmdma->Instance->CLAR = 0; in MDMA_Init()