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.
 
 
 

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