[Cryptech-Commits] [sw/stm32] 10/11: Split HAL_UART_RxCpltCallback into uart-specific callbacks.

git at cryptech.is git at cryptech.is
Mon Jun 6 18:32:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/stm32.

commit 89e6d25569bcc112b014d81368f90ca2fa4ae06a
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Mon Jun 6 12:13:10 2016 -0400

    Split HAL_UART_RxCpltCallback into uart-specific callbacks.
---
 .../TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c           | 58 ++++++++++++++++++----
 1 file changed, 47 insertions(+), 11 deletions(-)

diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c
index b3de408..f9f21ef 100644
--- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c
+++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c
@@ -44,6 +44,11 @@
 /*            Cortex-M4 Processor Exceptions Handlers                         */
 /******************************************************************************/
 
+/*
+ * We define these to make debugging easier, because otherwise gdb reports
+ * HardFault_Handler as WWDG_IRQHandler.
+ */
+
 /**
  * @brief   This function handles NMI exception.
  * @param  None
@@ -145,10 +150,26 @@ void SysTick_Handler(void)
 /******************************************************************************/
 
 /**
+* @brief This function handles DMA1 stream5 global interrupt.
+*/
+void DMA1_Stream5_IRQHandler(void)
+{
+    HAL_DMA_IRQHandler(&hdma_usart_user_rx);
+}
+
+/**
+* @brief This function handles DMA2 stream2 global interrupt.
+*/
+void DMA2_Stream2_IRQHandler(void)
+{
+    HAL_DMA_IRQHandler(&hdma_usart_mgmt_rx);
+}
+
+/**
  * @brief  This function handles UART interrupt request.
  * @param  None
  * @retval None
- * @Note   HAL_UART_IRQHandler will call HAL_UART_TxCpltCallback in main.c.
+ * @Note   HAL_UART_IRQHandler will call HAL_UART_RxCpltCallback in main.c.
  */
 void USART1_IRQHandler(void)
 {
@@ -159,28 +180,43 @@ void USART1_IRQHandler(void)
  * @brief  This function handles UART interrupt request.
  * @param  None
  * @retval None
- * @Note   HAL_UART_IRQHandler will call HAL_UART_TxCpltCallback in main.c.
+ * @Note   HAL_UART_IRQHandler will call HAL_UART_RxCpltCallback in main.c.
  */
 void USART2_IRQHandler(void)
 {
     HAL_UART_IRQHandler(&huart_user);
 }
 
-/**
-* @brief This function handles DMA1 stream5 global interrupt.
-*/
-void DMA1_Stream5_IRQHandler(void)
+void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
 {
-    HAL_DMA_IRQHandler(&hdma_usart_user_rx);
+    extern void HAL_UART1_RxCpltCallback(UART_HandleTypeDef *huart);
+    extern void HAL_UART2_RxCpltCallback(UART_HandleTypeDef *huart);
+
+    if (huart->Instance == USART1)
+        HAL_UART1_RxCpltCallback(huart);
+
+    else if (huart->Instance == USART2)
+        HAL_UART2_RxCpltCallback(huart);
 }
 
 /**
-* @brief This function handles DMA2 stream2 global interrupt.
-*/
-void DMA2_Stream2_IRQHandler(void)
+  * @brief  Rx Transfer completed callbacks.
+  * @param  huart: pointer to a UART_HandleTypeDef structure that contains
+  *                the configuration information for the specified UART module.
+  * @retval None
+  */
+__weak void HAL_UART1_RxCpltCallback(UART_HandleTypeDef *huart)
 {
-    HAL_DMA_IRQHandler(&hdma_usart_mgmt_rx);
+  /* NOTE: This function Should not be modified, when the callback is needed,
+           the HAL_UART_TxCpltCallback could be implemented in the user file
+   */
 }
 
+__weak void HAL_UART2_RxCpltCallback(UART_HandleTypeDef *huart)
+{
+  /* NOTE: This function Should not be modified, when the callback is needed,
+           the HAL_UART_TxCpltCallback could be implemented in the user file
+   */
+}
 
 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/



More information about the Commits mailing list