stm32f1xx_hal_cec.h 22 KB

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