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