Welcome to mirror list, hosted at ThFree Co, Russian Federation.

stm32wbxx_hal_ipcc.h « Inc « STM32WBxx_HAL_Driver « Drivers - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6088c9e33dc6804c3643336cb0ce2ffd8c0e6fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
/**
  ******************************************************************************
  * @file    stm32wbxx_hal_ipcc.h
  * @author  MCD Application Team
  * @brief   Header file of Mailbox HAL module.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under BSD 3-Clause license,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        opensource.org/licenses/BSD-3-Clause
  *
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef STM32WBxx_HAL_IPCC_H
#define STM32WBxx_HAL_IPCC_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32wbxx_hal_def.h"

#if defined(IPCC)

/** @addtogroup STM32WBxx_HAL_Driver
  * @{
  */

/** @defgroup IPCC IPCC
  * @brief IPCC HAL module driver
  * @{
  */

/* Exported constants --------------------------------------------------------*/

/** @defgroup IPCC_Exported_Constants IPCC Exported Constants
  * @{
  */

/** @defgroup IPCC_Channel IPCC Channel
  * @{
  */
#define IPCC_CHANNEL_1 0x00000000U
#define IPCC_CHANNEL_2 0x00000001U
#define IPCC_CHANNEL_3 0x00000002U
#define IPCC_CHANNEL_4 0x00000003U
#define IPCC_CHANNEL_5 0x00000004U
#define IPCC_CHANNEL_6 0x00000005U
/**
  * @}
  */

/**
  * @}
  */

/* Exported types ------------------------------------------------------------*/
/** @defgroup IPCC_Exported_Types IPCC Exported Types
  * @{
  */

/**
  * @brief HAL IPCC State structures definition
  */
typedef enum
{
  HAL_IPCC_STATE_RESET             = 0x00U,  /*!< IPCC not yet initialized or disabled  */
  HAL_IPCC_STATE_READY             = 0x01U,  /*!< IPCC initialized and ready for use    */
  HAL_IPCC_STATE_BUSY              = 0x02U   /*!< IPCC internal processing is ongoing   */
} HAL_IPCC_StateTypeDef;

/**
  * @brief  IPCC channel direction structure definition
  */
typedef enum
{
  IPCC_CHANNEL_DIR_TX  = 0x00U,  /*!< Channel direction Tx is used by an MCU to transmit */
  IPCC_CHANNEL_DIR_RX  = 0x01U   /*!< Channel direction Rx is used by an MCU to receive */
} IPCC_CHANNELDirTypeDef;

/**
  * @brief  IPCC channel status structure definition
  */
typedef enum
{
  IPCC_CHANNEL_STATUS_FREE       = 0x00U,  /*!< Means that a new msg can be posted on that channel */
  IPCC_CHANNEL_STATUS_OCCUPIED   = 0x01U   /*!< An MCU has posted a msg the other MCU hasn't retrieved */
} IPCC_CHANNELStatusTypeDef;

/**
  * @brief  IPCC handle structure definition
  */
typedef struct __IPCC_HandleTypeDef
{
  IPCC_TypeDef                   *Instance;     /*!< IPCC registers base address */
  void (* ChannelCallbackRx[IPCC_CHANNEL_NUMBER])(struct __IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);                            /*!< Rx Callback registration table */
  void (* ChannelCallbackTx[IPCC_CHANNEL_NUMBER])(struct __IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);                            /*!< Tx Callback registration table */
  uint32_t                       callbackRequest; /*!< Store information about callback notification by channel */
  __IO HAL_IPCC_StateTypeDef      State;         /*!< IPCC State: initialized or not */
} IPCC_HandleTypeDef;

/**
  * @brief  IPCC callback typedef
  */
typedef void ChannelCb(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);

/**
  * @}
  */

/* Exported macros -----------------------------------------------------------*/
/** @defgroup IPCC_Exported_Macros IPCC Exported Macros
  * @{
  */

/**
  * @brief  Enable the specified interrupt.
  * @param  __HANDLE__ specifies the IPCC Handle
  * @param  __CHDIRECTION__ specifies the channels Direction
  *          This parameter can be one of the following values:
  *            @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  *            @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  */
#define __HAL_IPCC_ENABLE_IT(__HANDLE__, __CHDIRECTION__) \
            (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
                ((__HANDLE__)->Instance->C1CR |= IPCC_C1CR_RXOIE) : \
                ((__HANDLE__)->Instance->C1CR |= IPCC_C1CR_TXFIE))

/**
  * @brief  Disable the specified interrupt.
  * @param  __HANDLE__ specifies the IPCC Handle
  * @param  __CHDIRECTION__ specifies the channels Direction
  *          This parameter can be one of the following values:
  *            @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  *            @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  */
#define __HAL_IPCC_DISABLE_IT(__HANDLE__, __CHDIRECTION__) \
            (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
                ((__HANDLE__)->Instance->C1CR &= ~IPCC_C1CR_RXOIE) : \
                ((__HANDLE__)->Instance->C1CR &= ~IPCC_C1CR_TXFIE))

