Modified version of the mbed library for use with the Nucleo boards.

Dependents:   EEPROMWrite Full-Project

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Mon Sep 28 10:45:10 2015 +0100
Revision:
630:825f75ca301e
Parent:
441:d2c15dda23c1
Synchronized with git revision 54fbe4144faf309c37205a5d39fa665daa919f10

Full URL: https://github.com/mbedmicro/mbed/commit/54fbe4144faf309c37205a5d39fa665daa919f10/

NUCLEO_F031K6 : Add new target

Who changed what in which revision?

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