Skip to content

STM32F4 - FIX to add the update of hdma->State variable #3424

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)

/* Update error code */
hdma->ErrorCode |= HAL_DMA_ERROR_TE;

/* Change the DMA state */
hdma->State = HAL_DMA_STATE_ERROR; // FIX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit pick: is the // FIX comment a convention you use? It seems a bit nondescript.

I would either leave the comment out or add more description to it. (same goes for the other // FIX comments)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I know... I have added this in order to see where we have modified the original ST HAL file...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the clarification @bcostm

}
}
/* FIFO Error Interrupt management ******************************************/
Expand All @@ -773,6 +776,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)

/* Update error code */
hdma->ErrorCode |= HAL_DMA_ERROR_FE;

/* Change the DMA state */
hdma->State = HAL_DMA_STATE_ERROR; // FIX
}
}
/* Direct Mode Error Interrupt management ***********************************/
Expand All @@ -785,6 +791,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)

/* Update error code */
hdma->ErrorCode |= HAL_DMA_ERROR_DME;

/* Change the DMA state */
hdma->State = HAL_DMA_STATE_ERROR; // FIX
}
}
/* Half Transfer Complete Interrupt management ******************************/
Expand All @@ -801,6 +810,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
/* Current memory buffer used is Memory 0 */
if((hdma->Instance->CR & DMA_SxCR_CT) == RESET)
{
/* Change DMA peripheral state */
hdma->State = HAL_DMA_STATE_READY_HALF_MEM0; // FIX

if(hdma->XferHalfCpltCallback != NULL)
{
/* Half transfer callback */
Expand All @@ -810,6 +822,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
/* Current memory buffer used is Memory 1 */
else
{
/* Change DMA peripheral state */
hdma->State = HAL_DMA_STATE_READY_HALF_MEM1; // FIX

if(hdma->XferM1HalfCpltCallback != NULL)
{
/* Half transfer callback */
Expand All @@ -826,6 +841,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
hdma->Instance->CR &= ~(DMA_IT_HT);
}

/* Change DMA peripheral state */
hdma->State = HAL_DMA_STATE_READY_HALF_MEM0; // FIX

if(hdma->XferHalfCpltCallback != NULL)
{
/* Half transfer callback */
Expand Down Expand Up @@ -874,6 +892,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
/* Current memory buffer used is Memory 0 */
if((hdma->Instance->CR & DMA_SxCR_CT) == RESET)
{
/* Change DMA peripheral state */
hdma->State = HAL_DMA_STATE_READY_MEM1; // FIX

if(hdma->XferM1CpltCallback != NULL)
{
/* Transfer complete Callback for memory1 */
Expand All @@ -883,6 +904,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
/* Current memory buffer used is Memory 1 */
else
{
/* Change DMA peripheral state */
hdma->State = HAL_DMA_STATE_READY_MEM0; // FIX

if(hdma->XferCpltCallback != NULL)
{
/* Transfer complete Callback for memory0 */
Expand All @@ -893,6 +917,9 @@ void HAL_DMA_IRQHandler(DMA_HandleTypeDef *hdma)
/* Disable the transfer complete interrupt if the DMA mode is not CIRCULAR */
else
{
/* Change DMA peripheral state */
hdma->State = HAL_DMA_STATE_READY_MEM0; // FIX

if((hdma->Instance->CR & DMA_SxCR_CIRC) == RESET)
{
/* Disable the transfer complete interrupt */
Expand Down
6 changes: 6 additions & 0 deletions targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ typedef enum
{
HAL_DMA_STATE_RESET = 0x00U, /*!< DMA not yet initialized or disabled */
HAL_DMA_STATE_READY = 0x01U, /*!< DMA initialized and ready for use */
HAL_DMA_STATE_READY_MEM0 = 0x11U, /*!< DMA Mem0 process success */ // FIX
HAL_DMA_STATE_READY_MEM1 = 0x21U, /*!< DMA Mem1 process success */ // FIX
HAL_DMA_STATE_READY_HALF_MEM0 = 0x31U, /*!< DMA Mem0 Half process success */ // FIX
HAL_DMA_STATE_READY_HALF_MEM1 = 0x41U, /*!< DMA Mem1 Half process success */ // FIX
HAL_DMA_STATE_BUSY = 0x02U, /*!< DMA process is ongoing */
HAL_DMA_STATE_BUSY_MEM0 = 0x12U, /*!< DMA Mem0 process is ongoing */ // FIX
HAL_DMA_STATE_BUSY_MEM1 = 0x22U, /*!< DMA Mem1 process is ongoing */ // FIX
HAL_DMA_STATE_TIMEOUT = 0x03U, /*!< DMA timeout state */
HAL_DMA_STATE_ERROR = 0x04U, /*!< DMA error state */
HAL_DMA_STATE_ABORT = 0x05U, /*!< DMA Abort state */
Expand Down