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:
110:165afa46840b
.

Who changed what in which revision?

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