123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- #ifndef __CECD_H_
- #define __CECD_H_
- #include <pthread.h>
- #include <stdbool.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <signal.h>
- #include <fcntl.h>
- #include <sys/mman.h>
- #include <errno.h>
- //#include <sis516/sishdmi_interface.h>
- #include <drv_cec_external.h>
- #include <drv_debug.h>
- //#include <sisdebug.h> unused
- #include "msgqueue.h"
- #include "cecddbg.h"
- #include "cecd_interface.h"
- BOOL get_bDebugLog();
- #define bCECDDBG get_bDebugLog()
- extern unsigned int sisdbgconf1;
- #ifndef CONFIG_SUPPORT_DEBUG_MESSAGE
- //#if 0
- #define CECDDBG(fmt,args...)
- #else
- #define CECDDBG(fmt,args...) do {if (sisdbgconf1 & DBGCFG_CEC) printf(("[CECD] " fmt), ## args);}while(0)
- #endif
- #define CECTV_DEV_FILE "/dev/cectv"
- typedef void (*CB_UMFHANDLER)(CECD_MSG *cecdMsg);
- inline static void cecd_msleep(INT32 msec)
- {
- usleep(msec * 1000);
- }
- typedef enum
- {
- YESSIR = 0, // OK, I did it.
- NOSIR, // NO, I cant do it (do nothing).
- SORRYSIR = -1 // SORRY, I did it but fail.
- } cec_result_t;
- typedef struct _CECDTV_t
- {
- UINT8 device_to_power_up;
- UINT8 PowerStatus;
- UINT8 ActiveSource;
- UINT8 MenuLanguageStr[3];
- UINT8 DeckStatus;
- UINT8 DeviceMenuStatus;
- UINT8 TvSource;
- UINT8 ViewOnStatus;
- pthread_mutex_t list_mutex;
- PDEVICEMAP_LIST deviceList;
- } CECDTV_t, *PCECDTV_t;
- typedef struct _CECDDev_t
- {
- volatile BOOL bRunning;
- BOOL bQuery;
- BOOL bDebugLog;
- INT32 CECdev;
- pCEC_MSG_t pcec_msg;
- pFRAME_t prMsg; // Point to the current frame in psiscec_msg.
- pthread_mutex_t tx_mutex;
- CECDTV_t cecTV;
- INT32 CECDmsgId;
- INT32 UMFmsgId;
- INT32 shmId;
- INT32 OSDStringshmId;
- BOOL bDeviceListCheck;
- pthread_mutex_t dl_mutex;
- pthread_cond_t dl_cond;
- } CECDDev_t, *PCECDDev_t;
- typedef enum
- {
- Feature_Abort = 0x00,
- Image_View_On = 0x04,
- Tuner_Step_Increment = 0x05,
- Tuner_Step_Decrement = 0x06,
- Tuner_Device_Status = 0x07,
- Give_Tuner_Device_Status = 0x08,
- Record_On = 0x09,
- Record_Status = 0x0a,
- Text_View_On = 0x0D,
- Record_TV_Screen = 0x0f,
- Give_Deck_Status = 0x1A,
- Deck_Status = 0x1B,
- Set_Menu_Language = 0x32,
- Standby = 0x36,
- Play = 0x41,
- Deck_Control = 0x42,
- User_Control_Pressed = 0x44,
- User_Control_Released = 0x45,
- Give_OSD_Name = 0x46,
- Set_OSD_Name = 0x47,
- Set_OSD_String = 0x64,
- System_Audio_Mode_Request = 0x70,
- Give_Audio_Status = 0x71,
- Set_System_Audio_Mode = 0x72,
- Report_Audio_Status = 0x7A,
- Give_System_Audio_Mode = 0x7D,
- System_Audio_Mode_Status = 0x7E,
- Routing_Change = 0x80,
- Routing_Information = 0x81,
- Active_Source = 0x82,
- Give_Physical_Address = 0x83,
- Report_Physical_Address = 0x84,
- Request_Active_Source = 0x85,
- Set_Stream_Path = 0x86,
- Device_Vendor_ID = 0x87,
- Vendor_Command = 0x89,
- Vendor_Remote_Button_Down = 0x8A,
- Vendor_Remote_Button_Up = 0x8B,
- Give_Device_Vendor_ID = 0x8C,
- Menu_Request = 0x8D,
- Menu_Statu = 0x8E,
- Give_Device_Power_Status = 0x8F,
- Report_Power_Status = 0x90,
- Get_Menu_Language = 0x91,
- Select_Digital_Serveice = 0x93,
- Inactive_Source = 0x9D,
- CEC_Version = 0x9E,
- Get_CEC_Version = 0x9F,
- Request_Short_Audio_Descriptor = 0xA4,
- Give_Features = 0xA5,
- Report_Features = 0xA6,
- Report_Current_Latency = 0xA8,
- Report_ARC_Initiated = 0xC1,
- Report_ARC_Terminated = 0xC2,
- Request_ARC_Initiation = 0xC3,
- Request_ARC_Termination = 0xC4,
- Polling_Message=0xfe,
- Abort = 0xff
- } cecmsg_t;
- //Function Prototype
- INT32 none(PCECDDev_t pcdv);
- INT32 receive_active_source(PCECDDev_t pcdv);
- INT32 receive_inactive_source(PCECDDev_t pcdv);
- INT32 receive_image_view_on(PCECDDev_t pcdv);
- INT32 receive_text_view_on(PCECDDev_t pcdv);
- INT32 receive_request_active_source(PCECDDev_t pcdv);
- INT32 receive_routing_change(PCECDDev_t pcdv);
- INT32 receive_routing_information(PCECDDev_t pcdv);
- INT32 receive_standby(PCECDDev_t pcdv);
- INT32 receive_give_physical_address(PCECDDev_t pcdv);
- INT32 receive_get_menu_language(PCECDDev_t pcdv);
- INT32 receive_report_physical_address(PCECDDev_t pcdv);
- INT32 receive_set_menu_language(PCECDDev_t pcdv);
- INT32 receive_deck_status(PCECDDev_t pcdv);
- INT32 receive_device_vendor_id(PCECDDev_t pcdv);
- INT32 receive_give_device_vendor_id(PCECDDev_t pcdv);
- INT32 receive_set_osd_string(PCECDDev_t pcdv);
- INT32 receive_give_osd_name(PCECDDev_t pcdv);
- INT32 receive_set_osd_name(PCECDDev_t pcdv);
- INT32 receive_menu_status(PCECDDev_t pcdv);
- INT32 receive_give_device_power_status(PCECDDev_t pcdv);
- INT32 receive_report_power_status(PCECDDev_t pcdv);
- INT32 receive_get_cec_version(PCECDDev_t pcdv);
- INT32 receive_cec_version(PCECDDev_t pcdv);
- INT32 receive_set_system_audio_mode(PCECDDev_t pcdv);
- INT32 receive_report_audio_status(PCECDDev_t pcdv);
- INT32 receive_system_audio_mode_status(PCECDDev_t pcdv);
- INT32 receive_user_control_pressed(PCECDDev_t pcdv);
- INT32 receive_user_control_released(PCECDDev_t pcdv);
- INT32 receive_feature_abort(PCECDDev_t pcdv);
- INT32 receive_abort(PCECDDev_t pcdv);
- INT32 receive_report_short_audio_description(PCECDDev_t pcdv);
- INT32 receive_initiate_ARC(PCECDDev_t pcdv);
- INT32 receive_terminate_ARC(PCECDDev_t pcdv);
- INT32 network_Report_PowerStatus(PCECDDev_t pcdv,UINT8 power_status);
- INT32 network_Report_OSD_Name(PCECDDev_t pcdv, PDEVICEMAP pdm);
- INT32 network_Report_List(PCECDDev_t pcdv);
- INT32 receive_give_features(PCECDDev_t pcdv);
- INT32 receive_report_features(PCECDDev_t pcdv);
- INT32 request_current_latency(PCECDDev_t pcdv);
- typedef INT32 (*opcode_handle_func_t)(PCECDDev_t pcdv);
- typedef struct _Opcode_type
- {
- UINT8 opcode;
- UINT8 param_num;
- UINT8 bDirect;
- UINT8 bBroadcast;
- opcode_handle_func_t receive;
- } Opcode_type;
- extern Opcode_type* CEC_CODES[256];
- void cecd_UmfEventHandle(CECD_MSG *CecdMsg);
- INT32 cecd_enable(void);
- INT32 cecd_disable(void);
- void UmfHandler_Register(CB_UMFHANDLER CB_UmfHandler);
- #endif
|