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