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_SECURE_MODE(hmdma->Init.SecureMode)); in HAL_MDMA_Init()
233 assert_param(IS_MDMA_ENDIANNESS_MODE(hmdma->Init.Endianness)); in HAL_MDMA_Init()
234 assert_param(IS_MDMA_REQUEST(hmdma->Init.Request)); in HAL_MDMA_Init()
235 assert_param(IS_MDMA_SOURCE_INC(hmdma->Init.SourceInc)); in HAL_MDMA_Init()
236 assert_param(IS_MDMA_DESTINATION_INC(hmdma->Init.DestinationInc)); in HAL_MDMA_Init()
237 assert_param(IS_MDMA_SOURCE_DATASIZE(hmdma->Init.SourceDataSize)); in HAL_MDMA_Init()
238 assert_param(IS_MDMA_DESTINATION_DATASIZE(hmdma->Init.DestDataSize)); in HAL_MDMA_Init()
239 assert_param(IS_MDMA_DATA_ALIGNMENT(hmdma->Init.DataAlignment)); in HAL_MDMA_Init()
240 assert_param(IS_MDMA_SOURCE_BURST(hmdma->Init.SourceBurst)); in HAL_MDMA_Init()
241 assert_param(IS_MDMA_DESTINATION_BURST(hmdma->Init.DestBurst)); in HAL_MDMA_Init()
242 assert_param(IS_MDMA_BUFFER_TRANSFER_LENGTH(hmdma->Init.BufferTransferLength)); in HAL_MDMA_Init()
243 assert_param(IS_MDMA_TRANSFER_TRIGGER_MODE(hmdma->Init.TransferTriggerMode)); in HAL_MDMA_Init()
244 assert_param(IS_MDMA_BLOCK_ADDR_OFFSET(hmdma->Init.SourceBlockAddressOffset)); in HAL_MDMA_Init()
245 assert_param(IS_MDMA_BLOCK_ADDR_OFFSET(hmdma->Init.DestBlockAddressOffset)); in HAL_MDMA_Init()
249 __HAL_UNLOCK(hmdma); in HAL_MDMA_Init()
251 if(hmdma->State == HAL_MDMA_STATE_RESET) in HAL_MDMA_Init()
254 HAL_MDMA_MspInit(hmdma); in HAL_MDMA_Init()
258 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_Init()
261 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Init()
264 while((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U) in HAL_MDMA_Init()
270 hmdma->ErrorCode = HAL_MDMA_ERROR_TIMEOUT; in HAL_MDMA_Init()
273 hmdma->State = HAL_MDMA_STATE_ERROR; in HAL_MDMA_Init()
280 MDMA_Init(hmdma); in HAL_MDMA_Init()
283 hmdma->FirstLinkedListNodeAddress = 0; in HAL_MDMA_Init()
284 hmdma->LastLinkedListNodeAddress = 0; in HAL_MDMA_Init()
285 hmdma->LinkedListNodeCounter = 0; in HAL_MDMA_Init()
288 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_Init()
291 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_Init()
302 HAL_StatusTypeDef HAL_MDMA_DeInit(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_DeInit() argument
306 if(hmdma == NULL) in HAL_MDMA_DeInit()
312 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_DeInit()
315 hmdma->Instance->CCR = 0; in HAL_MDMA_DeInit()
316 hmdma->Instance->CTCR = 0; in HAL_MDMA_DeInit()
317 hmdma->Instance->CBNDTR = 0; in HAL_MDMA_DeInit()
318 hmdma->Instance->CSAR = 0; in HAL_MDMA_DeInit()
319 hmdma->Instance->CDAR = 0; in HAL_MDMA_DeInit()
320 hmdma->Instance->CBRUR = 0; in HAL_MDMA_DeInit()
321 hmdma->Instance->CLAR = 0; in HAL_MDMA_DeInit()
322 hmdma->Instance->CTBR = 0; in HAL_MDMA_DeInit()
323 hmdma->Instance->CMAR = 0; in HAL_MDMA_DeInit()
324 hmdma->Instance->CMDR = 0; in HAL_MDMA_DeInit()
327 …__HAL_MDMA_CLEAR_FLAG(hmdma,(MDMA_FLAG_TE | MDMA_FLAG_CTC | MDMA_FLAG_BRT | MDMA_FLAG_BT | MDMA_FL… in HAL_MDMA_DeInit()
330 HAL_MDMA_MspDeInit(hmdma); in HAL_MDMA_DeInit()
333 hmdma->FirstLinkedListNodeAddress = 0; in HAL_MDMA_DeInit()
334 hmdma->LastLinkedListNodeAddress = 0; in HAL_MDMA_DeInit()
335 hmdma->LinkedListNodeCounter = 0; in HAL_MDMA_DeInit()
338 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_DeInit()
341 hmdma->State = HAL_MDMA_STATE_RESET; in HAL_MDMA_DeInit()
344 __HAL_UNLOCK(hmdma); in HAL_MDMA_DeInit()
358 HAL_StatusTypeDef HAL_MDMA_ConfigPostRequestMask(MDMA_HandleTypeDef *hmdma, uint32_t MaskAddress, u… in HAL_MDMA_ConfigPostRequestMask() argument
363 if(hmdma == NULL) in HAL_MDMA_ConfigPostRequestMask()
369 __HAL_LOCK(hmdma); in HAL_MDMA_ConfigPostRequestMask()
371 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_ConfigPostRequestMask()
374 if((hmdma->Instance->CTCR & MDMA_CTCR_SWRM) == 0U) in HAL_MDMA_ConfigPostRequestMask()
377 hmdma->Instance->CMAR = MaskAddress; in HAL_MDMA_ConfigPostRequestMask()
378 hmdma->Instance->CMDR = MaskData; in HAL_MDMA_ConfigPostRequestMask()
388 hmdma->Instance->CTCR &= ~MDMA_CTCR_BWM; in HAL_MDMA_ConfigPostRequestMask()
392 hmdma->Instance->CTCR |= MDMA_CTCR_BWM; in HAL_MDMA_ConfigPostRequestMask()
407 __HAL_UNLOCK(hmdma); in HAL_MDMA_ConfigPostRequestMask()
420 HAL_StatusTypeDef HAL_MDMA_RegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef C… in HAL_MDMA_RegisterCallback() argument
425 if(hmdma == NULL) in HAL_MDMA_RegisterCallback()
431 __HAL_LOCK(hmdma); in HAL_MDMA_RegisterCallback()
433 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_RegisterCallback()
438 hmdma->XferCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
442 hmdma->XferBufferCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
446 hmdma->XferBlockCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
450 hmdma->XferRepeatBlockCpltCallback = pCallback; in HAL_MDMA_RegisterCallback()
454 hmdma->XferErrorCallback = pCallback; in HAL_MDMA_RegisterCallback()
458 hmdma->XferAbortCallback = pCallback; in HAL_MDMA_RegisterCallback()
472 __HAL_UNLOCK(hmdma); in HAL_MDMA_RegisterCallback()
485 HAL_StatusTypeDef HAL_MDMA_UnRegisterCallback(MDMA_HandleTypeDef *hmdma, HAL_MDMA_CallbackIDTypeDef… in HAL_MDMA_UnRegisterCallback() argument
490 if(hmdma == NULL) in HAL_MDMA_UnRegisterCallback()
496 __HAL_LOCK(hmdma); in HAL_MDMA_UnRegisterCallback()
498 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_UnRegisterCallback()
503 hmdma->XferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
507 hmdma->XferBufferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
511 hmdma->XferBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
515 hmdma->XferRepeatBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
519 hmdma->XferErrorCallback = NULL; in HAL_MDMA_UnRegisterCallback()
523 hmdma->XferAbortCallback = NULL; in HAL_MDMA_UnRegisterCallback()
527 hmdma->XferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
528 hmdma->XferBufferCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
529 hmdma->XferBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
530 hmdma->XferRepeatBlockCpltCallback = NULL; in HAL_MDMA_UnRegisterCallback()
531 hmdma->XferErrorCallback = NULL; in HAL_MDMA_UnRegisterCallback()
532 hmdma->XferAbortCallback = NULL; in HAL_MDMA_UnRegisterCallback()
546 __HAL_UNLOCK(hmdma); in HAL_MDMA_UnRegisterCallback()
723 HAL_StatusTypeDef HAL_MDMA_LinkedList_AddNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *pNew… in HAL_MDMA_LinkedList_AddNode() argument
730 if((hmdma == NULL) || (pNewNode == NULL)) in HAL_MDMA_LinkedList_AddNode()
736 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_AddNode()
738 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_AddNode()
741 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_AddNode()
744 if((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) in HAL_MDMA_LinkedList_AddNode()
751 hmdma->Instance->CLAR = (uint32_t)pNewNode; in HAL_MDMA_LinkedList_AddNode()
753 hmdma->FirstLinkedListNodeAddress = pNewNode; in HAL_MDMA_LinkedList_AddNode()
759 hmdma->LastLinkedListNodeAddress = pNewNode; in HAL_MDMA_LinkedList_AddNode()
761 hmdma->LinkedListNodeCounter = 1; in HAL_MDMA_LinkedList_AddNode()
768 else if(hmdma->FirstLinkedListNodeAddress != pNewNode) in HAL_MDMA_LinkedList_AddNode()
771 pNode = hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_AddNode()
772 while((counter < hmdma->LinkedListNodeCounter) && (hal_status == HAL_OK)) in HAL_MDMA_LinkedList_AddNode()
785 if((pPrevNode == hmdma->LastLinkedListNodeAddress) || (pPrevNode == NULL)) in HAL_MDMA_LinkedList_AddNode()
788 pNewNode->CLAR = hmdma->LastLinkedListNodeAddress->CLAR; in HAL_MDMA_LinkedList_AddNode()
789 hmdma->LastLinkedListNodeAddress->CLAR = (uint32_t)pNewNode; in HAL_MDMA_LinkedList_AddNode()
791 hmdma->LastLinkedListNodeAddress = pNewNode; in HAL_MDMA_LinkedList_AddNode()
793 hmdma->LinkedListNodeCounter++; in HAL_MDMA_LinkedList_AddNode()
798 pNode = hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_AddNode()
800 while((counter < hmdma->LinkedListNodeCounter) && (nodeInserted == 0U)) in HAL_MDMA_LinkedList_AddNode()
809 hmdma->LinkedListNodeCounter++; in HAL_MDMA_LinkedList_AddNode()
831 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_AddNode()
833 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_AddNode()
840 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_AddNode()
856 HAL_StatusTypeDef HAL_MDMA_LinkedList_RemoveNode(MDMA_HandleTypeDef *hmdma, MDMA_LinkNodeTypeDef *p… in HAL_MDMA_LinkedList_RemoveNode() argument
863 if((hmdma == NULL) || (pNode == NULL)) in HAL_MDMA_LinkedList_RemoveNode()
869 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_RemoveNode()
871 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_RemoveNode()
874 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_RemoveNode()
877 …if(((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) || ((uint32_t)hmdma->LastLinkedListNodeAddr… in HAL_MDMA_LinkedList_RemoveNode()
881 else if(hmdma->FirstLinkedListNodeAddress == pNode) /* Deleting first node */ in HAL_MDMA_LinkedList_RemoveNode()
884 if(hmdma->LastLinkedListNodeAddress == pNode) in HAL_MDMA_LinkedList_RemoveNode()
889 hmdma->FirstLinkedListNodeAddress = 0; in HAL_MDMA_LinkedList_RemoveNode()
890 hmdma->LastLinkedListNodeAddress = 0; in HAL_MDMA_LinkedList_RemoveNode()
891 hmdma->LinkedListNodeCounter = 0; in HAL_MDMA_LinkedList_RemoveNode()
893 hmdma->Instance->CLAR = 0; in HAL_MDMA_LinkedList_RemoveNode()
897 if((uint32_t)hmdma->FirstLinkedListNodeAddress == hmdma->LastLinkedListNodeAddress->CLAR) in HAL_MDMA_LinkedList_RemoveNode()
900 hmdma->LastLinkedListNodeAddress->CLAR = pNode->CLAR; in HAL_MDMA_LinkedList_RemoveNode()
906 hmdma->Instance->CLAR = pNode->CLAR; in HAL_MDMA_LinkedList_RemoveNode()
907 hmdma->FirstLinkedListNodeAddress = (MDMA_LinkNodeTypeDef *)hmdma->Instance->CLAR; in HAL_MDMA_LinkedList_RemoveNode()
909 hmdma->LinkedListNodeCounter--; in HAL_MDMA_LinkedList_RemoveNode()
915 ptmpNode = hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_RemoveNode()
916 while((counter < hmdma->LinkedListNodeCounter) && (nodeDeleted == 0U)) in HAL_MDMA_LinkedList_RemoveNode()
922 if(pNode == hmdma->LastLinkedListNodeAddress) in HAL_MDMA_LinkedList_RemoveNode()
925 hmdma->LastLinkedListNodeAddress = ptmpNode; in HAL_MDMA_LinkedList_RemoveNode()
931 hmdma->LinkedListNodeCounter--; in HAL_MDMA_LinkedList_RemoveNode()
947 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_RemoveNode()
949 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_RemoveNode()
956 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_RemoveNode()
969 HAL_StatusTypeDef HAL_MDMA_LinkedList_EnableCircularMode(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_LinkedList_EnableCircularMode() argument
974 if(hmdma == NULL) in HAL_MDMA_LinkedList_EnableCircularMode()
980 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_EnableCircularMode()
982 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_EnableCircularMode()
985 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_EnableCircularMode()
988 …if(((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) || ((uint32_t)hmdma->LastLinkedListNodeAddr… in HAL_MDMA_LinkedList_EnableCircularMode()
995 hmdma->LastLinkedListNodeAddress->CLAR = (uint32_t)hmdma->FirstLinkedListNodeAddress; in HAL_MDMA_LinkedList_EnableCircularMode()
1000 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_EnableCircularMode()
1002 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_EnableCircularMode()
1013 HAL_StatusTypeDef HAL_MDMA_LinkedList_DisableCircularMode(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_LinkedList_DisableCircularMode() argument
1018 if(hmdma == NULL) in HAL_MDMA_LinkedList_DisableCircularMode()
1024 __HAL_LOCK(hmdma); in HAL_MDMA_LinkedList_DisableCircularMode()
1026 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_LinkedList_DisableCircularMode()
1029 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_LinkedList_DisableCircularMode()
1032 …if(((uint32_t)hmdma->FirstLinkedListNodeAddress == 0U) || ((uint32_t)hmdma->LastLinkedListNodeAddr… in HAL_MDMA_LinkedList_DisableCircularMode()
1039 hmdma->LastLinkedListNodeAddress->CLAR = 0; in HAL_MDMA_LinkedList_DisableCircularMode()
1044 __HAL_UNLOCK(hmdma); in HAL_MDMA_LinkedList_DisableCircularMode()
1046 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_LinkedList_DisableCircularMode()
1084 HAL_StatusTypeDef HAL_MDMA_Start(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddres… in HAL_MDMA_Start() argument
1091 if(hmdma == NULL) in HAL_MDMA_Start()
1097 __HAL_LOCK(hmdma); in HAL_MDMA_Start()
1099 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_Start()
1102 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_Start()
1105 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_Start()
1108 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Start()
1111 MDMA_SetConfig(hmdma, SrcAddress, DstAddress, BlockDataLength, BlockCount); in HAL_MDMA_Start()
1114 __HAL_MDMA_ENABLE(hmdma); in HAL_MDMA_Start()
1116 if(hmdma->Init.Request == MDMA_REQUEST_SW) in HAL_MDMA_Start()
1119 hmdma->Instance->CCR |= MDMA_CCR_SWRQ; in HAL_MDMA_Start()
1125 __HAL_UNLOCK(hmdma); in HAL_MDMA_Start()
1144 HAL_StatusTypeDef HAL_MDMA_Start_IT(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAdd… in HAL_MDMA_Start_IT() argument
1151 if(hmdma == NULL) in HAL_MDMA_Start_IT()
1157 __HAL_LOCK(hmdma); in HAL_MDMA_Start_IT()
1159 if(HAL_MDMA_STATE_READY == hmdma->State) in HAL_MDMA_Start_IT()
1162 hmdma->State = HAL_MDMA_STATE_BUSY; in HAL_MDMA_Start_IT()
1165 hmdma->ErrorCode = HAL_MDMA_ERROR_NONE; in HAL_MDMA_Start_IT()
1168 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Start_IT()
1171 MDMA_SetConfig(hmdma, SrcAddress, DstAddress, BlockDataLength, BlockCount); in HAL_MDMA_Start_IT()
1174 __HAL_MDMA_ENABLE_IT(hmdma, (MDMA_IT_TE | MDMA_IT_CTC)); in HAL_MDMA_Start_IT()
1176 if(hmdma->XferBlockCpltCallback != NULL) in HAL_MDMA_Start_IT()
1179 __HAL_MDMA_ENABLE_IT(hmdma, MDMA_IT_BT); in HAL_MDMA_Start_IT()
1182 if(hmdma->XferRepeatBlockCpltCallback != NULL) in HAL_MDMA_Start_IT()
1185 __HAL_MDMA_ENABLE_IT(hmdma, MDMA_IT_BRT); in HAL_MDMA_Start_IT()
1188 if(hmdma->XferBufferCpltCallback != NULL) in HAL_MDMA_Start_IT()
1191 __HAL_MDMA_ENABLE_IT(hmdma, MDMA_IT_BFTC); in HAL_MDMA_Start_IT()
1195 __HAL_MDMA_ENABLE(hmdma); in HAL_MDMA_Start_IT()
1197 if(hmdma->Init.Request == MDMA_REQUEST_SW) in HAL_MDMA_Start_IT()
1200 hmdma->Instance->CCR |= MDMA_CCR_SWRQ; in HAL_MDMA_Start_IT()
1206 __HAL_UNLOCK(hmdma); in HAL_MDMA_Start_IT()
1227 HAL_StatusTypeDef HAL_MDMA_Abort(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_Abort() argument
1232 if(hmdma == NULL) in HAL_MDMA_Abort()
1237 if(HAL_MDMA_STATE_BUSY != hmdma->State) in HAL_MDMA_Abort()
1239 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_Abort()
1242 __HAL_UNLOCK(hmdma); in HAL_MDMA_Abort()
1249 …__HAL_MDMA_DISABLE_IT(hmdma, (MDMA_IT_TE | MDMA_IT_CTC | MDMA_IT_BT | MDMA_IT_BRT | MDMA_IT_BFTC)); in HAL_MDMA_Abort()
1252 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Abort()
1255 while((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U) in HAL_MDMA_Abort()
1261 hmdma->ErrorCode |= HAL_MDMA_ERROR_TIMEOUT; in HAL_MDMA_Abort()
1264 __HAL_UNLOCK(hmdma); in HAL_MDMA_Abort()
1267 hmdma->State = HAL_MDMA_STATE_ERROR; in HAL_MDMA_Abort()
1274 …__HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_TE | MDMA_FLAG_CTC | MDMA_FLAG_BT | MDMA_FLAG_BRT | MDMA_F… in HAL_MDMA_Abort()
1277 __HAL_UNLOCK(hmdma); in HAL_MDMA_Abort()
1280 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_Abort()
1292 HAL_StatusTypeDef HAL_MDMA_Abort_IT(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_Abort_IT() argument
1295 if(hmdma == NULL) in HAL_MDMA_Abort_IT()
1300 if(HAL_MDMA_STATE_BUSY != hmdma->State) in HAL_MDMA_Abort_IT()
1303 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_Abort_IT()
1310 hmdma->State = HAL_MDMA_STATE_ABORT; in HAL_MDMA_Abort_IT()
1313 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_Abort_IT()
1327 HAL_StatusTypeDef HAL_MDMA_PollForTransfer(MDMA_HandleTypeDef *hmdma, HAL_MDMA_LevelCompleteTypeDef… in HAL_MDMA_PollForTransfer() argument
1336 if(hmdma == NULL) in HAL_MDMA_PollForTransfer()
1341 if(HAL_MDMA_STATE_BUSY != hmdma->State) in HAL_MDMA_PollForTransfer()
1344 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_PollForTransfer()
1359 while(__HAL_MDMA_GET_FLAG(hmdma, levelFlag) == 0U) in HAL_MDMA_PollForTransfer()
1361 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_TE) != 0U)) in HAL_MDMA_PollForTransfer()
1364 errorFlag = hmdma->Instance->CESR; in HAL_MDMA_PollForTransfer()
1369 hmdma->ErrorCode |= HAL_MDMA_ERROR_READ_XFER; in HAL_MDMA_PollForTransfer()
1374 hmdma->ErrorCode |= HAL_MDMA_ERROR_WRITE_XFER; in HAL_MDMA_PollForTransfer()
1380 hmdma->ErrorCode |= HAL_MDMA_ERROR_MASK_DATA; in HAL_MDMA_PollForTransfer()
1386 hmdma->ErrorCode |= HAL_MDMA_ERROR_LINKED_LIST; in HAL_MDMA_PollForTransfer()
1392 hmdma->ErrorCode |= HAL_MDMA_ERROR_ALIGNMENT; in HAL_MDMA_PollForTransfer()
1398 hmdma->ErrorCode |= HAL_MDMA_ERROR_BLOCK_SIZE; in HAL_MDMA_PollForTransfer()
1401 (void) HAL_MDMA_Abort(hmdma); /* if error then abort the current transfer */ in HAL_MDMA_PollForTransfer()
1420 hmdma->ErrorCode |= HAL_MDMA_ERROR_TIMEOUT; in HAL_MDMA_PollForTransfer()
1422 (void) HAL_MDMA_Abort(hmdma); /* if timeout then abort the current transfer */ in HAL_MDMA_PollForTransfer()
1439 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BFTC); in HAL_MDMA_PollForTransfer()
1444 __HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_BFTC | MDMA_FLAG_BT)); in HAL_MDMA_PollForTransfer()
1449 __HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_BFTC | MDMA_FLAG_BT | MDMA_FLAG_BRT)); in HAL_MDMA_PollForTransfer()
1453 __HAL_MDMA_CLEAR_FLAG(hmdma, (MDMA_FLAG_BRT | MDMA_FLAG_BT | MDMA_FLAG_BFTC | MDMA_FLAG_CTC)); in HAL_MDMA_PollForTransfer()
1456 __HAL_UNLOCK(hmdma); in HAL_MDMA_PollForTransfer()
1458 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_PollForTransfer()
1474 HAL_StatusTypeDef HAL_MDMA_GenerateSWRequest(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_GenerateSWRequest() argument
1479 if(hmdma == NULL) in HAL_MDMA_GenerateSWRequest()
1485 request_mode = hmdma->Instance->CTCR & MDMA_CTCR_SWRM; in HAL_MDMA_GenerateSWRequest()
1487 if((hmdma->Instance->CCR & MDMA_CCR_EN) == 0U) in HAL_MDMA_GenerateSWRequest()
1490 hmdma->ErrorCode = HAL_MDMA_ERROR_NO_XFER; in HAL_MDMA_GenerateSWRequest()
1494 else if(((hmdma->Instance->CISR & MDMA_CISR_CRQA) != 0U) || (request_mode == 0U)) in HAL_MDMA_GenerateSWRequest()
1497 hmdma->ErrorCode = HAL_MDMA_ERROR_BUSY; in HAL_MDMA_GenerateSWRequest()
1504 hmdma->Instance->CCR |= MDMA_CCR_SWRQ; in HAL_MDMA_GenerateSWRequest()
1516 void HAL_MDMA_IRQHandler(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_IRQHandler() argument
1524 …generalIntFlag = 1UL << ((((uint32_t)hmdma->Instance - (uint32_t)(MDMA_Channel0))/HAL_MDMA_CHANNE… in HAL_MDMA_IRQHandler()
1525 if((hmdma->Instance->CCR & MDMA_CCR_SM) != MDMA_CCR_SM) in HAL_MDMA_IRQHandler()
1543 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_TE) != 0U)) in HAL_MDMA_IRQHandler()
1545 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_TE) != 0U) in HAL_MDMA_IRQHandler()
1548 __HAL_MDMA_DISABLE_IT(hmdma, MDMA_IT_TE); in HAL_MDMA_IRQHandler()
1551 errorFlag = hmdma->Instance->CESR; in HAL_MDMA_IRQHandler()
1556 hmdma->ErrorCode |= HAL_MDMA_ERROR_READ_XFER; in HAL_MDMA_IRQHandler()
1561 hmdma->ErrorCode |= HAL_MDMA_ERROR_WRITE_XFER; in HAL_MDMA_IRQHandler()
1567 hmdma->ErrorCode |= HAL_MDMA_ERROR_MASK_DATA; in HAL_MDMA_IRQHandler()
1573 hmdma->ErrorCode |= HAL_MDMA_ERROR_LINKED_LIST; in HAL_MDMA_IRQHandler()
1579 hmdma->ErrorCode |= HAL_MDMA_ERROR_ALIGNMENT; in HAL_MDMA_IRQHandler()
1585 hmdma->ErrorCode |= HAL_MDMA_ERROR_BLOCK_SIZE; in HAL_MDMA_IRQHandler()
1589 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_TE); in HAL_MDMA_IRQHandler()
1594 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_BFTC) != 0U)) in HAL_MDMA_IRQHandler()
1596 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_BFTC) != 0U) in HAL_MDMA_IRQHandler()
1599 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BFTC); in HAL_MDMA_IRQHandler()
1601 if(hmdma->XferBufferCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1604 hmdma->XferBufferCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1610 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_BT) != 0U)) in HAL_MDMA_IRQHandler()
1612 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_BT) != 0U) in HAL_MDMA_IRQHandler()
1615 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BT); in HAL_MDMA_IRQHandler()
1617 if(hmdma->XferBlockCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1620 hmdma->XferBlockCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1626 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_BRT) != 0U)) in HAL_MDMA_IRQHandler()
1628 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_BRT) != 0U) in HAL_MDMA_IRQHandler()
1631 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_BRT); in HAL_MDMA_IRQHandler()
1633 if(hmdma->XferRepeatBlockCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1636 hmdma->XferRepeatBlockCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1642 if((__HAL_MDMA_GET_FLAG(hmdma, MDMA_FLAG_CTC) != 0U)) in HAL_MDMA_IRQHandler()
1644 if(__HAL_MDMA_GET_IT_SOURCE(hmdma, MDMA_IT_CTC) != 0U) in HAL_MDMA_IRQHandler()
1647 …__HAL_MDMA_DISABLE_IT(hmdma, (MDMA_IT_TE | MDMA_IT_CTC | MDMA_IT_BT | MDMA_IT_BRT | MDMA_IT_BFTC)); in HAL_MDMA_IRQHandler()
1649 if(HAL_MDMA_STATE_ABORT == hmdma->State) in HAL_MDMA_IRQHandler()
1652 __HAL_UNLOCK(hmdma); in HAL_MDMA_IRQHandler()
1655 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_IRQHandler()
1657 if(hmdma->XferAbortCallback != NULL) in HAL_MDMA_IRQHandler()
1659 hmdma->XferAbortCallback(hmdma); in HAL_MDMA_IRQHandler()
1665 __HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_CTC); in HAL_MDMA_IRQHandler()
1668 __HAL_UNLOCK(hmdma); in HAL_MDMA_IRQHandler()
1671 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_IRQHandler()
1673 if(hmdma->XferCpltCallback != NULL) in HAL_MDMA_IRQHandler()
1676 hmdma->XferCpltCallback(hmdma); in HAL_MDMA_IRQHandler()
1682 if(hmdma->ErrorCode != HAL_MDMA_ERROR_NONE) in HAL_MDMA_IRQHandler()
1684 hmdma->State = HAL_MDMA_STATE_ABORT; in HAL_MDMA_IRQHandler()
1687 __HAL_MDMA_DISABLE(hmdma); in HAL_MDMA_IRQHandler()
1696 while((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U); in HAL_MDMA_IRQHandler()
1699 __HAL_UNLOCK(hmdma); in HAL_MDMA_IRQHandler()
1701 if((hmdma->Instance->CCR & MDMA_CCR_EN) != 0U) in HAL_MDMA_IRQHandler()
1704 hmdma->State = HAL_MDMA_STATE_ERROR; in HAL_MDMA_IRQHandler()
1709 hmdma->State = HAL_MDMA_STATE_READY; in HAL_MDMA_IRQHandler()
1713 if (hmdma->XferErrorCallback != NULL) in HAL_MDMA_IRQHandler()
1716 hmdma->XferErrorCallback(hmdma); in HAL_MDMA_IRQHandler()
1746 HAL_MDMA_StateTypeDef HAL_MDMA_GetState(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_GetState() argument
1748 return hmdma->State; in HAL_MDMA_GetState()
1757 uint32_t HAL_MDMA_GetError(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_GetError() argument
1759 return hmdma->ErrorCode; in HAL_MDMA_GetError()
1784 static void MDMA_SetConfig(MDMA_HandleTypeDef *hmdma, uint32_t SrcAddress, uint32_t DstAddress, uin… in MDMA_SetConfig() argument
1789 MODIFY_REG(hmdma->Instance->CBNDTR ,MDMA_CBNDTR_BNDT, (BlockDataLength & MDMA_CBNDTR_BNDT)); in MDMA_SetConfig()
1792 …MODIFY_REG(hmdma->Instance->CBNDTR , MDMA_CBNDTR_BRC , ((BlockCount - 1U) << MDMA_CBNDTR_BRC_Pos) … in MDMA_SetConfig()
1795 …__HAL_MDMA_CLEAR_FLAG(hmdma, MDMA_FLAG_TE | MDMA_FLAG_CTC | MDMA_CISR_BRTIF | MDMA_CISR_BTIF | MDM… in MDMA_SetConfig()
1798 hmdma->Instance->CDAR = DstAddress; in MDMA_SetConfig()
1801 hmdma->Instance->CSAR = SrcAddress; in MDMA_SetConfig()
1807 hmdma->Instance->CTBR |= MDMA_CTBR_SBUS; in MDMA_SetConfig()
1812 hmdma->Instance->CTBR &= (~MDMA_CTBR_SBUS); in MDMA_SetConfig()
1819 hmdma->Instance->CTBR |= MDMA_CTBR_DBUS; in MDMA_SetConfig()
1824 hmdma->Instance->CTBR &= (~MDMA_CTBR_DBUS); in MDMA_SetConfig()
1828 hmdma->Instance->CLAR = (uint32_t)hmdma->FirstLinkedListNodeAddress; in MDMA_SetConfig()
1838 static void MDMA_Init(MDMA_HandleTypeDef *hmdma) in MDMA_Init() argument
1843 hmdma->Instance->CCR = hmdma->Init.Priority | hmdma->Init.SecureMode | hmdma->Init.Endianness; in MDMA_Init()
1846 hmdma->Instance->CTCR = hmdma->Init.SourceInc | hmdma->Init.DestinationInc | \ in MDMA_Init()
1847 hmdma->Init.SourceDataSize | hmdma->Init.DestDataSize | \ in MDMA_Init()
1848 hmdma->Init.DataAlignment | hmdma->Init.SourceBurst | \ in MDMA_Init()
1849 hmdma->Init.DestBurst | \ in MDMA_Init()
1850 ((hmdma->Init.BufferTransferLength - 1U) << MDMA_CTCR_TLEN_Pos) | \ in MDMA_Init()
1851 hmdma->Init.TransferTriggerMode; in MDMA_Init()
1854 if(hmdma->Init.Request == MDMA_REQUEST_SW) in MDMA_Init()
1862 hmdma->Instance->CTCR |= (MDMA_CTCR_SWRM | MDMA_CTCR_BWM); in MDMA_Init()
1866 hmdma->Instance->CBNDTR = 0; in MDMA_Init()
1869 if(hmdma->Init.SourceBlockAddressOffset < 0) in MDMA_Init()
1871 hmdma->Instance->CBNDTR |= MDMA_CBNDTR_BRSUM; in MDMA_Init()
1873 blockoffset = (uint32_t)(- hmdma->Init.SourceBlockAddressOffset); in MDMA_Init()
1874 hmdma->Instance->CBRUR = (blockoffset & 0x0000FFFFU); in MDMA_Init()
1879 hmdma->Instance->CBRUR = (((uint32_t)hmdma->Init.SourceBlockAddressOffset) & 0x0000FFFFU); in MDMA_Init()
1883 if(hmdma->Init.DestBlockAddressOffset < 0) in MDMA_Init()
1885 hmdma->Instance->CBNDTR |= MDMA_CBNDTR_BRDUM; in MDMA_Init()
1887 blockoffset = (uint32_t)(- hmdma->Init.DestBlockAddressOffset); in MDMA_Init()
1888 hmdma->Instance->CBRUR |= ((blockoffset & 0x0000FFFFU) << MDMA_CBRUR_DUV_Pos); in MDMA_Init()
1893 …hmdma->Instance->CBRUR |= ((((uint32_t)hmdma->Init.DestBlockAddressOffset) & 0x0000FFFFU) << MDMA_… in MDMA_Init()
1897 if(hmdma->Init.Request != MDMA_REQUEST_SW) in MDMA_Init()
1900 hmdma->Instance->CTBR = hmdma->Init.Request & MDMA_CTBR_TSEL; in MDMA_Init()
1904 hmdma->Instance->CTBR = 0; in MDMA_Init()
1908 hmdma->Instance->CLAR = 0; in MDMA_Init()
1919 __weak void HAL_MDMA_MspInit(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_MspInit() argument
1931 __weak void HAL_MDMA_MspDeInit(MDMA_HandleTypeDef *hmdma) in HAL_MDMA_MspDeInit() argument