mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Thu Nov 27 13:33:22 2014 +0000
Revision:
92:4fc01daae5a5
Parent:
85:024bf7f99721
Child:
93:e188a91d3eaa
Release 92 of the mbed libray

Main changes:

- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)

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