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

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Feb 03 15:31:20 2015 +0000
Revision:
93:e188a91d3eaa
Release 93 of the mbed library

Main changes:

- Renesas RZ_A1H bugfixes - i2c, ticker
- new targets - Nucleo F303RE, Nucleo F070RB, BLE SMURFS,
Dragonfly 411RE,
- BusXXX - is connected method, plus operators addition
- LPC8xx - I2c fixes
- timestamp_t reverted to uint32_t
- RTX - fixes regarding stack (alignment, magic word)

Who changed what in which revision?

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