/** * @brief DMA error callback * @param hdma: pointer to a DMA_HandleTypeDef structure that contains * the configuration information for the specified DMA module. * @retval None */ static void DCMI_DMAError(DMA_HandleTypeDef *hdma) { DCMI_HandleTypeDef* hdcmi = ( DCMI_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; if(hdcmi->DMA_Handle->ErrorCode != HAL_DMA_ERROR_FE) { /* Initialize the DCMI state*/ hdcmi->State = HAL_DCMI_STATE_READY; } /* DCMI error Callback */ HAL_DCMI_ErrorCallback(hdcmi); }
/** * @brief DMA error callback * @param hdma pointer to a DMA_HandleTypeDef structure that contains * the configuration information for the specified DMA module. * @retval None */ static void DCMI_DMAError(DMA_HandleTypeDef *hdma) { DCMI_HandleTypeDef* hdcmi = ( DCMI_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; if(hdcmi->DMA_Handle->ErrorCode != HAL_DMA_ERROR_FE) { /* Initialize the DCMI state*/ hdcmi->State = HAL_DCMI_STATE_READY; /* Set DCMI Error Code */ hdcmi->ErrorCode |= HAL_DCMI_ERROR_DMA; } /* DCMI error Callback */ #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1) /*Call registered DCMI error callback*/ hdcmi->ErrorCallback(hdcmi); #else HAL_DCMI_ErrorCallback(hdcmi); #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */ }
/** * @brief DMA error callback * @param hdma: pointer to a DMA_HandleTypeDef structure that contains * the configuration information for the specified DMA module. * @retval None */ static void DCMI_DMAError(DMA_HandleTypeDef *hdma) { DCMI_HandleTypeDef* hdcmi = ( DCMI_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; hdcmi->State= HAL_DCMI_STATE_READY; HAL_DCMI_ErrorCallback(hdcmi); }
/** * @brief Handles DCMI interrupt request. * @param hdcmi: pointer to a DCMI_HandleTypeDef structure that contains * the configuration information for the DCMI. * @retval None */ void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi) { /* Synchronization error interrupt management *******************************/ if(__HAL_DCMI_GET_FLAG(hdcmi, DCMI_FLAG_ERRRI) != RESET) { if(__HAL_DCMI_GET_IT_SOURCE(hdcmi, DCMI_IT_ERR) != RESET) { /* Disable the Synchronization error interrupt */ __HAL_DCMI_DISABLE_IT(hdcmi, DCMI_IT_ERR); /* Clear the Synchronization error flag */ __HAL_DCMI_CLEAR_FLAG(hdcmi, DCMI_FLAG_ERRRI); /* Update error code */ hdcmi->ErrorCode |= HAL_DCMI_ERROR_SYNC; /* Change DCMI state */ hdcmi->State = HAL_DCMI_STATE_ERROR; /* Process Unlocked */ __HAL_UNLOCK(hdcmi); /* Abort the DMA Transfer */ HAL_DMA_Abort(hdcmi->DMA_Handle); /* Synchronization error Callback */ HAL_DCMI_ErrorCallback(hdcmi); } } /* Overflow interrupt management ********************************************/ if(__HAL_DCMI_GET_FLAG(hdcmi, DCMI_FLAG_OVFRI) != RESET) { if(__HAL_DCMI_GET_IT_SOURCE(hdcmi, DCMI_IT_OVF) != RESET) { /* Disable the Overflow interrupt */ __HAL_DCMI_DISABLE_IT(hdcmi, DCMI_IT_OVF); /* Clear the Overflow flag */ __HAL_DCMI_CLEAR_FLAG(hdcmi, DCMI_FLAG_OVFRI); /* Update error code */ hdcmi->ErrorCode |= HAL_DCMI_ERROR_OVF; /* Change DCMI state */ hdcmi->State = HAL_DCMI_STATE_ERROR; /* Process Unlocked */ __HAL_UNLOCK(hdcmi); /* Abort the DMA Transfer */ HAL_DMA_Abort(hdcmi->DMA_Handle); /* Overflow Callback */ HAL_DCMI_ErrorCallback(hdcmi); } } /* Line Interrupt management ************************************************/ if(__HAL_DCMI_GET_FLAG(hdcmi, DCMI_FLAG_LINERI) != RESET) { if(__HAL_DCMI_GET_IT_SOURCE(hdcmi, DCMI_IT_LINE) != RESET) { /* Clear the Line interrupt flag */ __HAL_DCMI_CLEAR_FLAG(hdcmi, DCMI_FLAG_LINERI); /* Process Unlocked */ __HAL_UNLOCK(hdcmi); /* Line interrupt Callback */ HAL_DCMI_LineEventCallback(hdcmi); } } /* VSYNC interrupt management ***********************************************/ if(__HAL_DCMI_GET_FLAG(hdcmi, DCMI_FLAG_VSYNCRI) != RESET) { if(__HAL_DCMI_GET_IT_SOURCE(hdcmi, DCMI_IT_VSYNC) != RESET) { /* Disable the VSYNC interrupt */ __HAL_DCMI_DISABLE_IT(hdcmi, DCMI_IT_VSYNC); /* Clear the VSYNC flag */ __HAL_DCMI_CLEAR_FLAG(hdcmi, DCMI_FLAG_VSYNCRI); /* Process Unlocked */ __HAL_UNLOCK(hdcmi); /* VSYNC Callback */ HAL_DCMI_VsyncEventCallback(hdcmi); } } /* End of Frame interrupt management ****************************************/ if(__HAL_DCMI_GET_FLAG(hdcmi, DCMI_FLAG_FRAMERI) != RESET) { if(__HAL_DCMI_GET_IT_SOURCE(hdcmi, DCMI_IT_FRAME) != RESET) { /* Disable the End of Frame interrupt */ __HAL_DCMI_DISABLE_IT(hdcmi, DCMI_IT_FRAME); /* Clear the End of Frame flag */ __HAL_DCMI_CLEAR_FLAG(hdcmi, DCMI_FLAG_FRAMERI); /* Process Unlocked */ __HAL_UNLOCK(hdcmi); /* End of Frame Callback */ HAL_DCMI_FrameEventCallback(hdcmi); } } }