stm32100e_eval_cec.h

Go to the documentation of this file.
00001 /**
00002  ******************************************************************************
00003  * @file     stm32100e_eval_cec.h
00004  * @author   MCD Application Team
00005   * @version V4.3.0
00006   * @date    10/15/2010
00007  * @brief    This file contains all the functions prototypes for the stm32100e_eval_cec
00008  *           firmware driver.
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 __STM32100E_EVAL_CEC_H
00024 #define __STM32100E_EVAL_CEC_H
00025 
00026 #ifdef __cplusplus
00027 extern "C"
00028 {
00029 #endif
00030 
00031   /* Includes ------------------------------------------------------------------*/
00032 #include "stm32f10x.h"
00033 
00034 /** @addtogroup Utilities
00035   * @{
00036   */
00037 
00038 /** @addtogroup STM32_EVAL
00039   * @{
00040   */ 
00041 
00042 /** @addtogroup STM32100E_EVAL
00043   * @{
00044   */  
00045 
00046 /** @defgroup STM32100E_EVAL_CEC
00047   * @{
00048   */
00049 
00050 /** @defgroup STM32100E_EVAL_CEC_Exported_Types
00051   * @{
00052   */
00053 typedef enum
00054 {
00055   HDMI_CEC_BIT_TIMING              = (1), /*!< CEC Bit Timing Error */
00056   HDMI_CEC_BIT_PERIOD              = (2), /*!< CEC Bit Period Error */
00057   HDMI_CEC_RX_BLOCK_FINISHED       = (3), /*!< CEC Receive Block finished Error */
00058   HDMI_CEC_START_BIT               = (4), /*!< CEC Start Bit Error */
00059   HDMI_CEC_BLOCK_ACKNOWLEDGE       = (5), /*!< CEC Block Acknowledge Error */
00060   HDMI_CEC_LINE                    = (6), /*!< CEC Line Error */
00061   HDMI_CEC_TX_BLOCK_FINISHED       = (7), /*!< CEC Transmit Block Transfer finished Error */
00062   HDMI_CEC_DEVICE_UNREGISTRED      = (8), /*!< CEC Device Unregistred */
00063   HDMI_CEC_TIMEOUT                 = (9), /*!< CEC TimeOut */
00064   HDMI_CEC_OK                      = (10)  /*!< CEC OK */
00065 }HDMI_CEC_Error;
00066 
00067 typedef struct
00068 {
00069   __IO uint8_t PhysicalAddress_A;
00070   __IO uint8_t PhysicalAddress_B;
00071   __IO uint8_t PhysicalAddress_C;
00072   __IO uint8_t PhysicalAddress_D;
00073   __IO uint8_t LogicalAddress;
00074   __IO uint8_t DeviceType;
00075 }HDMI_CEC_Map;
00076 
00077 
00078 #define HDMI_CEC_TX_MESSAGE_LENGTH_MAX       ((uint32_t)0x0000000E)
00079 #define HDMI_CEC_TIMEOUT_VALUE               ((uint32_t)0x001FFFFF)
00080 
00081 /**
00082 * @brief  CEC Init Structure definition
00083 */
00084 typedef struct
00085 {
00086   __IO uint8_t Header;
00087   __IO uint8_t Opcode;
00088   __IO uint8_t Operande[HDMI_CEC_TX_MESSAGE_LENGTH_MAX];
00089   __IO uint8_t TxMessageLength;
00090   __IO uint8_t RxMessageLength;
00091 }HDMI_CEC_Message;
00092 
00093 /**
00094 * @}
00095 */
00096 
00097 /** @defgroup STM32100E_EVAL_CEC_Exported_Constants
00098   * @{
00099   */
00100 
00101 /**
00102   * @brief CEC device types
00103   */
00104 #define HDMI_CEC_TV                                         0x00
00105 #define HDMI_CEC_RECORDING                                  0x01
00106 #define HDMI_CEC_TUNER                                      0x03
00107 #define HDMI_CEC_PLAYBACK                                   0x04
00108 #define HDMI_CEC_AUDIOSYSTEM                                0x05
00109 
00110 
00111 /**
00112   * @brief  HDMI CEC I2C Interface pins
00113   */
00114 #define HDMI_CEC_I2C_SCL_PIN                                GPIO_Pin_6
00115 #define HDMI_CEC_I2C_SDA_PIN                                GPIO_Pin_7
00116 #define HDMI_CEC_I2C_GPIO_PORT                              GPIOB
00117 #define HDMI_CEC_I2C_GPIO_CLK                               RCC_APB2Periph_GPIOB
00118 #define HDMI_CEC_I2C                                        I2C1
00119 #define HDMI_CEC_I2C_CLK                                    RCC_APB1Periph_I2C1
00120 
00121 /**
00122   * @brief  HDMI CEC HPD (Hot Plug Detect) Interface pin
00123   */
00124 #define HDMI_CEC_HPD_PIN                                    GPIO_Pin_9
00125 #define HDMI_CEC_HPD_GPIO_PORT                              GPIOB
00126 #define HDMI_CEC_HPD_GPIO_CLK                               RCC_APB2Periph_GPIOB
00127 
00128 /**
00129   * @brief  HDMI CEC Interface pin
00130   */
00131 #define HDMI_CEC_LINE_PIN                                   GPIO_Pin_8
00132 #define HDMI_CEC_LINE_GPIO_PORT                             GPIOB
00133 #define HDMI_CEC_LINE_GPIO_CLK                              RCC_APB2Periph_GPIOB
00134 
00135 #define HDMI_CEC_I2C_SLAVE_ADDRESS7                         0xA0
00136 #define HDMI_CEC_I2C_CLOCK_SPEED                            100000
00137 
00138 /**
00139   * @brief  HDMI CEC Root (Mainly for TV with a fixed physical address (0.0.0.0))
00140   *         If you want to configure the STM32100E-EVAL board as CEC Root (Sink)
00141   *         change the following define to 0x1    
00142   */
00143 #define HDMI_CEC_ROOT                                       0x00
00144 
00145 /**
00146   * @brief  To select if the DDC Channel will be used for physical address discovery
00147   *         or not. To use the DDC Channel to read the EDID structure uncomment
00148   *         the following line.   
00149   *         If the device is configured as HMDI source it should read his own physical
00150   *         address from the sink that is connected to.         
00151   */
00152 /* #define HDMI_CEC_USE_DDC */                                    
00153 
00154 /**
00155   * @brief  CEC version: V1.3a
00156   */
00157 #define HDMI_CEC_VERSION                                    0x04
00158 
00159 /**
00160   * @brief  Reason for Abort feature
00161   */
00162 #define HDMI_CEC_UNRECOGNIZED_OPCODE                        0x00
00163 #define HDMI_CEC_NOT_CORRECT_MODETORESPOND                  0x01
00164 #define HDMI_CEC_CANNOTPROVIDE_SOURCE                       0x02
00165 #define HDMI_CEC_INVALID_OPERAND                            0x03
00166 #define HDMI_CEC_REFUSED                                    0x04
00167 
00168 /**
00169   * @brief  HDMI CEC specific commands
00170   */
00171 #define HDMI_CEC_OPCODE_ACTIVE_SOURCE                       ((uint8_t) 0x82)
00172 #define HDMI_CEC_OPCODE_IMAGE_VIEW_ON                       ((uint8_t) 0x04)
00173 #define HDMI_CEC_OPCODE_TEXT_VIEW_ON                        ((uint8_t) 0x0D)
00174 #define HDMI_CEC_OPCODE_INACTIVE_SOURCE                     ((uint8_t) 0x9D)
00175 #define HDMI_CEC_OPCODE_REQUEST_ACTIVE_SOURCE               ((uint8_t) 0x85)
00176 #define HDMI_CEC_OPCODE_ROUTING_CHANGE                      ((uint8_t) 0x80)
00177 #define HDMI_CEC_OPCODE_ROUTING_INFORMATION                 ((uint8_t) 0x81)
00178 #define HDMI_CEC_OPCODE_SET_STREAM_PATH                     ((uint8_t) 0x86)
00179 #define HDMI_CEC_OPCODE_STANDBY                             ((uint8_t) 0x36)
00180 #define HDMI_CEC_OPCODE_RECORD_OFF                          ((uint8_t) 0x0B)
00181 #define HDMI_CEC_OPCODE_RECORD_ON                           ((uint8_t) 0x09)
00182 #define HDMI_CEC_OPCODE_RECORD_STATUS                       ((uint8_t) 0x0A)
00183 #define HDMI_CEC_OPCODE_RECORD_TV_SCREEN                    ((uint8_t) 0x0F)
00184 #define HDMI_CEC_OPCODE_CLEAR_ANALOGUE_TIMER                ((uint8_t) 0x33)
00185 #define HDMI_CEC_OPCODE_CLEAR_DIGITAL_TIMER                 ((uint8_t) 0x99)
00186 #define HDMI_CEC_OPCODE_CLEAR_EXTERNAL_TIMER                ((uint8_t) 0xA1)
00187 #define HDMI_CEC_OPCODE_SET_ANALOGUE_TIMER                  ((uint8_t) 0x34)
00188 #define HDMI_CEC_OPCODE_SET_DIGITAL_TIMER                   ((uint8_t) 0x97)
00189 #define HDMI_CEC_OPCODE_SET_EXTERNAL_TIMER                  ((uint8_t) 0xA2)
00190 #define HDMI_CEC_OPCODE_SET_TIMER_PROGRAM_TITLE             ((uint8_t) 0x67)
00191 #define HDMI_CEC_OPCODE_TIMER_CLEARED_STATUS                ((uint8_t) 0x43)
00192 #define HDMI_CEC_OPCODE_TIMER_STATUS                        ((uint8_t) 0x35)
00193 #define HDMI_CEC_OPCODE_CEC_VERSION                         ((uint8_t) 0x9E)
00194 #define HDMI_CEC_OPCODE_GET_CEC_VERSION                     ((uint8_t) 0x9F)
00195 #define HDMI_CEC_OPCODE_GIVE_PHYSICAL_ADDRESS               ((uint8_t) 0x83)
00196 #define HDMI_CEC_OPCODE_GET_MENU_LANGUAGE                   ((uint8_t) 0x91)
00197 #define HDMI_CEC_OPCODE_REPORT_PHYSICAL_ADDRESS             ((uint8_t) 0x84)
00198 #define HDMI_CEC_OPCODE_SET_MENU_LANGUAGE                   ((uint8_t) 0x32)
00199 #define HDMI_CEC_OPCODE_DECK_CONTROL                        ((uint8_t) 0x42)
00200 #define HDMI_CEC_OPCODE_DECK_STATUS                         ((uint8_t) 0x1B)
00201 #define HDMI_CEC_OPCODE_GIVE_DECK_STATUS                    ((uint8_t) 0x1A)
00202 #define HDMI_CEC_OPCODE_PLAY                                ((uint8_t) 0x41)
00203 #define HDMI_CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS            ((uint8_t) 0x08)
00204 #define HDMI_CEC_OPCODE_SELECT_ANALOGUE_SERVICE             ((uint8_t) 0x92)
00205 #define HDMI_CEC_OPCODE_SELECT_DIGITAL_SERVICE              ((uint8_t) 0x93)
00206 #define HDMI_CEC_OPCODE_TUNER_DEVICE_STATUS                 ((uint8_t) 0x07)
00207 #define HDMI_CEC_OPCODE_TUNER_STEP_DECREMENT                ((uint8_t) 0x06)
00208 #define HDMI_CEC_OPCODE_TUNER_STEP_INCREMENT                ((uint8_t) 0x05)
00209 #define HDMI_CEC_OPCODE_DEVICE_VENDOR_ID                    ((uint8_t) 0x87)
00210 #define HDMI_CEC_OPCODE_GIVE_DEVICE_VENDOR_ID               ((uint8_t) 0x8C)
00211 #define HDMI_CEC_OPCODE_VENDOR_COMMAND                      ((uint8_t) 0x89)
00212 #define HDMI_CEC_OPCODE_VENDOR_COMMAND_WITH_ID              ((uint8_t) 0xA0)
00213 #define HDMI_CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN           ((uint8_t) 0x8A)
00214 #define HDMI_CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP             ((uint8_t) 0x8B)
00215 #define HDMI_CEC_OPCODE_SET_OSD_STRING                      ((uint8_t) 0x64)
00216 #define HDMI_CEC_OPCODE_GIVE_OSD_NAME                       ((uint8_t) 0x46)
00217 #define HDMI_CEC_OPCODE_SET_OSD_NAME                        ((uint8_t) 0x47)
00218 #define HDMI_CEC_OPCODE_MENU_REQUEST                        ((uint8_t) 0x8D)
00219 #define HDMI_CEC_OPCODE_MENU_STATUS                         ((uint8_t) 0x8E)
00220 #define HDMI_CEC_OPCODE_USER_CONTROL_PRESSED                ((uint8_t) 0x44)
00221 #define HDMI_CEC_OPCODE_USER_CONTROL_RELEASED               ((uint8_t) 0x45)
00222 #define HDMI_CEC_OPCODE_GIVE_DEVICE_POWER_STATUS            ((uint8_t) 0x8F)
00223 #define HDMI_CEC_OPCODE_REPORT_POWER_STATUS                 ((uint8_t) 0x90)
00224 #define HDMI_CEC_OPCODE_FEATURE_ABORT                       ((uint8_t) 0x00)
00225 #define HDMI_CEC_OPCODE_ABORT                               ((uint8_t) 0xFF)
00226 #define HDMI_CEC_OPCODE_GIVE_AUDIO_STATUS                   ((uint8_t) 0x71)
00227 #define HDMI_CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS       ((uint8_t) 0x7D)
00228 #define HDMI_CEC_OPCODE_REPORT_AUDIO_STATUS                 ((uint8_t) 0x7A)
00229 #define HDMI_CEC_OPCODE_SET_SYSTEM_AUDIO_MODE               ((uint8_t) 0x72)
00230 #define HDMI_CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST           ((uint8_t) 0x70)
00231 #define HDMI_CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS            ((uint8_t) 0x7E)
00232 #define HDMI_CEC_OPCODE_SET_AUDIO_RATE                      ((uint8_t) 0x9A)
00233 
00234 
00235 /**
00236   * @}
00237   */
00238 
00239 /** @defgroup STM32100E_EVAL_CEC_Exported_Macros
00240   * @{
00241   */
00242 /* HDMI_CEC_HPD: HDMI HPD pin low  */
00243 #define HDMI_CEC_HPD_LOW()       GPIO_ResetBits(HDMI_CEC_HPD_GPIO_PORT, HDMI_CEC_HPD_PIN)
00244 /* HDMI_CEC_HPD: HDMI HPD pin high  */
00245 #define HDMI_CEC_HPD_HIGH()      GPIO_SetBits(HDMI_CEC_HPD_GPIO_PORT, HDMI_CEC_HPD_PIN)
00246 
00247 /**
00248   * @}
00249   */
00250 
00251 /** @defgroup STM32100E_EVAL_CEC_Exported_Functions
00252   * @{
00253   */
00254 HDMI_CEC_Error HDMI_CEC_Init(void);
00255 HDMI_CEC_Error HDMI_CEC_TransmitMessage(HDMI_CEC_Message *HDMI_CEC_TX_MessageStructure);
00256 HDMI_CEC_Error HDMI_CEC_GetErrorStatus (void);
00257 void HDMI_CEC_ProcessIRQSrc(void);
00258 HDMI_CEC_Error HDMI_CEC_ReportPhysicalAddress(void);
00259 void HDMI_CEC_CommandCallBack(void);
00260 HDMI_CEC_Error HDMI_CEC_CheckConnectedDevices(void);
00261 
00262 #ifdef __cplusplus
00263 }
00264 #endif
00265 
00266 #endif /* __STM32100E_EVAL_CEC_H */
00267 
00268 /**
00269   * @}
00270   */
00271 
00272 /**
00273   * @}
00274   */
00275 
00276 /**
00277   * @}
00278   */
00279 
00280 /**
00281   * @}
00282   */
00283 
00284 /**
00285   * @}
00286   */
00287   
00288 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
00289 
STM32F10x Standard Peripherals Library: Footer

 

 

 

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