A bundled STM32F10x Std Periph and CMSIS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

212 lines
6.4 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f10x_cec.h
  4. * @author MCD Application Team
  5. * @version V3.5.0
  6. * @date 11-March-2011
  7. * @brief This file contains all the functions prototypes for the CEC firmware
  8. * library.
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  13. * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  14. * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  15. * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  16. * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  17. * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  18. *
  19. * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  20. ******************************************************************************
  21. */
  22. /* Define to prevent recursive inclusion -------------------------------------*/
  23. #ifndef __STM32F10x_CEC_H
  24. #define __STM32F10x_CEC_H
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f10x.h"
  30. #include "stm32f10x_assert.h"
  31. /** @addtogroup STM32F10x_StdPeriph_Driver
  32. * @{
  33. */
  34. /** @addtogroup CEC
  35. * @{
  36. */
  37. /** @defgroup CEC_Exported_Types
  38. * @{
  39. */
  40. /**
  41. * @brief CEC Init structure definition
  42. */
  43. typedef struct
  44. {
  45. uint16_t CEC_BitTimingMode; /*!< Configures the CEC Bit Timing Error Mode.
  46. This parameter can be a value of @ref CEC_BitTiming_Mode */
  47. uint16_t CEC_BitPeriodMode; /*!< Configures the CEC Bit Period Error Mode.
  48. This parameter can be a value of @ref CEC_BitPeriod_Mode */
  49. }CEC_InitTypeDef;
  50. /**
  51. * @}
  52. */
  53. /** @defgroup CEC_Exported_Constants
  54. * @{
  55. */
  56. /** @defgroup CEC_BitTiming_Mode
  57. * @{
  58. */
  59. #define CEC_BitTimingStdMode ((uint16_t)0x00) /*!< Bit timing error Standard Mode */
  60. #define CEC_BitTimingErrFreeMode CEC_CFGR_BTEM /*!< Bit timing error Free Mode */
  61. #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BitTimingStdMode) || \
  62. ((MODE) == CEC_BitTimingErrFreeMode))
  63. /**
  64. * @}
  65. */
  66. /** @defgroup CEC_BitPeriod_Mode
  67. * @{
  68. */
  69. #define CEC_BitPeriodStdMode ((uint16_t)0x00) /*!< Bit period error Standard Mode */
  70. #define CEC_BitPeriodFlexibleMode CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */
  71. #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BitPeriodStdMode) || \
  72. ((MODE) == CEC_BitPeriodFlexibleMode))
  73. /**
  74. * @}
  75. */
  76. /** @defgroup CEC_interrupts_definition
  77. * @{
  78. */
  79. #define CEC_IT_TERR CEC_CSR_TERR
  80. #define CEC_IT_TBTRF CEC_CSR_TBTRF
  81. #define CEC_IT_RERR CEC_CSR_RERR
  82. #define CEC_IT_RBTF CEC_CSR_RBTF
  83. #define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TERR) || ((IT) == CEC_IT_TBTRF) || \
  84. ((IT) == CEC_IT_RERR) || ((IT) == CEC_IT_RBTF))
  85. /**
  86. * @}
  87. */
  88. /** @defgroup CEC_Own_Address
  89. * @{
  90. */
  91. #define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10)
  92. /**
  93. * @}
  94. */
  95. /** @defgroup CEC_Prescaler
  96. * @{
  97. */
  98. #define IS_CEC_PRESCALER(PRESCALER) ((PRESCALER) <= 0x3FFF)
  99. /**
  100. * @}
  101. */
  102. /** @defgroup CEC_flags_definition
  103. * @{
  104. */
  105. /**
  106. * @brief ESR register flags
  107. */
  108. #define CEC_FLAG_BTE ((uint32_t)0x10010000)
  109. #define CEC_FLAG_BPE ((uint32_t)0x10020000)
  110. #define CEC_FLAG_RBTFE ((uint32_t)0x10040000)
  111. #define CEC_FLAG_SBE ((uint32_t)0x10080000)
  112. #define CEC_FLAG_ACKE ((uint32_t)0x10100000)
  113. #define CEC_FLAG_LINE ((uint32_t)0x10200000)
  114. #define CEC_FLAG_TBTFE ((uint32_t)0x10400000)
  115. /**
  116. * @brief CSR register flags
  117. */
  118. #define CEC_FLAG_TEOM ((uint32_t)0x00000002)
  119. #define CEC_FLAG_TERR ((uint32_t)0x00000004)
  120. #define CEC_FLAG_TBTRF ((uint32_t)0x00000008)
  121. #define CEC_FLAG_RSOM ((uint32_t)0x00000010)
  122. #define CEC_FLAG_REOM ((uint32_t)0x00000020)
  123. #define CEC_FLAG_RERR ((uint32_t)0x00000040)
  124. #define CEC_FLAG_RBTF ((uint32_t)0x00000080)
  125. #define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF03) == 0x00) && ((FLAG) != 0x00))
  126. #define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_BTE) || ((FLAG) == CEC_FLAG_BPE) || \
  127. ((FLAG) == CEC_FLAG_RBTFE) || ((FLAG)== CEC_FLAG_SBE) || \
  128. ((FLAG) == CEC_FLAG_ACKE) || ((FLAG) == CEC_FLAG_LINE) || \
  129. ((FLAG) == CEC_FLAG_TBTFE) || ((FLAG) == CEC_FLAG_TEOM) || \
  130. ((FLAG) == CEC_FLAG_TERR) || ((FLAG) == CEC_FLAG_TBTRF) || \
  131. ((FLAG) == CEC_FLAG_RSOM) || ((FLAG) == CEC_FLAG_REOM) || \
  132. ((FLAG) == CEC_FLAG_RERR) || ((FLAG) == CEC_FLAG_RBTF))
  133. /**
  134. * @}
  135. */
  136. /**
  137. * @}
  138. */
  139. /** @defgroup CEC_Exported_Macros
  140. * @{
  141. */
  142. /**
  143. * @}
  144. */
  145. /** @defgroup CEC_Exported_Functions
  146. * @{
  147. */
  148. void CEC_DeInit(void);
  149. void CEC_Init(CEC_InitTypeDef* CEC_InitStruct);
  150. void CEC_Cmd(FunctionalState NewState);
  151. void CEC_ITConfig(FunctionalState NewState);
  152. void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress);
  153. void CEC_SetPrescaler(uint16_t CEC_Prescaler);
  154. void CEC_SendDataByte(uint8_t Data);
  155. uint8_t CEC_ReceiveDataByte(void);
  156. void CEC_StartOfMessage(void);
  157. void CEC_EndOfMessageCmd(FunctionalState NewState);
  158. FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG);
  159. void CEC_ClearFlag(uint32_t CEC_FLAG);
  160. ITStatus CEC_GetITStatus(uint8_t CEC_IT);
  161. void CEC_ClearITPendingBit(uint16_t CEC_IT);
  162. #ifdef __cplusplus
  163. }
  164. #endif
  165. #endif /* __STM32F10x_CEC_H */
  166. /**
  167. * @}
  168. */
  169. /**
  170. * @}
  171. */
  172. /**
  173. * @}
  174. */
  175. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/