stm32f10x_cec.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32f10x_cec.h
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   This file contains all the functions prototypes for the CEC firmware 
00008   *          library.
00009   ******************************************************************************
00010   * @copy
00011   *
00012   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00013   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00014   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00015   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00016   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00017   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00018   *
00019   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00020   */ 
00021 
00022 /* Define to prevent recursive inclusion -------------------------------------*/
00023 #ifndef __STM32F10x_CEC_H
00024 #define __STM32F10x_CEC_H
00025 
00026 #ifdef __cplusplus
00027  extern "C" {
00028 #endif
00029 
00030 /* Includes ------------------------------------------------------------------*/
00031 #include "stm32f10x.h"
00032 
00033 /** @addtogroup STM32F10x_StdPeriph_Driver
00034   * @{
00035   */
00036 
00037 /** @addtogroup CEC
00038   * @{
00039   */
00040   
00041 
00042 /** @defgroup CEC_Exported_Types
00043   * @{
00044   */
00045    
00046 /** 
00047   * @brief  CEC Init structure definition  
00048   */ 
00049 typedef struct
00050 {
00051   uint16_t CEC_BitTimingMode; /*!< Configures the CEC Bit Timing Error Mode. 
00052                                This parameter can be a value of @ref CEC_BitTiming_Mode */
00053   uint16_t CEC_BitPeriodMode; /*!< Configures the CEC Bit Period Error Mode. 
00054                                This parameter can be a value of @ref CEC_BitPeriod_Mode */
00055 }CEC_InitTypeDef;
00056 
00057 /**
00058   * @}
00059   */
00060 
00061 /** @defgroup CEC_Exported_Constants
00062   * @{
00063   */ 
00064   
00065 /** @defgroup CEC_BitTiming_Mode 
00066   * @{
00067   */ 
00068 #define CEC_BitTimingStdMode                    ((uint16_t)0x00) /*!< Bit timing error Standard Mode */
00069 #define CEC_BitTimingErrFreeMode                CEC_CFGR_BTEM   /*!< Bit timing error Free Mode */
00070 
00071 #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BitTimingStdMode) || \
00072                                             ((MODE) == CEC_BitTimingErrFreeMode))
00073 /**
00074   * @}
00075   */
00076 
00077 /** @defgroup CEC_BitPeriod_Mode 
00078   * @{
00079   */ 
00080 #define CEC_BitPeriodStdMode                    ((uint16_t)0x00) /*!< Bit period error Standard Mode */
00081 #define CEC_BitPeriodFlexibleMode                CEC_CFGR_BPEM   /*!< Bit period error Flexible Mode */
00082 
00083 #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BitPeriodStdMode) || \
00084                                             ((MODE) == CEC_BitPeriodFlexibleMode))
00085 /**
00086   * @}
00087   */ 
00088 
00089 
00090 /** @defgroup CEC_interrupts_definition 
00091   * @{
00092   */ 
00093 #define CEC_IT_TERR                              CEC_CSR_TERR
00094 #define CEC_IT_TBTRF                             CEC_CSR_TBTRF
00095 #define CEC_IT_RERR                              CEC_CSR_RERR
00096 #define CEC_IT_RBTF                              CEC_CSR_RBTF
00097 #define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TERR) || ((IT) == CEC_IT_TBTRF) || \
00098                            ((IT) == CEC_IT_RERR) || ((IT) == CEC_IT_RBTF))
00099 /**
00100   * @}
00101   */ 
00102 
00103 
00104 /** @defgroup CEC_Own_Addres 
00105   * @{
00106   */ 
00107 #define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10)
00108 /**
00109   * @}
00110   */ 
00111 
00112 /** @defgroup CEC_Prescaler 
00113   * @{
00114   */ 
00115 #define IS_CEC_PRESCALER(PRESCALER) ((PRESCALER) <= 0x3FFF)
00116 
00117 /**
00118   * @}
00119   */
00120 
00121 /** @defgroup CEC_flags_definition 
00122   * @{
00123   */
00124    
00125 /** 
00126   * @brief  ESR register flags  
00127   */ 
00128 #define CEC_FLAG_BTE                            ((uint32_t)0x10010000)
00129 #define CEC_FLAG_BPE                            ((uint32_t)0x10020000)
00130 #define CEC_FLAG_RBTFE                          ((uint32_t)0x10040000)
00131 #define CEC_FLAG_SBE                            ((uint32_t)0x10080000)
00132 #define CEC_FLAG_ACKE                           ((uint32_t)0x10100000)
00133 #define CEC_FLAG_LINE                           ((uint32_t)0x10200000)
00134 #define CEC_FLAG_TBTFE                          ((uint32_t)0x10400000)
00135 
00136 /** 
00137   * @brief  CSR register flags  
00138   */ 
00139 #define CEC_FLAG_TEOM                           ((uint32_t)0x00000002)  
00140 #define CEC_FLAG_TERR                           ((uint32_t)0x00000004)
00141 #define CEC_FLAG_TBTRF                          ((uint32_t)0x00000008)
00142 #define CEC_FLAG_RSOM                           ((uint32_t)0x00000010)
00143 #define CEC_FLAG_REOM                           ((uint32_t)0x00000020)
00144 #define CEC_FLAG_RERR                           ((uint32_t)0x00000040)
00145 #define CEC_FLAG_RBTF                           ((uint32_t)0x00000080)
00146 
00147 #define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF03) == 0x00) && ((FLAG) != 0x00))
00148                                
00149 #define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_BTE) || ((FLAG) == CEC_FLAG_BPE) || \
00150                                ((FLAG) == CEC_FLAG_RBTFE) || ((FLAG)== CEC_FLAG_SBE) || \
00151                                ((FLAG) == CEC_FLAG_ACKE) || ((FLAG) == CEC_FLAG_LINE) || \
00152                                ((FLAG) == CEC_FLAG_TBTFE) || ((FLAG) == CEC_FLAG_TEOM) || \
00153                                ((FLAG) == CEC_FLAG_TERR) || ((FLAG) == CEC_FLAG_TBTRF) || \
00154                                ((FLAG) == CEC_FLAG_RSOM) || ((FLAG) == CEC_FLAG_REOM) || \
00155                                ((FLAG) == CEC_FLAG_RERR) || ((FLAG) == CEC_FLAG_RBTF))
00156 
00157 /**
00158   * @}
00159   */ 
00160 
00161 /**
00162   * @}
00163   */ 
00164 
00165 /** @defgroup CEC_Exported_Macros
00166   * @{
00167   */
00168  
00169 /**
00170   * @}
00171   */
00172 
00173 /** @defgroup CEC_Exported_Functions
00174   * @{
00175   */ 
00176 void CEC_DeInit(void);
00177 void CEC_Init(CEC_InitTypeDef* CEC_InitStruct);
00178 void CEC_Cmd(FunctionalState NewState);
00179 void CEC_ITConfig(FunctionalState NewState);
00180 void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress);
00181 void CEC_SetPrescaler(uint16_t CEC_Prescaler);
00182 void CEC_SendDataByte(uint8_t Data);
00183 uint8_t CEC_ReceiveDataByte(void);
00184 void CEC_StartOfMessage(void);
00185 void CEC_EndOfMessageCmd(FunctionalState NewState);
00186 FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG);
00187 void CEC_ClearFlag(uint32_t CEC_FLAG);
00188 ITStatus CEC_GetITStatus(uint8_t CEC_IT);
00189 void CEC_ClearITPendingBit(uint16_t CEC_IT);
00190 
00191 #ifdef __cplusplus
00192 }
00193 #endif
00194 
00195 #endif /* __STM32F10x_CEC_H */
00196 
00197 /**
00198   * @}
00199   */ 
00200 
00201 /**
00202   * @}
00203   */ 
00204 
00205 /**
00206   * @}
00207   */ 
00208 
00209 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32