Elijah Orr / mbed-renbed

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Wed Jan 13 09:48:29 2016 +0000
Revision:
112:6f327212ef96
Release 112 of the mbed library

Changes:
- new platforms - STM32 B96B F446, MOTE_L152RC
- nrf51 - fix serial init bug (character sent)
- stm all devices - fix RTC clocking in the init
- stm f0 - SystemInit clock fix, for SetVector()
- RawSerial - fix for microlib (vsnprintf with size 0)

Who changed what in which revision?

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