/**
  * @brief  Mask the specified interrupt.
  * @param  __HANDLE__ specifies the IPCC Handle
  * @param  __CHDIRECTION__ specifies the channels Direction
  *          This parameter can be one of the following values:
  *            @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  *            @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  * @param  __CHINDEX__ specifies the channels number:
  *         This parameter can be one of the following values:
  *            @arg IPCC_CHANNEL_1: IPCC Channel 1
  *            @arg IPCC_CHANNEL_2: IPCC Channel 2
  *            @arg IPCC_CHANNEL_3: IPCC Channel 3
  *            @arg IPCC_CHANNEL_4: IPCC Channel 4
  *            @arg IPCC_CHANNEL_5: IPCC Channel 5
  *            @arg IPCC_CHANNEL_6: IPCC Channel 6
  */
#define __HAL_IPCC_MASK_CHANNEL_IT(__HANDLE__, __CHDIRECTION__, __CHINDEX__) \
            (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
                ((__HANDLE__)->Instance->C1MR |= (IPCC_C1MR_CH1OM_Msk << (__CHINDEX__))) : \
                ((__HANDLE__)->Instance->C1MR |= (IPCC_C1MR_CH1FM_Msk << (__CHINDEX__))))

/**
  * @brief  Unmask the specified interrupt.
  * @param  __HANDLE__ specifies the IPCC Handle
  * @param  __CHDIRECTION__ specifies the channels Direction
  *          This parameter can be one of the following values:
  *            @arg @ref IPCC_CHANNEL_DIR_TX Transmit channel free interrupt enable
  *            @arg @ref IPCC_CHANNEL_DIR_RX Receive channel occupied interrupt enable
  * @param  __CHINDEX__ specifies the channels number:
  *         This parameter can be one of the following values:
  *            @arg IPCC_CHANNEL_1: IPCC Channel 1
  *            @arg IPCC_CHANNEL_2: IPCC Channel 2
  *            @arg IPCC_CHANNEL_3: IPCC Channel 3
  *            @arg IPCC_CHANNEL_4: IPCC Channel 4
  *            @arg IPCC_CHANNEL_5: IPCC Channel 5
  *            @arg IPCC_CHANNEL_6: IPCC Channel 6
  */
#define __HAL_IPCC_UNMASK_CHANNEL_IT(__HANDLE__, __CHDIRECTION__, __CHINDEX__) \
            (((__CHDIRECTION__) == IPCC_CHANNEL_DIR_RX) ? \
                ((__HANDLE__)->Instance->C1MR &= ~(IPCC_C1MR_CH1OM_Msk << (__CHINDEX__))) : \
                ((__HANDLE__)->Instance->C1MR &= ~(IPCC_C1MR_CH1FM_Msk << (__CHINDEX__))))

/**
  * @}
  */

/* Exported functions --------------------------------------------------------*/
/** @defgroup IPCC_Exported_Functions IPCC Exported Functions
  * @{
  */

/* Initialization and de-initialization functions *******************************/
/** @defgroup IPCC_Exported_Functions_Group1 Initialization and deinitialization functions
 *  @{
 */
HAL_StatusTypeDef HAL_IPCC_Init(IPCC_HandleTypeDef *hipcc);
HAL_StatusTypeDef HAL_IPCC_DeInit(IPCC_HandleTypeDef *hipcc);
void HAL_IPCC_MspInit(IPCC_HandleTypeDef *hipcc);
void HAL_IPCC_MspDeInit(IPCC_HandleTypeDef *hipcc);
/**
  * @}
  */

/** @defgroup IPCC_Exported_Functions_Group2 Communication functions
 *  @{
 */
/* IO operation functions  *****************************************************/
HAL_StatusTypeDef HAL_IPCC_ActivateNotification(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir, ChannelCb cb);
HAL_StatusTypeDef HAL_IPCC_DeActivateNotification(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
IPCC_CHANNELStatusTypeDef HAL_IPCC_GetChannelStatus(IPCC_HandleTypeDef const *const hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
HAL_StatusTypeDef HAL_IPCC_NotifyCPU(IPCC_HandleTypeDef const *const hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
/**
  * @}
  */

/** @defgroup IPCC_Exported_Functions_Group3 Peripheral State and Error functions
 *  @{
 */
/* Peripheral State and Error functions ****************************************/
HAL_IPCC_StateTypeDef HAL_IPCC_GetState(IPCC_HandleTypeDef const *const hipcc);
/**
  * @}
  */

/** @defgroup IPCC_IRQ_Handler_and_Callbacks Peripheral IRQ Handler and Callbacks
 *  @{
 */
/* IRQHandler and Callbacks used in non blocking modes  ************************/
void HAL_IPCC_TX_IRQHandler(IPCC_HandleTypeDef   *const hipcc);
void HAL_IPCC_RX_IRQHandler(IPCC_HandleTypeDef *const hipcc);
void HAL_IPCC_TxCallback(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
void HAL_IPCC_RxCallback(IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */
#endif /* IPCC */

#ifdef __cplusplus
}
#endif

#endif /* STM32WBxx_HAL_IPCC_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/