mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
lib/stm32: Pass DCMI handle to DCMI_DMAConvCpltUser.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
parent
c8a486cbda
commit
9f98ac73a0
@ -1114,12 +1114,6 @@ HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCM
|
||||
/** @defgroup DCMI_Private_Functions DCMI Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
__weak void DCMI_DMAConvCpltUser(uint32_t addr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DMA conversion complete callback.
|
||||
* @param hdma pointer to a DMA_HandleTypeDef structure that contains
|
||||
@ -1129,28 +1123,30 @@ __weak void DCMI_DMAConvCpltUser(uint32_t addr)
|
||||
static void DCMI_DMAXferCplt(DMA_HandleTypeDef *hdma)
|
||||
{
|
||||
DCMI_HandleTypeDef* hdcmi;
|
||||
DMA_Stream_TypeDef *stream;
|
||||
extern void DCMI_DMAConvCpltUser(DCMI_HandleTypeDef* hdcmi, uint32_t addr);
|
||||
|
||||
hdcmi = (DCMI_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
|
||||
hdcmi->State= HAL_DCMI_STATE_READY;
|
||||
stream = (DMA_Stream_TypeDef*) (hdcmi->DMA_Handle->Instance);
|
||||
|
||||
// Note: we don't need to adjust memory addresses because they stay the same.
|
||||
if (hdcmi->XferCount != 0) {
|
||||
hdcmi->XferCount--;
|
||||
}
|
||||
|
||||
if((hdcmi->DMA_Handle->Instance->CR & DMA_SxCR_CT) == 0) {
|
||||
if ((stream->CR & DMA_SxCR_CT) == 0) {
|
||||
// Current traget is M0 call user callback with M1
|
||||
DCMI_DMAConvCpltUser(hdcmi->DMA_Handle->Instance->M1AR);
|
||||
DCMI_DMAConvCpltUser(hdcmi, stream->M1AR);
|
||||
} else {
|
||||
// Current traget is M1 call user callback with M0
|
||||
DCMI_DMAConvCpltUser(hdcmi->DMA_Handle->Instance->M0AR);
|
||||
DCMI_DMAConvCpltUser(hdcmi, stream->M0AR);
|
||||
}
|
||||
|
||||
/* Check if the frame is transferred */
|
||||
if (hdcmi->XferCount == 0) {
|
||||
/* Reload XferCount */
|
||||
hdcmi->XferCount = hdcmi->XferTransferNumber;
|
||||
/* Enable the Frame interrupt */
|
||||
/* Re-enable frame interrupt */
|
||||
__HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_FRAME);
|
||||
|
||||
/* When snapshot mode, set dcmi state to ready */
|
||||
|
@ -800,10 +800,6 @@ __weak void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
|
||||
*/
|
||||
}
|
||||
|
||||
__weak void DCMI_DMAConvCpltUser(uint32_t addr)
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -1168,26 +1164,30 @@ HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCM
|
||||
static void DCMI_DMAXferCplt(DMA_HandleTypeDef *hdma)
|
||||
{
|
||||
DCMI_HandleTypeDef* hdcmi;
|
||||
DMA_Stream_TypeDef *stream;
|
||||
extern void DCMI_DMAConvCpltUser(DCMI_HandleTypeDef* hdcmi, uint32_t addr);
|
||||
|
||||
hdcmi = (DCMI_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
|
||||
stream = (DMA_Stream_TypeDef*) (hdcmi->DMA_Handle->Instance);
|
||||
|
||||
// Note: we don't need to adjust memory addresses because they stay the same.
|
||||
if (hdcmi->XferCount != 0) {
|
||||
hdcmi->XferCount--;
|
||||
}
|
||||
|
||||
if ((hdcmi->DMA_Handle->Instance->CR & DMA_SxCR_CT) == 0) {
|
||||
if ((stream->CR & DMA_SxCR_CT) == 0) {
|
||||
// Current traget is M0 call user callback with M1
|
||||
DCMI_DMAConvCpltUser(hdcmi->DMA_Handle->Instance->M1AR);
|
||||
DCMI_DMAConvCpltUser(hdcmi, stream->M1AR);
|
||||
} else {
|
||||
// Current traget is M1 call user callback with M0
|
||||
DCMI_DMAConvCpltUser(hdcmi->DMA_Handle->Instance->M0AR);
|
||||
DCMI_DMAConvCpltUser(hdcmi, stream->M0AR);
|
||||
}
|
||||
|
||||
/* Check if the frame is transferred */
|
||||
if (hdcmi->XferCount == 0) {
|
||||
/* Reload XferCount */
|
||||
hdcmi->XferCount = hdcmi->XferTransferNumber;
|
||||
/* Enable the Frame interrupt */
|
||||
/* Re-enable frame interrupt */
|
||||
__HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_FRAME);
|
||||
|
||||
/* When snapshot mode, set dcmi state to ready */
|
||||
@ -1196,6 +1196,7 @@ static void DCMI_DMAXferCplt(DMA_HandleTypeDef *hdma)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DMA error callback
|
||||
* @param hdma pointer to a DMA_HandleTypeDef structure that contains
|
||||
|
@ -809,11 +809,6 @@ __weak void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
|
||||
*/
|
||||
}
|
||||
|
||||
__weak void DCMI_DMAConvCpltUser(uint32_t addr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@ -1194,6 +1189,7 @@ static void DCMI_DMAXferCplt(DMA_HandleTypeDef *hdma)
|
||||
{
|
||||
DCMI_HandleTypeDef* hdcmi;
|
||||
DMA_Stream_TypeDef *stream;
|
||||
extern void DCMI_DMAConvCpltUser(DCMI_HandleTypeDef* hdcmi, uint32_t addr);
|
||||
|
||||
hdcmi = (DCMI_HandleTypeDef*) ((DMA_HandleTypeDef*)hdma)->Parent;
|
||||
stream = (DMA_Stream_TypeDef*) (hdcmi->DMA_Handle->Instance);
|
||||
@ -1205,10 +1201,10 @@ static void DCMI_DMAXferCplt(DMA_HandleTypeDef *hdma)
|
||||
|
||||
if ((stream->CR & DMA_SxCR_CT) == 0) {
|
||||
// Current traget is M0 call user callback with M1
|
||||
DCMI_DMAConvCpltUser(stream->M1AR);
|
||||
DCMI_DMAConvCpltUser(hdcmi, stream->M1AR);
|
||||
} else {
|
||||
// Current traget is M1 call user callback with M0
|
||||
DCMI_DMAConvCpltUser(stream->M0AR);
|
||||
DCMI_DMAConvCpltUser(hdcmi, stream->M0AR);
|
||||
}
|
||||
|
||||
/* Check if the frame is transferred */
|
||||
|
Loading…
Reference in New Issue
Block a user