Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 3 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /** |
1 | /** |
| 2 | ****************************************************************************** |
2 | ****************************************************************************** |
| 3 | * @file stm32f1xx_hal_cec.h |
3 | * @file stm32f1xx_hal_cec.h |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief Header file of CEC HAL module. |
5 | * @brief Header file of CEC HAL module. |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
9 | * Copyright (c) 2016 STMicroelectronics. |
| 10 | * All rights reserved.</center></h2> |
10 | * All rights reserved. |
| 11 | * |
11 | * |
| 12 | * This software component is licensed by ST under BSD 3-Clause license, |
12 | * This software is licensed under terms that can be found in the LICENSE file |
| 13 | * the "License"; You may not use this file except in compliance with the |
13 | * in the root directory of this software component. |
| 14 | * License. You may obtain a copy of the License at: |
14 | * If no LICENSE file comes with this software, it is provided AS-IS. |
| 15 | * opensource.org/licenses/BSD-3-Clause |
15 | * |
| 16 | * |
16 | ****************************************************************************** |
| 17 | ****************************************************************************** |
17 | */ |
| 18 | */ |
18 | |
| 19 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ |
|
| 20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | #ifndef __STM32F1xx_HAL_CEC_H |
| 21 | #ifndef __STM32F1xx_HAL_CEC_H |
21 | #define __STM32F1xx_HAL_CEC_H |
| 22 | #define __STM32F1xx_HAL_CEC_H |
22 | |
| 23 | 23 | #ifdef __cplusplus |
|
| 24 | #ifdef __cplusplus |
24 | extern "C" { |
| 25 | extern "C" { |
25 | #endif |
| 26 | #endif |
26 | |
| 27 | 27 | /* Includes ------------------------------------------------------------------*/ |
|
| 28 | /* Includes ------------------------------------------------------------------*/ |
28 | #include "stm32f1xx_hal_def.h" |
| 29 | #include "stm32f1xx_hal_def.h" |
29 | |
| 30 | 30 | #if defined (CEC) |
|
| 31 | #if defined (CEC) |
31 | |
| 32 | 32 | /** @addtogroup STM32F1xx_HAL_Driver |
|
| 33 | /** @addtogroup STM32F1xx_HAL_Driver |
33 | * @{ |
| 34 | * @{ |
34 | */ |
| 35 | */ |
35 | |
| 36 | 36 | /** @addtogroup CEC |
|
| 37 | /** @addtogroup CEC |
37 | * @{ |
| 38 | * @{ |
38 | */ |
| 39 | */ |
39 | |
| 40 | 40 | /* Exported types ------------------------------------------------------------*/ |
|
| 41 | /* Exported types ------------------------------------------------------------*/ |
41 | /** @defgroup CEC_Exported_Types CEC Exported Types |
| 42 | /** @defgroup CEC_Exported_Types CEC Exported Types |
42 | * @{ |
| 43 | * @{ |
43 | */ |
| 44 | */ |
44 | |
| 45 | /** |
45 | /** |
| 46 | * @brief CEC Init Structure definition |
46 | * @brief CEC Init Structure definition |
| 47 | */ |
47 | */ |
| 48 | typedef struct |
48 | typedef struct |
| 49 | { |
49 | { |
| 50 | uint32_t TimingErrorFree; /*!< Configures the CEC Bit Timing Error Mode. |
50 | uint32_t TimingErrorFree; /*!< Configures the CEC Bit Timing Error Mode. |
| 51 | This parameter can be a value of @ref CEC_BitTimingErrorMode */ |
51 | This parameter can be a value of CEC_BitTimingErrorMode */ |
| 52 | uint32_t PeriodErrorFree; /*!< Configures the CEC Bit Period Error Mode. |
52 | |
| 53 | This parameter can be a value of @ref CEC_BitPeriodErrorMode */ |
53 | uint32_t PeriodErrorFree; /*!< Configures the CEC Bit Period Error Mode. |
| 54 | uint16_t OwnAddress; /*!< Own addresses configuration |
54 | This parameter can be a value of CEC_BitPeriodErrorMode */ |
| 55 | This parameter can be a value of @ref CEC_OWN_ADDRESS */ |
55 | |
| 56 | uint8_t *RxBuffer; /*!< CEC Rx buffer pointeur */ |
56 | uint16_t OwnAddress; /*!< Own addresses configuration |
| 57 | }CEC_InitTypeDef; |
57 | This parameter can be a value of @ref CEC_OWN_ADDRESS */ |
| 58 | 58 | ||
| 59 | /** |
59 | uint8_t *RxBuffer; /*!< CEC Rx buffer pointer */ |
| 60 | * @brief HAL CEC State structures definition |
60 | } CEC_InitTypeDef; |
| 61 | * @note HAL CEC State value is a combination of 2 different substates: gState and RxState. |
61 | |
| 62 | * - gState contains CEC state information related to global Handle management |
62 | /** |
| 63 | * and also information related to Tx operations. |
63 | * @brief HAL CEC State definition |
| 64 | * gState value coding follow below described bitmap : |
64 | * @note HAL CEC State value is a combination of 2 different substates: gState and RxState |
| 65 | * b7 (not used) |
65 | (see @ref CEC_State_Definition). |
| 66 | * x : Should be set to 0 |
66 | * - gState contains CEC state information related to global Handle management |
| 67 | * b6 Error information |
67 | * and also information related to Tx operations. |
| 68 | * 0 : No Error |
68 | * gState value coding follow below described bitmap : |
| 69 | * 1 : Error |
69 | * b7 (not used) |
| 70 | * b5 IP initilisation status |
70 | * x : Should be set to 0 |
| 71 | * 0 : Reset (IP not initialized) |
71 | * b6 Error information |
| 72 | * 1 : Init done (IP initialized. HAL CEC Init function already called) |
72 | * 0 : No Error |
| 73 | * b4-b3 (not used) |
73 | * 1 : Error |
| 74 | * xx : Should be set to 00 |
74 | * b5 CEC peripheral initialization status |
| 75 | * b2 Intrinsic process state |
75 | * 0 : Reset (peripheral not initialized) |
| 76 | * 0 : Ready |
76 | * 1 : Init done (peripheral initialized. HAL CEC Init function already called) |
| 77 | * 1 : Busy (IP busy with some configuration or internal operations) |
77 | * b4-b3 (not used) |
| 78 | * b1 (not used) |
78 | * xx : Should be set to 00 |
| 79 | * x : Should be set to 0 |
79 | * b2 Intrinsic process state |
| 80 | * b0 Tx state |
80 | * 0 : Ready |
| 81 | * 0 : Ready (no Tx operation ongoing) |
81 | * 1 : Busy (peripheral busy with some configuration or internal operations) |
| 82 | * 1 : Busy (Tx operation ongoing) |
82 | * b1 (not used) |
| 83 | * - RxState contains information related to Rx operations. |
83 | * x : Should be set to 0 |
| 84 | * RxState value coding follow below described bitmap : |
84 | * b0 Tx state |
| 85 | * b7-b6 (not used) |
85 | * 0 : Ready (no Tx operation ongoing) |
| 86 | * xx : Should be set to 00 |
86 | * 1 : Busy (Tx operation ongoing) |
| 87 | * b5 IP initilisation status |
87 | * - RxState contains information related to Rx operations. |
| 88 | * 0 : Reset (IP not initialized) |
88 | * RxState value coding follow below described bitmap : |
| 89 | * 1 : Init done (IP initialized) |
89 | * b7-b6 (not used) |
| 90 | * b4-b2 (not used) |
90 | * xx : Should be set to 00 |
| 91 | * xxx : Should be set to 000 |
91 | * b5 CEC peripheral initialization status |
| 92 | * b1 Rx state |
92 | * 0 : Reset (peripheral not initialized) |
| 93 | * 0 : Ready (no Rx operation ongoing) |
93 | * 1 : Init done (peripheral initialized) |
| 94 | * 1 : Busy (Rx operation ongoing) |
94 | * b4-b2 (not used) |
| 95 | * b0 (not used) |
95 | * xxx : Should be set to 000 |
| 96 | * x : Should be set to 0. |
96 | * b1 Rx state |
| 97 | */ |
97 | * 0 : Ready (no Rx operation ongoing) |
| 98 | typedef enum |
98 | * 1 : Busy (Rx operation ongoing) |
| 99 | { |
99 | * b0 (not used) |
| 100 | HAL_CEC_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized |
100 | * x : Should be set to 0. |
| 101 | Value is allowed for gState and RxState */ |
101 | */ |
| 102 | HAL_CEC_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use |
102 | typedef enum |
| 103 | Value is allowed for gState and RxState */ |
103 | { |
| 104 | HAL_CEC_STATE_BUSY = 0x24U, /*!< an internal process is ongoing |
104 | HAL_CEC_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized |
| 105 | Value is allowed for gState only */ |
105 | Value is allowed for gState and RxState */ |
| 106 | HAL_CEC_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing |
106 | HAL_CEC_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use |
| 107 | Value is allowed for RxState only */ |
107 | Value is allowed for gState and RxState */ |
| 108 | HAL_CEC_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing |
108 | HAL_CEC_STATE_BUSY = 0x24U, /*!< an internal process is ongoing |
| 109 | Value is allowed for gState only */ |
109 | Value is allowed for gState only */ |
| 110 | HAL_CEC_STATE_BUSY_RX_TX = 0x23U, /*!< an internal process is ongoing |
110 | HAL_CEC_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing |
| 111 | Value is allowed for gState only */ |
111 | Value is allowed for RxState only */ |
| 112 | HAL_CEC_STATE_ERROR = 0x60U /*!< Error Value is allowed for gState only */ |
112 | HAL_CEC_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing |
| 113 | }HAL_CEC_StateTypeDef; |
113 | Value is allowed for gState only */ |
| 114 | 114 | HAL_CEC_STATE_BUSY_RX_TX = 0x23U, /*!< an internal process is ongoing |
|
| 115 | /** |
115 | Value is allowed for gState only */ |
| 116 | * @brief CEC handle Structure definition |
116 | HAL_CEC_STATE_ERROR = 0x60U /*!< Error Value is allowed for gState only */ |
| 117 | */ |
117 | } HAL_CEC_StateTypeDef; |
| 118 | typedef struct __CEC_HandleTypeDef |
118 | |
| 119 | { |
119 | /** |
| 120 | CEC_TypeDef *Instance; /*!< CEC registers base address */ |
120 | * @brief CEC handle Structure definition |
| 121 | 121 | */ |
|
| 122 | CEC_InitTypeDef Init; /*!< CEC communication parameters */ |
122 | typedef struct __CEC_HandleTypeDef |
| 123 | 123 | { |
|
| 124 | uint8_t *pTxBuffPtr; /*!< Pointer to CEC Tx transfer Buffer */ |
124 | CEC_TypeDef *Instance; /*!< CEC registers base address */ |
| 125 | 125 | ||
| 126 | uint16_t TxXferCount; /*!< CEC Tx Transfer Counter */ |
126 | CEC_InitTypeDef Init; /*!< CEC communication parameters */ |
| 127 | 127 | ||
| 128 | uint16_t RxXferSize; /*!< CEC Rx Transfer size, 0: header received only */ |
128 | const uint8_t *pTxBuffPtr; /*!< Pointer to CEC Tx transfer Buffer */ |
| 129 | 129 | ||
| 130 | HAL_LockTypeDef Lock; /*!< Locking object */ |
130 | uint16_t TxXferCount; /*!< CEC Tx Transfer Counter */ |
| 131 | 131 | ||
| 132 | HAL_CEC_StateTypeDef gState; /*!< CEC state information related to global Handle management |
132 | uint16_t RxXferSize; /*!< CEC Rx Transfer size, 0: header received only */ |
| 133 | and also related to Tx operations. |
133 | |
| 134 | This parameter can be a value of @ref HAL_CEC_StateTypeDef */ |
134 | HAL_LockTypeDef Lock; /*!< Locking object */ |
| 135 | 135 | ||
| 136 | HAL_CEC_StateTypeDef RxState; /*!< CEC state information related to Rx operations. |
136 | HAL_CEC_StateTypeDef gState; /*!< CEC state information related to global Handle management |
| 137 | This parameter can be a value of @ref HAL_CEC_StateTypeDef */ |
137 | and also related to Tx operations. |
| 138 | 138 | This parameter can be a value of @ref HAL_CEC_StateTypeDef */ |
|
| 139 | uint32_t ErrorCode; /*!< For errors handling purposes, copy of ISR register |
139 | |
| 140 | in case error is reported */ |
140 | HAL_CEC_StateTypeDef RxState; /*!< CEC state information related to Rx operations. |
| 141 | 141 | This parameter can be a value of @ref HAL_CEC_StateTypeDef */ |
|
| 142 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
142 | |
| 143 | void (* TxCpltCallback) ( struct __CEC_HandleTypeDef * hcec); /*!< CEC Tx Transfer completed callback */ |
143 | uint32_t ErrorCode; /*!< For errors handling purposes, copy of ISR register |
| 144 | void (* RxCpltCallback) ( struct __CEC_HandleTypeDef * hcec, uint32_t RxFrameSize); /*!< CEC Rx Transfer completed callback */ |
144 | in case error is reported */ |
| 145 | void (* ErrorCallback) ( struct __CEC_HandleTypeDef * hcec); /*!< CEC error callback */ |
145 | |
| 146 | 146 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
|
| 147 | void (* MspInitCallback) ( struct __CEC_HandleTypeDef * hcec); /*!< CEC Msp Init callback */ |
147 | void (* TxCpltCallback)(struct __CEC_HandleTypeDef *hcec); /*!< CEC Tx Transfer completed callback */ |
| 148 | void (* MspDeInitCallback) ( struct __CEC_HandleTypeDef * hcec); /*!< CEC Msp DeInit callback */ |
148 | void (* RxCpltCallback)(struct __CEC_HandleTypeDef *hcec, |
| 149 | 149 | uint32_t RxFrameSize); /*!< CEC Rx Transfer completed callback */ |
|
| 150 | #endif /* (USE_HAL_CEC_REGISTER_CALLBACKS) */ |
150 | void (* ErrorCallback)(struct __CEC_HandleTypeDef *hcec); /*!< CEC error callback */ |
| 151 | }CEC_HandleTypeDef; |
151 | |
| 152 | 152 | void (* MspInitCallback)(struct __CEC_HandleTypeDef *hcec); /*!< CEC Msp Init callback */ |
|
| 153 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
153 | void (* MspDeInitCallback)(struct __CEC_HandleTypeDef *hcec); /*!< CEC Msp DeInit callback */ |
| 154 | /** |
154 | |
| 155 | * @brief HAL CEC Callback ID enumeration definition |
155 | #endif /* (USE_HAL_CEC_REGISTER_CALLBACKS) */ |
| 156 | */ |
156 | } CEC_HandleTypeDef; |
| 157 | typedef enum |
157 | |
| 158 | { |
158 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
| 159 | HAL_CEC_TX_CPLT_CB_ID = 0x00U, /*!< CEC Tx Transfer completed callback ID */ |
159 | /** |
| 160 | HAL_CEC_RX_CPLT_CB_ID = 0x01U, /*!< CEC Rx Transfer completed callback ID */ |
160 | * @brief HAL CEC Callback ID enumeration definition |
| 161 | HAL_CEC_ERROR_CB_ID = 0x02U, /*!< CEC error callback ID */ |
161 | */ |
| 162 | HAL_CEC_MSPINIT_CB_ID = 0x03U, /*!< CEC Msp Init callback ID */ |
162 | typedef enum |
| 163 | HAL_CEC_MSPDEINIT_CB_ID = 0x04U /*!< CEC Msp DeInit callback ID */ |
163 | { |
| 164 | }HAL_CEC_CallbackIDTypeDef; |
164 | HAL_CEC_TX_CPLT_CB_ID = 0x00U, /*!< CEC Tx Transfer completed callback ID */ |
| 165 | 165 | HAL_CEC_RX_CPLT_CB_ID = 0x01U, /*!< CEC Rx Transfer completed callback ID */ |
|
| 166 | /** |
166 | HAL_CEC_ERROR_CB_ID = 0x02U, /*!< CEC error callback ID */ |
| 167 | * @brief HAL CEC Callback pointer definition |
167 | HAL_CEC_MSPINIT_CB_ID = 0x03U, /*!< CEC Msp Init callback ID */ |
| 168 | */ |
168 | HAL_CEC_MSPDEINIT_CB_ID = 0x04U /*!< CEC Msp DeInit callback ID */ |
| 169 | typedef void (*pCEC_CallbackTypeDef)(CEC_HandleTypeDef * hcec); /*!< pointer to an CEC callback function */ |
169 | } HAL_CEC_CallbackIDTypeDef; |
| 170 | typedef void (*pCEC_RxCallbackTypeDef)(CEC_HandleTypeDef * hcec, uint32_t RxFrameSize); /*!< pointer to an Rx Transfer completed callback function */ |
170 | |
| 171 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
171 | /** |
| 172 | /** |
172 | * @brief HAL CEC Callback pointer definition |
| 173 | * @} |
173 | */ |
| 174 | */ |
174 | typedef void (*pCEC_CallbackTypeDef)(CEC_HandleTypeDef *hcec); /*!< pointer to an CEC callback function */ |
| 175 | 175 | typedef void (*pCEC_RxCallbackTypeDef)(CEC_HandleTypeDef *hcec, |
|
| 176 | /* Exported constants --------------------------------------------------------*/ |
176 | uint32_t RxFrameSize); /*!< pointer to an Rx Transfer completed |
| 177 | /** @defgroup CEC_Exported_Constants CEC Exported Constants |
177 | callback function */ |
| 178 | * @{ |
178 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
| 179 | */ |
179 | /** |
| 180 | 180 | * @} |
|
| 181 | /** @defgroup CEC_Error_Code CEC Error Code |
181 | */ |
| 182 | * @{ |
182 | |
| 183 | */ |
183 | /* Exported constants --------------------------------------------------------*/ |
| 184 | #define HAL_CEC_ERROR_NONE 0x00000000U /*!< no error */ |
184 | /** @defgroup CEC_Exported_Constants CEC Exported Constants |
| 185 | #define HAL_CEC_ERROR_BTE CEC_ESR_BTE /*!< Bit Timing Error */ |
185 | * @{ |
| 186 | #define HAL_CEC_ERROR_BPE CEC_ESR_BPE /*!< Bit Period Error */ |
186 | */ |
| 187 | #define HAL_CEC_ERROR_RBTFE CEC_ESR_RBTFE /*!< Rx Block Transfer Finished Error */ |
187 | |
| 188 | #define HAL_CEC_ERROR_SBE CEC_ESR_SBE /*!< Start Bit Error */ |
188 | /** @defgroup CEC_Error_Code CEC Error Code |
| 189 | #define HAL_CEC_ERROR_ACKE CEC_ESR_ACKE /*!< Block Acknowledge Error */ |
189 | * @{ |
| 190 | #define HAL_CEC_ERROR_LINE CEC_ESR_LINE /*!< Line Error */ |
190 | */ |
| 191 | #define HAL_CEC_ERROR_TBTFE CEC_ESR_TBTFE /*!< Tx Block Transfer Finished Error */ |
191 | #define HAL_CEC_ERROR_NONE 0x00000000U /*!< no error */ |
| 192 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
192 | #define HAL_CEC_ERROR_BTE CEC_ESR_BTE /*!< Bit Timing Error */ |
| 193 | #define HAL_CEC_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U) /*!< Invalid Callback Error */ |
193 | #define HAL_CEC_ERROR_BPE CEC_ESR_BPE /*!< Bit Period Error */ |
| 194 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
194 | #define HAL_CEC_ERROR_RBTFE CEC_ESR_RBTFE /*!< Rx Block Transfer Finished Error */ |
| 195 | /** |
195 | #define HAL_CEC_ERROR_SBE CEC_ESR_SBE /*!< Start Bit Error */ |
| 196 | * @} |
196 | #define HAL_CEC_ERROR_ACKE CEC_ESR_ACKE /*!< Block Acknowledge Error */ |
| 197 | */ |
197 | #define HAL_CEC_ERROR_LINE CEC_ESR_LINE /*!< Line Error */ |
| 198 | 198 | #define HAL_CEC_ERROR_TBTFE CEC_ESR_TBTFE /*!< Tx Block Transfer Finished Error */ |
|
| 199 | /** @defgroup CEC_BitTimingErrorMode Bit Timing Error Mode |
199 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
| 200 | * @{ |
200 | #define HAL_CEC_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U) /*!< Invalid Callback Error */ |
| 201 | */ |
201 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
| 202 | #define CEC_BIT_TIMING_ERROR_MODE_STANDARD 0x00000000U /*!< Bit timing error Standard Mode */ |
202 | /** |
| 203 | #define CEC_BIT_TIMING_ERROR_MODE_ERRORFREE CEC_CFGR_BTEM /*!< Bit timing error Free Mode */ |
203 | * @} |
| 204 | /** |
204 | */ |
| 205 | * @} |
205 | |
| 206 | */ |
206 | /** @defgroup CEC_BitTimingErrorMode Bit Timing Error Mode |
| 207 | 207 | * @{ |
|
| 208 | /** @defgroup CEC_BitPeriodErrorMode Bit Period Error Mode |
208 | */ |
| 209 | * @{ |
209 | #define CEC_BIT_TIMING_ERROR_MODE_STANDARD 0x00000000U /*!< Bit timing error Standard Mode */ |
| 210 | */ |
210 | #define CEC_BIT_TIMING_ERROR_MODE_ERRORFREE CEC_CFGR_BTEM /*!< Bit timing error Free Mode */ |
| 211 | #define CEC_BIT_PERIOD_ERROR_MODE_STANDARD 0x00000000U /*!< Bit period error Standard Mode */ |
211 | /** |
| 212 | #define CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */ |
212 | * @} |
| 213 | /** |
213 | */ |
| 214 | * @} |
214 | |
| 215 | */ |
215 | /** @defgroup CEC_BitPeriodErrorMode Bit Period Error Mode |
| 216 | 216 | * @{ |
|
| 217 | /** @defgroup CEC_Initiator_Position CEC Initiator logical address position in message header |
217 | */ |
| 218 | * @{ |
218 | #define CEC_BIT_PERIOD_ERROR_MODE_STANDARD 0x00000000U /*!< Bit period error Standard Mode */ |
| 219 | */ |
219 | #define CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */ |
| 220 | #define CEC_INITIATOR_LSB_POS 4U |
220 | /** |
| 221 | /** |
221 | * @} |
| 222 | * @} |
222 | */ |
| 223 | */ |
223 | |
| 224 | 224 | /** @defgroup CEC_Initiator_Position CEC Initiator logical address position in message header |
|
| 225 | /** @defgroup CEC_OWN_ADDRESS CEC Own Address |
225 | * @{ |
| 226 | * @{ |
226 | */ |
| 227 | */ |
227 | #define CEC_INITIATOR_LSB_POS 4U |
| 228 | #define CEC_OWN_ADDRESS_NONE CEC_OWN_ADDRESS_0 /* Reset value */ |
228 | /** |
| 229 | #define CEC_OWN_ADDRESS_0 ((uint16_t)0x0000U) /* Logical Address 0 */ |
229 | * @} |
| 230 | #define CEC_OWN_ADDRESS_1 ((uint16_t)0x0001U) /* Logical Address 1 */ |
230 | */ |
| 231 | #define CEC_OWN_ADDRESS_2 ((uint16_t)0x0002U) /* Logical Address 2 */ |
231 | |
| 232 | #define CEC_OWN_ADDRESS_3 ((uint16_t)0x0003U) /* Logical Address 3 */ |
232 | /** @defgroup CEC_OWN_ADDRESS CEC Own Address |
| 233 | #define CEC_OWN_ADDRESS_4 ((uint16_t)0x0004U) /* Logical Address 4 */ |
233 | * @{ |
| 234 | #define CEC_OWN_ADDRESS_5 ((uint16_t)0x0005U) /* Logical Address 5 */ |
234 | */ |
| 235 | #define CEC_OWN_ADDRESS_6 ((uint16_t)0x0006U) /* Logical Address 6 */ |
235 | #define CEC_OWN_ADDRESS_NONE CEC_OWN_ADDRESS_0 /* Reset value */ |
| 236 | #define CEC_OWN_ADDRESS_7 ((uint16_t)0x0007U) /* Logical Address 7 */ |
236 | #define CEC_OWN_ADDRESS_0 ((uint16_t)0x0000U) /* Logical Address 0 */ |
| 237 | #define CEC_OWN_ADDRESS_8 ((uint16_t)0x0008U) /* Logical Address 8 */ |
237 | #define CEC_OWN_ADDRESS_1 ((uint16_t)0x0001U) /* Logical Address 1 */ |
| 238 | #define CEC_OWN_ADDRESS_9 ((uint16_t)0x0009U) /* Logical Address 9 */ |
238 | #define CEC_OWN_ADDRESS_2 ((uint16_t)0x0002U) /* Logical Address 2 */ |
| 239 | #define CEC_OWN_ADDRESS_10 ((uint16_t)0x000AU) /* Logical Address 10 */ |
239 | #define CEC_OWN_ADDRESS_3 ((uint16_t)0x0003U) /* Logical Address 3 */ |
| 240 | #define CEC_OWN_ADDRESS_11 ((uint16_t)0x000BU) /* Logical Address 11 */ |
240 | #define CEC_OWN_ADDRESS_4 ((uint16_t)0x0004U) /* Logical Address 4 */ |
| 241 | #define CEC_OWN_ADDRESS_12 ((uint16_t)0x000CU) /* Logical Address 12 */ |
241 | #define CEC_OWN_ADDRESS_5 ((uint16_t)0x0005U) /* Logical Address 5 */ |
| 242 | #define CEC_OWN_ADDRESS_13 ((uint16_t)0x000DU) /* Logical Address 13 */ |
242 | #define CEC_OWN_ADDRESS_6 ((uint16_t)0x0006U) /* Logical Address 6 */ |
| 243 | #define CEC_OWN_ADDRESS_14 ((uint16_t)0x000EU) /* Logical Address 14 */ |
243 | #define CEC_OWN_ADDRESS_7 ((uint16_t)0x0007U) /* Logical Address 7 */ |
| 244 | #define CEC_OWN_ADDRESS_15 ((uint16_t)0x000FU) /* Logical Address 15 */ |
244 | #define CEC_OWN_ADDRESS_8 ((uint16_t)0x0008U) /* Logical Address 8 */ |
| 245 | /** |
245 | #define CEC_OWN_ADDRESS_9 ((uint16_t)0x0009U) /* Logical Address 9 */ |
| 246 | * @} |
246 | #define CEC_OWN_ADDRESS_10 ((uint16_t)0x000AU) /* Logical Address 10 */ |
| 247 | */ |
247 | #define CEC_OWN_ADDRESS_11 ((uint16_t)0x000BU) /* Logical Address 11 */ |
| 248 | 248 | #define CEC_OWN_ADDRESS_12 ((uint16_t)0x000CU) /* Logical Address 12 */ |
|
| 249 | /** @defgroup CEC_Interrupts_Definitions Interrupts definition |
249 | #define CEC_OWN_ADDRESS_13 ((uint16_t)0x000DU) /* Logical Address 13 */ |
| 250 | * @{ |
250 | #define CEC_OWN_ADDRESS_14 ((uint16_t)0x000EU) /* Logical Address 14 */ |
| 251 | */ |
251 | #define CEC_OWN_ADDRESS_15 ((uint16_t)0x000FU) /* Logical Address 15 */ |
| 252 | #define CEC_IT_IE CEC_CFGR_IE |
252 | /** |
| 253 | /** |
253 | * @} |
| 254 | * @} |
254 | */ |
| 255 | */ |
255 | |
| 256 | 256 | /** @defgroup CEC_Interrupts_Definitions Interrupts definition |
|
| 257 | /** @defgroup CEC_Flags_Definitions Flags definition |
257 | * @{ |
| 258 | * @{ |
258 | */ |
| 259 | */ |
259 | #define CEC_IT_IE CEC_CFGR_IE |
| 260 | #define CEC_FLAG_TSOM CEC_CSR_TSOM |
260 | /** |
| 261 | #define CEC_FLAG_TEOM CEC_CSR_TEOM |
261 | * @} |
| 262 | #define CEC_FLAG_TERR CEC_CSR_TERR |
262 | */ |
| 263 | #define CEC_FLAG_TBTRF CEC_CSR_TBTRF |
263 | |
| 264 | #define CEC_FLAG_RSOM CEC_CSR_RSOM |
264 | /** @defgroup CEC_Flags_Definitions Flags definition |
| 265 | #define CEC_FLAG_REOM CEC_CSR_REOM |
265 | * @{ |
| 266 | #define CEC_FLAG_RERR CEC_CSR_RERR |
266 | */ |
| 267 | #define CEC_FLAG_RBTF CEC_CSR_RBTF |
267 | #define CEC_FLAG_TSOM CEC_CSR_TSOM |
| 268 | /** |
268 | #define CEC_FLAG_TEOM CEC_CSR_TEOM |
| 269 | * @} |
269 | #define CEC_FLAG_TERR CEC_CSR_TERR |
| 270 | */ |
270 | #define CEC_FLAG_TBTRF CEC_CSR_TBTRF |
| 271 | 271 | #define CEC_FLAG_RSOM CEC_CSR_RSOM |
|
| 272 | /** |
272 | #define CEC_FLAG_REOM CEC_CSR_REOM |
| 273 | * @} |
273 | #define CEC_FLAG_RERR CEC_CSR_RERR |
| 274 | */ |
274 | #define CEC_FLAG_RBTF CEC_CSR_RBTF |
| 275 | 275 | /** |
|
| 276 | /* Exported macros -----------------------------------------------------------*/ |
276 | * @} |
| 277 | /** @defgroup CEC_Exported_Macros CEC Exported Macros |
277 | */ |
| 278 | * @{ |
278 | |
| 279 | */ |
279 | /** |
| 280 | 280 | * @} |
|
| 281 | /** @brief Reset CEC handle gstate & RxState |
281 | */ |
| 282 | * @param __HANDLE__: CEC handle. |
282 | |
| 283 | * @retval None |
283 | /* Exported macros -----------------------------------------------------------*/ |
| 284 | */ |
284 | /** @defgroup CEC_Exported_Macros CEC Exported Macros |
| 285 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
285 | * @{ |
| 286 | #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
286 | */ |
| 287 | (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \ |
287 | |
| 288 | (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \ |
288 | /** @brief Reset CEC handle gstate & RxState |
| 289 | (__HANDLE__)->MspInitCallback = NULL; \ |
289 | * @param __HANDLE__ CEC handle. |
| 290 | (__HANDLE__)->MspDeInitCallback = NULL; \ |
290 | * @retval None |
| 291 | } while(0) |
291 | */ |
| 292 | #else |
292 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
| 293 | #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
293 | #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
| 294 | (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \ |
294 | (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \ |
| 295 | (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \ |
295 | (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \ |
| 296 | } while(0) |
296 | (__HANDLE__)->MspInitCallback = NULL; \ |
| 297 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
297 | (__HANDLE__)->MspDeInitCallback = NULL; \ |
| 298 | 298 | } while(0) |
|
| 299 | /** @brief Checks whether or not the specified CEC interrupt flag is set. |
299 | #else |
| 300 | * @param __HANDLE__: specifies the CEC Handle. |
300 | #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \ |
| 301 | * @param __FLAG__: specifies the flag to check. |
301 | (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \ |
| 302 | * @arg CEC_FLAG_TERR: Tx Error |
302 | (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \ |
| 303 | * @arg CEC_FLAG_TBTRF:Tx Block Transfer Finished |
303 | } while(0) |
| 304 | * @arg CEC_FLAG_RERR: Rx Error |
304 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
| 305 | * @arg CEC_FLAG_RBTF: Rx Block Transfer Finished |
305 | |
| 306 | * @retval ITStatus |
306 | /** @brief Checks whether or not the specified CEC interrupt flag is set. |
| 307 | */ |
307 | * @param __HANDLE__ specifies the CEC Handle. |
| 308 | #define __HAL_CEC_GET_FLAG(__HANDLE__, __FLAG__) READ_BIT((__HANDLE__)->Instance->CSR,(__FLAG__)) |
308 | * @param __FLAG__ specifies the flag to check. |
| 309 | 309 | * @arg CEC_FLAG_TERR: Tx Error |
|
| 310 | /** @brief Clears the CEC's pending flags. |
310 | * @arg CEC_FLAG_TBTRF:Tx Block Transfer Finished |
| 311 | * @param __HANDLE__: specifies the CEC Handle. |
311 | * @arg CEC_FLAG_RERR: Rx Error |
| 312 | * @param __FLAG__: specifies the flag to clear. |
312 | * @arg CEC_FLAG_RBTF: Rx Block Transfer Finished |
| 313 | * This parameter can be any combination of the following values: |
313 | * @retval ITStatus |
| 314 | * @arg CEC_CSR_TERR: Tx Error |
314 | */ |
| 315 | * @arg CEC_FLAG_TBTRF: Tx Block Transfer Finished |
315 | #define __HAL_CEC_GET_FLAG(__HANDLE__, __FLAG__) READ_BIT((__HANDLE__)->Instance->CSR,(__FLAG__)) |
| 316 | * @arg CEC_CSR_RERR: Rx Error |
316 | |
| 317 | * @arg CEC_CSR_RBTF: Rx Block Transfer Finished |
317 | /** @brief Clears the CEC's pending flags. |
| 318 | * @retval none |
318 | * @param __HANDLE__ specifies the CEC Handle. |
| 319 | */ |
319 | * @param __FLAG__ specifies the flag to clear. |
| 320 | #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) \ |
320 | * This parameter can be any combination of the following values: |
| 321 | do { \ |
321 | * @arg CEC_CSR_TERR: Tx Error |
| 322 | uint32_t tmp = 0x0U; \ |
322 | * @arg CEC_FLAG_TBTRF: Tx Block Transfer Finished |
| 323 | tmp = (__HANDLE__)->Instance->CSR & 0x00000002U; \ |
323 | * @arg CEC_CSR_RERR: Rx Error |
| 324 | (__HANDLE__)->Instance->CSR &= (uint32_t)(((~(uint32_t)(__FLAG__)) & 0xFFFFFFFCU) | tmp);\ |
324 | * @arg CEC_CSR_RBTF: Rx Block Transfer Finished |
| 325 | } while(0U) |
325 | * @retval none |
| 326 | 326 | */ |
|
| 327 | /** @brief Enables the specified CEC interrupt. |
327 | #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) \ |
| 328 | * @param __HANDLE__: specifies the CEC Handle. |
328 | do { \ |
| 329 | * @param __INTERRUPT__: specifies the CEC interrupt to enable. |
329 | uint32_t tmp = 0x0U; \ |
| 330 | * This parameter can be: |
330 | tmp = (__HANDLE__)->Instance->CSR & 0x00000002U; \ |
| 331 | * @arg CEC_IT_IE : Interrupt Enable. |
331 | (__HANDLE__)->Instance->CSR &= (uint32_t)(((~(uint32_t)(__FLAG__)) & 0xFFFFFFFCU) | tmp);\ |
| 332 | * @retval none |
332 | } while(0U) |
| 333 | */ |
333 | |
| 334 | #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__)) |
334 | /** @brief Enables the specified CEC interrupt. |
| 335 | 335 | * @param __HANDLE__ specifies the CEC Handle. |
|
| 336 | /** @brief Disables the specified CEC interrupt. |
336 | * @param __INTERRUPT__ specifies the CEC interrupt to enable. |
| 337 | * @param __HANDLE__: specifies the CEC Handle. |
337 | * This parameter can be one of the following values: |
| 338 | * @param __INTERRUPT__: specifies the CEC interrupt to disable. |
338 | * @arg CEC_IT_IE : Interrupt Enable. |
| 339 | * This parameter can be: |
339 | * @retval none |
| 340 | * @arg CEC_IT_IE : Interrupt Enable |
340 | */ |
| 341 | * @retval none |
341 | #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__)) |
| 342 | */ |
342 | |
| 343 | #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__)) |
343 | /** @brief Disables the specified CEC interrupt. |
| 344 | 344 | * @param __HANDLE__ specifies the CEC Handle. |
|
| 345 | /** @brief Checks whether or not the specified CEC interrupt is enabled. |
345 | * @param __INTERRUPT__ specifies the CEC interrupt to disable. |
| 346 | * @param __HANDLE__: specifies the CEC Handle. |
346 | * This parameter can be one of the following values: |
| 347 | * @param __INTERRUPT__: specifies the CEC interrupt to check. |
347 | * @arg CEC_IT_IE : Interrupt Enable |
| 348 | * This parameter can be: |
348 | * @retval none |
| 349 | * @arg CEC_IT_IE : Interrupt Enable |
349 | */ |
| 350 | * @retval FlagStatus |
350 | #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__)) |
| 351 | */ |
351 | |
| 352 | #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) READ_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__)) |
352 | /** @brief Checks whether or not the specified CEC interrupt is enabled. |
| 353 | 353 | * @param __HANDLE__ specifies the CEC Handle. |
|
| 354 | /** @brief Enables the CEC device |
354 | * @param __INTERRUPT__ specifies the CEC interrupt to check. |
| 355 | * @param __HANDLE__: specifies the CEC Handle. |
355 | * This parameter can be one of the following values: |
| 356 | * @retval none |
356 | * @arg CEC_IT_IE : Interrupt Enable |
| 357 | */ |
357 | * @retval FlagStatus |
| 358 | #define __HAL_CEC_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE) |
358 | */ |
| 359 | 359 | #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) READ_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__)) |
|
| 360 | /** @brief Disables the CEC device |
360 | |
| 361 | * @param __HANDLE__: specifies the CEC Handle. |
361 | /** @brief Enables the CEC device |
| 362 | * @retval none |
362 | * @param __HANDLE__ specifies the CEC Handle. |
| 363 | */ |
363 | * @retval none |
| 364 | #define __HAL_CEC_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE) |
364 | */ |
| 365 | 365 | #define __HAL_CEC_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE) |
|
| 366 | /** @brief Set Transmission Start flag |
366 | |
| 367 | * @param __HANDLE__: specifies the CEC Handle. |
367 | /** @brief Disables the CEC device |
| 368 | * @retval none |
368 | * @param __HANDLE__ specifies the CEC Handle. |
| 369 | */ |
369 | * @retval none |
| 370 | #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM) |
370 | */ |
| 371 | 371 | #define __HAL_CEC_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE) |
|
| 372 | /** @brief Set Transmission End flag |
372 | |
| 373 | * @param __HANDLE__: specifies the CEC Handle. |
373 | /** @brief Set Transmission Start flag |
| 374 | * @retval none |
374 | * @param __HANDLE__ specifies the CEC Handle. |
| 375 | */ |
375 | * @retval none |
| 376 | #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM) |
376 | */ |
| 377 | 377 | #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM) |
|
| 378 | /** @brief Get Transmission Start flag |
378 | |
| 379 | * @param __HANDLE__: specifies the CEC Handle. |
379 | /** @brief Set Transmission End flag |
| 380 | * @retval FlagStatus |
380 | * @param __HANDLE__ specifies the CEC Handle. |
| 381 | */ |
381 | * @retval none |
| 382 | #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM) |
382 | */ |
| 383 | 383 | #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM) |
|
| 384 | /** @brief Get Transmission End flag |
384 | |
| 385 | * @param __HANDLE__: specifies the CEC Handle. |
385 | /** @brief Get Transmission Start flag |
| 386 | * @retval FlagStatus |
386 | * @param __HANDLE__ specifies the CEC Handle. |
| 387 | */ |
387 | * @retval FlagStatus |
| 388 | #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM) |
388 | */ |
| 389 | 389 | #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM) |
|
| 390 | /** @brief Clear OAR register |
390 | |
| 391 | * @param __HANDLE__: specifies the CEC Handle. |
391 | /** @brief Get Transmission End flag |
| 392 | * @retval none |
392 | * @param __HANDLE__ specifies the CEC Handle. |
| 393 | */ |
393 | * @retval FlagStatus |
| 394 | #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->OAR, CEC_OAR_OA) |
394 | */ |
| 395 | 395 | #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM) |
|
| 396 | /** @brief Set OAR register |
396 | |
| 397 | * @param __HANDLE__: specifies the CEC Handle. |
397 | /** @brief Clear OAR register |
| 398 | * @param __ADDRESS__: Own Address value. |
398 | * @param __HANDLE__ specifies the CEC Handle. |
| 399 | * @retval none |
399 | * @retval none |
| 400 | */ |
400 | */ |
| 401 | #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) MODIFY_REG((__HANDLE__)->Instance->OAR, CEC_OAR_OA, (__ADDRESS__)); |
401 | #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->OAR, CEC_OAR_OA) |
| 402 | 402 | ||
| 403 | /** |
403 | /** @brief Set OAR register |
| 404 | * @} |
404 | * @param __HANDLE__ specifies the CEC Handle. |
| 405 | */ |
405 | * @param __ADDRESS__ Own Address value. |
| 406 | 406 | * @retval none |
|
| 407 | /* Exported functions --------------------------------------------------------*/ |
407 | */ |
| 408 | /** @addtogroup CEC_Exported_Functions CEC Exported Functions |
408 | #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) MODIFY_REG((__HANDLE__)->Instance->OAR, CEC_OAR_OA, (__ADDRESS__)); |
| 409 | * @{ |
409 | |
| 410 | */ |
410 | /** |
| 411 | 411 | * @} |
|
| 412 | /** @addtogroup CEC_Exported_Functions_Group1 Initialization and de-initialization functions |
412 | */ |
| 413 | * @brief Initialization and Configuration functions |
413 | |
| 414 | * @{ |
414 | /* Exported functions --------------------------------------------------------*/ |
| 415 | */ |
415 | /** @addtogroup CEC_Exported_Functions CEC Exported Functions |
| 416 | /* Initialization and de-initialization functions ****************************/ |
416 | * @{ |
| 417 | HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec); |
417 | */ |
| 418 | HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec); |
418 | |
| 419 | HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress); |
419 | /** @addtogroup CEC_Exported_Functions_Group1 Initialization and de-initialization functions |
| 420 | void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec); |
420 | * @brief Initialization and Configuration functions |
| 421 | void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec); |
421 | * @{ |
| 422 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
422 | */ |
| 423 | HAL_StatusTypeDef HAL_CEC_RegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID, pCEC_CallbackTypeDef pCallback); |
423 | /* Initialization and de-initialization functions ****************************/ |
| 424 | HAL_StatusTypeDef HAL_CEC_UnRegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID); |
424 | HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec); |
| 425 | 425 | HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec); |
|
| 426 | HAL_StatusTypeDef HAL_CEC_RegisterRxCpltCallback(CEC_HandleTypeDef *hcec, pCEC_RxCallbackTypeDef pCallback); |
426 | HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress); |
| 427 | HAL_StatusTypeDef HAL_CEC_UnRegisterRxCpltCallback(CEC_HandleTypeDef *hcec); |
427 | void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec); |
| 428 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
428 | void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec); |
| 429 | /** |
429 | |
| 430 | * @} |
430 | #if (USE_HAL_CEC_REGISTER_CALLBACKS == 1) |
| 431 | */ |
431 | HAL_StatusTypeDef HAL_CEC_RegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID, |
| 432 | 432 | pCEC_CallbackTypeDef pCallback); |
|
| 433 | /** @addtogroup CEC_Exported_Functions_Group2 Input and Output operation functions |
433 | HAL_StatusTypeDef HAL_CEC_UnRegisterCallback(CEC_HandleTypeDef *hcec, HAL_CEC_CallbackIDTypeDef CallbackID); |
| 434 | * @brief CEC Transmit/Receive functions |
434 | |
| 435 | * @{ |
435 | HAL_StatusTypeDef HAL_CEC_RegisterRxCpltCallback(CEC_HandleTypeDef *hcec, pCEC_RxCallbackTypeDef pCallback); |
| 436 | */ |
436 | HAL_StatusTypeDef HAL_CEC_UnRegisterRxCpltCallback(CEC_HandleTypeDef *hcec); |
| 437 | /* I/O operation functions ***************************************************/ |
437 | #endif /* USE_HAL_CEC_REGISTER_CALLBACKS */ |
| 438 | HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t InitiatorAddress,uint8_t DestinationAddress, uint8_t *pData, uint32_t Size); |
438 | /** |
| 439 | uint32_t HAL_CEC_GetLastReceivedFrameSize(CEC_HandleTypeDef *hcec); |
439 | * @} |
| 440 | void HAL_CEC_ChangeRxBuffer(CEC_HandleTypeDef *hcec, uint8_t* Rxbuffer); |
440 | */ |
| 441 | void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec); |
441 | |
| 442 | void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec); |
442 | /** @addtogroup CEC_Exported_Functions_Group2 Input and Output operation functions |
| 443 | void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec, uint32_t RxFrameSize); |
443 | * @brief CEC Transmit/Receive functions |
| 444 | void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec); |
444 | * @{ |
| 445 | /** |
445 | */ |
| 446 | * @} |
446 | /* I/O operation functions ***************************************************/ |
| 447 | */ |
447 | HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t InitiatorAddress, uint8_t DestinationAddress, |
| 448 | 448 | const uint8_t *pData, uint32_t Size); |
|
| 449 | /** @defgroup CEC_Exported_Functions_Group3 Peripheral Control functions |
449 | uint32_t HAL_CEC_GetLastReceivedFrameSize(const CEC_HandleTypeDef *hcec); |
| 450 | * @brief CEC control functions |
450 | void HAL_CEC_ChangeRxBuffer(CEC_HandleTypeDef *hcec, uint8_t *Rxbuffer); |
| 451 | * @{ |
451 | void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec); |
| 452 | */ |
452 | void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec); |
| 453 | /* Peripheral State and Error functions ***************************************/ |
453 | void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec, uint32_t RxFrameSize); |
| 454 | HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec); |
454 | void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec); |
| 455 | uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec); |
455 | /** |
| 456 | /** |
456 | * @} |
| 457 | * @} |
457 | */ |
| 458 | */ |
458 | |
| 459 | 459 | /** @defgroup CEC_Exported_Functions_Group3 Peripheral Control functions |
|
| 460 | /** |
460 | * @brief CEC control functions |
| 461 | * @} |
461 | * @{ |
| 462 | */ |
462 | */ |
| 463 | 463 | /* Peripheral State functions ************************************************/ |
|
| 464 | /* Private types -------------------------------------------------------------*/ |
464 | HAL_CEC_StateTypeDef HAL_CEC_GetState(const CEC_HandleTypeDef *hcec); |
| 465 | /** @defgroup CEC_Private_Types CEC Private Types |
465 | uint32_t HAL_CEC_GetError(const CEC_HandleTypeDef *hcec); |
| 466 | * @{ |
466 | /** |
| 467 | */ |
467 | * @} |
| 468 | 468 | */ |
|
| 469 | /** |
469 | |
| 470 | * @} |
470 | /** |
| 471 | */ |
471 | * @} |
| 472 | 472 | */ |
|
| 473 | /* Private variables ---------------------------------------------------------*/ |
473 | |
| 474 | /** @defgroup CEC_Private_Variables CEC Private Variables |
474 | /* Private types -------------------------------------------------------------*/ |
| 475 | * @{ |
475 | /** @defgroup CEC_Private_Types CEC Private Types |
| 476 | */ |
476 | * @{ |
| 477 | 477 | */ |
|
| 478 | /** |
478 | |
| 479 | * @} |
479 | /** |
| 480 | */ |
480 | * @} |
| 481 | 481 | */ |
|
| 482 | /* Private constants ---------------------------------------------------------*/ |
482 | |
| 483 | /** @defgroup CEC_Private_Constants CEC Private Constants |
483 | /* Private variables ---------------------------------------------------------*/ |
| 484 | * @{ |
484 | /** @defgroup CEC_Private_Variables CEC Private Variables |
| 485 | */ |
485 | * @{ |
| 486 | 486 | */ |
|
| 487 | /** |
487 | |
| 488 | * @} |
488 | /** |
| 489 | */ |
489 | * @} |
| 490 | 490 | */ |
|
| 491 | /* Private macros ------------------------------------------------------------*/ |
491 | |
| 492 | /** @defgroup CEC_Private_Macros CEC Private Macros |
492 | /* Private constants ---------------------------------------------------------*/ |
| 493 | * @{ |
493 | /** @defgroup CEC_Private_Constants CEC Private Constants |
| 494 | */ |
494 | * @{ |
| 495 | #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BIT_TIMING_ERROR_MODE_STANDARD) || \ |
495 | */ |
| 496 | ((MODE) == CEC_BIT_TIMING_ERROR_MODE_ERRORFREE)) |
496 | |
| 497 | 497 | /** |
|
| 498 | #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BIT_PERIOD_ERROR_MODE_STANDARD) || \ |
498 | * @} |
| 499 | ((MODE) == CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE)) |
499 | */ |
| 500 | 500 | ||
| 501 | /** @brief Check CEC message size. |
501 | /* Private macros ------------------------------------------------------------*/ |
| 502 | * The message size is the payload size: without counting the header, |
502 | /** @defgroup CEC_Private_Macros CEC Private Macros |
| 503 | * it varies from 0 byte (ping operation, one header only, no payload) to |
503 | * @{ |
| 504 | * 15 bytes (1 opcode and up to 14 operands following the header). |
504 | */ |
| 505 | * @param __SIZE__: CEC message size. |
505 | #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BIT_TIMING_ERROR_MODE_STANDARD) || \ |
| 506 | * @retval Test result (TRUE or FALSE). |
506 | ((MODE) == CEC_BIT_TIMING_ERROR_MODE_ERRORFREE)) |
| 507 | */ |
507 | |
| 508 | #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10U) |
508 | #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BIT_PERIOD_ERROR_MODE_STANDARD) || \ |
| 509 | /** @brief Check CEC device Own Address Register (OAR) setting. |
509 | ((MODE) == CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE)) |
| 510 | * @param __ADDRESS__: CEC own address. |
510 | |
| 511 | * @retval Test result (TRUE or FALSE). |
511 | /** @brief Check CEC message size. |
| 512 | */ |
512 | * The message size is the payload size: without counting the header, |
| 513 | #define IS_CEC_OWN_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0000000FU) |
513 | * it varies from 0 byte (ping operation, one header only, no payload) to |
| 514 | 514 | * 15 bytes (1 opcode and up to 14 operands following the header). |
|
| 515 | /** @brief Check CEC initiator or destination logical address setting. |
515 | * @param __SIZE__ CEC message size. |
| 516 | * Initiator and destination addresses are coded over 4 bits. |
516 | * @retval Test result (TRUE or FALSE). |
| 517 | * @param __ADDRESS__: CEC initiator or logical address. |
517 | */ |
| 518 | * @retval Test result (TRUE or FALSE). |
518 | #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10U) |
| 519 | */ |
519 | |
| 520 | #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0000000FU) |
520 | /** @brief Check CEC device Own Address Register (OAR) setting. |
| 521 | 521 | * @param __ADDRESS__ CEC own address. |
|
| 522 | 522 | * @retval Test result (TRUE or FALSE). |
|
| 523 | 523 | */ |
|
| 524 | /** |
524 | #define IS_CEC_OWN_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0000000FU) |
| 525 | * @} |
525 | |
| 526 | */ |
526 | /** @brief Check CEC initiator or destination logical address setting. |
| 527 | /* Private functions ---------------------------------------------------------*/ |
527 | * Initiator and destination addresses are coded over 4 bits. |
| 528 | /** @defgroup CEC_Private_Functions CEC Private Functions |
528 | * @param __ADDRESS__ CEC initiator or logical address. |
| 529 | * @{ |
529 | * @retval Test result (TRUE or FALSE). |
| 530 | */ |
530 | */ |
| 531 | 531 | #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0000000FU) |
|
| 532 | /** |
532 | /** |
| 533 | * @} |
533 | * @} |
| 534 | */ |
534 | */ |
| 535 | 535 | /* Private functions ---------------------------------------------------------*/ |
|
| 536 | /** |
536 | /** @defgroup CEC_Private_Functions CEC Private Functions |
| 537 | * @} |
537 | * @{ |
| 538 | */ |
538 | */ |
| 539 | 539 | ||
| 540 | /** |
540 | /** |
| 541 | * @} |
541 | * @} |
| 542 | */ |
542 | */ |
| 543 | 543 | ||
| 544 | #endif /* CEC */ |
544 | /** |
| 545 | 545 | * @} |
|
| 546 | #ifdef __cplusplus |
546 | */ |
| 547 | } |
547 | |
| 548 | #endif |
548 | /** |
| 549 | 549 | * @} |
|
| 550 | #endif /* __STM32F1xx_HAL_CEC_H */ |
550 | */ |
| 551 | 551 | ||
| 552 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
552 | #endif /* CEC */ |
| - | 553 | ||
| - | 554 | #ifdef __cplusplus |
|
| - | 555 | } |
|
| - | 556 | #endif |
|
| - | 557 | ||
| - | 558 | #endif /* __STM32F1xx_HAL_CEC_H */ |
|
| - | 559 | ||