#ifndef _CECD_INTERFACE_H_ #define _CECD_INTERFACE_H_ //#include #include "cecd_keycode.h" //#include "types.h" #define NULL_NODE_INDEX 16 #define MAX_DEVICE_NUM 16 #define MAX_OSDNAME_LENGTH 15 #define MAX_OSDSTRING_LENGTH 14 #define BROADCAST_LOGICAL_ADDR 0xf #define UNREGIST_LOGICAL_ADDR 0xf #define UNREGIST_PHYSICAL_ADDR 0xffff #define CECTV_LOGICAL_ADDR 0x0 #define CECTV_PHYSICAL_ADDR 0x0000 #define PLAYBACK_DEVICE_1_LOGICAL_ADDR 0x04 #define PLAYBACK_DEVICE_2_LOGICAL_ADDR 0x08 #define PLAYBACK_DEVICE_3_LOGICAL_ADDR 0x0B #define AUDIO_SYSTEM_LOGICAL_ADDR 0x05 // ------------------------------------------------------------------------------- // Definitions for CECD INTERFACE // ------------------------------------------------------------------------------- // General definition typedef enum{ CS_STATUS_START, CS_INIT_OK, CS_EXIT_OK, CS_DEVICENOTEXIST, CS_DEVICEEXIST, CS_STATUS_END }cecd_status_t; typedef enum{ PWS_ON = 0x00, PWS_STANDBY, PWS_IN_TRANSITION_STANDBY_TO_ON, PWS_IN_TRANSITION_ON_TO_STANDBY }power_status_t; typedef enum{ DEVICE_TYPE_TV = 0, DEVICE_TYPE_RECORDING_DEVICE = 1, DEVICE_TYPE_STB = 3, DEVICE_TYPE_DVD = 4, DEVICE_TYPE_AUDIO_SYSTEM = 5, DEVICE_TYPE_UNKNOW = 0xf }device_type_t; typedef enum{ ABT_UNRECOGNIZED_OPCODE = 0, ABT_NOT_IN_CORRECT_MODE_TO_RESPOND, ABT_CANNOT_PROVIDE_SOURCE, ABT_INVALID_OPERAND, ABT_REFUSED }abort_reason_t; // Deck related definition typedef enum{ DSR_ON = 1, DSR_OFF, DSR_ONCE }deck_status_request_t; typedef enum{ DS_START = 0x11, DS_PLAY = DS_START, DS_RECORD, DS_PLAY_REVERSE, DS_STILL, DS_SLOW, DS_SLOW_REVERSE, DS_SEARCH_FORWARD, DS_SEARCH_REVERSE, DS_NO_MEDIA, DS_STOP, DS_WIND, DS_REWIND, DS_INDEX_SEARCH_FORWARD, DS_INDEX_SEARCH_REVERSE, DS_OTHER_STATUS, DS_NOTSUPPORTED, // Don't support deck control. DS_END = DS_NOTSUPPORTED, }deck_status_t; // Device menu related definition typedef enum{ MRT_ACTIVATE = 0, MRT_DEACTIVATE, MRT_QUERY }menu_request_t; typedef enum{ MS_ACTIVATED = 0, MS_DEACTIVATED, MS_MENUNOTSUPPORTED, // Don't support menu device. MS_KEYNOTSUPPORTED // Don't support this user key. }menu_status_t; typedef enum{ AS_OFF, AS_ON }audio_status_t; typedef enum{ VS_IMAGE, VS_TEXT, VS_UNKNOWN }viewon_status_t; typedef UINT32 audio_volume_t; typedef enum{ OSD_DC_Default, //Display for default time OSD_DC_KeepDisplay, //Display until cleared OSD_DC_Clear //Clear previous message }osdstring_display_control_t; //05/13/2010 added by cdlin to support ARC, and typedef enum{ ARC_FeatureAbort, ARC_Active, ARC_DeActive }audio_ARCstatus_t; typedef enum{ AudioCodec_Reserved0=0, AudioCodec_LinearPCM, AudioCodec_AC3, AudioCodec_MPEG1, AudioCodec_MP3, AudioCodec_MPEG2, AudioCodec_AAC, AudioCodec_DTS, AudioCodec_ATRAC, AudioCodec_Reserved9, AudioCodec_Reserved10, AudioCodec_Reserved11, AudioCodec_Reserved12, AudioCodec_Reserved13, AudioCodec_Reserved14, AudioCodec_Reserved15 }audio_format_codec_t; typedef enum{ AudioSampleRate_32K=1, AudioSampleRate_44K=2, AudioSampleRate_48K=4, AudioSampleRate_88K=8, AudioSampleRate_96K=16, AudioSampleRate_176K=32, AudioSampleRate_192K=64 }audio_SampleRate_t; //~cdlin // ------------------------------------------------------------------------------- // Definition for cecd message // ------------------------------------------------------------------------------- typedef enum{ SRC_OTHERS, SRC_HDMI_1, SRC_HDMI_2, SRC_HDMI_3, SRC_HDMI_4, SRC_HDMI_5, SRC_END, SRC_UNKNOWN }tv_source_t; typedef enum{ STATE_IMAGE_DISPLAY, STATE_MENU_DISPLAY, STATE_TEXT_DISPLAY, STATE_DEVICE_MENU_ACTIVE, STATE_DEVICE_MENU_INACTIVE }state_tv_t; typedef enum{ //UMF to CECD CMD_NULL = 0, //CECDMSG_NOTICE_CECD CMD_SetCECEnable, CMD_NoticeStandby, CMD_NoticeSourceChange, CMD_NoticeRoutingInfo, CMD_NoticeMenuLanguage, CMD_NoticePowerStatus, CMD_ReportFeatures, //CECDMSG_NETWORK_CONTROL CMD_RefreshDeviceList, CMD_RemoveDevice, CMD_AssignDisplayDevice, //CECDMSG_DECK_CONTROL CMD_QueryDeckStatus, CMD_DeckControl, //CECDMSG_MENU_CONTROL CMD_RequestDeviceMenuStatus, CMD_RemoteControlPassThrough, //CECDMSG_AUDIO_CONTROL CMD_RequestAudioMode, CMD_RequestAudioModeStatus, CMD_RemoteControlAudioVolume, CMD_RemoteControlAudioVolumeRelease, //06/29/2009 by cdlin to add CMD_RequestAudioStatus CMD_RequestAudioStatus, //~cdlin //05/13/2010 added by cdlin to support ARC, and //06/03/2010 modified by cdlin for rename CMD_RequestARC to CMD_QueryARC and CMD_ReportARC to CMD_RequestARC //CMD_RequestARC, //CMD_ReportARC, CMD_QueryARC, CMD_Hdmi_ARC_Switch, CMD_RequestARC, //~cdlin CMD_RequestShortAudioDescriptor, //~cdlin CMD_RequestARCTerminated, CMD_ReportCurrentLatency, //CECD to UMF //CECDMSG_NOTICE_UMF CMD_ReportTVPowerOff, CMD_ReportCecdStatus, CMD_ReportActiveSource, CMD_ReportInactiveSource, CMD_ReportPhysicalAddress, CMD_ReportPowerStatus, CMD_ReportFeatures_TOUMF, //CECDMSG_NETWORK_REPORT CMD_ReportDeviceList, CMD_ReportAddDevice, CMD_ReportOSDString, //CECDMSG_DECK_REPORT CMD_ReportDeckStatus, //CECDMSG_DEVICE_MENU_REPORT CMD_ReportDeviceMenuStatus, //CECDMSG_SYSTEM_AUDIO_REPORT CMD_ReportAudioMode, //05/13/2010 added by cdlin to support ARC, and //CMD_ReportAudioVolume CMD_ReportAudioVolume, CMD_ReportAudioARCStatus, CMD_ReportAudioCodecCapability, //~cdlin // 06/28/2021 added to support eARC, and <> CMD_GIVE_FEATURES, CMD_RequestCurrentLatency }CECDMSG_cmdtype_t; typedef enum{ CECDMSG_NULL = 0, //UMF to CECD CECDMSG_SET_CECENABLE, CECDMSG_NOTICE_CECD, CECDMSG_NETWORK_CONTROL, CECDMSG_DECK_CONTROL, CECDMSG_DEVICE_MENU_CONTROL, CECDMSG_SYSTEM_AUDIO_CONTROL, CECDMSG_PORT_HPD_TOGGLE, //CECDMSG_TUNER_CONTROL, //CECD to UMF CECDMSG_NOTICE_UMF, CECDMSG_NETWORK_REPORT, CECDMSG_DECK_REPORT, CECDMSG_DEVICE_MENU_REPORT, CECDMSG_SYSTEM_AUDIO_REPORT //CECDMSG_TUNER_REPORT, }CECDMSG_TYPE; // ------------------------------------------------------------------------------- // Definitions for device info and list (shared memory mapping) // ------------------------------------------------------------------------------- typedef UINT32 PHYADDR; //Physical ADDRESS typedef UINT8 LOGADDR; //Logical Address // CECD use only typedef struct _DEVICEMAP { INT8 OSDNAME[MAX_OSDNAME_LENGTH]; union{ UINT32 device_info[2]; struct{ UINT32 hdmi_source:4; UINT32 device_type:4; UINT32 vendor_id:24; UINT32 physical_addr:16; UINT32 logical_addr:8; UINT32 bValid:1; UINT32 nextNode:7; }; }; }DEVICEMAP,*PDEVICEMAP; // CECD use only typedef struct _DEVICEMAP_LIST{ UINT8 deviceNum; UINT8 victim; UINT8 ptrNode; UINT8 logList[16]; DEVICEMAP device[MAX_DEVICE_NUM+1]; }DEVICEMAP_LIST,*PDEVICEMAP_LIST; //device information typedef struct _DEVICEINFO { INT8 OSDNAME[MAX_OSDNAME_LENGTH]; union{ UINT32 info[2]; struct{ tv_source_t hdmi_source:4; device_type_t device_type:4; UINT32 vendor_id:24; PHYADDR physical_addr:16; LOGADDR logical_addr:8; }; }; }DEVICEINFO,*PDEVICEINFO; //OSD String for UMF typedef struct _OSDSTRING { UINT8 display_control; INT8 osd_string[MAX_OSDSTRING_LENGTH]; }OSDSTRING,*POSDSTRING; //The device list for UMF typedef struct _DEVICEINFO_LIST { UINT8 deviceNum; INT32 bLock; DEVICEINFO device[MAX_DEVICE_NUM]; }DEVICEINFO_LIST,*PDEVICEINFO_LIST; //message structure for umf - notice typedef struct _CECDMSG_NOTICECECD { union{ UINT32 info; //UMF to CECD LOGADDR logAddr; tv_source_t target_src; struct{ INT8 lng_str[3]; }; //OsdLangMode language; power_status_t power_state; //CECD to UMF struct{ LOGADDR tar_logAddr:8; cecd_status_t state:8; }; struct{ LOGADDR active_logAddr:8; tv_source_t toSrc:4; viewon_status_t viewon_state:4; PHYADDR phyAddr:16; }; struct{ UINT32 cec_version; UINT32 all_device_type; UINT32 rc_profile; UINT32 device_features; }; }; }CECDMSG_NOTICECECD; //message structure for umf - network typedef struct _CECDMSG_NETWORK { union{ UINT32 info; //UMF to CECD struct{ LOGADDR logAddr:8; PHYADDR phyAddr:16; }; //CECD to UMF INT32 shmId; INT32 OSDStringshmId; }; }CECDMSG_NETWORK; //message structure for umf - deck typedef struct _CECDMSG_DECK { union{ UINT32 info; //UMF to CECD struct{ LOGADDR logAddr:8; UINT32 deck_reserved_1:8; }; struct{ UINT32 deck_reserved_2:8; deck_control_t deckCmd:8; }; //CECD to UMF struct{ UINT32 deck_reserved_3:8; deck_status_t deckInfo:8; }; //~cdlin }; }CECDMSG_DECK; //message structure for umf - device menu typedef struct _CECDMSG_MENU { union{ UINT32 info; //UMF to CECD struct{ LOGADDR logAddr:8; UINT32 menu_reserved_1:8; }; struct{ UINT32 menu_reserved_2:8; menu_request_t menuRequestType:8; }; struct{ UINT32 menu_reserved_3:8; user_control_code_t userControlCode:8; }; //CECD to UMF struct{ UINT32 menu_reserved_4:8; menu_status_t menuState:8; }; //~cdlin }; }CECDMSG_MENU; //05/13/2010 added by cdlin to support ARC, and typedef struct _audioformat { UINT8 audioFormatCodec;//use audio_format_codec_t UINT8 audioSampleRate; //use audio_SampleRate_t and can "or" UINT8 audioChannelCount; // 2: 2ch,..., 6:6ch, .., 8:8ch UINT8 audioAtmos; } audioformat ; //message structure for umf - audio mode typedef struct _CECDMSG_AUDIO { union{ UINT32 info; //UMF to CECD struct{ LOGADDR logAddr:8;//current active source's(ARC) logAddr UINT32 audio_reserved_1:16; //Physical Address switch Audio feature on/off }; struct{ UINT32 audio_reserved_2:8; user_control_code_t userControlCode:8; }; //05/13/2010 added by cdlin to support ARC, and struct{ UINT32 audio_reserved_3:8; PHYADDR phyAddr:16; audio_ARCstatus_t audoTxSetARCActiveDeActive:8; }; //~cdlin //CECD to UMF struct{ UINT32 audio_reserved_4:8; audio_status_t audioModeStatus:8; }; struct{ UINT32 audio_reserved_5:8; audio_volume_t audioVol:8; // Bit7:Mute on/off, Bit6-0: Vol 0% ~ 100% }; //05/13/2010 added by cdlin to support ARC, and struct{ UINT32 audio_reserved_6:8; audio_ARCstatus_t audioRxARCstatus:8; }; struct{ UINT32 audio_reserved_7:8; audioformat audioFormat[16]; UINT8 audioNumFormatCodec; // number of audio format }; //~cdlin //~cdlin struct{ UINT32 audio_reserved_8:8; UINT32 vlatency:8; UINT32 lflgs:8; UINT32 aod:8; }; }; }CECDMSG_AUDIO; //message structure for umf (Message queue) typedef struct _CECD_MESSAGE { union{ LONG type; struct{ LONG MsgType:16; LONG CmdType:16; }; }; union{ UINT32 param; CECDMSG_NOTICECECD notice; CECDMSG_NETWORK network; CECDMSG_DECK deck; CECDMSG_MENU menu; CECDMSG_AUDIO audio; }; }CECD_MSG,*PCECD_MSG; #define CECD_MSG_SIZE (sizeof(CECD_MSG)-sizeof(CECDMSG_AUDIO)) #define SIZE_OF_CECDDEVICEINFO (sizeof(DEVICEINFO)) #define SIZE_OF_CECDEVICE_LIST (sizeof(DEVICEINFO_LIST)) #define SIZE_OF_OSD_STRING (sizeof(OSDSTRING)) #endif