stm32f1xx_hal_cec.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. /**
  2. ******************************************************************************
  3. * @file stm32f1xx_hal_cec.h
  4. * @author MCD Application Team
  5. * @version V1.1.1
  6. * @date 12-May-2017
  7. * @brief Header file of CEC HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32F1xx_HAL_CEC_H
  39. #define __STM32F1xx_HAL_CEC_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if defined(STM32F100xB) || defined(STM32F100xE)
  44. /* Includes ------------------------------------------------------------------*/
  45. #include "stm32f1xx_hal_def.h"
  46. /** @addtogroup STM32F1xx_HAL_Driver
  47. * @{
  48. */
  49. /** @addtogroup CEC
  50. * @{
  51. */
  52. /* Exported types ------------------------------------------------------------*/
  53. /** @defgroup CEC_Exported_Types CEC Exported Types
  54. * @{
  55. */
  56. /**
  57. * @brief CEC Init Structure definition
  58. */
  59. typedef struct
  60. {
  61. uint32_t TimingErrorFree; /*!< Configures the CEC Bit Timing Error Mode.
  62. This parameter can be a value of @ref CEC_BitTimingErrorMode */
  63. uint32_t PeriodErrorFree; /*!< Configures the CEC Bit Period Error Mode.
  64. This parameter can be a value of @ref CEC_BitPeriodErrorMode */
  65. uint16_t OwnAddress; /*!< Own addresses configuration
  66. This parameter can be a value of @ref CEC_OWN_ADDRESS */
  67. uint8_t *RxBuffer; /*!< CEC Rx buffer pointeur */
  68. }CEC_InitTypeDef;
  69. /**
  70. * @brief HAL CEC State structures definition
  71. * @note HAL CEC State value is a combination of 2 different substates: gState and RxState.
  72. * - gState contains CEC state information related to global Handle management
  73. * and also information related to Tx operations.
  74. * gState value coding follow below described bitmap :
  75. * b7 (not used)
  76. * x : Should be set to 0
  77. * b6 Error information
  78. * 0 : No Error
  79. * 1 : Error
  80. * b5 IP initilisation status
  81. * 0 : Reset (IP not initialized)
  82. * 1 : Init done (IP initialized. HAL CEC Init function already called)
  83. * b4-b3 (not used)
  84. * xx : Should be set to 00
  85. * b2 Intrinsic process state
  86. * 0 : Ready
  87. * 1 : Busy (IP busy with some configuration or internal operations)
  88. * b1 (not used)
  89. * x : Should be set to 0
  90. * b0 Tx state
  91. * 0 : Ready (no Tx operation ongoing)
  92. * 1 : Busy (Tx operation ongoing)
  93. * - RxState contains information related to Rx operations.
  94. * RxState value coding follow below described bitmap :
  95. * b7-b6 (not used)
  96. * xx : Should be set to 00
  97. * b5 IP initilisation status
  98. * 0 : Reset (IP not initialized)
  99. * 1 : Init done (IP initialized)
  100. * b4-b2 (not used)
  101. * xxx : Should be set to 000
  102. * b1 Rx state
  103. * 0 : Ready (no Rx operation ongoing)
  104. * 1 : Busy (Rx operation ongoing)
  105. * b0 (not used)
  106. * x : Should be set to 0.
  107. */
  108. typedef enum
  109. {
  110. HAL_CEC_STATE_RESET = 0x00U, /*!< Peripheral is not yet Initialized
  111. Value is allowed for gState and RxState */
  112. HAL_CEC_STATE_READY = 0x20U, /*!< Peripheral Initialized and ready for use
  113. Value is allowed for gState and RxState */
  114. HAL_CEC_STATE_BUSY = 0x24U, /*!< an internal process is ongoing
  115. Value is allowed for gState only */
  116. HAL_CEC_STATE_BUSY_RX = 0x22U, /*!< Data Reception process is ongoing
  117. Value is allowed for RxState only */
  118. HAL_CEC_STATE_BUSY_TX = 0x21U, /*!< Data Transmission process is ongoing
  119. Value is allowed for gState only */
  120. HAL_CEC_STATE_BUSY_RX_TX = 0x23U, /*!< an internal process is ongoing
  121. Value is allowed for gState only */
  122. HAL_CEC_STATE_ERROR = 0x60U /*!< Error Value is allowed for gState only */
  123. }HAL_CEC_StateTypeDef;
  124. /**
  125. * @brief CEC handle Structure definition
  126. */
  127. typedef struct
  128. {
  129. CEC_TypeDef *Instance; /*!< CEC registers base address */
  130. CEC_InitTypeDef Init; /*!< CEC communication parameters */
  131. uint8_t *pTxBuffPtr; /*!< Pointer to CEC Tx transfer Buffer */
  132. uint16_t TxXferCount; /*!< CEC Tx Transfer Counter */
  133. uint16_t RxXferSize; /*!< CEC Rx Transfer size, 0: header received only */
  134. HAL_LockTypeDef Lock; /*!< Locking object */
  135. HAL_CEC_StateTypeDef gState; /*!< CEC state information related to global Handle management
  136. and also related to Tx operations.
  137. This parameter can be a value of @ref HAL_CEC_StateTypeDef */
  138. HAL_CEC_StateTypeDef RxState; /*!< CEC state information related to Rx operations.
  139. This parameter can be a value of @ref HAL_CEC_StateTypeDef */
  140. uint32_t ErrorCode; /*!< For errors handling purposes, copy of ISR register
  141. in case error is reported */
  142. }CEC_HandleTypeDef;
  143. /**
  144. * @}
  145. */
  146. /* Exported constants --------------------------------------------------------*/
  147. /** @defgroup CEC_Exported_Constants CEC Exported Constants
  148. * @{
  149. */
  150. /** @defgroup CEC_Error_Code CEC Error Code
  151. * @{
  152. */
  153. #define HAL_CEC_ERROR_NONE 0x00000000U /*!< no error */
  154. #define HAL_CEC_ERROR_BTE CEC_ESR_BTE /*!< Bit Timing Error */
  155. #define HAL_CEC_ERROR_BPE CEC_ESR_BPE /*!< Bit Period Error */
  156. #define HAL_CEC_ERROR_RBTFE CEC_ESR_RBTFE /*!< Rx Block Transfer Finished Error */
  157. #define HAL_CEC_ERROR_SBE CEC_ESR_SBE /*!< Start Bit Error */
  158. #define HAL_CEC_ERROR_ACKE CEC_ESR_ACKE /*!< Block Acknowledge Error */
  159. #define HAL_CEC_ERROR_LINE CEC_ESR_LINE /*!< Line Error */
  160. #define HAL_CEC_ERROR_TBTFE CEC_ESR_TBTFE /*!< Tx Block Transfer Finished Error */
  161. /**
  162. * @}
  163. */
  164. /** @defgroup CEC_BitTimingErrorMode Bit Timing Error Mode
  165. * @{
  166. */
  167. #define CEC_BIT_TIMING_ERROR_MODE_STANDARD 0x00000000U /*!< Bit timing error Standard Mode */
  168. #define CEC_BIT_TIMING_ERROR_MODE_ERRORFREE CEC_CFGR_BTEM /*!< Bit timing error Free Mode */
  169. /**
  170. * @}
  171. */
  172. /** @defgroup CEC_BitPeriodErrorMode Bit Period Error Mode
  173. * @{
  174. */
  175. #define CEC_BIT_PERIOD_ERROR_MODE_STANDARD 0x00000000U /*!< Bit period error Standard Mode */
  176. #define CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */
  177. /**
  178. * @}
  179. */
  180. /** @defgroup CEC_Initiator_Position CEC Initiator logical address position in message header
  181. * @{
  182. */
  183. #define CEC_INITIATOR_LSB_POS 4U
  184. /**
  185. * @}
  186. */
  187. /** @defgroup CEC_OWN_ADDRESS CEC Own Address
  188. * @{
  189. */
  190. #define CEC_OWN_ADDRESS_NONE CEC_OWN_ADDRESS_0 /* Reset value */
  191. #define CEC_OWN_ADDRESS_0 ((uint16_t)0x0000U) /* Logical Address 0 */
  192. #define CEC_OWN_ADDRESS_1 ((uint16_t)0x0001U) /* Logical Address 1 */
  193. #define CEC_OWN_ADDRESS_2 ((uint16_t)0x0002U) /* Logical Address 2 */
  194. #define CEC_OWN_ADDRESS_3 ((uint16_t)0x0003U) /* Logical Address 3 */
  195. #define CEC_OWN_ADDRESS_4 ((uint16_t)0x0004U) /* Logical Address 4 */
  196. #define CEC_OWN_ADDRESS_5 ((uint16_t)0x0005U) /* Logical Address 5 */
  197. #define CEC_OWN_ADDRESS_6 ((uint16_t)0x0006U) /* Logical Address 6 */
  198. #define CEC_OWN_ADDRESS_7 ((uint16_t)0x0007U) /* Logical Address 7 */
  199. #define CEC_OWN_ADDRESS_8 ((uint16_t)0x0008U) /* Logical Address 8 */
  200. #define CEC_OWN_ADDRESS_9 ((uint16_t)0x0009U) /* Logical Address 9 */
  201. #define CEC_OWN_ADDRESS_10 ((uint16_t)0x000AU) /* Logical Address 10 */
  202. #define CEC_OWN_ADDRESS_11 ((uint16_t)0x000BU) /* Logical Address 11 */
  203. #define CEC_OWN_ADDRESS_12 ((uint16_t)0x000CU) /* Logical Address 12 */
  204. #define CEC_OWN_ADDRESS_13 ((uint16_t)0x000DU) /* Logical Address 13 */
  205. #define CEC_OWN_ADDRESS_14 ((uint16_t)0x000EU) /* Logical Address 14 */
  206. #define CEC_OWN_ADDRESS_15 ((uint16_t)0x000FU) /* Logical Address 15 */
  207. /**
  208. * @}
  209. */
  210. /** @defgroup CEC_Interrupts_Definitions Interrupts definition
  211. * @{
  212. */
  213. #define CEC_IT_IE CEC_CFGR_IE
  214. /**
  215. * @}
  216. */
  217. /** @defgroup CEC_Flags_Definitions Flags definition
  218. * @{
  219. */
  220. #define CEC_FLAG_TSOM CEC_CSR_TSOM
  221. #define CEC_FLAG_TEOM CEC_CSR_TEOM
  222. #define CEC_FLAG_TERR CEC_CSR_TERR
  223. #define CEC_FLAG_TBTRF CEC_CSR_TBTRF
  224. #define CEC_FLAG_RSOM CEC_CSR_RSOM
  225. #define CEC_FLAG_REOM CEC_CSR_REOM
  226. #define CEC_FLAG_RERR CEC_CSR_RERR
  227. #define CEC_FLAG_RBTF CEC_CSR_RBTF
  228. /**
  229. * @}
  230. */
  231. /**
  232. * @}
  233. */
  234. /* Exported macros -----------------------------------------------------------*/
  235. /** @defgroup CEC_Exported_Macros CEC Exported Macros
  236. * @{
  237. */
  238. /** @brief Reset CEC handle gstate & RxState
  239. * @param __HANDLE__: CEC handle.
  240. * @retval None
  241. */
  242. #define __HAL_CEC_RESET_HANDLE_STATE(__HANDLE__) do{ \
  243. (__HANDLE__)->gState = HAL_CEC_STATE_RESET; \
  244. (__HANDLE__)->RxState = HAL_CEC_STATE_RESET; \
  245. } while(0U)
  246. /** @brief Checks whether or not the specified CEC interrupt flag is set.
  247. * @param __HANDLE__: specifies the CEC Handle.
  248. * @param __FLAG__: specifies the flag to check.
  249. * @arg CEC_FLAG_TERR: Tx Error
  250. * @arg CEC_FLAG_TBTRF:Tx Block Transfer Finished
  251. * @arg CEC_FLAG_RERR: Rx Error
  252. * @arg CEC_FLAG_RBTF: Rx Block Transfer Finished
  253. * @retval ITStatus
  254. */
  255. #define __HAL_CEC_GET_FLAG(__HANDLE__, __FLAG__) READ_BIT((__HANDLE__)->Instance->CSR,(__FLAG__))
  256. /** @brief Clears the CEC's pending flags.
  257. * @param __HANDLE__: specifies the CEC Handle.
  258. * @param __FLAG__: specifies the flag to clear.
  259. * This parameter can be any combination of the following values:
  260. * @arg CEC_CSR_TERR: Tx Error
  261. * @arg CEC_FLAG_TBTRF: Tx Block Transfer Finished
  262. * @arg CEC_CSR_RERR: Rx Error
  263. * @arg CEC_CSR_RBTF: Rx Block Transfer Finished
  264. * @retval none
  265. */
  266. #define __HAL_CEC_CLEAR_FLAG(__HANDLE__, __FLAG__) \
  267. do { \
  268. uint32_t tmp = 0x0U; \
  269. tmp = (__HANDLE__)->Instance->CSR & 0x00000002U; \
  270. (__HANDLE__)->Instance->CSR &= (uint32_t)(((~(uint32_t)(__FLAG__)) & 0xFFFFFFFCU) | tmp);\
  271. } while(0U)
  272. /** @brief Enables the specified CEC interrupt.
  273. * @param __HANDLE__: specifies the CEC Handle.
  274. * @param __INTERRUPT__: specifies the CEC interrupt to enable.
  275. * This parameter can be:
  276. * @arg CEC_IT_IE : Interrupt Enable.
  277. * @retval none
  278. */
  279. #define __HAL_CEC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__))
  280. /** @brief Disables the specified CEC interrupt.
  281. * @param __HANDLE__: specifies the CEC Handle.
  282. * @param __INTERRUPT__: specifies the CEC interrupt to disable.
  283. * This parameter can be:
  284. * @arg CEC_IT_IE : Interrupt Enable
  285. * @retval none
  286. */
  287. #define __HAL_CEC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__))
  288. /** @brief Checks whether or not the specified CEC interrupt is enabled.
  289. * @param __HANDLE__: specifies the CEC Handle.
  290. * @param __INTERRUPT__: specifies the CEC interrupt to check.
  291. * This parameter can be:
  292. * @arg CEC_IT_IE : Interrupt Enable
  293. * @retval FlagStatus
  294. */
  295. #define __HAL_CEC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) READ_BIT((__HANDLE__)->Instance->CFGR, (__INTERRUPT__))
  296. /** @brief Enables the CEC device
  297. * @param __HANDLE__: specifies the CEC Handle.
  298. * @retval none
  299. */
  300. #define __HAL_CEC_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE)
  301. /** @brief Disables the CEC device
  302. * @param __HANDLE__: specifies the CEC Handle.
  303. * @retval none
  304. */
  305. #define __HAL_CEC_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CFGR, CEC_CFGR_PE)
  306. /** @brief Set Transmission Start flag
  307. * @param __HANDLE__: specifies the CEC Handle.
  308. * @retval none
  309. */
  310. #define __HAL_CEC_FIRST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM)
  311. /** @brief Set Transmission End flag
  312. * @param __HANDLE__: specifies the CEC Handle.
  313. * @retval none
  314. */
  315. #define __HAL_CEC_LAST_BYTE_TX_SET(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM)
  316. /** @brief Get Transmission Start flag
  317. * @param __HANDLE__: specifies the CEC Handle.
  318. * @retval FlagStatus
  319. */
  320. #define __HAL_CEC_GET_TRANSMISSION_START_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TSOM)
  321. /** @brief Get Transmission End flag
  322. * @param __HANDLE__: specifies the CEC Handle.
  323. * @retval FlagStatus
  324. */
  325. #define __HAL_CEC_GET_TRANSMISSION_END_FLAG(__HANDLE__) READ_BIT((__HANDLE__)->Instance->CSR, CEC_CSR_TEOM)
  326. /** @brief Clear OAR register
  327. * @param __HANDLE__: specifies the CEC Handle.
  328. * @retval none
  329. */
  330. #define __HAL_CEC_CLEAR_OAR(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->OAR, CEC_OAR_OA)
  331. /** @brief Set OAR register
  332. * @param __HANDLE__: specifies the CEC Handle.
  333. * @param __ADDRESS__: Own Address value.
  334. * @retval none
  335. */
  336. #define __HAL_CEC_SET_OAR(__HANDLE__,__ADDRESS__) MODIFY_REG((__HANDLE__)->Instance->OAR, CEC_OAR_OA, (__ADDRESS__));
  337. /**
  338. * @}
  339. */
  340. /* Exported functions --------------------------------------------------------*/
  341. /** @addtogroup CEC_Exported_Functions CEC Exported Functions
  342. * @{
  343. */
  344. /** @addtogroup CEC_Exported_Functions_Group1 Initialization and de-initialization functions
  345. * @brief Initialization and Configuration functions
  346. * @{
  347. */
  348. /* Initialization and de-initialization functions ****************************/
  349. HAL_StatusTypeDef HAL_CEC_Init(CEC_HandleTypeDef *hcec);
  350. HAL_StatusTypeDef HAL_CEC_DeInit(CEC_HandleTypeDef *hcec);
  351. HAL_StatusTypeDef HAL_CEC_SetDeviceAddress(CEC_HandleTypeDef *hcec, uint16_t CEC_OwnAddress);
  352. void HAL_CEC_MspInit(CEC_HandleTypeDef *hcec);
  353. void HAL_CEC_MspDeInit(CEC_HandleTypeDef *hcec);
  354. /**
  355. * @}
  356. */
  357. /** @addtogroup CEC_Exported_Functions_Group2 Input and Output operation functions
  358. * @brief CEC Transmit/Receive functions
  359. * @{
  360. */
  361. /* I/O operation functions ***************************************************/
  362. HAL_StatusTypeDef HAL_CEC_Transmit_IT(CEC_HandleTypeDef *hcec, uint8_t InitiatorAddress,uint8_t DestinationAddress, uint8_t *pData, uint32_t Size);
  363. uint32_t HAL_CEC_GetLastReceivedFrameSize(CEC_HandleTypeDef *hcec);
  364. void HAL_CEC_ChangeRxBuffer(CEC_HandleTypeDef *hcec, uint8_t* Rxbuffer);
  365. void HAL_CEC_IRQHandler(CEC_HandleTypeDef *hcec);
  366. void HAL_CEC_TxCpltCallback(CEC_HandleTypeDef *hcec);
  367. void HAL_CEC_RxCpltCallback(CEC_HandleTypeDef *hcec, uint32_t RxFrameSize);
  368. void HAL_CEC_ErrorCallback(CEC_HandleTypeDef *hcec);
  369. /**
  370. * @}
  371. */
  372. /** @defgroup CEC_Exported_Functions_Group3 Peripheral Control functions
  373. * @brief CEC control functions
  374. * @{
  375. */
  376. /* Peripheral State and Error functions ***************************************/
  377. HAL_CEC_StateTypeDef HAL_CEC_GetState(CEC_HandleTypeDef *hcec);
  378. uint32_t HAL_CEC_GetError(CEC_HandleTypeDef *hcec);
  379. /**
  380. * @}
  381. */
  382. /**
  383. * @}
  384. */
  385. /* Private types -------------------------------------------------------------*/
  386. /** @defgroup CEC_Private_Types CEC Private Types
  387. * @{
  388. */
  389. /**
  390. * @}
  391. */
  392. /* Private variables ---------------------------------------------------------*/
  393. /** @defgroup CEC_Private_Variables CEC Private Variables
  394. * @{
  395. */
  396. /**
  397. * @}
  398. */
  399. /* Private constants ---------------------------------------------------------*/
  400. /** @defgroup CEC_Private_Constants CEC Private Constants
  401. * @{
  402. */
  403. /**
  404. * @}
  405. */
  406. /* Private macros ------------------------------------------------------------*/
  407. /** @defgroup CEC_Private_Macros CEC Private Macros
  408. * @{
  409. */
  410. #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BIT_TIMING_ERROR_MODE_STANDARD) || \
  411. ((MODE) == CEC_BIT_TIMING_ERROR_MODE_ERRORFREE))
  412. #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BIT_PERIOD_ERROR_MODE_STANDARD) || \
  413. ((MODE) == CEC_BIT_PERIOD_ERROR_MODE_FLEXIBLE))
  414. /** @brief Check CEC message size.
  415. * The message size is the payload size: without counting the header,
  416. * it varies from 0 byte (ping operation, one header only, no payload) to
  417. * 15 bytes (1 opcode and up to 14 operands following the header).
  418. * @param __SIZE__: CEC message size.
  419. * @retval Test result (TRUE or FALSE).
  420. */
  421. #define IS_CEC_MSGSIZE(__SIZE__) ((__SIZE__) <= 0x10U)
  422. /** @brief Check CEC device Own Address Register (OAR) setting.
  423. * @param __ADDRESS__: CEC own address.
  424. * @retval Test result (TRUE or FALSE).
  425. */
  426. #define IS_CEC_OWN_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0000000FU)
  427. /** @brief Check CEC initiator or destination logical address setting.
  428. * Initiator and destination addresses are coded over 4 bits.
  429. * @param __ADDRESS__: CEC initiator or logical address.
  430. * @retval Test result (TRUE or FALSE).
  431. */
  432. #define IS_CEC_ADDRESS(__ADDRESS__) ((__ADDRESS__) <= 0x0000000FU)
  433. /**
  434. * @}
  435. */
  436. /* Private functions ---------------------------------------------------------*/
  437. /** @defgroup CEC_Private_Functions CEC Private Functions
  438. * @{
  439. */
  440. /**
  441. * @}
  442. */
  443. /**
  444. * @}
  445. */
  446. /**
  447. * @}
  448. */
  449. #endif /* defined(STM32F100xB) || defined(STM32F100xE) */
  450. #ifdef __cplusplus
  451. }
  452. #endif
  453. #endif /* __STM32F1xx_HAL_CEC_H */
  454. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/