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

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

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

Who changed what in which revision?

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