The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Fri May 26 12:30:20 2017 +0100
Revision:
143:86740a56073b
Parent:
134:ad3be0349dc5
Release 143 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx_hal_cec.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
<> 134:ad3be0349dc5 5 * @version V1.5.0
<> 134:ad3be0349dc5 6 * @date 04-November-2016
bogdanm 85:024bf7f99721 7 * @brief Header file of CEC HAL module.
bogdanm 85:024bf7f99721 8 ******************************************************************************
bogdanm 85:024bf7f99721 9 * @attention
bogdanm 85:024bf7f99721 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 12 *
bogdanm 85:024bf7f99721 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 14 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 16 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 19 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 21 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 22 * without specific prior written permission.
bogdanm 85:024bf7f99721 23 *
bogdanm 85:024bf7f99721 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 34 *
bogdanm 85:024bf7f99721 35 ******************************************************************************
bogdanm 85:024bf7f99721 36 */
bogdanm 85:024bf7f99721 37
bogdanm 85:024bf7f99721 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 39 #ifndef __STM32F0xx_HAL_CEC_H
bogdanm 85:024bf7f99721 40 #define __STM32F0xx_HAL_CEC_H
bogdanm 85:024bf7f99721 41
bogdanm 85:024bf7f99721 42 #ifdef __cplusplus
bogdanm 85:024bf7f99721 43 extern "C" {
bogdanm 85:024bf7f99721 44 #endif
bogdanm 85:024bf7f99721 45
bogdanm 85:024bf7f99721 46 #if defined(STM32F042x6) || defined(STM32F048xx) ||\
bogdanm 85:024bf7f99721 47 defined(STM32F051x8) || defined(STM32F058xx) ||\
bogdanm 92:4fc01daae5a5 48 defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) ||\
bogdanm 92:4fc01daae5a5 49 defined(STM32F091xC) || defined(STM32F098xx)
bogdanm 85:024bf7f99721 50 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 51 #include "stm32f0xx_hal_def.h"
bogdanm 85:024bf7f99721 52
bogdanm 85:024bf7f99721 53 /** @addtogroup STM32F0xx_HAL_Driver
bogdanm 85:024bf7f99721 54 * @{
bogdanm 85:024bf7f99721 55 */
bogdanm 85:024bf7f99721 56
<> 134:ad3be0349dc5 57 /** @addtogroup CEC
bogdanm 85:024bf7f99721 58 * @{
<> 134:ad3be0349dc5 59 */
bogdanm 85:024bf7f99721 60
bogdanm 85:024bf7f99721 61 /* Exported types ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 62 /** @defgroup CEC_Exported_Types CEC Exported Types
bogdanm 92:4fc01daae5a5 63 * @{
bogdanm 92:4fc01daae5a5 64 */
bogdanm 92:4fc01daae5a5 65
bogdanm 85:024bf7f99721 66 /**
bogdanm 85:024bf7f99721 67 * @brief CEC Init Structure definition
bogdanm 85:024bf7f99721 68 */
bogdanm 85:024bf7f99721 69 typedef struct
bogdanm 85:024bf7f99721 70 {
bogdanm 85:024bf7f99721 71 uint32_t SignalFreeTime; /*!< Set SFT field, specifies the Signal Free Time.
bogdanm 85:024bf7f99721 72 It can be one of @ref CEC_Signal_Free_Time
bogdanm 85:024bf7f99721 73 and belongs to the set {0,...,7} where
bogdanm 85:024bf7f99721 74 0x0 is the default configuration
bogdanm 85:024bf7f99721 75 else means 0.5 + (SignalFreeTime - 1) nominal data bit periods */
bogdanm 85:024bf7f99721 76
bogdanm 85:024bf7f99721 77 uint32_t Tolerance; /*!< Set RXTOL bit, specifies the tolerance accepted on the received waveforms,
bogdanm 85:024bf7f99721 78 it can be a value of @ref CEC_Tolerance : it is either CEC_STANDARD_TOLERANCE
bogdanm 85:024bf7f99721 79 or CEC_EXTENDED_TOLERANCE */
bogdanm 85:024bf7f99721 80
bogdanm 85:024bf7f99721 81 uint32_t BRERxStop; /*!< Set BRESTP bit @ref CEC_BRERxStop : specifies whether or not a Bit Rising Error stops the reception.
bogdanm 85:024bf7f99721 82 CEC_NO_RX_STOP_ON_BRE: reception is not stopped.
bogdanm 85:024bf7f99721 83 CEC_RX_STOP_ON_BRE: reception is stopped. */
bogdanm 85:024bf7f99721 84
bogdanm 85:024bf7f99721 85 uint32_t BREErrorBitGen; /*!< Set BREGEN bit @ref CEC_BREErrorBitGen : specifies whether or not an Error-Bit is generated on the
bogdanm 85:024bf7f99721 86 CEC line upon Bit Rising Error detection.
bogdanm 85:024bf7f99721 87 CEC_BRE_ERRORBIT_NO_GENERATION: no error-bit generation.
bogdanm 85:024bf7f99721 88 CEC_BRE_ERRORBIT_GENERATION: error-bit generation if BRESTP is set. */
bogdanm 85:024bf7f99721 89
bogdanm 85:024bf7f99721 90 uint32_t LBPEErrorBitGen; /*!< Set LBPEGEN bit @ref CEC_LBPEErrorBitGen : specifies whether or not an Error-Bit is generated on the
bogdanm 85:024bf7f99721 91 CEC line upon Long Bit Period Error detection.
bogdanm 85:024bf7f99721 92 CEC_LBPE_ERRORBIT_NO_GENERATION: no error-bit generation.
bogdanm 85:024bf7f99721 93 CEC_LBPE_ERRORBIT_GENERATION: error-bit generation. */
bogdanm 85:024bf7f99721 94
bogdanm 85:024bf7f99721 95 uint32_t BroadcastMsgNoErrorBitGen; /*!< Set BRDNOGEN bit @ref CEC_BroadCastMsgErrorBitGen : allows to avoid an Error-Bit generation on the CEC line
bogdanm 85:024bf7f99721 96 upon an error detected on a broadcast message.
bogdanm 85:024bf7f99721 97
bogdanm 85:024bf7f99721 98 It supersedes BREGEN and LBPEGEN bits for a broadcast message error handling. It can take two values:
bogdanm 85:024bf7f99721 99
bogdanm 85:024bf7f99721 100 1) CEC_BROADCASTERROR_ERRORBIT_GENERATION.
bogdanm 85:024bf7f99721 101 a) BRE detection: error-bit generation on the CEC line if BRESTP=CEC_RX_STOP_ON_BRE
bogdanm 85:024bf7f99721 102 and BREGEN=CEC_BRE_ERRORBIT_NO_GENERATION.
bogdanm 85:024bf7f99721 103 b) LBPE detection: error-bit generation on the CEC line
bogdanm 85:024bf7f99721 104 if LBPGEN=CEC_LBPE_ERRORBIT_NO_GENERATION.
bogdanm 85:024bf7f99721 105
bogdanm 85:024bf7f99721 106 2) CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION.
bogdanm 85:024bf7f99721 107 no error-bit generation in case neither a) nor b) are satisfied. Additionally,
bogdanm 85:024bf7f99721 108 there is no error-bit generation in case of Short Bit Period Error detection in
bogdanm 85:024bf7f99721 109 a broadcast message while LSTN bit is set. */
bogdanm 85:024bf7f99721 110
bogdanm 85:024bf7f99721 111 uint32_t SignalFreeTimeOption; /*!< Set SFTOP bit @ref CEC_SFT_Option : specifies when SFT timer starts.
bogdanm 85:024bf7f99721 112 CEC_SFT_START_ON_TXSOM SFT: timer starts when TXSOM is set by software.
bogdanm 85:024bf7f99721 113 CEC_SFT_START_ON_TX_RX_END: SFT timer starts automatically at the end of message transmission/reception. */
bogdanm 85:024bf7f99721 114
bogdanm 85:024bf7f99721 115 uint32_t ListenMode; /*!< Set LSTN bit @ref CEC_Listening_Mode : specifies device listening mode. It can take two values:
bogdanm 85:024bf7f99721 116
bogdanm 85:024bf7f99721 117 CEC_REDUCED_LISTENING_MODE: CEC peripheral receives only message addressed to its
bogdanm 85:024bf7f99721 118 own address (OAR). Messages addressed to different destination are ignored.
bogdanm 85:024bf7f99721 119 Broadcast messages are always received.
bogdanm 85:024bf7f99721 120
bogdanm 85:024bf7f99721 121 CEC_FULL_LISTENING_MODE: CEC peripheral receives messages addressed to its own
bogdanm 85:024bf7f99721 122 address (OAR) with positive acknowledge. Messages addressed to different destination
bogdanm 85:024bf7f99721 123 are received, but without interfering with the CEC bus: no acknowledge sent. */
bogdanm 85:024bf7f99721 124
<> 134:ad3be0349dc5 125 uint16_t OwnAddress; /*!< Own addresses configuration
<> 134:ad3be0349dc5 126 This parameter can be a value of @ref CEC_OWN_ADDRESS */
<> 134:ad3be0349dc5 127
<> 134:ad3be0349dc5 128 uint8_t *RxBuffer; /*!< CEC Rx buffer pointeur */
<> 134:ad3be0349dc5 129
bogdanm 85:024bf7f99721 130
bogdanm 85:024bf7f99721 131 }CEC_InitTypeDef;
bogdanm 85:024bf7f99721 132
bogdanm 85:024bf7f99721 133 /**
<> 134:ad3be0349dc5 134 * @brief HAL CEC State structures definition
<> 134:ad3be0349dc5 135 * @note HAL CEC State value is a combination of 2 different substates: gState and RxState.
<> 134:ad3be0349dc5 136 * - gState contains CEC state information related to global Handle management
<> 134:ad3be0349dc5 137 * and also information related to Tx operations.
<> 134:ad3be0349dc5 138 * gState value coding follow below described bitmap :
<> 134:ad3be0349dc5 139 * b7 (not used)
<> 134:ad3be0349dc5 140 * x : Should be set to 0
<> 134:ad3be0349dc5 141 * b6 Error information
<> 134:ad3be0349dc5 142 * 0 : No Error
<> 134:ad3be0349dc5 143 * 1 : Error
<> 134:ad3be0349dc5 144 * b5 IP initilisation status
<> 134:ad3be0349dc5 145 * 0 : Reset (IP not initialized)
<> 134:ad3be0349dc5 146 * 1 : Init done (IP initialized. HAL CEC Init function already called)
<> 134:ad3be0349dc5 147 * b4-b3 (not used)
<> 134:ad3be0349dc5 148 * xx : Should be set to 00
<> 134:ad3be0349dc5 149 * b2 Intrinsic process state
<> 134:ad3be0349dc5 150 * 0 : Ready
<> 134:ad3be0349dc5 151 * 1 : Busy (IP busy with some configuration or internal operations)
<> 134:ad3be0349dc5 152 * b1 (not used)
<> 134:ad3be0349dc5 153 * x : Should be set to 0
<> 134:ad3be0349dc5 154 * b0 Tx state
<> 134:ad3be0349dc5 155 * 0 : Ready (no Tx operation ongoing)
<> 134:ad3be0349dc5 156 * 1 : Busy (Tx operation ongoing)
<> 134:ad3be0349dc5 157 * - RxState contains information related to Rx operations.
<> 134:ad3be0349dc5 158 * RxState value coding follow below described bitmap :
<> 134:ad3be0349dc5 159 * b7-b6 (not used)
<> 134:ad3be0349dc5 160 * xx : Should be set to 00
<> 134:ad3be0349dc5 161 * b5 IP initilisation status
<> 134:ad3be0349dc5 162 * 0 : Reset (IP not initialized)
<> 134:ad3be0349dc5 163 * 1 : Init done (IP initialized)
<> 134:ad3be0349dc5 164 * b4-b2 (not used)
<> 134:ad3be0349dc5 165 * xxx : Should be set to 000
<> 134:ad3be0349dc5 166 * b1 Rx state
<> 134:ad3be0349dc5 167 * 0 : Ready (no Rx operation ongoing)
<> 134:ad3be0349dc5 168 * 1 : Busy (Rx operation ongoing)
<> 134:ad3be0349dc5 169 * b0 (not used)
<> 134:ad3be0349dc5 170 * x : Should be set to 0.
bogdanm 85:024bf7f99721 171 */
bogdanm 85:024bf7f99721 172 typedef enum
bogdanm 85:024bf7f99721 173 {
<> 134:ad3be0349dc5 174 HAL_CEC_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized
<> 134:ad3be0349dc5 175 Value is allowed for gState and RxState */
<> 134:ad3be0349dc5 176 HAL_CEC_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use
<> 134:ad3be0349dc5 177 Value is allowed for gState and RxState */
<> 134:ad3be0349dc5 178 HAL_CEC_STATE_BUSY = 0x24U, /*!< an internal process is ongoing
<> 134:ad3be0349dc5 179 Value is allowed for gState only */
<> 134:ad3be0349dc5 180 HAL_CEC_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing
<> 134:ad3be0349dc5 181 Value is allowed for RxState only */
<> 134:ad3be0349dc5 182 HAL_CEC_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing
<> 134:ad3be0349dc5 183 Value is allowed for gState only */
<> 134:ad3be0349dc5 184 HAL_CEC_STATE_BUSY_RX_TX = 0x23U, /*!< an internal process is ongoing
<> 134:ad3be0349dc5 185 Value is allowed for gState only */
<> 134:ad3be0349dc5 186 HAL_CEC_STATE_ERROR = 0x60U /*!< Error Value is allowed for gState only */
bogdanm 85:024bf7f99721 187 }HAL_CEC_StateTypeDef;
bogdanm 85:024bf7f99721 188
bogdanm 85:024bf7f99721 189 /**
bogdanm 85:024bf7f99721 190 * @brief CEC handle Structure definition
bogdanm 85:024bf7f99721 191 */
bogdanm 85:024bf7f99721 192 typedef struct
bogdanm 85:024bf7f99721 193 {
<> 134:ad3be0349dc5 194 CEC_TypeDef *Instance; /*!< CEC registers base address */
bogdanm 85:024bf7f99721 195
<> 134:ad3be0349dc5 196 CEC_InitTypeDef Init; /*!< CEC communication parameters */
bogdanm 85:024bf7f99721 197
<> 134:ad3be0349dc5 198 uint8_t *pTxBuffPtr; /*!< Pointer to CEC Tx transfer Buffer */
bogdanm 85:024bf7f99721 199
<> 134:ad3be0349dc5 200 uint16_t TxXferCount; /*!< CEC Tx Transfer Counter */
bogdanm 85:024bf7f99721 201
<> 134:ad3be0349dc5 202 uint16_t RxXferSize; /*!< CEC Rx Transfer size, 0: header received only */
bogdanm 85:024bf7f99721 203
<> 134:ad3be0349dc5 204 HAL_LockTypeDef Lock; /*!< Locking object */
<> 134:ad3be0349dc5 205
<> 134:ad3be0349dc5 206 HAL_CEC_StateTypeDef gState; /*!< CEC state information related to global Handle management
<> 134:ad3be0349dc5 207 and also related to Tx operations.
<> 134:ad3be0349dc5 208 This parameter can be a value of @ref HAL_CEC_StateTypeDef */
bogdanm 85:024bf7f99721 209
<> 134:ad3be0349dc5 210 HAL_CEC_StateTypeDef RxState; /*!< CEC state information related to Rx operations.
<> 134:ad3be0349dc5 211 This parameter can be a value of @ref HAL_CEC_StateTypeDef */
bogdanm 85:024bf7f99721 212
<> 134:ad3be0349dc5 213 uint32_t ErrorCode; /*!< For errors handling purposes, copy of ISR register
<> 134:ad3be0349dc5 214 in case error is reported */
bogdanm 85:024bf7f99721 215 }CEC_HandleTypeDef;
bogdanm 92:4fc01daae5a5 216 /**
bogdanm 92:4fc01daae5a5 217 * @}
bogdanm 92:4fc01daae5a5 218 */
bogdanm 85:024bf7f99721 219
bogdanm 85:024bf7f99721 220 /* Exported constants --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 221 /** @defgroup CEC_Exported_Constants CEC Exported Constants
bogdanm 85:024bf7f99721 222 * @{
bogdanm 85:024bf7f99721 223 */
<> 134:ad3be0349dc5 224
Kojto 108:34e6b704fe68 225 /** @defgroup CEC_Error_Code CEC Error Code
Kojto 108:34e6b704fe68 226 * @{
Kojto 108:34e6b704fe68 227 */
<> 134:ad3be0349dc5 228 #define HAL_CEC_ERROR_NONE (0x00000000U) /*!< no error */
Kojto 108:34e6b704fe68 229 #define HAL_CEC_ERROR_RXOVR CEC_ISR_RXOVR /*!< CEC Rx-Overrun */
Kojto 108:34e6b704fe68 230 #define HAL_CEC_ERROR_BRE CEC_ISR_BRE /*!< CEC Rx Bit Rising Error */
Kojto 108:34e6b704fe68 231 #define HAL_CEC_ERROR_SBPE CEC_ISR_SBPE /*!< CEC Rx Short Bit period Error */
Kojto 108:34e6b704fe68 232 #define HAL_CEC_ERROR_LBPE CEC_ISR_LBPE /*!< CEC Rx Long Bit period Error */
Kojto 108:34e6b704fe68 233 #define HAL_CEC_ERROR_RXACKE CEC_ISR_RXACKE /*!< CEC Rx Missing Acknowledge */
Kojto 108:34e6b704fe68 234 #define HAL_CEC_ERROR_ARBLST CEC_ISR_ARBLST /*!< CEC Arbitration Lost */
Kojto 108:34e6b704fe68 235 #define HAL_CEC_ERROR_TXUDR CEC_ISR_TXUDR /*!< CEC Tx-Buffer Underrun */
Kojto 108:34e6b704fe68 236 #define HAL_CEC_ERROR_TXERR CEC_ISR_TXERR /*!< CEC Tx-Error */
Kojto 108:34e6b704fe68 237 #define HAL_CEC_ERROR_TXACKE CEC_ISR_TXACKE /*!< CEC Tx Missing Acknowledge */
Kojto 108:34e6b704fe68 238 /**
Kojto 108:34e6b704fe68 239 * @}
Kojto 108:34e6b704fe68 240 */
Kojto 108:34e6b704fe68 241
<> 134:ad3be0349dc5 242 /** @defgroup CEC_Signal_Free_Time CEC Signal Free Time setting parameter
bogdanm 85:024bf7f99721 243 * @{
bogdanm 85:024bf7f99721 244 */
<> 134:ad3be0349dc5 245 #define CEC_DEFAULT_SFT (0x00000000U)
<> 134:ad3be0349dc5 246 #define CEC_0_5_BITPERIOD_SFT (0x00000001U)
<> 134:ad3be0349dc5 247 #define CEC_1_5_BITPERIOD_SFT (0x00000002U)
<> 134:ad3be0349dc5 248 #define CEC_2_5_BITPERIOD_SFT (0x00000003U)
<> 134:ad3be0349dc5 249 #define CEC_3_5_BITPERIOD_SFT (0x00000004U)
<> 134:ad3be0349dc5 250 #define CEC_4_5_BITPERIOD_SFT (0x00000005U)
<> 134:ad3be0349dc5 251 #define CEC_5_5_BITPERIOD_SFT (0x00000006U)
<> 134:ad3be0349dc5 252 #define CEC_6_5_BITPERIOD_SFT (0x00000007U)
bogdanm 85:024bf7f99721 253 /**
bogdanm 85:024bf7f99721 254 * @}
bogdanm 85:024bf7f99721 255 */
bogdanm 85:024bf7f99721 256
<> 134:ad3be0349dc5 257 /** @defgroup CEC_Tolerance CEC Receiver Tolerance
bogdanm 85:024bf7f99721 258 * @{
bogdanm 85:024bf7f99721 259 */
<> 134:ad3be0349dc5 260 #define CEC_STANDARD_TOLERANCE (0x00000000U)
bogdanm 85:024bf7f99721 261 #define CEC_EXTENDED_TOLERANCE ((uint32_t)CEC_CFGR_RXTOL)
bogdanm 85:024bf7f99721 262 /**
bogdanm 85:024bf7f99721 263 * @}
bogdanm 85:024bf7f99721 264 */
bogdanm 85:024bf7f99721 265
<> 134:ad3be0349dc5 266 /** @defgroup CEC_BRERxStop CEC Reception Stop on Error
bogdanm 85:024bf7f99721 267 * @{
bogdanm 85:024bf7f99721 268 */
<> 134:ad3be0349dc5 269 #define CEC_NO_RX_STOP_ON_BRE (0x00000000U)
bogdanm 85:024bf7f99721 270 #define CEC_RX_STOP_ON_BRE ((uint32_t)CEC_CFGR_BRESTP)
bogdanm 85:024bf7f99721 271 /**
bogdanm 85:024bf7f99721 272 * @}
bogdanm 85:024bf7f99721 273 */
bogdanm 85:024bf7f99721 274
<> 134:ad3be0349dc5 275 /** @defgroup CEC_BREErrorBitGen CEC Error Bit Generation if Bit Rise Error reported
bogdanm 85:024bf7f99721 276 * @{
bogdanm 85:024bf7f99721 277 */
<> 134:ad3be0349dc5 278 #define CEC_BRE_ERRORBIT_NO_GENERATION (0x00000000U)
bogdanm 85:024bf7f99721 279 #define CEC_BRE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BREGEN)
bogdanm 85:024bf7f99721 280 /**
bogdanm 85:024bf7f99721 281 * @}
bogdanm 85:024bf7f99721 282 */
bogdanm 85:024bf7f99721 283
<> 134:ad3be0349dc5 284 /** @defgroup CEC_LBPEErrorBitGen CEC Error Bit Generation if Long Bit Period Error reported
bogdanm 85:024bf7f99721 285 * @{
bogdanm 85:024bf7f99721 286 */
<> 134:ad3be0349dc5 287 #define CEC_LBPE_ERRORBIT_NO_GENERATION (0x00000000U)
bogdanm 85:024bf7f99721 288 #define CEC_LBPE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_LBPEGEN)
bogdanm 85:024bf7f99721 289 /**
bogdanm 85:024bf7f99721 290 * @}
bogdanm 85:024bf7f99721 291 */
bogdanm 85:024bf7f99721 292
<> 134:ad3be0349dc5 293 /** @defgroup CEC_BroadCastMsgErrorBitGen CEC Error Bit Generation on Broadcast message
bogdanm 85:024bf7f99721 294 * @{
bogdanm 85:024bf7f99721 295 */
<> 134:ad3be0349dc5 296 #define CEC_BROADCASTERROR_ERRORBIT_GENERATION (0x00000000U)
bogdanm 85:024bf7f99721 297 #define CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BRDNOGEN)
bogdanm 85:024bf7f99721 298 /**
bogdanm 85:024bf7f99721 299 * @}
bogdanm 85:024bf7f99721 300 */
bogdanm 85:024bf7f99721 301
<> 134:ad3be0349dc5 302 /** @defgroup CEC_SFT_Option CEC Signal Free Time start option
bogdanm 85:024bf7f99721 303 * @{
bogdanm 85:024bf7f99721 304 */
<> 134:ad3be0349dc5 305 #define CEC_SFT_START_ON_TXSOM (0x00000000U)
bogdanm 85:024bf7f99721 306 #define CEC_SFT_START_ON_TX_RX_END ((uint32_t)CEC_CFGR_SFTOPT)
bogdanm 85:024bf7f99721 307 /**
bogdanm 85:024bf7f99721 308 * @}
bogdanm 85:024bf7f99721 309 */
bogdanm 85:024bf7f99721 310
<> 134:ad3be0349dc5 311 /** @defgroup CEC_Listening_Mode CEC Listening mode option
bogdanm 85:024bf7f99721 312 * @{
bogdanm 85:024bf7f99721 313 */
<> 134:ad3be0349dc5 314 #define CEC_REDUCED_LISTENING_MODE (0x00000000U)
bogdanm 85:024bf7f99721 315 #define CEC_FULL_LISTENING_MODE ((uint32_t)CEC_CFGR_LSTN)
Kojto 108:34e6b704fe68 316 /**
Kojto 108:34e6b704fe68 317 * @}
Kojto 108:34e6b704fe68 318 */
Kojto 108:34e6b704fe68 319
<> 134:ad3be0349dc5 320 /** @defgroup CEC_OAR_Position CEC Device Own Address position in CEC CFGR register
Kojto 108:34e6b704fe68 321 * @{
Kojto 108:34e6b704fe68 322 */
<> 134:ad3be0349dc5 323 #define CEC_CFGR_OAR_LSB_POS (16U)
Kojto 108:34e6b704fe68 324 /**
Kojto 108:34e6b704fe68 325 * @}
Kojto 108:34e6b704fe68 326 */
Kojto 108:34e6b704fe68 327
<> 134:ad3be0349dc5 328 /** @defgroup CEC_Initiator_Position CEC Initiator logical address position in message header
Kojto 108:34e6b704fe68 329 * @{
Kojto 108:34e6b704fe68 330 */
<> 134:ad3be0349dc5 331 #define CEC_INITIATOR_LSB_POS (4U)
bogdanm 85:024bf7f99721 332 /**
bogdanm 85:024bf7f99721 333 * @}
bogdanm 85:024bf7f99721 334 */
<> 134:ad3be0349dc5 335
<> 134:ad3be0349dc5 336 /** @defgroup CEC_OWN_ADDRESS CEC Own Address
<> 134:ad3be0349dc5 337 * @{
<> 134:ad3be0349dc5 338 */
<> 134:ad3be0349dc5 339 #define CEC_OWN_ADDRESS_NONE ((uint16_t) 0x0000U) /* Reset value */
<> 134:ad3be0349dc5 340 #define CEC_OWN_ADDRESS_0 ((uint16_t) 0x0001U) /* Logical Address 0 */
<> 134:ad3be0349dc5 341 #define CEC_OWN_ADDRESS_1 ((uint16_t) 0x0002U) /* Logical Address 1 */
<> 134:ad3be0349dc5 342 #define CEC_OWN_ADDRESS_2 ((uint16_t) 0x0004U) /* Logical Address 2 */
<> 134:ad3be0349dc5 343 #define CEC_OWN_ADDRESS_3 ((uint16_t) 0x0008U) /* Logical Address 3 */
<> 134:ad3be0349dc5 344 #define CEC_OWN_ADDRESS_4 ((uint16_t) 0x0010U) /* Logical Address 4 */
<> 134:ad3be0349dc5 345 #define CEC_OWN_ADDRESS_5 ((uint16_t) 0x0020U) /* Logical Address 5 */
<> 134:ad3be0349dc5 346 #define CEC_OWN_ADDRESS_6 ((uint16_t) 0x0040U) /* Logical Address 6 */
<> 134:ad3be0349dc5 347 #define CEC_OWN_ADDRESS_7 ((uint16_t) 0x0080U) /* Logical Address 7 */
<> 134:ad3be0349dc5 348 #define CEC_OWN_ADDRESS_8 ((uint16_t) 0x0100U) /* Logical Address 9 */
<> 134:ad3be0349dc5 349 #define CEC_OWN_ADDRESS_9 ((uint16_t) 0x0200U) /* Logical Address 10 */
<> 134:ad3be0349dc5 350 #define CEC_OWN_ADDRESS_10 ((uint16_t) 0x0400U) /* Logical Address 11 */
<> 134:ad3be0349dc5 351 #define CEC_OWN_ADDRESS_11 ((uint16_t) 0x0800U) /* Logical Address 12 */
<> 134:ad3be0349dc5 352 #define CEC_OWN_ADDRESS_12 ((uint16_t) 0x1000U) /* Logical Address 13 */
<> 134:ad3be0349dc5 353 #define CEC_OWN_ADDRESS_13 ((uint16_t) 0x2000U) /* Logical Address 14 */
<> 134:ad3be0349dc5 354 #define CEC_OWN_ADDRESS_14 ((uint16_t) 0x4000U) /* Logical Address 15 */
<> 134:ad3be0349dc5 355 /**
<> 134:ad3be0349dc5 356 * @}
<> 134:ad3be0349dc5 357 */
<> 134:ad3be0349dc5 358
Kojto 108:34e6b704fe68 359 /** @defgroup CEC_Interrupts_Definitions CEC Interrupts definition
Kojto 108:34e6b704fe68 360 * @{
Kojto 108:34e6b704fe68 361 */
Kojto 108:34e6b704fe68 362 #define CEC_IT_TXACKE CEC_IER_TXACKEIE
Kojto 108:34e6b704fe68 363 #define CEC_IT_TXERR CEC_IER_TXERRIE
Kojto 108:34e6b704fe68 364 #define CEC_IT_TXUDR CEC_IER_TXUDRIE
Kojto 108:34e6b704fe68 365 #define CEC_IT_TXEND CEC_IER_TXENDIE
Kojto 108:34e6b704fe68 366 #define CEC_IT_TXBR CEC_IER_TXBRIE
Kojto 108:34e6b704fe68 367 #define CEC_IT_ARBLST CEC_IER_ARBLSTIE
Kojto 108:34e6b704fe68 368 #define CEC_IT_RXACKE CEC_IER_RXACKEIE
Kojto 108:34e6b704fe68 369 #define CEC_IT_LBPE CEC_IER_LBPEIE
Kojto 108:34e6b704fe68 370 #define CEC_IT_SBPE CEC_IER_SBPEIE
Kojto 108:34e6b704fe68 371 #define CEC_IT_BRE CEC_IER_BREIE
Kojto 108:34e6b704fe68 372 #define CEC_IT_RXOVR CEC_IER_RXOVRIE
Kojto 108:34e6b704fe68 373 #define CEC_IT_RXEND CEC_IER_RXENDIE
Kojto 108:34e6b704fe68 374 #define CEC_IT_RXBR CEC_IER_RXBRIE
Kojto 108:34e6b704fe68 375 /**
Kojto 108:34e6b704fe68 376 * @}
Kojto 108:34e6b704fe68 377 */
Kojto 108:34e6b704fe68 378
Kojto 108:34e6b704fe68 379 /** @defgroup CEC_Flags_Definitions CEC Flags definition
Kojto 108:34e6b704fe68 380 * @{
Kojto 108:34e6b704fe68 381 */
Kojto 108:34e6b704fe68 382 #define CEC_FLAG_TXACKE CEC_ISR_TXACKE
Kojto 108:34e6b704fe68 383 #define CEC_FLAG_TXERR CEC_ISR_TXERR
Kojto 108:34e6b704fe68 384 #define CEC_FLAG_TXUDR CEC_ISR_TXUDR
Kojto 108:34e6b704fe68 385 #define CEC_FLAG_TXEND CEC_ISR_TXEND
Kojto 108:34e6b704fe68 386 #define CEC_FLAG_TXBR CEC_ISR_TXBR
Kojto 108:34e6b704fe68 387 #define CEC_FLAG_ARBLST CEC_ISR_ARBLST
Kojto 108:34e6b704fe68 388 #define CEC_FLAG_RXACKE CEC_ISR_RXACKE
Kojto 108:34e6b704fe68 389 #define CEC_FLAG_LBPE CEC_ISR_LBPE
Kojto 108:34e6b704fe68 390 #define CEC_FLAG_SBPE CEC_ISR_SBPE
Kojto 108:34e6b704fe68 391 #define CEC_FLAG_BRE CEC_ISR_BRE
Kojto 108:34e6b704fe68 392 #define CEC_FLAG_RXOVR CEC_ISR_RXOVR
Kojto 108:34e6b704fe68 393 #define CEC_FLAG_RXEND CEC_ISR_RXEND
Kojto 108:34e6b704fe68 394 #define CEC_FLAG_RXBR CEC_ISR_RXBR
Kojto 108:34e6b704fe68 395 /**
Kojto 108:34e6b704fe68 396 * @}
Kojto 108:34e6b704fe68 397 */
<> 134:ad3be0349dc5 398
<> 134:ad3be0349dc5 399 /** @defgroup CEC_ALL_ERROR CEC all RX or TX errors flags
bogdanm 85:024bf7f99721 400 * @{
bogdanm 85:024bf7f99721 401 */
bogdanm 85:024bf7f99721 402 #define CEC_ISR_ALL_ERROR ((uint32_t)CEC_ISR_RXOVR|CEC_ISR_BRE|CEC_ISR_SBPE|CEC_ISR_LBPE|CEC_ISR_RXACKE|\
bogdanm 85:024bf7f99721 403 CEC_ISR_ARBLST|CEC_ISR_TXUDR|CEC_ISR_TXERR|CEC_ISR_TXACKE)
bogdanm 85:024bf7f99721 404 /**
bogdanm 85:024bf7f99721 405 * @}
bogdanm 85:024bf7f99721 406 */
bogdanm 85:024bf7f99721 407
<> 134:ad3be0349dc5 408 /** @defgroup CEC_IER_ALL_RX CEC all RX errors interrupts enabling flag
bogdanm 85:024bf7f99721 409 * @{
bogdanm 85:024bf7f99721 410 */
bogdanm 85:024bf7f99721 411 #define CEC_IER_RX_ALL_ERR ((uint32_t)CEC_IER_RXACKEIE|CEC_IER_LBPEIE|CEC_IER_SBPEIE|CEC_IER_BREIE|CEC_IER_RXOVRIE)
bogdanm 85:024bf7f99721 412 /**
bogdanm 85:024bf7f99721 413 * @}
bogdanm 85:024bf7f99721 414 */
bogdanm 85:024bf7f99721 415
<> 134:ad3be0349dc5 416 /** @defgroup CEC_IER_ALL_TX CEC all TX errors interrupts enabling flag
bogdanm 85:024bf7f99721 417 * @{
bogdanm 85:024bf7f99721 418 */
bogdanm 85:024bf7f99721 419 #define CEC_IER_TX_ALL_ERR ((uint32_t)CEC_IER_TXACKEIE|CEC_IER_TXERRIE|CEC_IER_TXUDRIE|CEC_IER_ARBLSTIE)
bogdanm 85:024bf7f99721 420 /**
bogdanm 85:024bf7f99721 421 * @}
<> 134:ad3be0349dc5 422 */
bogdanm 85:024bf7f99721 423
bogdanm 85:024bf7f99721 424 /**
bogdanm 85:024bf7f99721 425 * @}
bogdanm 85:024bf7f99721 426 */
bogdanm 85:024bf7f99721 427
bogdanm 85:024bf7f99721 428 /* Exported macros -----------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 429 /** @defgroup CEC_Exported_Macros CEC Exported Macros
bogdanm 85:024bf7f99721 430 * @{
bogdanm 85:024bf7f99721 431 */
bogdanm 85:024bf7f99721 432
<> 134:ad3be0349dc5 433 /** @brief Reset CEC handle gstate & RxState
bogdanm 85:024bf7f99721 434 * @param __HANDLE__: CEC handle.
bogdanm 85:024bf7f99721 435 * @retval None
bogdanm 85:024bf7f99721 436 */
<> 134:ad3be0349dc5 437 #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \
<> 134:ad3be0349dc5 438 (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \
<> 134:ad3be0349dc5 439 (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \
<> 134:ad3be0349dc5 440 } while(0)
bogdanm 85:024bf7f99721 441
bogdanm 85:024bf7f99721 442 /** @brief Checks whether or not the specified CEC interrupt flag is set.
bogdanm 85:024bf7f99721 443 * @param __HANDLE__: specifies the CEC Handle.
<> 134:ad3be0349dc5 444 * @param __FLAG__: specifies the flag to check.
Kojto 108:34e6b704fe68 445 * @arg CEC_FLAG_TXACKE: Tx Missing acknowledge Error
Kojto 108:34e6b704fe68 446 * @arg CEC_FLAG_TXERR: Tx Error.
Kojto 108:34e6b704fe68 447 * @arg CEC_FLAG_TXUDR: Tx-Buffer Underrun.
Kojto 108:34e6b704fe68 448 * @arg CEC_FLAG_TXEND: End of transmission (successful transmission of the last byte).
Kojto 108:34e6b704fe68 449 * @arg CEC_FLAG_TXBR: Tx-Byte Request.
Kojto 108:34e6b704fe68 450 * @arg CEC_FLAG_ARBLST: Arbitration Lost
Kojto 108:34e6b704fe68 451 * @arg CEC_FLAG_RXACKE: Rx-Missing Acknowledge
Kojto 108:34e6b704fe68 452 * @arg CEC_FLAG_LBPE: Rx Long period Error
Kojto 108:34e6b704fe68 453 * @arg CEC_FLAG_SBPE: Rx Short period Error
<> 134:ad3be0349dc5 454 * @arg CEC_FLAG_BRE: Rx Bit Rising Error
Kojto 108:34e6b704fe68 455 * @arg CEC_FLAG_RXOVR: Rx Overrun.
Kojto 108:34e6b704fe68 456 * @arg CEC_FLAG_RXEND: End Of Reception.
<> 134:ad3be0349dc5 457 * @arg CEC_FLAG_RXBR: Rx-Byte Received.
<> 134:ad3be0349dc5 458 * @retval ITStatus
bogdanm 85:024bf7f99721 459 */
Kojto 108:34e6b704fe68 460 #define __HAL_CEC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
bogdanm 85:024bf7f99721 461
bogdanm 85:024bf7f99721 462 /** @brief Clears the interrupt or status flag when raised (write at 1)
bogdanm 85:024bf7f99721 463 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 464 * @param __FLAG__: specifies the interrupt/status flag to clear.
bogdanm 85:024bf7f99721 465 * This parameter can be one of the following values:
Kojto 108:34e6b704fe68 466 * @arg CEC_FLAG_TXACKE: Tx Missing acknowledge Error
Kojto 108:34e6b704fe68 467 * @arg CEC_FLAG_TXERR: Tx Error.
Kojto 108:34e6b704fe68 468 * @arg CEC_FLAG_TXUDR: Tx-Buffer Underrun.
Kojto 108:34e6b704fe68 469 * @arg CEC_FLAG_TXEND: End of transmission (successful transmission of the last byte).
Kojto 108:34e6b704fe68 470 * @arg CEC_FLAG_TXBR: Tx-Byte Request.
Kojto 108:34e6b704fe68 471 * @arg CEC_FLAG_ARBLST: Arbitration Lost
Kojto 108:34e6b704fe68 472 * @arg CEC_FLAG_RXACKE: Rx-Missing Acknowledge
Kojto 108:34e6b704fe68 473 * @arg CEC_FLAG_LBPE: Rx Long period Error
Kojto 108:34e6b704fe68 474 * @arg CEC_FLAG_SBPE: Rx Short period Error
<> 134:ad3be0349dc5 475 * @arg CEC_FLAG_BRE: Rx Bit Rising Error
Kojto 108:34e6b704fe68 476 * @arg CEC_FLAG_RXOVR: Rx Overrun.
Kojto 108:34e6b704fe68 477 * @arg CEC_FLAG_RXEND: End Of Reception.
Kojto 108:34e6b704fe68 478 * @arg CEC_FLAG_RXBR: Rx-Byte Received.
bogdanm 85:024bf7f99721 479 * @retval none
bogdanm 85:024bf7f99721 480 */
Kojto 108:34e6b704fe68 481 #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR |= (__FLAG__))
bogdanm 85:024bf7f99721 482
bogdanm 85:024bf7f99721 483 /** @brief Enables the specified CEC interrupt.
bogdanm 85:024bf7f99721 484 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 485 * @param __INTERRUPT__: specifies the CEC interrupt to enable.
bogdanm 85:024bf7f99721 486 * This parameter can be one of the following values:
Kojto 108:34e6b704fe68 487 * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable
Kojto 108:34e6b704fe68 488 * @arg CEC_IT_TXERR: Tx Error IT Enable
Kojto 108:34e6b704fe68 489 * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable
Kojto 108:34e6b704fe68 490 * @arg CEC_IT_TXEND: End of transmission IT Enable
Kojto 108:34e6b704fe68 491 * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable
Kojto 108:34e6b704fe68 492 * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable
Kojto 108:34e6b704fe68 493 * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable
Kojto 108:34e6b704fe68 494 * @arg CEC_IT_LBPE: Rx Long period Error IT Enable
Kojto 108:34e6b704fe68 495 * @arg CEC_IT_SBPE: Rx Short period Error IT Enable
Kojto 108:34e6b704fe68 496 * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable
Kojto 108:34e6b704fe68 497 * @arg CEC_IT_RXOVR: Rx Overrun IT Enable
Kojto 108:34e6b704fe68 498 * @arg CEC_IT_RXEND: End Of Reception IT Enable
Kojto 108:34e6b704fe68 499 * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable
bogdanm 85:024bf7f99721 500 * @retval none
bogdanm 85:024bf7f99721 501 */
bogdanm 85:024bf7f99721 502 #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
bogdanm 85:024bf7f99721 503
bogdanm 85:024bf7f99721 504 /** @brief Disables the specified CEC interrupt.
bogdanm 85:024bf7f99721 505 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 506 * @param __INTERRUPT__: specifies the CEC interrupt to disable.
bogdanm 85:024bf7f99721 507 * This parameter can be one of the following values:
Kojto 108:34e6b704fe68 508 * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable
Kojto 108:34e6b704fe68 509 * @arg CEC_IT_TXERR: Tx Error IT Enable
Kojto 108:34e6b704fe68 510 * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable
Kojto 108:34e6b704fe68 511 * @arg CEC_IT_TXEND: End of transmission IT Enable
Kojto 108:34e6b704fe68 512 * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable
Kojto 108:34e6b704fe68 513 * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable
Kojto 108:34e6b704fe68 514 * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable
Kojto 108:34e6b704fe68 515 * @arg CEC_IT_LBPE: Rx Long period Error IT Enable
Kojto 108:34e6b704fe68 516 * @arg CEC_IT_SBPE: Rx Short period Error IT Enable
Kojto 108:34e6b704fe68 517 * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable
Kojto 108:34e6b704fe68 518 * @arg CEC_IT_RXOVR: Rx Overrun IT Enable
Kojto 108:34e6b704fe68 519 * @arg CEC_IT_RXEND: End Of Reception IT Enable
Kojto 108:34e6b704fe68 520 * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable
bogdanm 85:024bf7f99721 521 * @retval none
bogdanm 85:024bf7f99721 522 */
bogdanm 85:024bf7f99721 523 #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
bogdanm 85:024bf7f99721 524
bogdanm 85:024bf7f99721 525 /** @brief Checks whether or not the specified CEC interrupt is enabled.
bogdanm 85:024bf7f99721 526 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 527 * @param __INTERRUPT__: specifies the CEC interrupt to check.
bogdanm 85:024bf7f99721 528 * This parameter can be one of the following values:
Kojto 108:34e6b704fe68 529 * @arg CEC_IT_TXACKE: Tx Missing acknowledge Error IT Enable
Kojto 108:34e6b704fe68 530 * @arg CEC_IT_TXERR: Tx Error IT Enable
Kojto 108:34e6b704fe68 531 * @arg CEC_IT_TXUDR: Tx-Buffer Underrun IT Enable
Kojto 108:34e6b704fe68 532 * @arg CEC_IT_TXEND: End of transmission IT Enable
Kojto 108:34e6b704fe68 533 * @arg CEC_IT_TXBR: Tx-Byte Request IT Enable
Kojto 108:34e6b704fe68 534 * @arg CEC_IT_ARBLST: Arbitration Lost IT Enable
Kojto 108:34e6b704fe68 535 * @arg CEC_IT_RXACKE: Rx-Missing Acknowledge IT Enable
Kojto 108:34e6b704fe68 536 * @arg CEC_IT_LBPE: Rx Long period Error IT Enable
Kojto 108:34e6b704fe68 537 * @arg CEC_IT_SBPE: Rx Short period Error IT Enable
Kojto 108:34e6b704fe68 538 * @arg CEC_IT_BRE: Rx Bit Rising Error IT Enable
Kojto 108:34e6b704fe68 539 * @arg CEC_IT_RXOVR: Rx Overrun IT Enable
Kojto 108:34e6b704fe68 540 * @arg CEC_IT_RXEND: End Of Reception IT Enable
Kojto 108:34e6b704fe68 541 * @arg CEC_IT_RXBR: Rx-Byte Received IT Enable
bogdanm 85:024bf7f99721 542 * @retval FlagStatus
bogdanm 85:024bf7f99721 543 */
bogdanm 85:024bf7f99721 544 #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__))
bogdanm 85:024bf7f99721 545
bogdanm 85:024bf7f99721 546 /** @brief Enables the CEC device
bogdanm 85:024bf7f99721 547 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 548 * @retval none
bogdanm 85:024bf7f99721 549 */
bogdanm 85:024bf7f99721 550 #define __HAL_CEC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_CECEN)
bogdanm 85:024bf7f99721 551
bogdanm 85:024bf7f99721 552 /** @brief Disables the CEC device
bogdanm 85:024bf7f99721 553 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 554 * @retval none
bogdanm 85:024bf7f99721 555 */
bogdanm 85:024bf7f99721 556 #define __HAL_CEC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~CEC_CR_CECEN)
bogdanm 85:024bf7f99721 557
bogdanm 85:024bf7f99721 558 /** @brief Set Transmission Start flag
bogdanm 85:024bf7f99721 559 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 560 * @retval none
bogdanm 85:024bf7f99721 561 */
bogdanm 85:024bf7f99721 562 #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXSOM)
bogdanm 85:024bf7f99721 563
bogdanm 85:024bf7f99721 564 /** @brief Set Transmission End flag
bogdanm 85:024bf7f99721 565 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 566 * @retval none
bogdanm 85:024bf7f99721 567 * If the CEC message consists of only one byte, TXEOM must be set before of TXSOM.
bogdanm 85:024bf7f99721 568 */
bogdanm 85:024bf7f99721 569 #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXEOM)
bogdanm 85:024bf7f99721 570
bogdanm 85:024bf7f99721 571 /** @brief Get Transmission Start flag
bogdanm 85:024bf7f99721 572 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 573 * @retval FlagStatus
bogdanm 85:024bf7f99721 574 */
bogdanm 85:024bf7f99721 575 #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM)
bogdanm 85:024bf7f99721 576
bogdanm 85:024bf7f99721 577 /** @brief Get Transmission End flag
bogdanm 85:024bf7f99721 578 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 579 * @retval FlagStatus
bogdanm 85:024bf7f99721 580 */
bogdanm 85:024bf7f99721 581 #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXEOM)
bogdanm 85:024bf7f99721 582
bogdanm 85:024bf7f99721 583 /** @brief Clear OAR register
bogdanm 85:024bf7f99721 584 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 585 * @retval none
bogdanm 85:024bf7f99721 586 */
bogdanm 85:024bf7f99721 587 #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_OAR)
bogdanm 85:024bf7f99721 588
bogdanm 85:024bf7f99721 589 /** @brief Set OAR register (without resetting previously set address in case of multi-address mode)
bogdanm 85:024bf7f99721 590 * To reset OAR, __HAL_CEC_CLEAR_OAR() needs to be called beforehand
bogdanm 85:024bf7f99721 591 * @param __HANDLE__: specifies the CEC Handle.
bogdanm 85:024bf7f99721 592 * @param __ADDRESS__: Own Address value (CEC logical address is identified by bit position)
bogdanm 85:024bf7f99721 593 * @retval none
bogdanm 85:024bf7f99721 594 */
bogdanm 85:024bf7f99721 595 #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) SET_BIT((__HANDLE__)->Instance->CFGR, (__ADDRESS__)<< CEC_CFGR_OAR_LSB_POS)
<> 134:ad3be0349dc5 596
Kojto 108:34e6b704fe68 597 /**
Kojto 108:34e6b704fe68 598 * @}
Kojto 108:34e6b704fe68 599 */
bogdanm 85:024bf7f99721 600
Kojto 108:34e6b704fe68 601 /* Exported functions --------------------------------------------------------*/
Kojto 108:34e6b704fe68 602 /** @addtogroup CEC_Exported_Functions
Kojto 108:34e6b704fe68 603 * @{
Kojto 108:34e6b704fe68 604 */
<> 134:ad3be0349dc5 605
<> 134:ad3be0349dc5 606 /** @addtogroup CEC_Exported_Functions_Group1
Kojto 108:34e6b704fe68 607 * @{
Kojto 108:34e6b704fe68 608 */
Kojto 108:34e6b704fe68 609 /* Initialization and de-initialization functions ****************************/
Kojto 108:34e6b704fe68 610 HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
Kojto 108:34e6b704fe68 611 HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
<> 134:ad3be0349dc5 612 HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress);
Kojto 108:34e6b704fe68 613 void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
Kojto 108:34e6b704fe68 614 void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
Kojto 108:34e6b704fe68 615 /**
Kojto 108:34e6b704fe68 616 * @}
<> 134:ad3be0349dc5 617 */
Kojto 108:34e6b704fe68 618
<> 134:ad3be0349dc5 619 /** @addtogroup CEC_Exported_Functions_Group2
Kojto 108:34e6b704fe68 620 * @{
<> 134:ad3be0349dc5 621 */
Kojto 108:34e6b704fe68 622 /* I/O operation functions ***************************************************/
<> 134:ad3be0349dc5 623 HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t InitiatorAddress,uint8_t DestinationAddress, uint8_t *pData, uint32_t Size);
<> 134:ad3be0349dc5 624 uint32_t HAL_CEC_GetLastReceivedFrameSize(CEC_HandleTypeDef *hcec);
<> 134:ad3be0349dc5 625 void HAL_CEC_ChangeRxBuffer(CEC_HandleTypeDef *hcec, uint8_t* Rxbuffer);
Kojto 108:34e6b704fe68 626 void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec);
Kojto 108:34e6b704fe68 627 void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec);
<> 134:ad3be0349dc5 628 void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec, uint32_t RxFrameSize);
Kojto 108:34e6b704fe68 629 void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec);
Kojto 108:34e6b704fe68 630 /**
Kojto 108:34e6b704fe68 631 * @}
Kojto 108:34e6b704fe68 632 */
Kojto 108:34e6b704fe68 633
<> 134:ad3be0349dc5 634 /** @addtogroup CEC_Exported_Functions_Group3
Kojto 108:34e6b704fe68 635 * @{
<> 134:ad3be0349dc5 636 */
Kojto 108:34e6b704fe68 637 /* Peripheral State functions ************************************************/
Kojto 108:34e6b704fe68 638 HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec);
Kojto 108:34e6b704fe68 639 uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec);
Kojto 108:34e6b704fe68 640 /**
Kojto 108:34e6b704fe68 641 * @}
Kojto 108:34e6b704fe68 642 */
Kojto 108:34e6b704fe68 643
Kojto 108:34e6b704fe68 644 /**
Kojto 108:34e6b704fe68 645 * @}
Kojto 108:34e6b704fe68 646 */
<> 134:ad3be0349dc5 647
Kojto 108:34e6b704fe68 648 /* Private types -------------------------------------------------------------*/
Kojto 108:34e6b704fe68 649 /** @defgroup CEC_Private_Types CEC Private Types
Kojto 108:34e6b704fe68 650 * @{
Kojto 108:34e6b704fe68 651 */
Kojto 108:34e6b704fe68 652
Kojto 108:34e6b704fe68 653 /**
Kojto 108:34e6b704fe68 654 * @}
Kojto 108:34e6b704fe68 655 */
Kojto 108:34e6b704fe68 656
Kojto 108:34e6b704fe68 657 /* Private variables ---------------------------------------------------------*/
Kojto 108:34e6b704fe68 658 /** @defgroup CEC_Private_Variables CEC Private Variables
Kojto 108:34e6b704fe68 659 * @{
Kojto 108:34e6b704fe68 660 */
Kojto 108:34e6b704fe68 661
Kojto 108:34e6b704fe68 662 /**
Kojto 108:34e6b704fe68 663 * @}
Kojto 108:34e6b704fe68 664 */
Kojto 108:34e6b704fe68 665
Kojto 108:34e6b704fe68 666 /* Private constants ---------------------------------------------------------*/
Kojto 108:34e6b704fe68 667 /** @defgroup CEC_Private_Constants CEC Private Constants
Kojto 108:34e6b704fe68 668 * @{
Kojto 108:34e6b704fe68 669 */
Kojto 108:34e6b704fe68 670
Kojto 108:34e6b704fe68 671 /**
Kojto 108:34e6b704fe68 672 * @}
Kojto 108:34e6b704fe68 673 */
Kojto 108:34e6b704fe68 674
Kojto 108:34e6b704fe68 675 /* Private macros ------------------------------------------------------------*/
Kojto 108:34e6b704fe68 676 /** @defgroup CEC_Private_Macros CEC Private Macros
Kojto 108:34e6b704fe68 677 * @{
Kojto 108:34e6b704fe68 678 */
Kojto 108:34e6b704fe68 679
Kojto 108:34e6b704fe68 680 #define IS_CEC_SIGNALFREETIME(__SFT__) ((__SFT__) <= CEC_CFGR_SFT)
Kojto 108:34e6b704fe68 681
Kojto 108:34e6b704fe68 682 #define IS_CEC_TOLERANCE(__RXTOL__) (((__RXTOL__) == CEC_STANDARD_TOLERANCE) || \
Kojto 108:34e6b704fe68 683 ((__RXTOL__) == CEC_EXTENDED_TOLERANCE))
<> 134:ad3be0349dc5 684
Kojto 108:34e6b704fe68 685 #define IS_CEC_BRERXSTOP(__BRERXSTOP__) (((__BRERXSTOP__) == CEC_NO_RX_STOP_ON_BRE) || \
Kojto 108:34e6b704fe68 686 ((__BRERXSTOP__) == CEC_RX_STOP_ON_BRE))
<> 134:ad3be0349dc5 687
Kojto 108:34e6b704fe68 688 #define IS_CEC_BREERRORBITGEN(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_BRE_ERRORBIT_NO_GENERATION) || \
Kojto 108:34e6b704fe68 689 ((__ERRORBITGEN__) == CEC_BRE_ERRORBIT_GENERATION))
Kojto 108:34e6b704fe68 690
Kojto 108:34e6b704fe68 691 #define IS_CEC_LBPEERRORBITGEN(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_LBPE_ERRORBIT_NO_GENERATION) || \
Kojto 108:34e6b704fe68 692 ((__ERRORBITGEN__) == CEC_LBPE_ERRORBIT_GENERATION))
<> 134:ad3be0349dc5 693
Kojto 108:34e6b704fe68 694 #define IS_CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION(__ERRORBITGEN__) (((__ERRORBITGEN__) == CEC_BROADCASTERROR_ERRORBIT_GENERATION) || \
Kojto 108:34e6b704fe68 695 ((__ERRORBITGEN__) == CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION))
<> 134:ad3be0349dc5 696
Kojto 108:34e6b704fe68 697 #define IS_CEC_SFTOP(__SFTOP__) (((__SFTOP__) == CEC_SFT_START_ON_TXSOM) || \
Kojto 108:34e6b704fe68 698 ((__SFTOP__) == CEC_SFT_START_ON_TX_RX_END))
<> 134:ad3be0349dc5 699
Kojto 108:34e6b704fe68 700 #define IS_CEC_LISTENING_MODE(__MODE__) (((__MODE__) == CEC_REDUCED_LISTENING_MODE) || \
Kojto 108:34e6b704fe68 701 ((__MODE__) == CEC_FULL_LISTENING_MODE))
bogdanm 85:024bf7f99721 702
bogdanm 85:024bf7f99721 703 /** @brief Check CEC message size.
bogdanm 85:024bf7f99721 704 * The message size is the payload size: without counting the header,
bogdanm 85:024bf7f99721 705 * it varies from 0 byte (ping operation, one header only, no payload) to
bogdanm 85:024bf7f99721 706 * 15 bytes (1 opcode and up to 14 operands following the header).
bogdanm 85:024bf7f99721 707 * @param __SIZE__: CEC message size.
bogdanm 85:024bf7f99721 708 * @retval Test result (TRUE or FALSE).
bogdanm 85:024bf7f99721 709 */
<> 134:ad3be0349dc5 710 #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10U)
<> 134:ad3be0349dc5 711
<> 134:ad3be0349dc5 712 /** @brief Check CEC device Own Address Register (OAR) setting.
<> 134:ad3be0349dc5 713 * OAR address is written in a 15-bit field within CEC_CFGR register.
<> 134:ad3be0349dc5 714 * @param __ADDRESS__: CEC own address.
<> 134:ad3be0349dc5 715 * @retval Test result (TRUE or FALSE).
<> 134:ad3be0349dc5 716 */
<> 134:ad3be0349dc5 717 #define IS_CEC_OWN_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x7FFFU)
<> 134:ad3be0349dc5 718
<> 134:ad3be0349dc5 719 /** @brief Check CEC initiator or destination logical address setting.
<> 134:ad3be0349dc5 720 * Initiator and destination addresses are coded over 4 bits.
<> 134:ad3be0349dc5 721 * @param __ADDRESS__: CEC initiator or logical address.
<> 134:ad3be0349dc5 722 * @retval Test result (TRUE or FALSE).
<> 134:ad3be0349dc5 723 */
<> 134:ad3be0349dc5 724 #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0FU)
bogdanm 92:4fc01daae5a5 725 /**
bogdanm 92:4fc01daae5a5 726 * @}
<> 134:ad3be0349dc5 727 */
Kojto 108:34e6b704fe68 728 /* Private functions ---------------------------------------------------------*/
Kojto 108:34e6b704fe68 729 /** @defgroup CEC_Private_Functions CEC Private Functions
bogdanm 92:4fc01daae5a5 730 * @{
bogdanm 92:4fc01daae5a5 731 */
Kojto 108:34e6b704fe68 732
bogdanm 85:024bf7f99721 733 /**
bogdanm 85:024bf7f99721 734 * @}
bogdanm 92:4fc01daae5a5 735 */
<> 134:ad3be0349dc5 736
bogdanm 92:4fc01daae5a5 737 /**
bogdanm 92:4fc01daae5a5 738 * @}
bogdanm 85:024bf7f99721 739 */
bogdanm 85:024bf7f99721 740
bogdanm 85:024bf7f99721 741 /**
bogdanm 85:024bf7f99721 742 * @}
bogdanm 85:024bf7f99721 743 */
bogdanm 85:024bf7f99721 744
bogdanm 92:4fc01daae5a5 745 #endif /* defined(STM32F042x6) || defined(STM32F048xx) || */
bogdanm 92:4fc01daae5a5 746 /* defined(STM32F051x8) || defined(STM32F058xx) || */
bogdanm 92:4fc01daae5a5 747 /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || */
bogdanm 92:4fc01daae5a5 748 /* defined(STM32F091xC) || defined(STM32F098xx) */
bogdanm 85:024bf7f99721 749 #ifdef __cplusplus
bogdanm 85:024bf7f99721 750 }
bogdanm 85:024bf7f99721 751 #endif
bogdanm 85:024bf7f99721 752
bogdanm 85:024bf7f99721 753 #endif /* __STM32F0xx_HAL_CEC_H */
bogdanm 85:024bf7f99721 754
bogdanm 85:024bf7f99721 755 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/