meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jun 11 15:14:05 2014 +0100
Revision:
85:024bf7f99721
Child:
92:4fc01daae5a5
Release 85 of the mbed library

Main changes:

- K64F Ethernet fixes
- Updated tests
- Fixes for various mbed targets
- Code cleanup: fixed warnings, more consistent code style
- GCC support for K64F

There is a known issue with the I2C interface on some ST targets. If you
find the I2C interface problematic on your ST board, please log a bug
against this on mbed.org.

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