xref: /utopia/UTPA2-700.0.x/modules/hdmi/drv/cec/include/drvCEC.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 #ifndef _DRV_CEC_H_
96 #define _DRV_CEC_H_
97 
98 
99 
100 
101 //-------------------------------------------------------------------------------------------------
102 //  Macro and Define
103 //-------------------------------------------------------------------------------------------------
104 #define MDRV_IRQ_BEGIN      0x40
105 #define MDRV_IRQ_END        0x7F
106 #define IRQ_ADCDVI2RIU     (MDRV_IRQ_BEGIN + 31)//31 (level)
107 
108 //-------------------------------------------------------------------------------------------------
109 //  Type and Structure
110 //-------------------------------------------------------------------------------------------------
111 
112 //-------------------------------------------------------------------------------------------------
113 //  Function Prototype
114 //-------------------------------------------------------------------------------------------------
115 #ifdef _DRV_CEC_C_
116 #define INTERFACE
117 #else
118 #define INTERFACE extern
119 #endif
120 
121 MS_U32 mdrv_CEC_STREventProc(void* pModule, EN_POWER_MODE usPowerState);
122 
123 INTERFACE MS_BOOL MDrv_CEC_DDC2BI_GetInfo(void* pInstance, MS_CEC_INFO_LIST *pInfo);
124 INTERFACE void MDrv_CEC_PortSelect(void* pInstance, MsCEC_INPUT_PORT InputPort);
125 INTERFACE void MDrv_CEC_Init(void* pInstance, MS_U32 u32XTAL_CLK_Hz);
126 INTERFACE void MDrv_CEC_Exit(void* pInstance);
127 INTERFACE void MDrv_CEC_CheckExistDevices(void* pInstance);
128 INTERFACE MsCEC_DEVICELA MDrv_CEC_NextDevice(void* pInstance);
129 INTERFACE void MDrv_CEC_ChkRxBuf(void* pInstance);
130 // command call _MDrv_CEC_TxApi
131 INTERFACE CEC_ERROR_CODE MDrv_CEC_TxSendMsg(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSGLIST msg, MS_U8 *cmd, MS_U8 len);
132 INTERFACE CEC_ERROR_CODE MDrv_CEC_TxSendMsg2(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSGLIST msg, MS_U8* cmd, MS_U8 len);
133 INTERFACE CEC_ERROR_CODE MDrv_CecTxSendPollingMsg(void* pInstance, MsCEC_DEVICELA dst_address);
134 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ActiveSource(void* pInstance);
135 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_RoutingChange(void* pInstance, MS_U8* orig_address, MS_U8* new_address);
136 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReqActiveSource(void* pInstance);
137 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_SetStreamPath(void* pInstance, MS_U8* new_address);
138 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_Standby(void* pInstance, MsCEC_DEVICELA dst_address);
139 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_RecordOff(void* pInstance, MsCEC_DEVICELA dst_address);
140 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_RecordOn(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSG_RECORD_SOURCE_TYPE cmd);
141 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReportCECVersion(void* pInstance, MsCEC_DEVICELA dst_address, MS_U8 version);
142 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReqCECVersion(void* pInstance, MsCEC_DEVICELA dst_address);
143 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReportPhycalAddress(void* pInstance);
144 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReqPhycalAddress(void* pInstance, MsCEC_DEVICELA dst_address);
145 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_DeckControl(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSG_DC_DECK_CTRL_PARM cmd);
146 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_DecStatus(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSG_DC_DECK_STATUS_PARM cmd);
147 INTERFACE CEC_ERROR_CODE MDrv_CEC_MSg_GiveDeckStatus(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSG_STATUS_REQUEST_PARM cmd);
148 INTERFACE CEC_ERROR_CODE MDrv_CEC_MSg_DCPlay(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSG_DC_PLAY_PARM cmd);
149 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReqMenuStatus(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSG_MENU_REQ_TYPE cmd);
150 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_UserCtrlPressed(void* pInstance, MS_BOOL bUserCtrlEn, MsCEC_DEVICELA dst_address, MsCEC_MSG_USER_CTRL_PARM cmd);
151 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_UserCtrlReleased(void* pInstance, MsCEC_DEVICELA dst_address);
152 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_GiveAudioStatus(void* pInstance, MsCEC_DEVICELA dst_address);
153 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReportPowerStatus(void* pInstance, MsCEC_DEVICELA dst_address);
154 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReqPowerStatus(void* pInstance, MsCEC_DEVICELA dst_address);
155 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_FeatureAbort(void* pInstance, MsCEC_DEVICELA dst_address, MsCEC_MSGLIST msg, MsCEC_MSG_ABORT_REASON cmd);
156 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_Abort(void* pInstance, MsCEC_DEVICELA dst_address);
157 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_SendMenuLanguage(void* pInstance, MS_U8* pu8MenuLanguageCode);
158 INTERFACE CEC_ERROR_CODE MDrv_CecMsg_ReqARCInitiation(void* pInstance, MsCEC_DEVICELA dst_address);
159 INTERFACE CEC_ERROR_CODE MDrv_CecMsg_ReqARCTermination(void* pInstance, MsCEC_DEVICELA dst_address);
160 INTERFACE CEC_ERROR_CODE MDrv_CecMsg_AudioModeReq(void* pInstance, MsCEC_DEVICELA dst_address, MS_BOOL amp_switch, MS_U8* my_address);
161 // command end
162 INTERFACE MS_BOOL MDrv_CEC_CheckFrame(void* pInstance, MsCEC_MSG_TRANS_TYPE msg_type, MS_U8 ucLen);
163 INTERFACE void MDrv_CEC_ConfigWakeUp(void* pInstance);
164 INTERFACE void MDrv_CEC_Enabled(void* pInstance, MS_BOOL bEnableFlag);
165 INTERFACE void MDrv_CEC_SetMyLogicalAddress(void* pInstance, MsCEC_DEVICELA MyLogicalAddress);
166 INTERFACE void MDrv_CEC_InitChip(void* pInstance, MS_U32 u32XTAL_CLK_Hz);
167 INTERFACE MS_U8 MDrv_CEC_TxStatus(void* pInstance);
168 INTERFACE MS_BOOL MDrv_CEC_CheckDeviceIsTx(void* pInstance);
169 INTERFACE MS_U32 MDrv_CEC_SetPowerState(void* pInstance, EN_POWER_MODE u16PowerState);
170 
171 #if ENABLE_CEC_MULTIPLE
172 INTERFACE void MDrv_CEC_SetMyLogicalAddress2(void* pInstance, MsCEC_DEVICELA MyLogicalAddress);
173 INTERFACE CEC_ERROR_CODE MDrv_CEC_Msg_ReportPhycalAddress2(void* pInstance);
174 INTERFACE void MDrv_CEC_SetMyPhysicalAddress2(void* pInstance, MS_U8 *pdata);
175 INTERFACE void MDrv_CEC_SetInitiator(void* pInstance, MsCEC_DEVICELA IniLA);
176 #endif
177 
178 
179 
180 INTERFACE void MDrv_CEC_SetRetryCount(void* pInstance, MS_U8 u8RetryCount);
181 INTERFACE void MDrv_CEC_ConfigWakeupInfoVendorID(void* pInstance, MS_U8 *u8CecVendorID);
182 
183 MS_U8 MDrv_CEC_Get_Header(void* pInstance);
184 MS_U8 MDrv_CEC_Get_OpCode(void* pInstance);
185 MS_U8 MDrv_CEC_Get_Para(void* pInstance, MS_U8 u8Idx);
186 MS_U8 MDrv_CEC_GetCmdLen(void* pInstance);
187 MS_BOOL MDrv_CEC_IsRxBufEmpty(void* pInstance);
188 void MDrv_CEC_SetActiveLogicalAddress(void* pInstance, MsCEC_DEVICELA Addr);
189 MsCEC_DEVICELA MDrv_CEC_GetActiveLogicalAddress(void* pInstance);
190 MsCEC_MSG_POWER_STATUS_PARM MDrv_CEC_GetPowerStatus(void* pInstance);
191 MS_U8 MDrv_CEC_GetFifoIdx(void* pInstance);
192 void MDrv_CEC_SetFifoIdx(void* pInstance, MS_U8 u8Idx);
193 void MDrv_CEC_SetActivePowerStatus(void* pInstance, MsCEC_MSG_POWER_STATUS_PARM Status);
194 MsCEC_MSG_POWER_STATUS_PARM MDrv_CEC_GetActivePowerStatus(void* pInstance);
195 void MDrv_CEC_SetActivePhysicalAddress(void* pInstance, MS_U8 u8Para1, MS_U8 u8Para2);
196 void MDrv_CEC_SetActiveDeviceCECVersion(void* pInstance, MS_U8 u8Ver);
197 void MDrv_CEC_SetActiveDeviceType(void* pInstance, MsCEC_DEVICE_TYPE Type);
198 MS_U8 MDrv_CEC_GetMsgCnt(void* pInstance);
199 void MDrv_CEC_SetMsgCnt(void* pInstance, MS_U8 u8Cnt);
200 MS_U8 MDrv_CEC_GetRxData(void* pInstance, MS_U8 u8Fifoidx, MS_U8 u8Idx);
201 void MDrv_CEC_SetMyPhysicalAddress(void* pInstance, MS_U8 *pdata);
202 void MDrv_CEC_AttachDriverISR(void* pInstance, MS_BOOL bAttachDrvFlag);
203 stCEC_INITIAL_CONFIG_INFO MDrv_CEC_GetConfiguration(void* pInstance);
204 #ifdef CONFIG_UTOPIA_PROC_DBG_SUPPORT
205 void mdrv_CEC_MDCMDEchoCommand(void* pInstance, MS_U64* u64ReqHdl, char* pcCmdLine);
206 void mdrv_CEC_MDCMDGetInfo(void* pInstance, MS_U64* u64ReqHdl);
207 #endif
208 
209 ////////////////////////////////////////////////////////////////////////////////
210 #undef INTERFACE
211 
212 ////////////////////////////////////////////////////////////////////////////////
213 #endif //_DRV_CEC_H_
214 
215