|
关于这个循环里面模式,要特别注意一点
他不是从节点0开始循环的,是从节点1开始循环的,如节点1,节点2,节点3组成一个循环
而节点0是初始配置,在用户调用了HAL_MDMA_Start_IT后仅执行一次。


- /**
- * @brief Make the linked list circular by connecting the last node to the first.
- * @param hmdma : Pointer to a MDMA_HandleTypeDef structure that contains
- * the configuration information for the specified MDMA Channel.
- * @retval HAL status
- */
- HAL_StatusTypeDef HAL_MDMA_LinkedList_EnableCircularMode(MDMA_HandleTypeDef *hmdma)
- {
- HAL_StatusTypeDef hal_status = HAL_OK;
-
- /* Check the MDMA peripheral handle */
- if(hmdma == NULL)
- {
- return HAL_ERROR;
- }
-
- /* Process locked */
- __HAL_LOCK(hmdma);
-
- if(HAL_MDMA_STATE_READY == hmdma->State)
- {
- /* Change MDMA peripheral state */
- hmdma->State = HAL_MDMA_STATE_BUSY;
-
- /* If first and last node are null (no nodes in the list) : return error*/
- if(((uint32_t)hmdma->FirstLinkedListNodeAddress == 0) || ((uint32_t)hmdma->LastLinkedListNodeAddress == 0) || (hmdma->LinkedListNodeCounter == 0))
- {
- hal_status = HAL_ERROR;
- }
- else
- {
- /* to enable circular mode Last Node should be connected to first node */
- hmdma->LastLinkedListNodeAddress->CLAR = (uint32_t)hmdma->FirstLinkedListNodeAddress;
- }
-
- }
- /* Process unlocked */
- __HAL_UNLOCK(hmdma);
-
- hmdma->State = HAL_MDMA_STATE_READY;
-
- return hal_status;
- }
复制代码
|
|