xref: /utopia/UTPA2-700.0.x/modules/hdmi/api/mhl/apiMHL_private.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 /// @file   Mapi_mhl.h
81 /// @author MStar Semiconductor Inc.
82 /// @brief  MHL driver Function
83 ///////////////////////////////////////////////////////////////////////////////////////////////////
84 
85 /*
86     1. Check whether MHL cable is plugged or not in Rx side
87     2. Disable R-term and output Vbus
88     3. Check whether Cbus is connected(discovery pulse completed)
89     4. Sink -> Source: "SET_HPD"
90     5. Sink -> Source: Write_Stat - "DCAP_RDY" and Write_INT - "DCAP_CHG"
91     6. Sink -> Source: Write_Stat - "PATH_EN"
92 */
93 
94 
95 #ifndef _API_MHL_PRIVATE_H_
96 #define _API_MHL_PRIVATE_H_
97 
98 #include "MsTypes.h"
99 #include "MsDevice.h"
100 #include "MsCommon.h"
101 
102 #include "mdrv_mhl_st.h"
103 #include "apiMHL.h"
104 
105 #ifdef __cplusplus
106 extern "C"
107 {
108 #endif
109 
110 //-------------------------------------------------------------------------------------------------
111 //  Local Defines
112 //-------------------------------------------------------------------------------------------------
113 
114 //-------------------------------------------------------------------------------------------------
115 //  Local Structures
116 //-------------------------------------------------------------------------------------------------
117 typedef struct _MHL_RESOURCE_PRIVATE
118 {
119     MS_U8 ucInitialIndex;
120     MS_U8 ucMHLSupportPath;
121     MS_U8 ucCurrentHDMIPort;
122     MS_U8 ucCurrentQueueIndex;
123     MS_U8 ucChipCapability;
124     MS_U8 ucDeviceVenderID;
125     MS_U8 ucTMDSClockMode;
126     MS_U8 ucAskData;
127     MS_U8 ucMSGData[2];
128     MS_U8 ucReceiveCounter;
129     MS_U8 ucEMSCReceiveCounter;
130     MS_U8 ucSourceVenderID;
131     MS_U8 ucProcDoneIndex;
132     MS_U8 ucWriteBurstState;
133     MS_U8 ucFeatureRequestState;
134     MS_U8 ucECbusState;
135     MS_U8 ucECbusTrainState;
136     MS_U8 ucBISTModeState;
137     MS_U8 ucPreRCPKeyCode;
138     MS_U8 ucWriteBurstSequence;
139     MS_U8 uc3DTotalEntryDTD;
140     MS_U8 uc3DTotalEntryVIC;
141     MS_U8 ucDeviceCapabilityTable[MHL_DEVICE_CAPABILITY_SIZE +MHL_XDEVICE_CAPABILITY_SIZE];
142     MS_U8 ucSourceDevcapTable[MHL_DEVICE_CAPABILITY_SIZE +MHL_XDEVICE_CAPABILITY_SIZE];
143     MS_U8 uc3DInformationDTD[MHL_3D_DTD_INFORMATION_LENGTH];
144     MS_U8 uc3DInformationVIC[MHL_3D_VIC_INFORMATION_LENGTH];
145     MS_U8 ucWriteBurstAddress;
146     MS_U8 ucWriteBurstLength;
147     MS_U8 ucWriteBurstInformation[MHL_MSC_SCRATCHPAD_SIZE +1];
148     MS_U8 ucEMSCSendStatus;
149     MS_U8 ucCallBackFunctionIndex;
150     MS_U8 ucMHLPollingStack[MHL_POLLING_STACK_SIZE];
151     MS_U8 ucPowerOnPatchState;
152     MS_U8 ucHighEndVICTotalEntry;
153     MS_U16 usDisplayIndex;
154     MS_U16 usDeviceIndex;
155     MS_U16 usEMSCRxBufferSize;
156     MS_U16 usEMSCTxBufferSize;
157     MS_U16 usReadDevcapMask;
158     MS_U16 usReadExtendDevcapMask;
159     MS_U16 usMSGKeyInfo;
160     MS_U16 usHighEndVICTable[MHL_HEV_VIC_INFORMATION_LENGTH];
161     MS_U16 usEMSCSupportTable[MHL_EMSC_SUPPORT_INFORMATION_LENGTH];
162     MS_U32 ulCurrentTimerTick;
163     MS_U32 ulSystemIndex;
164     MS_U32 ulTimerIndex;
165     MS_U32 ulCbusReceiveIndex;
166     MS_U32 ulCbusSendIndex;
167     MS_U32 ulEnableIndex;
168     MS_U32 ulAudioTunnelTable[MHL_AUDIO_TUNNEL_INFORMATION_LENGTH];
169     MS_S32 slMHLPollingTaskID;
170     MS_VIRT ulRiuBaseAddress;
171 #if !defined (__aarch64__)
172     MS_U32 ulRiuBaseAddressDummy;
173 #endif
174     MS_VIRT ulPMRiuBaseAddress;
175 #if !defined (__aarch64__)
176     MS_U32 ulPMRiuBaseAddressDummy;
177 #endif
178     EN_POWER_MODE usPrePowerState;
179     stMHL_TIMER_EVENT_INFO stTimerEventInfo[MHL_TIMER_EVENT_MASK];
180     stMHL_QUEUE_INFO stCbusQueueInfo[MHL_CBUS_TOTAL_QUEUE_NUM];
181     stMHL_VIRTUAL_CHANNEL_INFO stVirtualChannelInfo[MHL_VIRTUAL_CHANNEL_LENGTH];
182     stMHL_BIST_MODE_INFO stBISTParameterInfo;
183     stMHL_SIGNAL_STATUS_INFO stSignalStatusInfo;
184 }MHL_RESOURCE_PRIVATE;
185 
186 typedef void    (*IOCTL_MHL_SUPPORT_PATH)           (void*, MS_U8);
187 typedef void    (*IOCTL_MHL_INITIAL)                 (void*, MS_U8*, MS_U8*);
188 typedef MS_U16  (*IOCTL_MHL_HANDLER)                 (void*);
189 typedef MS_BOOL (*IOCTL_MHL_AUTO_SWITCH)            (void*, MS_BOOL, MS_U8*);
190 typedef MS_U32  (*IOCTL_MHL_SET_POWER_STATE)        (void*, EN_POWER_MODE);
191 typedef void    (*IOCTL_MHL_CBUS_CONTROL)            (void*, MS_U8);
192 typedef void    (*IOCTL_MHL_LOAD_EDID)               (void*, MS_U8*);
193 typedef void    (*IOCTL_MHL_READ_EDID)               (void*, MS_U8, MS_U8*);
194 typedef void    (*IOCTL_MHL_LOAD_DEVCAP)             (void*, MS_U8*);
195 typedef void    (*IOCTL_MHL_SET_VENDER_ID)           (void*, MS_U8);
196 typedef void    (*IOCTL_MHL_CABLE_DETECT_INVERT)    (void*, MS_BOOL);
197 typedef void    (*IOCTL_MHL_VBUS_CONFIG)             (void*, MS_U8);
198 typedef void    (*IOCTL_MHL_ADJUST_I_CONTROL)        (void*, MS_U8);
199 typedef void    (*IOCTL_MHL_ADJUST_IMPEDANCE)        (void*, MS_U8);
200 typedef MS_BOOL (*IOCTL_MHL_CABLE_DETECT_FLAG)       (void*);
201 typedef MS_BOOL (*IOCTL_MHL_CBUS_CONNECT_FLAG)       (void*);
202 typedef MS_BOOL (*IOCTL_MHL_CBUS_WAKEUP_FLAG)        (void*);
203 typedef MS_BOOL (*IOCTL_MHL_SOURCE_SUPPORT_RCP)      (void*);
204 typedef MS_BOOL (*IOCTL_MHL_SOURCE_SUPPORT_RAP)      (void*);
205 typedef MS_BOOL (*IOCTL_MHL_GET_STATUS_FLAG)         (void*, MS_U8);
206 typedef MS_BOOL (*IOCTL_MHL_SEND_RAP_COMMAND)        (void*, MS_U8);
207 typedef MS_BOOL (*IOCTL_MHL_SEND_RCP_COMMAND)        (void*, MS_U8);
208 typedef MS_BOOL (*IOCTL_MHL_SEND_UCP_COMMAND)        (void*, MS_U8);
209 typedef MS_BOOL (*IOCTL_MHL_SEND_WRITE_BURST)        (void*, MS_U8, MS_U8, MS_U8*);
210 typedef MS_BOOL (*IOCTL_MHL_SEND_USER_WRITE_BURST)  (void*, MS_U8, MS_U8*);
211 typedef MS_BOOL (*IOCTL_MHL_GET_DEVCAP)               (void*, MS_U16, MS_U8*);
212 typedef MS_BOOL (*IOCTL_MHL_GET_EXTEND_DEVCAP)       (void*, MS_U16, MS_U8*);
213 typedef MS_BOOL (*IOCTL_MHL_GET_VENDER_ID)           (void*, MS_U8*);
214 typedef MS_BOOL (*IOCTL_MHL_GET_WRITE_BURST_DATA)   (void*, MS_U8*);
215 typedef MS_BOOL (*IOCTL_MHL_CALL_BACK_FUNCTION)      (void*, MS_BOOL, MS_BOOL);
216 typedef MS_BOOL (*IOCTL_MHL_RCP_CALL_BACK_FUNCTION)  (void*, MS_BOOL);
217 typedef MS_BOOL (*IOCTL_MHL_RAP_CALL_BACK_FUNCTION)  (void*, MS_BOOL);
218 typedef MS_BOOL (*IOCTL_MHL_UCP_CALL_BACK_FUNCTION)  (void*, MS_BOOL);
219 typedef MS_BOOL (*IOCTL_MHL_ATT_CALL_BACK_FUNCTION)  (void*, MS_BOOL);
220 typedef MS_BOOL (*IOCTL_MHL_RBP_CALL_BACK_FUNCTION)  (void*, MS_BOOL);
221 typedef stMHL_INITIAL_CONFIG_INFO  (*IOCTL_MHL_GET_CONFIGURATION)        (void*);
222 
223 typedef struct _MHL_INSTANT_PRIVATE
224 {
225     MS_U32                              ulDeviceID;
226     IOCTL_MHL_SUPPORT_PATH              fpMHLSupportPath;
227     IOCTL_MHL_INITIAL                   fpMHLInitial;
228     IOCTL_MHL_HANDLER                   fpMHLHandler;
229     IOCTL_MHL_AUTO_SWITCH               fpMHLAutoSwitchHandler;
230     IOCTL_MHL_SET_POWER_STATE           fpMHLSetPowerState;
231     IOCTL_MHL_CBUS_CONTROL              fpMHLCbusControl;
232     IOCTL_MHL_LOAD_EDID                 fpMHLLoadEDID;
233     IOCTL_MHL_READ_EDID                 fpMHLReadEDID;
234     IOCTL_MHL_LOAD_DEVCAP               fpMHLLoadDeviceCapability;
235     IOCTL_MHL_SET_VENDER_ID             fpMHLSetVenderID;
236     IOCTL_MHL_CABLE_DETECT_INVERT       fpMHLCableDetectInvert;
237     IOCTL_MHL_VBUS_CONFIG               fpMHLVbusConfigSetting;
238     IOCTL_MHL_ADJUST_I_CONTROL          fpMHLAdjustIControl;
239     IOCTL_MHL_ADJUST_IMPEDANCE          fpMHLAdjustImpedance;
240     IOCTL_MHL_CABLE_DETECT_FLAG         fpMHLCableDetectFlag;
241     IOCTL_MHL_CBUS_CONNECT_FLAG         fpMHLCbusConnectFlag;
242     IOCTL_MHL_CBUS_WAKEUP_FLAG          fpMHLCbusWakeupIntFlag;
243     IOCTL_MHL_SOURCE_SUPPORT_RCP        fpMHLSourceSupportRCP;
244     IOCTL_MHL_SOURCE_SUPPORT_RAP        fpMHLSourceSupportRAP;
245     IOCTL_MHL_GET_STATUS_FLAG           fpMHLGetStatusFlag;
246     IOCTL_MHL_SEND_RAP_COMMAND          fpMHLSendRAPCommand;
247     IOCTL_MHL_SEND_RCP_COMMAND          fpMHLSendRCPCommand;
248     IOCTL_MHL_SEND_UCP_COMMAND          fpMHLSendUCPCommand;
249     IOCTL_MHL_SEND_WRITE_BURST          fpMHLSendWriteBurst;
250     IOCTL_MHL_SEND_USER_WRITE_BURST     fpMHLSendUserWriteBurst;
251     IOCTL_MHL_GET_DEVCAP                fpMHLGetDeviceCapability;
252     IOCTL_MHL_GET_EXTEND_DEVCAP         fpMHLGetExtendDeviceCapability;
253     IOCTL_MHL_GET_VENDER_ID             fpMHLGetVenderID;
254     IOCTL_MHL_GET_WRITE_BURST_DATA      fpMHLGetWriteBurstData;
255     IOCTL_MHL_CALL_BACK_FUNCTION        fpMHLRegisterCallBackfunction;
256     IOCTL_MHL_RCP_CALL_BACK_FUNCTION    fpMHLRegisterRCPCallBackfunction;
257     IOCTL_MHL_RAP_CALL_BACK_FUNCTION    fpMHLRegisterRAPCallBackfunction;
258     IOCTL_MHL_UCP_CALL_BACK_FUNCTION    fpMHLRegisterUCPCallBackfunction;
259     IOCTL_MHL_ATT_CALL_BACK_FUNCTION    fpMHLRegisterATTCallBackfunction;
260     IOCTL_MHL_RBP_CALL_BACK_FUNCTION    fpMHLRegisterRBPCallBackfunction;
261     IOCTL_MHL_GET_CONFIGURATION         fpMHLGetConfiguration;
262 }MHL_INSTANT_PRIVATE;
263 
264 typedef enum
265 {
266     MHL_POOL = 0,
267     MHL_POOL_MAX,
268 }eMHLPoolID;
269 
270 //-------------------------------------------------------------------------------------------------
271 //  Global Variables
272 //-------------------------------------------------------------------------------------------------
273 
274 //-------------------------------------------------------------------------------------------------
275 //  Function Prototype
276 //-------------------------------------------------------------------------------------------------
277 
278 #endif //_API_MHL_PRIVATE_H_
279