You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

264 lines
9.6 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32wbxx_hal_ipcc.h
  4. * @author MCD Application Team
  5. * @brief Header file of Mailbox HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32WBxx_HAL_IPCC_H
  21. #define STM32WBxx_HAL_IPCC_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32wbxx_hal_def.h"
  27. /** @addtogroup STM32WBxx_HAL_Driver
  28. * @{
  29. */
  30. /** @defgroup IPCC IPCC
  31. * @brief IPCC HAL module driver
  32. * @{
  33. */
  34. /* Exported constants --------------------------------------------------------*/
  35. /** @defgroup IPCC_Exported_Constants IPCC Exported Constants
  36. * @{
  37. */
  38. /** @defgroup IPCC_Channel IPCC Channel
  39. * @{
  40. */
  41. #define IPCC_CHANNEL_1 0x00000000U
  42. #define IPCC_CHANNEL_2 0x00000001U
  43. #define IPCC_CHANNEL_3 0x00000002U
  44. #define IPCC_CHANNEL_4 0x00000003U
  45. #define IPCC_CHANNEL_5 0x00000004U
  46. #define IPCC_CHANNEL_6 0x00000005U
  47. /**
  48. * @}
  49. */
  50. /**
  51. * @}
  52. */
  53. /* Exported types ------------------------------------------------------------*/
  54. /** @defgroup IPCC_Exported_Types IPCC Exported Types
  55. * @{
  56. */
  57. /**
  58. * @brief HAL IPCC State structures definition
  59. */
  60. typedef enum
  61. {
  62. HAL_IPCC_STATE_RESET = 0x00U, /*!< IPCC not yet initialized or disabled */
  63. HAL_IPCC_STATE_READY = 0x01U, /*!< IPCC initialized and ready for use */
  64. HAL_IPCC_STATE_BUSY = 0x02U /*!< IPCC internal processing is ongoing */
  65. } HAL_IPCC_StateTypeDef;
  66. /**
  67. * @brief IPCC channel direction structure definition
  68. */
  69. typedef enum
  70. {
  71. IPCC_CHANNEL_DIR_TX = 0x00U, /*!< Channel direction Tx is used by an MCU to transmit */
  72. IPCC_CHANNEL_DIR_RX = 0x01U /*!< Channel direction Rx is used by an MCU to receive */
  73. } IPCC_CHANNELDirTypeDef;
  74. /**
  75. * @brief IPCC channel status structure definition
  76. */
  77. typedef enum
  78. {
  79. IPCC_CHANNEL_STATUS_FREE = 0x00U, /*!< Means that a new msg can be posted on that channel */
  80. IPCC_CHANNEL_STATUS_OCCUPIED = 0x01U /*!< An MCU has posted a msg the other MCU hasn't retrieved */
  81. } IPCC_CHANNELStatusTypeDef;
  82. /**
  83. * @brief IPCC handle structure definition
  84. */
  85. typedef struct __IPCC_HandleTypeDef
  86. {
  87. IPCC_TypeDef *Instance; /*!< IPCC registers base address */
  88. void (* ChannelCallbackRx[IPCC_CHANNEL_NUMBER])(struct __IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir); /*!< Rx Callback registration table */
  89. void (* ChannelCallbackTx[IPCC_CHANNEL_NUMBER])(struct __IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir); /*!< Tx Callback registration table */
  90. uint32_t callbackRequest; /*!< Store information about callback notification by channel */
  91. __IO HAL_IPCC_StateTypeDef State; /*!< IPCC State: initialized or not */
  92. } IPCC_HandleTypeDef;
  93. /**
  94. * @brief IPCC callback typedef
  95. */
  96. typedef void ChannelCb(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
  97. /**
  98. * @}
  99. */
  100. /* Exported macros -----------------------------------------------------------*/
  101. /** @defgroup IPCC_Exported_Macros IPCC Exported Macros
  102. * @{
  103. */
  104. /**
  105. * @brief Enable the specified interrupt.
  106. * @param __HANDLE__ specifies the IPCC Handle
  107. * @param __CHDIRECTION__ specifies the channels Direction
  108. * This parameter can be one of the following values:
  109. * @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  110. * @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  111. */
  112. #define __HAL_IPCC_ENABLE_IT(__HANDLE__, __CHDIRECTION__) \
  113. (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
  114. ((__HANDLE__)->Instance->C1CR |= IPCC_C1CR_RXOIE) : \
  115. ((__HANDLE__)->Instance->C1CR |= IPCC_C1CR_TXFIE))
  116. /**
  117. * @brief Disable the specified interrupt.
  118. * @param __HANDLE__ specifies the IPCC Handle
  119. * @param __CHDIRECTION__ specifies the channels Direction
  120. * This parameter can be one of the following values:
  121. * @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  122. * @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  123. */
  124. #define __HAL_IPCC_DISABLE_IT(__HANDLE__, __CHDIRECTION__) \
  125. (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
  126. ((__HANDLE__)->Instance->C1CR &= ~IPCC_C1CR_RXOIE) : \
  127. ((__HANDLE__)->Instance->C1CR &= ~IPCC_C1CR_TXFIE))
  128. /**
  129. * @brief Mask the specified interrupt.
  130. * @param __HANDLE__ specifies the IPCC Handle
  131. * @param __CHDIRECTION__ specifies the channels Direction
  132. * This parameter can be one of the following values:
  133. * @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  134. * @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  135. * @param __CHINDEX__ specifies the channels number:
  136. * This parameter can be one of the following values:
  137. * @arg IPCC_CHANNEL_1: IPCC Channel 1
  138. * @arg IPCC_CHANNEL_2: IPCC Channel 2
  139. * @arg IPCC_CHANNEL_3: IPCC Channel 3
  140. * @arg IPCC_CHANNEL_4: IPCC Channel 4
  141. * @arg IPCC_CHANNEL_5: IPCC Channel 5
  142. * @arg IPCC_CHANNEL_6: IPCC Channel 6
  143. */
  144. #define __HAL_IPCC_MASK_CHANNEL_IT(__HANDLE__, __CHDIRECTION__, __CHINDEX__) \
  145. (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
  146. ((__HANDLE__)->Instance->C1MR |= (IPCC_C1MR_CH1OM_Msk << (__CHINDEX__))) : \
  147. ((__HANDLE__)->Instance->C1MR |= (IPCC_C1MR_CH1FM_Msk << (__CHINDEX__))))
  148. /**
  149. * @brief Unmask the specified interrupt.
  150. * @param __HANDLE__ specifies the IPCC Handle
  151. * @param __CHDIRECTION__ specifies the channels Direction
  152. * This parameter can be one of the following values:
  153. * @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  154. * @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  155. * @param __CHINDEX__ specifies the channels number:
  156. * This parameter can be one of the following values:
  157. * @arg IPCC_CHANNEL_1: IPCC Channel 1
  158. * @arg IPCC_CHANNEL_2: IPCC Channel 2
  159. * @arg IPCC_CHANNEL_3: IPCC Channel 3
  160. * @arg IPCC_CHANNEL_4: IPCC Channel 4
  161. * @arg IPCC_CHANNEL_5: IPCC Channel 5
  162. * @arg IPCC_CHANNEL_6: IPCC Channel 6
  163. */
  164. #define __HAL_IPCC_UNMASK_CHANNEL_IT(__HANDLE__, __CHDIRECTION__, __CHINDEX__) \
  165. (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
  166. ((__HANDLE__)->Instance->C1MR &= ~(IPCC_C1MR_CH1OM_Msk << (__CHINDEX__))) : \
  167. ((__HANDLE__)->Instance->C1MR &= ~(IPCC_C1MR_CH1FM_Msk << (__CHINDEX__))))
  168. /**
  169. * @}
  170. */
  171. /* Exported functions --------------------------------------------------------*/
  172. /** @defgroup IPCC_Exported_Functions IPCC Exported Functions
  173. * @{
  174. */
  175. /* Initialization and de-initialization functions *******************************/
  176. /** @defgroup IPCC_Exported_Functions_Group1 Initialization and deinitialization functions
  177. * @{
  178. */
  179. HAL_StatusTypeDef HAL_IPCC_Init(IPCC_HandleTypeDef *hipcc);
  180. HAL_StatusTypeDef HAL_IPCC_DeInit(IPCC_HandleTypeDef *hipcc);
  181. void HAL_IPCC_MspInit(IPCC_HandleTypeDef *hipcc);
  182. void HAL_IPCC_MspDeInit(IPCC_HandleTypeDef *hipcc);
  183. /**
  184. * @}
  185. */
  186. /** @defgroup IPCC_Exported_Functions_Group2 Communication functions
  187. * @{
  188. */
  189. /* IO operation functions *****************************************************/
  190. HAL_StatusTypeDef HAL_IPCC_ActivateNotification(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir, ChannelCb cb);
  191. HAL_StatusTypeDef HAL_IPCC_DeActivateNotification(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
  192. IPCC_CHANNELStatusTypeDef HAL_IPCC_GetChannelStatus(IPCC_HandleTypeDef const *const hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
  193. HAL_StatusTypeDef HAL_IPCC_NotifyCPU(IPCC_HandleTypeDef const *const hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
  194. /**
  195. * @}
  196. */
  197. /** @defgroup IPCC_Exported_Functions_Group3 Peripheral State and Error functions
  198. * @{
  199. */
  200. /* Peripheral State and Error functions ****************************************/
  201. HAL_IPCC_StateTypeDef HAL_IPCC_GetState(IPCC_HandleTypeDef const *const hipcc);
  202. /**
  203. * @}
  204. */
  205. /** @defgroup IPCC_IRQ_Handler_and_Callbacks Peripheral IRQ Handler and Callbacks
  206. * @{
  207. */
  208. /* IRQHandler and Callbacks used in non blocking modes ************************/
  209. void HAL_IPCC_TX_IRQHandler(IPCC_HandleTypeDef *const hipcc);
  210. void HAL_IPCC_RX_IRQHandler(IPCC_HandleTypeDef *const hipcc);
  211. void HAL_IPCC_TxCallback(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
  212. void HAL_IPCC_RxCallback(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
  213. /**
  214. * @}
  215. */
  216. /**
  217. * @}
  218. */
  219. /**
  220. * @}
  221. */
  222. /**
  223. * @}
  224. */
  225. #ifdef __cplusplus
  226. }
  227. #endif
  228. #endif /* STM32WBxx_HAL_IPCC_H */
  229. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/