Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
100:cbbeb26dbd92
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 100:cbbeb26dbd92 1 /**
Kojto 100:cbbeb26dbd92 2 ******************************************************************************
Kojto 100:cbbeb26dbd92 3 * @file stm32f3xx_hal_cec.h
Kojto 100:cbbeb26dbd92 4 * @author MCD Application Team
Kojto 100:cbbeb26dbd92 5 * @version V1.1.0
Kojto 100:cbbeb26dbd92 6 * @date 12-Sept-2014
Kojto 100:cbbeb26dbd92 7 * @brief Header file of CEC HAL module.
Kojto 100:cbbeb26dbd92 8 ******************************************************************************
Kojto 100:cbbeb26dbd92 9 * @attention
Kojto 100:cbbeb26dbd92 10 *
Kojto 100:cbbeb26dbd92 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 100:cbbeb26dbd92 12 *
Kojto 100:cbbeb26dbd92 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 100:cbbeb26dbd92 14 * are permitted provided that the following conditions are met:
Kojto 100:cbbeb26dbd92 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 100:cbbeb26dbd92 16 * this list of conditions and the following disclaimer.
Kojto 100:cbbeb26dbd92 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 100:cbbeb26dbd92 18 * this list of conditions and the following disclaimer in the documentation
Kojto 100:cbbeb26dbd92 19 * and/or other materials provided with the distribution.
Kojto 100:cbbeb26dbd92 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 100:cbbeb26dbd92 21 * may be used to endorse or promote products derived from this software
Kojto 100:cbbeb26dbd92 22 * without specific prior written permission.
Kojto 100:cbbeb26dbd92 23 *
Kojto 100:cbbeb26dbd92 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 100:cbbeb26dbd92 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 100:cbbeb26dbd92 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 100:cbbeb26dbd92 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 100:cbbeb26dbd92 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 100:cbbeb26dbd92 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 100:cbbeb26dbd92 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 100:cbbeb26dbd92 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 100:cbbeb26dbd92 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 100:cbbeb26dbd92 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 100:cbbeb26dbd92 34 *
Kojto 100:cbbeb26dbd92 35 ******************************************************************************
Kojto 100:cbbeb26dbd92 36 */
Kojto 100:cbbeb26dbd92 37
Kojto 100:cbbeb26dbd92 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 100:cbbeb26dbd92 39 #ifndef __STM32F3xx_HAL_CEC_H
Kojto 100:cbbeb26dbd92 40 #define __STM32F3xx_HAL_CEC_H
Kojto 100:cbbeb26dbd92 41
Kojto 100:cbbeb26dbd92 42 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 43 extern "C" {
Kojto 100:cbbeb26dbd92 44 #endif
Kojto 100:cbbeb26dbd92 45
Kojto 100:cbbeb26dbd92 46 #if defined(STM32F373xC) || defined(STM32F378xx)
Kojto 100:cbbeb26dbd92 47 /* Includes ------------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 48 #include "stm32f3xx_hal_def.h"
Kojto 100:cbbeb26dbd92 49
Kojto 100:cbbeb26dbd92 50 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 100:cbbeb26dbd92 51 * @{
Kojto 100:cbbeb26dbd92 52 */
Kojto 100:cbbeb26dbd92 53
Kojto 100:cbbeb26dbd92 54 /** @addtogroup CEC
Kojto 100:cbbeb26dbd92 55 * @{
Kojto 100:cbbeb26dbd92 56 */
Kojto 100:cbbeb26dbd92 57
Kojto 100:cbbeb26dbd92 58 /* Exported types ------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 59 /** @defgroup CEC_Exported_Types CEC Exported Types
Kojto 100:cbbeb26dbd92 60 * @{
Kojto 100:cbbeb26dbd92 61 */
Kojto 100:cbbeb26dbd92 62 /**
Kojto 100:cbbeb26dbd92 63 * @brief CEC Init Structure definition
Kojto 100:cbbeb26dbd92 64 */
Kojto 100:cbbeb26dbd92 65 typedef struct
Kojto 100:cbbeb26dbd92 66 {
Kojto 100:cbbeb26dbd92 67 uint32_t SignalFreeTime; /*!< Set SFT field, specifies the Signal Free Time.
Kojto 100:cbbeb26dbd92 68 It can be one of @ref CEC_Signal_Free_Time
Kojto 100:cbbeb26dbd92 69 and belongs to the set {0,...,7} where
Kojto 100:cbbeb26dbd92 70 0x0 is the default configuration
Kojto 100:cbbeb26dbd92 71 else means 0.5 + (SignalFreeTime - 1) nominal data bit periods */
Kojto 100:cbbeb26dbd92 72
Kojto 100:cbbeb26dbd92 73 uint32_t Tolerance; /*!< Set RXTOL bit, specifies the tolerance accepted on the received waveforms,
Kojto 100:cbbeb26dbd92 74 it can be a value of @ref CEC_Tolerance : it is either CEC_STANDARD_TOLERANCE
Kojto 100:cbbeb26dbd92 75 or CEC_EXTENDED_TOLERANCE */
Kojto 100:cbbeb26dbd92 76
Kojto 100:cbbeb26dbd92 77 uint32_t BRERxStop; /*!< Set BRESTP bit @ref CEC_BRERxStop : specifies whether or not a Bit Rising Error stops the reception.
Kojto 100:cbbeb26dbd92 78 CEC_NO_RX_STOP_ON_BRE: reception is not stopped.
Kojto 100:cbbeb26dbd92 79 CEC_RX_STOP_ON_BRE: reception is stopped. */
Kojto 100:cbbeb26dbd92 80
Kojto 100:cbbeb26dbd92 81 uint32_t BREErrorBitGen; /*!< Set BREGEN bit @ref CEC_BREErrorBitGen : specifies whether or not an Error-Bit is generated on the
Kojto 100:cbbeb26dbd92 82 CEC line upon Bit Rising Error detection.
Kojto 100:cbbeb26dbd92 83 CEC_BRE_ERRORBIT_NO_GENERATION: no error-bit generation.
Kojto 100:cbbeb26dbd92 84 CEC_BRE_ERRORBIT_GENERATION: error-bit generation if BRESTP is set. */
Kojto 100:cbbeb26dbd92 85
Kojto 100:cbbeb26dbd92 86 uint32_t LBPEErrorBitGen; /*!< Set LBPEGEN bit @ref CEC_LBPEErrorBitGen : specifies whether or not an Error-Bit is generated on the
Kojto 100:cbbeb26dbd92 87 CEC line upon Long Bit Period Error detection.
Kojto 100:cbbeb26dbd92 88 CEC_LBPE_ERRORBIT_NO_GENERATION: no error-bit generation.
Kojto 100:cbbeb26dbd92 89 CEC_LBPE_ERRORBIT_GENERATION: error-bit generation. */
Kojto 100:cbbeb26dbd92 90
Kojto 100:cbbeb26dbd92 91 uint32_t BroadcastMsgNoErrorBitGen; /*!< Set BRDNOGEN bit @ref CEC_BroadCastMsgErrorBitGen : allows to avoid an Error-Bit generation on the CEC line
Kojto 100:cbbeb26dbd92 92 upon an error detected on a broadcast message.
Kojto 100:cbbeb26dbd92 93
Kojto 100:cbbeb26dbd92 94 It supersedes BREGEN and LBPEGEN bits for a broadcast message error handling. It can take two values:
Kojto 100:cbbeb26dbd92 95
Kojto 100:cbbeb26dbd92 96 1) CEC_BROADCASTERROR_ERRORBIT_GENERATION.
Kojto 100:cbbeb26dbd92 97 a) BRE detection: error-bit generation on the CEC line if BRESTP=CEC_RX_STOP_ON_BRE
Kojto 100:cbbeb26dbd92 98 and BREGEN=CEC_BRE_ERRORBIT_NO_GENERATION.
Kojto 100:cbbeb26dbd92 99 b) LBPE detection: error-bit generation on the CEC line
Kojto 100:cbbeb26dbd92 100 if LBPGEN=CEC_LBPE_ERRORBIT_NO_GENERATION.
Kojto 100:cbbeb26dbd92 101
Kojto 100:cbbeb26dbd92 102 2) CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION.
Kojto 100:cbbeb26dbd92 103 no error-bit generation in case neither a) nor b) are satisfied. Additionally,
Kojto 100:cbbeb26dbd92 104 there is no error-bit generation in case of Short Bit Period Error detection in
Kojto 100:cbbeb26dbd92 105 a broadcast message while LSTN bit is set. */
Kojto 100:cbbeb26dbd92 106
Kojto 100:cbbeb26dbd92 107 uint32_t SignalFreeTimeOption; /*!< Set SFTOP bit @ref CEC_SFT_Option : specifies when SFT timer starts.
Kojto 100:cbbeb26dbd92 108 CEC_SFT_START_ON_TXSOM SFT: timer starts when TXSOM is set by software.
Kojto 100:cbbeb26dbd92 109 CEC_SFT_START_ON_TX_RX_END: SFT timer starts automatically at the end of message transmission/reception. */
Kojto 100:cbbeb26dbd92 110
Kojto 100:cbbeb26dbd92 111 uint32_t OwnAddress; /*!< Set OAR field, specifies CEC device address within a 15-bit long field */
Kojto 100:cbbeb26dbd92 112
Kojto 100:cbbeb26dbd92 113 uint32_t ListenMode; /*!< Set LSTN bit @ref CEC_Listening_Mode : specifies device listening mode. It can take two values:
Kojto 100:cbbeb26dbd92 114
Kojto 100:cbbeb26dbd92 115 CEC_REDUCED_LISTENING_MODE: CEC peripheral receives only message addressed to its
Kojto 100:cbbeb26dbd92 116 own address (OAR). Messages addressed to different destination are ignored.
Kojto 100:cbbeb26dbd92 117 Broadcast messages are always received.
Kojto 100:cbbeb26dbd92 118
Kojto 100:cbbeb26dbd92 119 CEC_FULL_LISTENING_MODE: CEC peripheral receives messages addressed to its own
Kojto 100:cbbeb26dbd92 120 address (OAR) with positive acknowledge. Messages addressed to different destination
Kojto 100:cbbeb26dbd92 121 are received, but without interfering with the CEC bus: no acknowledge sent. */
Kojto 100:cbbeb26dbd92 122
Kojto 100:cbbeb26dbd92 123 uint8_t InitiatorAddress; /* Initiator address (source logical address, sent in each header) */
Kojto 100:cbbeb26dbd92 124
Kojto 100:cbbeb26dbd92 125 }CEC_InitTypeDef;
Kojto 100:cbbeb26dbd92 126
Kojto 100:cbbeb26dbd92 127 /**
Kojto 100:cbbeb26dbd92 128 * @brief HAL CEC State structures definition
Kojto 100:cbbeb26dbd92 129 */
Kojto 100:cbbeb26dbd92 130 typedef enum
Kojto 100:cbbeb26dbd92 131 {
Kojto 100:cbbeb26dbd92 132 HAL_CEC_STATE_RESET = 0x00, /*!< Peripheral Reset state */
Kojto 100:cbbeb26dbd92 133 HAL_CEC_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
Kojto 100:cbbeb26dbd92 134 HAL_CEC_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
Kojto 100:cbbeb26dbd92 135 HAL_CEC_STATE_BUSY_TX = 0x03, /*!< Data Transmission process is ongoing */
Kojto 100:cbbeb26dbd92 136 HAL_CEC_STATE_BUSY_RX = 0x04, /*!< Data Reception process is ongoing */
Kojto 100:cbbeb26dbd92 137 HAL_CEC_STATE_STANDBY_RX = 0x05, /*!< IP ready to receive, doesn't prevent IP to transmit */
Kojto 100:cbbeb26dbd92 138 HAL_CEC_STATE_TIMEOUT = 0x06, /*!< Timeout state */
Kojto 100:cbbeb26dbd92 139 HAL_CEC_STATE_ERROR = 0x07 /*!< State Error */
Kojto 100:cbbeb26dbd92 140 }HAL_CEC_StateTypeDef;
Kojto 100:cbbeb26dbd92 141
Kojto 100:cbbeb26dbd92 142 /**
Kojto 100:cbbeb26dbd92 143 * @brief HAL Error structures definition
Kojto 100:cbbeb26dbd92 144 */
Kojto 100:cbbeb26dbd92 145 typedef enum
Kojto 100:cbbeb26dbd92 146 {
Kojto 100:cbbeb26dbd92 147 HAL_CEC_ERROR_NONE = (uint32_t) 0x0, /*!< no error */
Kojto 100:cbbeb26dbd92 148 HAL_CEC_ERROR_RXOVR = CEC_ISR_RXOVR, /*!< CEC Rx-Overrun */
Kojto 100:cbbeb26dbd92 149 HAL_CEC_ERROR_BRE = CEC_ISR_BRE, /*!< CEC Rx Bit Rising Error */
Kojto 100:cbbeb26dbd92 150 HAL_CEC_ERROR_SBPE = CEC_ISR_SBPE, /*!< CEC Rx Short Bit period Error */
Kojto 100:cbbeb26dbd92 151 HAL_CEC_ERROR_LBPE = CEC_ISR_LBPE, /*!< CEC Rx Long Bit period Error */
Kojto 100:cbbeb26dbd92 152 HAL_CEC_ERROR_RXACKE = CEC_ISR_RXACKE, /*!< CEC Rx Missing Acknowledge */
Kojto 100:cbbeb26dbd92 153 HAL_CEC_ERROR_ARBLST = CEC_ISR_ARBLST, /*!< CEC Arbitration Lost */
Kojto 100:cbbeb26dbd92 154 HAL_CEC_ERROR_TXUDR = CEC_ISR_TXUDR, /*!< CEC Tx-Buffer Underrun */
Kojto 100:cbbeb26dbd92 155 HAL_CEC_ERROR_TXERR = CEC_ISR_TXERR, /*!< CEC Tx-Error */
Kojto 100:cbbeb26dbd92 156 HAL_CEC_ERROR_TXACKE = CEC_ISR_TXACKE /*!< CEC Tx Missing Acknowledge */
Kojto 100:cbbeb26dbd92 157 }
Kojto 100:cbbeb26dbd92 158 HAL_CEC_ErrorTypeDef;
Kojto 100:cbbeb26dbd92 159
Kojto 100:cbbeb26dbd92 160 /**
Kojto 100:cbbeb26dbd92 161 * @brief CEC handle Structure definition
Kojto 100:cbbeb26dbd92 162 */
Kojto 100:cbbeb26dbd92 163 typedef struct
Kojto 100:cbbeb26dbd92 164 {
Kojto 100:cbbeb26dbd92 165 CEC_TypeDef *Instance; /* CEC registers base address */
Kojto 100:cbbeb26dbd92 166
Kojto 100:cbbeb26dbd92 167 CEC_InitTypeDef Init; /* CEC communication parameters */
Kojto 100:cbbeb26dbd92 168
Kojto 100:cbbeb26dbd92 169 uint8_t *pTxBuffPtr; /* Pointer to CEC Tx transfer Buffer */
Kojto 100:cbbeb26dbd92 170
Kojto 100:cbbeb26dbd92 171 uint16_t TxXferCount; /* CEC Tx Transfer Counter */
Kojto 100:cbbeb26dbd92 172
Kojto 100:cbbeb26dbd92 173 uint8_t *pRxBuffPtr; /* Pointer to CEC Rx transfer Buffer */
Kojto 100:cbbeb26dbd92 174
Kojto 100:cbbeb26dbd92 175 uint16_t RxXferSize; /* CEC Rx Transfer size, 0: header received only */
Kojto 100:cbbeb26dbd92 176
Kojto 100:cbbeb26dbd92 177 uint32_t ErrorCode; /* For errors handling purposes, copy of ISR register
Kojto 100:cbbeb26dbd92 178 in case error is reported */
Kojto 100:cbbeb26dbd92 179
Kojto 100:cbbeb26dbd92 180 HAL_LockTypeDef Lock; /* Locking object */
Kojto 100:cbbeb26dbd92 181
Kojto 100:cbbeb26dbd92 182 HAL_CEC_StateTypeDef State; /* CEC communication state */
Kojto 100:cbbeb26dbd92 183
Kojto 100:cbbeb26dbd92 184 }CEC_HandleTypeDef;
Kojto 100:cbbeb26dbd92 185
Kojto 100:cbbeb26dbd92 186 /**
Kojto 100:cbbeb26dbd92 187 * @}
Kojto 100:cbbeb26dbd92 188 */
Kojto 100:cbbeb26dbd92 189
Kojto 100:cbbeb26dbd92 190 /* Exported constants --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 191 /** @defgroup CEC_Exported_Constants CEC Exported Constants
Kojto 100:cbbeb26dbd92 192 * @{
Kojto 100:cbbeb26dbd92 193 */
Kojto 100:cbbeb26dbd92 194
Kojto 100:cbbeb26dbd92 195 /** @defgroup CEC_Signal_Free_Time Signal Free Time setting parameter
Kojto 100:cbbeb26dbd92 196 * @{
Kojto 100:cbbeb26dbd92 197 */
Kojto 100:cbbeb26dbd92 198 #define CEC_DEFAULT_SFT ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 199 #define CEC_0_5_BITPERIOD_SFT ((uint32_t)0x00000001)
Kojto 100:cbbeb26dbd92 200 #define CEC_1_5_BITPERIOD_SFT ((uint32_t)0x00000002)
Kojto 100:cbbeb26dbd92 201 #define CEC_2_5_BITPERIOD_SFT ((uint32_t)0x00000003)
Kojto 100:cbbeb26dbd92 202 #define CEC_3_5_BITPERIOD_SFT ((uint32_t)0x00000004)
Kojto 100:cbbeb26dbd92 203 #define CEC_4_5_BITPERIOD_SFT ((uint32_t)0x00000005)
Kojto 100:cbbeb26dbd92 204 #define CEC_5_5_BITPERIOD_SFT ((uint32_t)0x00000006)
Kojto 100:cbbeb26dbd92 205 #define CEC_6_5_BITPERIOD_SFT ((uint32_t)0x00000007)
Kojto 100:cbbeb26dbd92 206 #define IS_CEC_SIGNALFREETIME(SFT) ((SFT) <= CEC_CFGR_SFT)
Kojto 100:cbbeb26dbd92 207 /**
Kojto 100:cbbeb26dbd92 208 * @}
Kojto 100:cbbeb26dbd92 209 */
Kojto 100:cbbeb26dbd92 210
Kojto 100:cbbeb26dbd92 211 /** @defgroup CEC_Tolerance Receiver Tolerance
Kojto 100:cbbeb26dbd92 212 * @{
Kojto 100:cbbeb26dbd92 213 */
Kojto 100:cbbeb26dbd92 214 #define CEC_STANDARD_TOLERANCE ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 215 #define CEC_EXTENDED_TOLERANCE ((uint32_t)CEC_CFGR_RXTOL)
Kojto 100:cbbeb26dbd92 216 #define IS_CEC_TOLERANCE(RXTOL) (((RXTOL) == CEC_STANDARD_TOLERANCE) || \
Kojto 100:cbbeb26dbd92 217 ((RXTOL) == CEC_EXTENDED_TOLERANCE))
Kojto 100:cbbeb26dbd92 218 /**
Kojto 100:cbbeb26dbd92 219 * @}
Kojto 100:cbbeb26dbd92 220 */
Kojto 100:cbbeb26dbd92 221
Kojto 100:cbbeb26dbd92 222 /** @defgroup CEC_BRERxStop Reception Stop on Error
Kojto 100:cbbeb26dbd92 223 * @{
Kojto 100:cbbeb26dbd92 224 */
Kojto 100:cbbeb26dbd92 225 #define CEC_NO_RX_STOP_ON_BRE ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 226 #define CEC_RX_STOP_ON_BRE ((uint32_t)CEC_CFGR_BRESTP)
Kojto 100:cbbeb26dbd92 227 #define IS_CEC_BRERXSTOP(BRERXSTOP) (((BRERXSTOP) == CEC_NO_RX_STOP_ON_BRE) || \
Kojto 100:cbbeb26dbd92 228 ((BRERXSTOP) == CEC_RX_STOP_ON_BRE))
Kojto 100:cbbeb26dbd92 229 /**
Kojto 100:cbbeb26dbd92 230 * @}
Kojto 100:cbbeb26dbd92 231 */
Kojto 100:cbbeb26dbd92 232
Kojto 100:cbbeb26dbd92 233 /** @defgroup CEC_BREErrorBitGen Error Bit Generation if Bit Rise Error reported
Kojto 100:cbbeb26dbd92 234 * @{
Kojto 100:cbbeb26dbd92 235 */
Kojto 100:cbbeb26dbd92 236 #define CEC_BRE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 237 #define CEC_BRE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BREGEN)
Kojto 100:cbbeb26dbd92 238 #define IS_CEC_BREERRORBITGEN(ERRORBITGEN) (((ERRORBITGEN) == CEC_BRE_ERRORBIT_NO_GENERATION) || \
Kojto 100:cbbeb26dbd92 239 ((ERRORBITGEN) == CEC_BRE_ERRORBIT_GENERATION))
Kojto 100:cbbeb26dbd92 240 /**
Kojto 100:cbbeb26dbd92 241 * @}
Kojto 100:cbbeb26dbd92 242 */
Kojto 100:cbbeb26dbd92 243
Kojto 100:cbbeb26dbd92 244 /** @defgroup CEC_LBPEErrorBitGen Error Bit Generation if Long Bit Period Error reported
Kojto 100:cbbeb26dbd92 245 * @{
Kojto 100:cbbeb26dbd92 246 */
Kojto 100:cbbeb26dbd92 247 #define CEC_LBPE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 248 #define CEC_LBPE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_LBPEGEN)
Kojto 100:cbbeb26dbd92 249 #define IS_CEC_LBPEERRORBITGEN(ERRORBITGEN) (((ERRORBITGEN) == CEC_LBPE_ERRORBIT_NO_GENERATION) || \
Kojto 100:cbbeb26dbd92 250 ((ERRORBITGEN) == CEC_LBPE_ERRORBIT_GENERATION))
Kojto 100:cbbeb26dbd92 251 /**
Kojto 100:cbbeb26dbd92 252 * @}
Kojto 100:cbbeb26dbd92 253 */
Kojto 100:cbbeb26dbd92 254
Kojto 100:cbbeb26dbd92 255 /** @defgroup CEC_BroadCastMsgErrorBitGen Error Bit Generation on Broadcast message
Kojto 100:cbbeb26dbd92 256 * @{
Kojto 100:cbbeb26dbd92 257 */
Kojto 100:cbbeb26dbd92 258 #define CEC_BROADCASTERROR_ERRORBIT_GENERATION ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 259 #define CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BRDNOGEN)
Kojto 100:cbbeb26dbd92 260 #define IS_CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION(ERRORBITGEN) (((ERRORBITGEN) == CEC_BROADCASTERROR_ERRORBIT_GENERATION) || \
Kojto 100:cbbeb26dbd92 261 ((ERRORBITGEN) == CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION))
Kojto 100:cbbeb26dbd92 262 /**
Kojto 100:cbbeb26dbd92 263 * @}
Kojto 100:cbbeb26dbd92 264 */
Kojto 100:cbbeb26dbd92 265
Kojto 100:cbbeb26dbd92 266 /** @defgroup CEC_SFT_Option Signal Free Time start option
Kojto 100:cbbeb26dbd92 267 * @{
Kojto 100:cbbeb26dbd92 268 */
Kojto 100:cbbeb26dbd92 269 #define CEC_SFT_START_ON_TXSOM ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 270 #define CEC_SFT_START_ON_TX_RX_END ((uint32_t)CEC_CFGR_SFTOPT)
Kojto 100:cbbeb26dbd92 271 #define IS_CEC_SFTOP(SFTOP) (((SFTOP) == CEC_SFT_START_ON_TXSOM) || \
Kojto 100:cbbeb26dbd92 272 ((SFTOP) == CEC_SFT_START_ON_TX_RX_END))
Kojto 100:cbbeb26dbd92 273 /**
Kojto 100:cbbeb26dbd92 274 * @}
Kojto 100:cbbeb26dbd92 275 */
Kojto 100:cbbeb26dbd92 276
Kojto 100:cbbeb26dbd92 277 /** @defgroup CEC_Listening_Mode Listening mode option
Kojto 100:cbbeb26dbd92 278 * @{
Kojto 100:cbbeb26dbd92 279 */
Kojto 100:cbbeb26dbd92 280 #define CEC_REDUCED_LISTENING_MODE ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 281 #define CEC_FULL_LISTENING_MODE ((uint32_t)CEC_CFGR_LSTN)
Kojto 100:cbbeb26dbd92 282 #define IS_CEC_LISTENING_MODE(MODE) (((MODE) == CEC_REDUCED_LISTENING_MODE) || \
Kojto 100:cbbeb26dbd92 283 ((MODE) == CEC_FULL_LISTENING_MODE))
Kojto 100:cbbeb26dbd92 284 /**
Kojto 100:cbbeb26dbd92 285 * @}
Kojto 100:cbbeb26dbd92 286 */
Kojto 100:cbbeb26dbd92 287
Kojto 100:cbbeb26dbd92 288 /** @defgroup CEC_ALL_ERROR all RX or TX errors flags in CEC ISR register
Kojto 100:cbbeb26dbd92 289 * @{
Kojto 100:cbbeb26dbd92 290 */
Kojto 100:cbbeb26dbd92 291 #define CEC_ISR_ALL_ERROR ((uint32_t)CEC_ISR_RXOVR|CEC_ISR_BRE|CEC_ISR_SBPE|CEC_ISR_LBPE|CEC_ISR_RXACKE|\
Kojto 100:cbbeb26dbd92 292 CEC_ISR_ARBLST|CEC_ISR_TXUDR|CEC_ISR_TXERR|CEC_ISR_TXACKE)
Kojto 100:cbbeb26dbd92 293 /**
Kojto 100:cbbeb26dbd92 294 * @}
Kojto 100:cbbeb26dbd92 295 */
Kojto 100:cbbeb26dbd92 296
Kojto 100:cbbeb26dbd92 297 /** @defgroup CEC_IER_ALL_RX all RX errors interrupts enabling flag
Kojto 100:cbbeb26dbd92 298 * @{
Kojto 100:cbbeb26dbd92 299 */
Kojto 100:cbbeb26dbd92 300 #define CEC_IER_RX_ALL_ERR ((uint32_t)CEC_IER_RXACKEIE|CEC_IER_LBPEIE|CEC_IER_SBPEIE|CEC_IER_BREIE|CEC_IER_RXOVRIE)
Kojto 100:cbbeb26dbd92 301 /**
Kojto 100:cbbeb26dbd92 302 * @}
Kojto 100:cbbeb26dbd92 303 */
Kojto 100:cbbeb26dbd92 304
Kojto 100:cbbeb26dbd92 305 /** @defgroup CEC_IER_ALL_TX all TX errors interrupts enabling flag
Kojto 100:cbbeb26dbd92 306 * @{
Kojto 100:cbbeb26dbd92 307 */
Kojto 100:cbbeb26dbd92 308 #define CEC_IER_TX_ALL_ERR ((uint32_t)CEC_IER_TXACKEIE|CEC_IER_TXERRIE|CEC_IER_TXUDRIE|CEC_IER_ARBLSTIE)
Kojto 100:cbbeb26dbd92 309 /**
Kojto 100:cbbeb26dbd92 310 * @}
Kojto 100:cbbeb26dbd92 311 */
Kojto 100:cbbeb26dbd92 312
Kojto 100:cbbeb26dbd92 313 /** @defgroup CEC_OAR_Position Device Own Address position in CEC CFGR register
Kojto 100:cbbeb26dbd92 314 * @{
Kojto 100:cbbeb26dbd92 315 */
Kojto 100:cbbeb26dbd92 316 #define CEC_CFGR_OAR_LSB_POS ((uint32_t) 16)
Kojto 100:cbbeb26dbd92 317 /**
Kojto 100:cbbeb26dbd92 318 * @}
Kojto 100:cbbeb26dbd92 319 */
Kojto 100:cbbeb26dbd92 320
Kojto 100:cbbeb26dbd92 321 /** @defgroup CEC_Initiator_Position Initiator logical address position in message header
Kojto 100:cbbeb26dbd92 322 * @{
Kojto 100:cbbeb26dbd92 323 */
Kojto 100:cbbeb26dbd92 324 #define CEC_INITIATOR_LSB_POS ((uint32_t) 4)
Kojto 100:cbbeb26dbd92 325 /**
Kojto 100:cbbeb26dbd92 326 * @}
Kojto 100:cbbeb26dbd92 327 */
Kojto 100:cbbeb26dbd92 328
Kojto 100:cbbeb26dbd92 329 /**
Kojto 100:cbbeb26dbd92 330 * @}
Kojto 100:cbbeb26dbd92 331 */
Kojto 100:cbbeb26dbd92 332
Kojto 100:cbbeb26dbd92 333 /* Exported macros -----------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 334 /** @defgroup CEC_Exported_Macros CEC Exported Macros
Kojto 100:cbbeb26dbd92 335 * @{
Kojto 100:cbbeb26dbd92 336 */
Kojto 100:cbbeb26dbd92 337
Kojto 100:cbbeb26dbd92 338 /** @brief Reset CEC handle state
Kojto 100:cbbeb26dbd92 339 * @param __HANDLE__: CEC handle.
Kojto 100:cbbeb26dbd92 340 * @retval None
Kojto 100:cbbeb26dbd92 341 */
Kojto 100:cbbeb26dbd92 342 #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CEC_STATE_RESET)
Kojto 100:cbbeb26dbd92 343
Kojto 100:cbbeb26dbd92 344 /** @brief Checks whether or not the specified CEC interrupt flag is set.
Kojto 100:cbbeb26dbd92 345 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 346 * @param __INTERRUPT__: specifies the interrupt to check.
Kojto 100:cbbeb26dbd92 347 * This parameter can be one of the following values:
Kojto 100:cbbeb26dbd92 348 * @arg CEC_ISR_RXBR : Rx-Byte Received
Kojto 100:cbbeb26dbd92 349 * @arg CEC_ISR_RXEND : End of Reception
Kojto 100:cbbeb26dbd92 350 * @arg CEC_ISR_RXOVR : Rx Overrun
Kojto 100:cbbeb26dbd92 351 * @arg CEC_ISR_BRE : Rx Bit Rising Error
Kojto 100:cbbeb26dbd92 352 * @arg CEC_ISR_SBPE : Rx Short Bit Period Error
Kojto 100:cbbeb26dbd92 353 * @arg CEC_ISR_LBPE : Rx Long Bit Period Error
Kojto 100:cbbeb26dbd92 354 * @arg CEC_ISR_RXACKE : Rx Missing Acknowledge
Kojto 100:cbbeb26dbd92 355 * @arg CEC_ISR_ARBLST : Arbitration lost
Kojto 100:cbbeb26dbd92 356 * @arg CEC_ISR_TXBR : Tx-Byte Request
Kojto 100:cbbeb26dbd92 357 * @arg CEC_ISR_TXEND : End of Transmission
Kojto 100:cbbeb26dbd92 358 * @arg CEC_ISR_TXUDR : Tx-buffer Underrun
Kojto 100:cbbeb26dbd92 359 * @arg CEC_ISR_TXERR : Tx Error
Kojto 100:cbbeb26dbd92 360 * @arg CEC_ISR_TXACKE : Tx Missing Acknowledge
Kojto 100:cbbeb26dbd92 361 * @retval ITStatus
Kojto 100:cbbeb26dbd92 362 */
Kojto 100:cbbeb26dbd92 363 #define __HAL_CEC_GET_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->ISR & (__INTERRUPT__))
Kojto 100:cbbeb26dbd92 364
Kojto 100:cbbeb26dbd92 365 /** @brief Clears the interrupt or status flag when raised (write at 1)
Kojto 100:cbbeb26dbd92 366 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 367 * @param __FLAG__: specifies the interrupt/status flag to clear.
Kojto 100:cbbeb26dbd92 368 * This parameter can be one of the following values:
Kojto 100:cbbeb26dbd92 369 * @arg CEC_ISR_RXBR : Rx-Byte Received
Kojto 100:cbbeb26dbd92 370 * @arg CEC_ISR_RXEND : End of Reception
Kojto 100:cbbeb26dbd92 371 * @arg CEC_ISR_RXOVR : Rx Overrun
Kojto 100:cbbeb26dbd92 372 * @arg CEC_ISR_BRE : Rx Bit Rising Error
Kojto 100:cbbeb26dbd92 373 * @arg CEC_ISR_SBPE : Rx Short Bit Period Error
Kojto 100:cbbeb26dbd92 374 * @arg CEC_ISR_LBPE : Rx Long Bit Period Error
Kojto 100:cbbeb26dbd92 375 * @arg CEC_ISR_RXACKE : Rx Missing Acknowledge
Kojto 100:cbbeb26dbd92 376 * @arg CEC_ISR_ARBLST : Arbitration lost
Kojto 100:cbbeb26dbd92 377 * @arg CEC_ISR_TXBR : Tx-Byte Request
Kojto 100:cbbeb26dbd92 378 * @arg CEC_ISR_TXEND : End of Transmission
Kojto 100:cbbeb26dbd92 379 * @arg CEC_ISR_TXUDR : Tx-buffer Underrun
Kojto 100:cbbeb26dbd92 380 * @arg CEC_ISR_TXERR : Tx Error
Kojto 100:cbbeb26dbd92 381 * @arg CEC_ISR_TXACKE : Tx Missing Acknowledge
Kojto 100:cbbeb26dbd92 382 * @retval none
Kojto 100:cbbeb26dbd92 383 */
Kojto 100:cbbeb26dbd92 384 #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR = (__FLAG__))
Kojto 100:cbbeb26dbd92 385
Kojto 100:cbbeb26dbd92 386 /** @brief Enables the specified CEC interrupt.
Kojto 100:cbbeb26dbd92 387 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 388 * @param __INTERRUPT__: specifies the CEC interrupt to enable.
Kojto 100:cbbeb26dbd92 389 * This parameter can be one of the following values:
Kojto 100:cbbeb26dbd92 390 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
Kojto 100:cbbeb26dbd92 391 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
Kojto 100:cbbeb26dbd92 392 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
Kojto 100:cbbeb26dbd92 393 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
Kojto 100:cbbeb26dbd92 394 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
Kojto 100:cbbeb26dbd92 395 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
Kojto 100:cbbeb26dbd92 396 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
Kojto 100:cbbeb26dbd92 397 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
Kojto 100:cbbeb26dbd92 398 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
Kojto 100:cbbeb26dbd92 399 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
Kojto 100:cbbeb26dbd92 400 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
Kojto 100:cbbeb26dbd92 401 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
Kojto 100:cbbeb26dbd92 402 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
Kojto 100:cbbeb26dbd92 403 * @retval none
Kojto 100:cbbeb26dbd92 404 */
Kojto 100:cbbeb26dbd92 405 #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
Kojto 100:cbbeb26dbd92 406
Kojto 100:cbbeb26dbd92 407 /** @brief Disables the specified CEC interrupt.
Kojto 100:cbbeb26dbd92 408 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 409 * @param __INTERRUPT__: specifies the CEC interrupt to disable.
Kojto 100:cbbeb26dbd92 410 * This parameter can be one of the following values:
Kojto 100:cbbeb26dbd92 411 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
Kojto 100:cbbeb26dbd92 412 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
Kojto 100:cbbeb26dbd92 413 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
Kojto 100:cbbeb26dbd92 414 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
Kojto 100:cbbeb26dbd92 415 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
Kojto 100:cbbeb26dbd92 416 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
Kojto 100:cbbeb26dbd92 417 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
Kojto 100:cbbeb26dbd92 418 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
Kojto 100:cbbeb26dbd92 419 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
Kojto 100:cbbeb26dbd92 420 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
Kojto 100:cbbeb26dbd92 421 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
Kojto 100:cbbeb26dbd92 422 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
Kojto 100:cbbeb26dbd92 423 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
Kojto 100:cbbeb26dbd92 424 * @retval none
Kojto 100:cbbeb26dbd92 425 */
Kojto 100:cbbeb26dbd92 426 #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
Kojto 100:cbbeb26dbd92 427
Kojto 100:cbbeb26dbd92 428 /** @brief Checks whether or not the specified CEC interrupt is enabled.
Kojto 100:cbbeb26dbd92 429 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 430 * @param __INTERRUPT__: specifies the CEC interrupt to check.
Kojto 100:cbbeb26dbd92 431 * This parameter can be one of the following values:
Kojto 100:cbbeb26dbd92 432 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
Kojto 100:cbbeb26dbd92 433 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
Kojto 100:cbbeb26dbd92 434 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
Kojto 100:cbbeb26dbd92 435 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
Kojto 100:cbbeb26dbd92 436 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
Kojto 100:cbbeb26dbd92 437 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
Kojto 100:cbbeb26dbd92 438 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
Kojto 100:cbbeb26dbd92 439 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
Kojto 100:cbbeb26dbd92 440 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
Kojto 100:cbbeb26dbd92 441 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
Kojto 100:cbbeb26dbd92 442 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
Kojto 100:cbbeb26dbd92 443 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
Kojto 100:cbbeb26dbd92 444 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
Kojto 100:cbbeb26dbd92 445 * @retval FlagStatus
Kojto 100:cbbeb26dbd92 446 */
Kojto 100:cbbeb26dbd92 447 #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__))
Kojto 100:cbbeb26dbd92 448
Kojto 100:cbbeb26dbd92 449 /** @brief Enables the CEC device
Kojto 100:cbbeb26dbd92 450 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 451 * @retval none
Kojto 100:cbbeb26dbd92 452 */
Kojto 100:cbbeb26dbd92 453 #define __HAL_CEC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_CECEN)
Kojto 100:cbbeb26dbd92 454
Kojto 100:cbbeb26dbd92 455 /** @brief Disables the CEC device
Kojto 100:cbbeb26dbd92 456 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 457 * @retval none
Kojto 100:cbbeb26dbd92 458 */
Kojto 100:cbbeb26dbd92 459 #define __HAL_CEC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~CEC_CR_CECEN)
Kojto 100:cbbeb26dbd92 460
Kojto 100:cbbeb26dbd92 461 /** @brief Set Transmission Start flag
Kojto 100:cbbeb26dbd92 462 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 463 * @retval none
Kojto 100:cbbeb26dbd92 464 */
Kojto 100:cbbeb26dbd92 465 #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXSOM)
Kojto 100:cbbeb26dbd92 466
Kojto 100:cbbeb26dbd92 467 /** @brief Set Transmission End flag
Kojto 100:cbbeb26dbd92 468 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 469 * @retval none
Kojto 100:cbbeb26dbd92 470 * If the CEC message consists of only one byte, TXEOM must be set before of TXSOM.
Kojto 100:cbbeb26dbd92 471 */
Kojto 100:cbbeb26dbd92 472 #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXEOM)
Kojto 100:cbbeb26dbd92 473
Kojto 100:cbbeb26dbd92 474 /** @brief Get Transmission Start flag
Kojto 100:cbbeb26dbd92 475 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 476 * @retval FlagStatus
Kojto 100:cbbeb26dbd92 477 */
Kojto 100:cbbeb26dbd92 478 #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM)
Kojto 100:cbbeb26dbd92 479
Kojto 100:cbbeb26dbd92 480 /** @brief Get Transmission End flag
Kojto 100:cbbeb26dbd92 481 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 482 * @retval FlagStatus
Kojto 100:cbbeb26dbd92 483 */
Kojto 100:cbbeb26dbd92 484 #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXEOM)
Kojto 100:cbbeb26dbd92 485
Kojto 100:cbbeb26dbd92 486 /** @brief Clear OAR register
Kojto 100:cbbeb26dbd92 487 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 488 * @retval none
Kojto 100:cbbeb26dbd92 489 */
Kojto 100:cbbeb26dbd92 490 #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_OAR)
Kojto 100:cbbeb26dbd92 491
Kojto 100:cbbeb26dbd92 492 /** @brief Set OAR register (without resetting previously set address in case of multi-address mode)
Kojto 100:cbbeb26dbd92 493 * To reset OAR, __HAL_CEC_CLEAR_OAR() needs to be called beforehand
Kojto 100:cbbeb26dbd92 494 * @param __HANDLE__: specifies the CEC Handle.
Kojto 100:cbbeb26dbd92 495 * @param __ADDRESS__: Own Address value (CEC logical address is identified by bit position)
Kojto 100:cbbeb26dbd92 496 * @retval none
Kojto 100:cbbeb26dbd92 497 */
Kojto 100:cbbeb26dbd92 498 #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) SET_BIT((__HANDLE__)->Instance->CFGR, (__ADDRESS__)<< CEC_CFGR_OAR_LSB_POS)
Kojto 100:cbbeb26dbd92 499
Kojto 100:cbbeb26dbd92 500 /** @brief Check CEC device Own Address Register (OAR) setting.
Kojto 100:cbbeb26dbd92 501 * OAR address is written in a 15-bit field within CEC_CFGR register.
Kojto 100:cbbeb26dbd92 502 * @param __ADDRESS__: CEC own address.
Kojto 100:cbbeb26dbd92 503 * @retval Test result (TRUE or FALSE).
Kojto 100:cbbeb26dbd92 504 */
Kojto 100:cbbeb26dbd92 505 #define IS_CEC_OAR_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x07FFF)
Kojto 100:cbbeb26dbd92 506
Kojto 100:cbbeb26dbd92 507 /** @brief Check CEC initiator or destination logical address setting.
Kojto 100:cbbeb26dbd92 508 * Initiator and destination addresses are coded over 4 bits.
Kojto 100:cbbeb26dbd92 509 * @param __ADDRESS__: CEC initiator or logical address.
Kojto 100:cbbeb26dbd92 510 * @retval Test result (TRUE or FALSE).
Kojto 100:cbbeb26dbd92 511 */
Kojto 100:cbbeb26dbd92 512 #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0xF)
Kojto 100:cbbeb26dbd92 513
Kojto 100:cbbeb26dbd92 514 /** @brief Check CEC message size.
Kojto 100:cbbeb26dbd92 515 * The message size is the payload size: without counting the header,
Kojto 100:cbbeb26dbd92 516 * it varies from 0 byte (ping operation, one header only, no payload) to
Kojto 100:cbbeb26dbd92 517 * 15 bytes (1 opcode and up to 14 operands following the header).
Kojto 100:cbbeb26dbd92 518 * @param __SIZE__: CEC message size.
Kojto 100:cbbeb26dbd92 519 * @retval Test result (TRUE or FALSE).
Kojto 100:cbbeb26dbd92 520 */
Kojto 100:cbbeb26dbd92 521 #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0xF)
Kojto 100:cbbeb26dbd92 522
Kojto 100:cbbeb26dbd92 523 /**
Kojto 100:cbbeb26dbd92 524 * @}
Kojto 100:cbbeb26dbd92 525 */
Kojto 100:cbbeb26dbd92 526
Kojto 100:cbbeb26dbd92 527 /* Exported functions --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 528 /** @addtogroup CEC_Exported_Functions CEC Exported Functions
Kojto 100:cbbeb26dbd92 529 * @{
Kojto 100:cbbeb26dbd92 530 */
Kojto 100:cbbeb26dbd92 531
Kojto 100:cbbeb26dbd92 532 /** @addtogroup CEC_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 100:cbbeb26dbd92 533 * @brief Initialization and Configuration functions
Kojto 100:cbbeb26dbd92 534 * @{
Kojto 100:cbbeb26dbd92 535 */
Kojto 100:cbbeb26dbd92 536 /* Initialization and de-initialization functions ****************************/
Kojto 100:cbbeb26dbd92 537 HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 538 HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 539 void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 540 void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 541 /**
Kojto 100:cbbeb26dbd92 542 * @}
Kojto 100:cbbeb26dbd92 543 */
Kojto 100:cbbeb26dbd92 544
Kojto 100:cbbeb26dbd92 545 /** @addtogroup CEC_Exported_Functions_Group2 Input and Output operation functions
Kojto 100:cbbeb26dbd92 546 * @brief CEC Transmit/Receive functions
Kojto 100:cbbeb26dbd92 547 * @{
Kojto 100:cbbeb26dbd92 548 */
Kojto 100:cbbeb26dbd92 549 /* IO operation functions *****************************************************/
Kojto 100:cbbeb26dbd92 550 HAL_StatusTypeDef HAL_CEC_Transmit(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size, uint32_t Timeout);
Kojto 100:cbbeb26dbd92 551 HAL_StatusTypeDef HAL_CEC_Receive(CEC_HandleTypeDef *hcec, uint8_t *pData, uint32_t Timeout);
Kojto 100:cbbeb26dbd92 552 HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size);
Kojto 100:cbbeb26dbd92 553 HAL_StatusTypeDef HAL_CEC_Receive_IT(CEC_HandleTypeDef *hcec, uint8_t *pData);
Kojto 100:cbbeb26dbd92 554 void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 555 void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 556 void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 557 void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 558 /**
Kojto 100:cbbeb26dbd92 559 * @}
Kojto 100:cbbeb26dbd92 560 */
Kojto 100:cbbeb26dbd92 561
Kojto 100:cbbeb26dbd92 562 /** @defgroup CEC_Exported_Functions_Group3 Peripheral Control functions
Kojto 100:cbbeb26dbd92 563 * @brief CEC control functions
Kojto 100:cbbeb26dbd92 564 * @{
Kojto 100:cbbeb26dbd92 565 */
Kojto 100:cbbeb26dbd92 566 /* Peripheral State and Error functions ***************************************/
Kojto 100:cbbeb26dbd92 567 HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 568 uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec);
Kojto 100:cbbeb26dbd92 569 /**
Kojto 100:cbbeb26dbd92 570 * @}
Kojto 100:cbbeb26dbd92 571 */
Kojto 100:cbbeb26dbd92 572
Kojto 100:cbbeb26dbd92 573 /**
Kojto 100:cbbeb26dbd92 574 * @}
Kojto 100:cbbeb26dbd92 575 */
Kojto 100:cbbeb26dbd92 576
Kojto 100:cbbeb26dbd92 577 /**
Kojto 100:cbbeb26dbd92 578 * @}
Kojto 100:cbbeb26dbd92 579 */
Kojto 100:cbbeb26dbd92 580
Kojto 100:cbbeb26dbd92 581 /**
Kojto 100:cbbeb26dbd92 582 * @}
Kojto 100:cbbeb26dbd92 583 */
Kojto 100:cbbeb26dbd92 584
Kojto 100:cbbeb26dbd92 585 #endif /* defined(STM32F373xC) || defined(STM32F378xx) */
Kojto 100:cbbeb26dbd92 586
Kojto 100:cbbeb26dbd92 587 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 588 }
Kojto 100:cbbeb26dbd92 589 #endif
Kojto 100:cbbeb26dbd92 590
Kojto 100:cbbeb26dbd92 591 #endif /* __STM32F3xx_HAL_CEC_H */
Kojto 100:cbbeb26dbd92 592
Kojto 100:cbbeb26dbd92 593 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/