mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Oct 09 08:15:07 2014 +0100
Revision:
340:28d1f895c6fe
Synchronized with git revision b5a4c8e80393336b2656fb29ab46d405d3068602

Full URL: https://github.com/mbedmicro/mbed/commit/b5a4c8e80393336b2656fb29ab46d405d3068602/

HAL: nrf51822 - Few fixes for PWM and Serial

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 340:28d1f895c6fe 5 * @version V1.1.0
mbed_official 340:28d1f895c6fe 6 * @date 03-Oct-2014
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 340:28d1f895c6fe 11 * <h2><center>&copy; COPYRIGHT(c) 2014 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 340:28d1f895c6fe 57 /** @addtogroup CEC CEC HAL Module Driver
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 HAL Error structures definition
mbed_official 340:28d1f895c6fe 148 */
mbed_official 340:28d1f895c6fe 149 typedef enum
mbed_official 340:28d1f895c6fe 150 {
mbed_official 340:28d1f895c6fe 151 HAL_CEC_ERROR_NONE = (uint32_t) 0x0, /*!< no error */
mbed_official 340:28d1f895c6fe 152 HAL_CEC_ERROR_RXOVR = CEC_ISR_RXOVR, /*!< CEC Rx-Overrun */
mbed_official 340:28d1f895c6fe 153 HAL_CEC_ERROR_BRE = CEC_ISR_BRE, /*!< CEC Rx Bit Rising Error */
mbed_official 340:28d1f895c6fe 154 HAL_CEC_ERROR_SBPE = CEC_ISR_SBPE, /*!< CEC Rx Short Bit period Error */
mbed_official 340:28d1f895c6fe 155 HAL_CEC_ERROR_LBPE = CEC_ISR_LBPE, /*!< CEC Rx Long Bit period Error */
mbed_official 340:28d1f895c6fe 156 HAL_CEC_ERROR_RXACKE = CEC_ISR_RXACKE, /*!< CEC Rx Missing Acknowledge */
mbed_official 340:28d1f895c6fe 157 HAL_CEC_ERROR_ARBLST = CEC_ISR_ARBLST, /*!< CEC Arbitration Lost */
mbed_official 340:28d1f895c6fe 158 HAL_CEC_ERROR_TXUDR = CEC_ISR_TXUDR, /*!< CEC Tx-Buffer Underrun */
mbed_official 340:28d1f895c6fe 159 HAL_CEC_ERROR_TXERR = CEC_ISR_TXERR, /*!< CEC Tx-Error */
mbed_official 340:28d1f895c6fe 160 HAL_CEC_ERROR_TXACKE = CEC_ISR_TXACKE /*!< CEC Tx Missing Acknowledge */
mbed_official 340:28d1f895c6fe 161 }
mbed_official 340:28d1f895c6fe 162 HAL_CEC_ErrorTypeDef;
mbed_official 340:28d1f895c6fe 163
mbed_official 340:28d1f895c6fe 164 /**
mbed_official 340:28d1f895c6fe 165 * @brief CEC handle Structure definition
mbed_official 340:28d1f895c6fe 166 */
mbed_official 340:28d1f895c6fe 167 typedef struct
mbed_official 340:28d1f895c6fe 168 {
mbed_official 340:28d1f895c6fe 169 CEC_TypeDef *Instance; /* CEC registers base address */
mbed_official 340:28d1f895c6fe 170
mbed_official 340:28d1f895c6fe 171 CEC_InitTypeDef Init; /* CEC communication parameters */
mbed_official 340:28d1f895c6fe 172
mbed_official 340:28d1f895c6fe 173 uint8_t *pTxBuffPtr; /* Pointer to CEC Tx transfer Buffer */
mbed_official 340:28d1f895c6fe 174
mbed_official 340:28d1f895c6fe 175 uint16_t TxXferCount; /* CEC Tx Transfer Counter */
mbed_official 340:28d1f895c6fe 176
mbed_official 340:28d1f895c6fe 177 uint8_t *pRxBuffPtr; /* Pointer to CEC Rx transfer Buffer */
mbed_official 340:28d1f895c6fe 178
mbed_official 340:28d1f895c6fe 179 uint16_t RxXferSize; /* CEC Rx Transfer size, 0: header received only */
mbed_official 340:28d1f895c6fe 180
mbed_official 340:28d1f895c6fe 181 uint32_t ErrorCode; /* For errors handling purposes, copy of ISR register
mbed_official 340:28d1f895c6fe 182 in case error is reported */
mbed_official 340:28d1f895c6fe 183
mbed_official 340:28d1f895c6fe 184 HAL_LockTypeDef Lock; /* Locking object */
mbed_official 340:28d1f895c6fe 185
mbed_official 340:28d1f895c6fe 186 HAL_CEC_StateTypeDef State; /* CEC communication state */
mbed_official 340:28d1f895c6fe 187
mbed_official 340:28d1f895c6fe 188 }CEC_HandleTypeDef;
mbed_official 340:28d1f895c6fe 189 /**
mbed_official 340:28d1f895c6fe 190 * @}
mbed_official 340:28d1f895c6fe 191 */
mbed_official 340:28d1f895c6fe 192
mbed_official 340:28d1f895c6fe 193 /* Exported constants --------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 194 /** @defgroup CEC_Exported_Constants CEC Exported Constants
mbed_official 340:28d1f895c6fe 195 * @{
mbed_official 340:28d1f895c6fe 196 */
mbed_official 340:28d1f895c6fe 197
mbed_official 340:28d1f895c6fe 198 /** @defgroup CEC_Signal_Free_Time Signal Free Time setting parameter
mbed_official 340:28d1f895c6fe 199 * @{
mbed_official 340:28d1f895c6fe 200 */
mbed_official 340:28d1f895c6fe 201 #define CEC_DEFAULT_SFT ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 202 #define CEC_0_5_BITPERIOD_SFT ((uint32_t)0x00000001)
mbed_official 340:28d1f895c6fe 203 #define CEC_1_5_BITPERIOD_SFT ((uint32_t)0x00000002)
mbed_official 340:28d1f895c6fe 204 #define CEC_2_5_BITPERIOD_SFT ((uint32_t)0x00000003)
mbed_official 340:28d1f895c6fe 205 #define CEC_3_5_BITPERIOD_SFT ((uint32_t)0x00000004)
mbed_official 340:28d1f895c6fe 206 #define CEC_4_5_BITPERIOD_SFT ((uint32_t)0x00000005)
mbed_official 340:28d1f895c6fe 207 #define CEC_5_5_BITPERIOD_SFT ((uint32_t)0x00000006)
mbed_official 340:28d1f895c6fe 208 #define CEC_6_5_BITPERIOD_SFT ((uint32_t)0x00000007)
mbed_official 340:28d1f895c6fe 209 #define IS_CEC_SIGNALFREETIME(SFT) ((SFT) <= CEC_CFGR_SFT)
mbed_official 340:28d1f895c6fe 210 /**
mbed_official 340:28d1f895c6fe 211 * @}
mbed_official 340:28d1f895c6fe 212 */
mbed_official 340:28d1f895c6fe 213
mbed_official 340:28d1f895c6fe 214 /** @defgroup CEC_Tolerance Receiver Tolerance
mbed_official 340:28d1f895c6fe 215 * @{
mbed_official 340:28d1f895c6fe 216 */
mbed_official 340:28d1f895c6fe 217 #define CEC_STANDARD_TOLERANCE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 218 #define CEC_EXTENDED_TOLERANCE ((uint32_t)CEC_CFGR_RXTOL)
mbed_official 340:28d1f895c6fe 219 #define IS_CEC_TOLERANCE(RXTOL) (((RXTOL) == CEC_STANDARD_TOLERANCE) || \
mbed_official 340:28d1f895c6fe 220 ((RXTOL) == CEC_EXTENDED_TOLERANCE))
mbed_official 340:28d1f895c6fe 221 /**
mbed_official 340:28d1f895c6fe 222 * @}
mbed_official 340:28d1f895c6fe 223 */
mbed_official 340:28d1f895c6fe 224
mbed_official 340:28d1f895c6fe 225 /** @defgroup CEC_BRERxStop Reception Stop on Error
mbed_official 340:28d1f895c6fe 226 * @{
mbed_official 340:28d1f895c6fe 227 */
mbed_official 340:28d1f895c6fe 228 #define CEC_NO_RX_STOP_ON_BRE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 229 #define CEC_RX_STOP_ON_BRE ((uint32_t)CEC_CFGR_BRESTP)
mbed_official 340:28d1f895c6fe 230 #define IS_CEC_BRERXSTOP(BRERXSTOP) (((BRERXSTOP) == CEC_NO_RX_STOP_ON_BRE) || \
mbed_official 340:28d1f895c6fe 231 ((BRERXSTOP) == CEC_RX_STOP_ON_BRE))
mbed_official 340:28d1f895c6fe 232 /**
mbed_official 340:28d1f895c6fe 233 * @}
mbed_official 340:28d1f895c6fe 234 */
mbed_official 340:28d1f895c6fe 235
mbed_official 340:28d1f895c6fe 236 /** @defgroup CEC_BREErrorBitGen Error Bit Generation if Bit Rise Error reported
mbed_official 340:28d1f895c6fe 237 * @{
mbed_official 340:28d1f895c6fe 238 */
mbed_official 340:28d1f895c6fe 239 #define CEC_BRE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 240 #define CEC_BRE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BREGEN)
mbed_official 340:28d1f895c6fe 241 #define IS_CEC_BREERRORBITGEN(ERRORBITGEN) (((ERRORBITGEN) == CEC_BRE_ERRORBIT_NO_GENERATION) || \
mbed_official 340:28d1f895c6fe 242 ((ERRORBITGEN) == CEC_BRE_ERRORBIT_GENERATION))
mbed_official 340:28d1f895c6fe 243 /**
mbed_official 340:28d1f895c6fe 244 * @}
mbed_official 340:28d1f895c6fe 245 */
mbed_official 340:28d1f895c6fe 246
mbed_official 340:28d1f895c6fe 247 /** @defgroup CEC_LBPEErrorBitGen Error Bit Generation if Long Bit Period Error reported
mbed_official 340:28d1f895c6fe 248 * @{
mbed_official 340:28d1f895c6fe 249 */
mbed_official 340:28d1f895c6fe 250 #define CEC_LBPE_ERRORBIT_NO_GENERATION ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 251 #define CEC_LBPE_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_LBPEGEN)
mbed_official 340:28d1f895c6fe 252 #define IS_CEC_LBPEERRORBITGEN(ERRORBITGEN) (((ERRORBITGEN) == CEC_LBPE_ERRORBIT_NO_GENERATION) || \
mbed_official 340:28d1f895c6fe 253 ((ERRORBITGEN) == CEC_LBPE_ERRORBIT_GENERATION))
mbed_official 340:28d1f895c6fe 254 /**
mbed_official 340:28d1f895c6fe 255 * @}
mbed_official 340:28d1f895c6fe 256 */
mbed_official 340:28d1f895c6fe 257
mbed_official 340:28d1f895c6fe 258 /** @defgroup CEC_BroadCastMsgErrorBitGen Error Bit Generation on Broadcast message
mbed_official 340:28d1f895c6fe 259 * @{
mbed_official 340:28d1f895c6fe 260 */
mbed_official 340:28d1f895c6fe 261 #define CEC_BROADCASTERROR_ERRORBIT_GENERATION ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 262 #define CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION ((uint32_t)CEC_CFGR_BRDNOGEN)
mbed_official 340:28d1f895c6fe 263 #define IS_CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION(ERRORBITGEN) (((ERRORBITGEN) == CEC_BROADCASTERROR_ERRORBIT_GENERATION) || \
mbed_official 340:28d1f895c6fe 264 ((ERRORBITGEN) == CEC_BROADCASTERROR_NO_ERRORBIT_GENERATION))
mbed_official 340:28d1f895c6fe 265 /**
mbed_official 340:28d1f895c6fe 266 * @}
mbed_official 340:28d1f895c6fe 267 */
mbed_official 340:28d1f895c6fe 268
mbed_official 340:28d1f895c6fe 269 /** @defgroup CEC_SFT_Option Signal Free Time start option
mbed_official 340:28d1f895c6fe 270 * @{
mbed_official 340:28d1f895c6fe 271 */
mbed_official 340:28d1f895c6fe 272 #define CEC_SFT_START_ON_TXSOM ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 273 #define CEC_SFT_START_ON_TX_RX_END ((uint32_t)CEC_CFGR_SFTOPT)
mbed_official 340:28d1f895c6fe 274 #define IS_CEC_SFTOP(SFTOP) (((SFTOP) == CEC_SFT_START_ON_TXSOM) || \
mbed_official 340:28d1f895c6fe 275 ((SFTOP) == CEC_SFT_START_ON_TX_RX_END))
mbed_official 340:28d1f895c6fe 276 /**
mbed_official 340:28d1f895c6fe 277 * @}
mbed_official 340:28d1f895c6fe 278 */
mbed_official 340:28d1f895c6fe 279
mbed_official 340:28d1f895c6fe 280 /** @defgroup CEC_Listening_Mode Listening mode option
mbed_official 340:28d1f895c6fe 281 * @{
mbed_official 340:28d1f895c6fe 282 */
mbed_official 340:28d1f895c6fe 283 #define CEC_REDUCED_LISTENING_MODE ((uint32_t)0x00000000)
mbed_official 340:28d1f895c6fe 284 #define CEC_FULL_LISTENING_MODE ((uint32_t)CEC_CFGR_LSTN)
mbed_official 340:28d1f895c6fe 285 #define IS_CEC_LISTENING_MODE(MODE) (((MODE) == CEC_REDUCED_LISTENING_MODE) || \
mbed_official 340:28d1f895c6fe 286 ((MODE) == CEC_FULL_LISTENING_MODE))
mbed_official 340:28d1f895c6fe 287 /**
mbed_official 340:28d1f895c6fe 288 * @}
mbed_official 340:28d1f895c6fe 289 */
mbed_official 340:28d1f895c6fe 290
mbed_official 340:28d1f895c6fe 291 /** @defgroup CEC_ALL_ERROR all RX or TX errors flags in CEC ISR register
mbed_official 340:28d1f895c6fe 292 * @{
mbed_official 340:28d1f895c6fe 293 */
mbed_official 340:28d1f895c6fe 294 #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 295 CEC_ISR_ARBLST|CEC_ISR_TXUDR|CEC_ISR_TXERR|CEC_ISR_TXACKE)
mbed_official 340:28d1f895c6fe 296 /**
mbed_official 340:28d1f895c6fe 297 * @}
mbed_official 340:28d1f895c6fe 298 */
mbed_official 340:28d1f895c6fe 299
mbed_official 340:28d1f895c6fe 300 /** @defgroup CEC_IER_ALL_RX all RX errors interrupts enabling flag
mbed_official 340:28d1f895c6fe 301 * @{
mbed_official 340:28d1f895c6fe 302 */
mbed_official 340:28d1f895c6fe 303 #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 304 /**
mbed_official 340:28d1f895c6fe 305 * @}
mbed_official 340:28d1f895c6fe 306 */
mbed_official 340:28d1f895c6fe 307
mbed_official 340:28d1f895c6fe 308 /** @defgroup CEC_IER_ALL_TX all TX errors interrupts enabling flag
mbed_official 340:28d1f895c6fe 309 * @{
mbed_official 340:28d1f895c6fe 310 */
mbed_official 340:28d1f895c6fe 311 #define CEC_IER_TX_ALL_ERR ((uint32_t)CEC_IER_TXACKEIE|CEC_IER_TXERRIE|CEC_IER_TXUDRIE|CEC_IER_ARBLSTIE)
mbed_official 340:28d1f895c6fe 312 /**
mbed_official 340:28d1f895c6fe 313 * @}
mbed_official 340:28d1f895c6fe 314 */
mbed_official 340:28d1f895c6fe 315
mbed_official 340:28d1f895c6fe 316 /** @defgroup CEC_OAR_Position Device Own Address position in CEC CFGR register
mbed_official 340:28d1f895c6fe 317 * @{
mbed_official 340:28d1f895c6fe 318 */
mbed_official 340:28d1f895c6fe 319 #define CEC_CFGR_OAR_LSB_POS ((uint32_t) 16)
mbed_official 340:28d1f895c6fe 320 /**
mbed_official 340:28d1f895c6fe 321 * @}
mbed_official 340:28d1f895c6fe 322 */
mbed_official 340:28d1f895c6fe 323
mbed_official 340:28d1f895c6fe 324 /** @defgroup CEC_Initiator_Position Initiator logical address position in message header
mbed_official 340:28d1f895c6fe 325 * @{
mbed_official 340:28d1f895c6fe 326 */
mbed_official 340:28d1f895c6fe 327 #define CEC_INITIATOR_LSB_POS ((uint32_t) 4)
mbed_official 340:28d1f895c6fe 328 /**
mbed_official 340:28d1f895c6fe 329 * @}
mbed_official 340:28d1f895c6fe 330 */
mbed_official 340:28d1f895c6fe 331
mbed_official 340:28d1f895c6fe 332 /**
mbed_official 340:28d1f895c6fe 333 * @}
mbed_official 340:28d1f895c6fe 334 */
mbed_official 340:28d1f895c6fe 335
mbed_official 340:28d1f895c6fe 336 /* Exported macros -----------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 337 /** @defgroup CEC_Exported_Macros CEC Exported Macros
mbed_official 340:28d1f895c6fe 338 * @{
mbed_official 340:28d1f895c6fe 339 */
mbed_official 340:28d1f895c6fe 340
mbed_official 340:28d1f895c6fe 341 /** @brief Reset CEC handle state
mbed_official 340:28d1f895c6fe 342 * @param __HANDLE__: CEC handle.
mbed_official 340:28d1f895c6fe 343 * @retval None
mbed_official 340:28d1f895c6fe 344 */
mbed_official 340:28d1f895c6fe 345 #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CEC_STATE_RESET)
mbed_official 340:28d1f895c6fe 346
mbed_official 340:28d1f895c6fe 347 /** @brief Checks whether or not the specified CEC interrupt flag is set.
mbed_official 340:28d1f895c6fe 348 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 349 * @param __INTERRUPT__: specifies the interrupt to check.
mbed_official 340:28d1f895c6fe 350 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 351 * @arg CEC_ISR_RXBR : Rx-Byte Received
mbed_official 340:28d1f895c6fe 352 * @arg CEC_ISR_RXEND : End of Reception
mbed_official 340:28d1f895c6fe 353 * @arg CEC_ISR_RXOVR : Rx Overrun
mbed_official 340:28d1f895c6fe 354 * @arg CEC_ISR_BRE : Rx Bit Rising Error
mbed_official 340:28d1f895c6fe 355 * @arg CEC_ISR_SBPE : Rx Short Bit Period Error
mbed_official 340:28d1f895c6fe 356 * @arg CEC_ISR_LBPE : Rx Long Bit Period Error
mbed_official 340:28d1f895c6fe 357 * @arg CEC_ISR_RXACKE : Rx Missing Acknowledge
mbed_official 340:28d1f895c6fe 358 * @arg CEC_ISR_ARBLST : Arbitration lost
mbed_official 340:28d1f895c6fe 359 * @arg CEC_ISR_TXBR : Tx-Byte Request
mbed_official 340:28d1f895c6fe 360 * @arg CEC_ISR_TXEND : End of Transmission
mbed_official 340:28d1f895c6fe 361 * @arg CEC_ISR_TXUDR : Tx-buffer Underrun
mbed_official 340:28d1f895c6fe 362 * @arg CEC_ISR_TXERR : Tx Error
mbed_official 340:28d1f895c6fe 363 * @arg CEC_ISR_TXACKE : Tx Missing Acknowledge
mbed_official 340:28d1f895c6fe 364 * @retval ITStatus
mbed_official 340:28d1f895c6fe 365 */
mbed_official 340:28d1f895c6fe 366 #define __HAL_CEC_GET_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->ISR & (__INTERRUPT__))
mbed_official 340:28d1f895c6fe 367
mbed_official 340:28d1f895c6fe 368 /** @brief Clears the interrupt or status flag when raised (write at 1)
mbed_official 340:28d1f895c6fe 369 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 370 * @param __FLAG__: specifies the interrupt/status flag to clear.
mbed_official 340:28d1f895c6fe 371 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 372 * @arg CEC_ISR_RXBR : Rx-Byte Received
mbed_official 340:28d1f895c6fe 373 * @arg CEC_ISR_RXEND : End of Reception
mbed_official 340:28d1f895c6fe 374 * @arg CEC_ISR_RXOVR : Rx Overrun
mbed_official 340:28d1f895c6fe 375 * @arg CEC_ISR_BRE : Rx Bit Rising Error
mbed_official 340:28d1f895c6fe 376 * @arg CEC_ISR_SBPE : Rx Short Bit Period Error
mbed_official 340:28d1f895c6fe 377 * @arg CEC_ISR_LBPE : Rx Long Bit Period Error
mbed_official 340:28d1f895c6fe 378 * @arg CEC_ISR_RXACKE : Rx Missing Acknowledge
mbed_official 340:28d1f895c6fe 379 * @arg CEC_ISR_ARBLST : Arbitration lost
mbed_official 340:28d1f895c6fe 380 * @arg CEC_ISR_TXBR : Tx-Byte Request
mbed_official 340:28d1f895c6fe 381 * @arg CEC_ISR_TXEND : End of Transmission
mbed_official 340:28d1f895c6fe 382 * @arg CEC_ISR_TXUDR : Tx-buffer Underrun
mbed_official 340:28d1f895c6fe 383 * @arg CEC_ISR_TXERR : Tx Error
mbed_official 340:28d1f895c6fe 384 * @arg CEC_ISR_TXACKE : Tx Missing Acknowledge
mbed_official 340:28d1f895c6fe 385 * @retval none
mbed_official 340:28d1f895c6fe 386 */
mbed_official 340:28d1f895c6fe 387 #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR = (__FLAG__))
mbed_official 340:28d1f895c6fe 388
mbed_official 340:28d1f895c6fe 389 /** @brief Enables the specified CEC interrupt.
mbed_official 340:28d1f895c6fe 390 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 391 * @param __INTERRUPT__: specifies the CEC interrupt to enable.
mbed_official 340:28d1f895c6fe 392 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 393 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
mbed_official 340:28d1f895c6fe 394 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
mbed_official 340:28d1f895c6fe 395 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
mbed_official 340:28d1f895c6fe 396 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
mbed_official 340:28d1f895c6fe 397 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
mbed_official 340:28d1f895c6fe 398 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
mbed_official 340:28d1f895c6fe 399 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
mbed_official 340:28d1f895c6fe 400 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
mbed_official 340:28d1f895c6fe 401 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
mbed_official 340:28d1f895c6fe 402 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
mbed_official 340:28d1f895c6fe 403 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
mbed_official 340:28d1f895c6fe 404 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
mbed_official 340:28d1f895c6fe 405 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
mbed_official 340:28d1f895c6fe 406 * @retval none
mbed_official 340:28d1f895c6fe 407 */
mbed_official 340:28d1f895c6fe 408 #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
mbed_official 340:28d1f895c6fe 409
mbed_official 340:28d1f895c6fe 410 /** @brief Disables the specified CEC interrupt.
mbed_official 340:28d1f895c6fe 411 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 412 * @param __INTERRUPT__: specifies the CEC interrupt to disable.
mbed_official 340:28d1f895c6fe 413 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 414 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
mbed_official 340:28d1f895c6fe 415 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
mbed_official 340:28d1f895c6fe 416 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
mbed_official 340:28d1f895c6fe 417 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
mbed_official 340:28d1f895c6fe 418 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
mbed_official 340:28d1f895c6fe 419 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
mbed_official 340:28d1f895c6fe 420 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
mbed_official 340:28d1f895c6fe 421 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
mbed_official 340:28d1f895c6fe 422 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
mbed_official 340:28d1f895c6fe 423 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
mbed_official 340:28d1f895c6fe 424 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
mbed_official 340:28d1f895c6fe 425 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
mbed_official 340:28d1f895c6fe 426 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
mbed_official 340:28d1f895c6fe 427 * @retval none
mbed_official 340:28d1f895c6fe 428 */
mbed_official 340:28d1f895c6fe 429 #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__)))
mbed_official 340:28d1f895c6fe 430
mbed_official 340:28d1f895c6fe 431 /** @brief Checks whether or not the specified CEC interrupt is enabled.
mbed_official 340:28d1f895c6fe 432 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 433 * @param __INTERRUPT__: specifies the CEC interrupt to check.
mbed_official 340:28d1f895c6fe 434 * This parameter can be one of the following values:
mbed_official 340:28d1f895c6fe 435 * @arg CEC_IER_RXBRIE : Rx-Byte Received IT Enable
mbed_official 340:28d1f895c6fe 436 * @arg CEC_IER_RXENDIE : End Of Reception IT Enable
mbed_official 340:28d1f895c6fe 437 * @arg CEC_IER_RXOVRIE : Rx-Overrun IT Enable
mbed_official 340:28d1f895c6fe 438 * @arg CEC_IER_BREIE : Rx Bit Rising Error IT Enable
mbed_official 340:28d1f895c6fe 439 * @arg CEC_IER_SBPEIE : Rx Short Bit period Error IT Enable
mbed_official 340:28d1f895c6fe 440 * @arg CEC_IER_LBPEIE : Rx Long Bit period Error IT Enable
mbed_official 340:28d1f895c6fe 441 * @arg CEC_IER_RXACKEIE : Rx Missing Acknowledge IT Enable
mbed_official 340:28d1f895c6fe 442 * @arg CEC_IER_ARBLSTIE : Arbitration Lost IT Enable
mbed_official 340:28d1f895c6fe 443 * @arg CEC_IER_TXBRIE : Tx Byte Request IT Enable
mbed_official 340:28d1f895c6fe 444 * @arg CEC_IER_TXENDIE : End of Transmission IT Enable
mbed_official 340:28d1f895c6fe 445 * @arg CEC_IER_TXUDRIE : Tx-Buffer Underrun IT Enable
mbed_official 340:28d1f895c6fe 446 * @arg CEC_IER_TXERRIE : Tx-Error IT Enable
mbed_official 340:28d1f895c6fe 447 * @arg CEC_IER_TXACKEIE : Tx Missing Acknowledge IT Enable
mbed_official 340:28d1f895c6fe 448 * @retval FlagStatus
mbed_official 340:28d1f895c6fe 449 */
mbed_official 340:28d1f895c6fe 450 #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__))
mbed_official 340:28d1f895c6fe 451
mbed_official 340:28d1f895c6fe 452 /** @brief Enables the CEC device
mbed_official 340:28d1f895c6fe 453 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 454 * @retval none
mbed_official 340:28d1f895c6fe 455 */
mbed_official 340:28d1f895c6fe 456 #define __HAL_CEC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_CECEN)
mbed_official 340:28d1f895c6fe 457
mbed_official 340:28d1f895c6fe 458 /** @brief Disables the CEC device
mbed_official 340:28d1f895c6fe 459 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 460 * @retval none
mbed_official 340:28d1f895c6fe 461 */
mbed_official 340:28d1f895c6fe 462 #define __HAL_CEC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~CEC_CR_CECEN)
mbed_official 340:28d1f895c6fe 463
mbed_official 340:28d1f895c6fe 464 /** @brief Set Transmission Start flag
mbed_official 340:28d1f895c6fe 465 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 466 * @retval none
mbed_official 340:28d1f895c6fe 467 */
mbed_official 340:28d1f895c6fe 468 #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXSOM)
mbed_official 340:28d1f895c6fe 469
mbed_official 340:28d1f895c6fe 470 /** @brief Set Transmission End flag
mbed_official 340:28d1f895c6fe 471 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 472 * @retval none
mbed_official 340:28d1f895c6fe 473 * If the CEC message consists of only one byte, TXEOM must be set before of TXSOM.
mbed_official 340:28d1f895c6fe 474 */
mbed_official 340:28d1f895c6fe 475 #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CEC_CR_TXEOM)
mbed_official 340:28d1f895c6fe 476
mbed_official 340:28d1f895c6fe 477 /** @brief Get Transmission Start flag
mbed_official 340:28d1f895c6fe 478 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 479 * @retval FlagStatus
mbed_official 340:28d1f895c6fe 480 */
mbed_official 340:28d1f895c6fe 481 #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXSOM)
mbed_official 340:28d1f895c6fe 482
mbed_official 340:28d1f895c6fe 483 /** @brief Get Transmission End flag
mbed_official 340:28d1f895c6fe 484 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 485 * @retval FlagStatus
mbed_official 340:28d1f895c6fe 486 */
mbed_official 340:28d1f895c6fe 487 #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) ((__HANDLE__)->Instance->CR & CEC_CR_TXEOM)
mbed_official 340:28d1f895c6fe 488
mbed_official 340:28d1f895c6fe 489 /** @brief Clear OAR register
mbed_official 340:28d1f895c6fe 490 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 491 * @retval none
mbed_official 340:28d1f895c6fe 492 */
mbed_official 340:28d1f895c6fe 493 #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_OAR)
mbed_official 340:28d1f895c6fe 494
mbed_official 340:28d1f895c6fe 495 /** @brief Set OAR register (without resetting previously set address in case of multi-address mode)
mbed_official 340:28d1f895c6fe 496 * To reset OAR, __HAL_CEC_CLEAR_OAR() needs to be called beforehand
mbed_official 340:28d1f895c6fe 497 * @param __HANDLE__: specifies the CEC Handle.
mbed_official 340:28d1f895c6fe 498 * @param __ADDRESS__: Own Address value (CEC logical address is identified by bit position)
mbed_official 340:28d1f895c6fe 499 * @retval none
mbed_official 340:28d1f895c6fe 500 */
mbed_official 340:28d1f895c6fe 501 #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) SET_BIT((__HANDLE__)->Instance->CFGR, (__ADDRESS__)<< CEC_CFGR_OAR_LSB_POS)
mbed_official 340:28d1f895c6fe 502
mbed_official 340:28d1f895c6fe 503 /** @brief Check CEC device Own Address Register (OAR) setting.
mbed_official 340:28d1f895c6fe 504 * OAR address is written in a 15-bit field within CEC_CFGR register.
mbed_official 340:28d1f895c6fe 505 * @param __ADDRESS__: CEC own address.
mbed_official 340:28d1f895c6fe 506 * @retval Test result (TRUE or FALSE).
mbed_official 340:28d1f895c6fe 507 */
mbed_official 340:28d1f895c6fe 508 #define IS_CEC_OAR_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x07FFF)
mbed_official 340:28d1f895c6fe 509
mbed_official 340:28d1f895c6fe 510 /** @brief Check CEC initiator or destination logical address setting.
mbed_official 340:28d1f895c6fe 511 * Initiator and destination addresses are coded over 4 bits.
mbed_official 340:28d1f895c6fe 512 * @param __ADDRESS__: CEC initiator or logical address.
mbed_official 340:28d1f895c6fe 513 * @retval Test result (TRUE or FALSE).
mbed_official 340:28d1f895c6fe 514 */
mbed_official 340:28d1f895c6fe 515 #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0xF)
mbed_official 340:28d1f895c6fe 516
mbed_official 340:28d1f895c6fe 517 /** @brief Check CEC message size.
mbed_official 340:28d1f895c6fe 518 * The message size is the payload size: without counting the header,
mbed_official 340:28d1f895c6fe 519 * it varies from 0 byte (ping operation, one header only, no payload) to
mbed_official 340:28d1f895c6fe 520 * 15 bytes (1 opcode and up to 14 operands following the header).
mbed_official 340:28d1f895c6fe 521 * @param __SIZE__: CEC message size.
mbed_official 340:28d1f895c6fe 522 * @retval Test result (TRUE or FALSE).
mbed_official 340:28d1f895c6fe 523 */
mbed_official 340:28d1f895c6fe 524 #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0xF)
mbed_official 340:28d1f895c6fe 525
mbed_official 340:28d1f895c6fe 526 /**
mbed_official 340:28d1f895c6fe 527 * @}
mbed_official 340:28d1f895c6fe 528 */
mbed_official 340:28d1f895c6fe 529
mbed_official 340:28d1f895c6fe 530 /* Exported functions --------------------------------------------------------*/
mbed_official 340:28d1f895c6fe 531 /** @addtogroup CEC_Exported_Functions CEC Exported Functions
mbed_official 340:28d1f895c6fe 532 * @{
mbed_official 340:28d1f895c6fe 533 */
mbed_official 340:28d1f895c6fe 534 /** @addtogroup CEC_Exported_Functions_Group1 Initialization/de-initialization function
mbed_official 340:28d1f895c6fe 535 * @brief Initialization and Configuration functions
mbed_official 340:28d1f895c6fe 536 * @{
mbed_official 340:28d1f895c6fe 537 */
mbed_official 340:28d1f895c6fe 538 /* Initialization and de-initialization functions ****************************/
mbed_official 340:28d1f895c6fe 539 HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 540 HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 541 void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 542 void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 543 /**
mbed_official 340:28d1f895c6fe 544 * @}
mbed_official 340:28d1f895c6fe 545 */
mbed_official 340:28d1f895c6fe 546
mbed_official 340:28d1f895c6fe 547 /** @addtogroup CEC_Exported_Functions_Group2 IO operation function
mbed_official 340:28d1f895c6fe 548 * @brief CEC Transmit/Receive functions
mbed_official 340:28d1f895c6fe 549 * @{
mbed_official 340:28d1f895c6fe 550 */
mbed_official 340:28d1f895c6fe 551 /* I/O operation functions ***************************************************/
mbed_official 340:28d1f895c6fe 552 HAL_StatusTypeDef HAL_CEC_Transmit(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size, uint32_t Timeout);
mbed_official 340:28d1f895c6fe 553 HAL_StatusTypeDef HAL_CEC_Receive(CEC_HandleTypeDef *hcec, uint8_t *pData, uint32_t Timeout);
mbed_official 340:28d1f895c6fe 554 HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t DestinationAddress, uint8_t *pData, uint32_t Size);
mbed_official 340:28d1f895c6fe 555 HAL_StatusTypeDef HAL_CEC_Receive_IT(CEC_HandleTypeDef *hcec, uint8_t *pData);
mbed_official 340:28d1f895c6fe 556 void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 557 void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 558 void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 559 void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 560 /**
mbed_official 340:28d1f895c6fe 561 * @}
mbed_official 340:28d1f895c6fe 562 */
mbed_official 340:28d1f895c6fe 563
mbed_official 340:28d1f895c6fe 564 /** @addtogroup CEC_Exported_Functions_Group3 Peripheral Control function
mbed_official 340:28d1f895c6fe 565 * @brief CEC control functions
mbed_official 340:28d1f895c6fe 566 * @{
mbed_official 340:28d1f895c6fe 567 */
mbed_official 340:28d1f895c6fe 568 /* Peripheral State functions ************************************************/
mbed_official 340:28d1f895c6fe 569 HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 570 uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec);
mbed_official 340:28d1f895c6fe 571 /**
mbed_official 340:28d1f895c6fe 572 * @}
mbed_official 340:28d1f895c6fe 573 */
mbed_official 340:28d1f895c6fe 574
mbed_official 340:28d1f895c6fe 575 /**
mbed_official 340:28d1f895c6fe 576 * @}
mbed_official 340:28d1f895c6fe 577 */
mbed_official 340:28d1f895c6fe 578
mbed_official 340:28d1f895c6fe 579 /**
mbed_official 340:28d1f895c6fe 580 * @}
mbed_official 340:28d1f895c6fe 581 */
mbed_official 340:28d1f895c6fe 582
mbed_official 340:28d1f895c6fe 583 /**
mbed_official 340:28d1f895c6fe 584 * @}
mbed_official 340:28d1f895c6fe 585 */
mbed_official 340:28d1f895c6fe 586
mbed_official 340:28d1f895c6fe 587 #endif /* defined(STM32F042x6) || defined(STM32F048xx) || */
mbed_official 340:28d1f895c6fe 588 /* defined(STM32F051x8) || defined(STM32F058xx) || */
mbed_official 340:28d1f895c6fe 589 /* defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || */
mbed_official 340:28d1f895c6fe 590 /* defined(STM32F091xC) || defined(STM32F098xx) */
mbed_official 340:28d1f895c6fe 591 #ifdef __cplusplus
mbed_official 340:28d1f895c6fe 592 }
mbed_official 340:28d1f895c6fe 593 #endif
mbed_official 340:28d1f895c6fe 594
mbed_official 340:28d1f895c6fe 595 #endif /* __STM32F0xx_HAL_CEC_H */
mbed_official 340:28d1f895c6fe 596
mbed_official 340:28d1f895c6fe 597 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
mbed_official 340:28d1f895c6fe 598