xref: /utopia/UTPA2-700.0.x/mxlib/include/apiMHL.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 */
87 
88 /*! \defgroup MISC MISC modules
89  * \defgroup MHL MHL interface (apiMHL.h)
90  *  \ingroup MISC
91     <b>Operation Flow</b>
92     -# Check whether MHL cable is plugged or not in Rx side
93     -# Disable R-term and output Vbus
94     -# Check whether Cbus is connected(discovery pulse completed)
95     -# Sink -> Source: "SET_HPD"
96     -# Sink -> Source: Write_Stat - "DCAP_RDY" and Write_INT - "DCAP_CHG"
97     -# Sink -> Source: Write_Stat - "PATH_EN"
98 
99 
100  * \defgroup MHL_BASIC MHL Module basic
101  *  \ingroup MHL
102  * \defgroup MHL_CAPABILITY MHL capability setting
103  *  \ingroup MHL
104  * \defgroup MHL_CONFIG MHL pad config
105  *  \ingroup MHL
106  * \defgroup MHL_STATUS MHL status flag
107  *  \ingroup MHL
108  * \defgroup MHL_SEND MHL Tx send function
109  *  \ingroup MHL
110  * \defgroup MHL_RECEIVE MHL Rx recevice data
111  *  \ingroup MHL
112  * \defgroup MHL_CALLBACK MHL call back function
113  *  \ingroup MHL
114  * \defgroup MHL_REMOVE MHL want to remove function
115  *  \ingroup MHL
116 */
117 
118 #ifndef _API_MHL_H_
119 #define _API_MHL_H_
120 
121 #include "MsTypes.h"
122 #include "MsDevice.h"
123 #include "MsCommon.h"
124 
125 #ifdef __cplusplus
126 extern "C"
127 {
128 #endif
129 
130 //////////////////////////////////////////////////
131 //                MHL SW Version                //
132 //////////////////////////////////////////////////
133 #define P4_CHANGELIST       "00522289"
134 #define FW_VER_MAJOR        "04"
135 #define FW_VER_MINOR        "18"
136 
137 typedef MS_U8 (*link_cbus_event_handle_func)(MS_U8);
138 
139 typedef struct
140 {
141     MS_U8 ucSupportPath;
142     MS_U8 *ucEDIDTable;
143     MS_U8 *ucDevcapTable;
144 } stMHL_INITIAL_CONFIG;
145 
146 typedef struct
147 {
148     MS_U8 ucMHLSupportPath;
149     MS_U8 ucDeviceCapabilityTable[20];
150     MS_U32 ulReturnValue;
151 } stMHL_INITIAL_CONFIG_INFO;
152 
153 typedef enum
154 {
155     E_MHL_POWER_ON,
156     E_MHL_POWER_STANDBY,
157     E_MHL_POWER_DOWN
158 } E_MHL_POWERCTRL_Mode;
159 
160 enum
161 {
162     RCP_KEYID_SELECT = 0x00,
163     RCP_KEYID_UP = 0x01,
164     RCP_KEYID_DOWN = 0x02,
165     RCP_KEYID_LEFT = 0x03,
166     RCP_KEYID_RIGHT = 0x04,
167     RCP_KEYID_RIGHT_UP = 0x05,
168     RCP_KEYID_RIGHT_DOWN = 0x06,
169     RCP_KEYID_LEFT_UP = 0x07,
170     RCP_KEYID_LEFT_DOWN = 0x08,
171     RCP_KEYID_ROOT_MENU = 0x09,
172     RCP_KEYID_SETUP_MENU = 0x0A,
173     RCP_KEYID_CONTENTS_MENU = 0x0B,
174     RCP_KEYID_FAVORITE_MENU = 0x0C,
175     RCP_KEYID_EXIT = 0x0D,
176     //0x0E - 0x1F are reserved
177     RCP_KEYID_NUM_0 = 0x20,
178     RCP_KEYID_NUM_1 = 0x21,
179     RCP_KEYID_NUM_2 = 0x22,
180     RCP_KEYID_NUM_3 = 0x23,
181     RCP_KEYID_NUM_4 = 0x24,
182     RCP_KEYID_NUM_5 = 0x25,
183     RCP_KEYID_NUM_6 = 0x26,
184     RCP_KEYID_NUM_7 = 0x27,
185     RCP_KEYID_NUM_8 = 0x28,
186     RCP_KEYID_NUM_9 = 0x29,
187     RCP_KEYID_DOT = 0x2A,
188     RCP_KEYID_ENTER = 0x2B,
189     RCP_KEYID_CLEAR = 0x2C,
190     //0x2D - 0x2F are reserved
191     RCP_KEYID_CH_UP = 0x30,
192     RCP_KEYID_CH_DOWN = 0x31,
193     RCP_KEYID_PRE_CH = 0x32,
194     RCP_KEYID_SOUND_SELECT = 0x33,
195     RCP_KEYID_INPUT_SELECT = 0x34,
196     RCP_KEYID_SHOW_INFO = 0x35,
197     RCP_KEYID_HELP = 0x36,
198     RCP_KEYID_PAGE_UP = 0x37,
199     RCP_KEYID_PAGE_DOWN = 0x38,
200     //0x39 - 0x40 are reserved
201     RCP_KEYID_VOL_UP = 0x41,
202     RCP_KEYID_VOL_DOWN = 0x42,
203     RCP_KEYID_MUTE = 0x43,
204     RCP_KEYID_PLAY = 0x44,
205     RCP_KEYID_STOP = 0x45,
206     RCP_KEYID_PAUSE = 0x46,
207     RCP_KEYID_RECORD = 0x47,
208     RCP_KEYID_REWIND = 0x48,
209     RCP_KEYID_FAST_FWD = 0x49,
210     RCP_KEYID_EJECT  = 0x4A,
211     RCP_KEYID_FORWARD = 0x4B,
212     RCP_KEYID_BACKWARD = 0x4C,
213     //0x4D - 0x4F are reserved
214     RCP_KEYID_ANGLE = 0x50,
215     RCP_KEYID_SUBPICTURE = 0x51,
216     //0x52 - 0x5F are reserved
217     RCP_KEYID_PLAY_FUNC = 0x60,
218     RCP_KEYID_PAUSE_PLAY_FUNC = 0x61,
219     RCP_KEYID_RECORD_FUNC = 0x62,
220     RCP_KEYID_PAUSE_REC_FUNC = 0x63,
221     RCP_KEYID_STOP_FUNC = 0x64,
222     RCP_KEYID_MUTE_FUNC = 0x65,
223     RCP_KEYID_UN_MUTE_FUNC = 0x66,
224     RCP_KEYID_TUNE_FUNC = 0x67,
225     RCP_KEYID_MEDIA_FUNC = 0x68,
226     //0x69 - 0x70 are reserved
227     RCP_KEYID_F1 = 0x71,
228     RCP_KEYID_F2 = 0x72,
229     RCP_KEYID_F3 = 0x73,
230     RCP_KEYID_F4 = 0x74,
231     RCP_KEYID_F5 = 0x75,
232     //0x76 - 0x7D are reserved
233     RCP_KEYID_VENDOR_SPECIFIC = 0x7E,
234     RCP_KEYID_RESERVED = 0x7F,
235     RCP_KEYID_SELECT_RELEASE = 0x80,
236 }; // MscRcpKcode_T;
237 
238 typedef enum
239 {
240     MSC_RAP_POLL = 0x00,
241     MSC_RAP_CONTENT_ON = 0x10,
242     MSC_RAP_CONTENT_OFF = 0x11,
243 } MscRapActionCode_T;
244 
245 enum
246 {
247     MSC_RCP_NO_ERROR = 0x00,     // RCP No Error
248     MSC_RCP_INEFFECTIVE_KEY_CODE = 0x01,     // The key code in the RCP sub-command is not recognized
249     MSC_RCP_RESPONDER_BUSY = 0x02,     // RCP Response busy
250 }; //MscRcpStatusCode_T;
251 
252 enum
253 {
254     MSC_RAP_NO_ERROR = 0x00,     // RAP No Error
255     MSC_RAP_UNRECOGNIZED_ACTION_CODE = 0x01,
256     MSC_RAP_UNSUPPORTED_ACTION_CODE = 0x02,
257     MSC_RAP_RESPONDER_BUSY = 0x03,
258 }; //MscRapStatusCode_T;
259 
260 enum MHL_CBUS_CONTROL_TYPE
261 {
262     MHL_FORCE_HDMI_BY_PASS = 0,
263     MHL_FORCE_24BIT_MODE,
264     MHL_FORCE_PACKET_PIXEL_MODE,
265     MHL_CBUS_ISOLATION_ON,
266     MHL_CBUS_ISOLATION_OFF,
267     MHL_CBUS_FLOATING_ON,
268     MHL_CBUS_FLOATING_OFF,
269     MHL_CBUS_RTERM_OFF,
270     MHL_CBUS_FORCE_CLEAR_HPD,
271     MHL_CBUS_FORCE_RESET_HPD,
272     MHL_VBUS_HW_DETCET,
273     MHL_VBUS_CHARGE_ON,
274     MHL_VBUS_CHARGE_OFF,
275     MHL_CBUS_FORCE_READY_DEVCAP,
276     MHL_CBUS_FORCE_RECEIVE_3D_REQ,
277     MHL_CBUS_FORCE_SEND_COMMAND_ENABLE,
278     MHL_CBUS_FORCE_SEND_COMMAND_DISABLE,
279     MHL_CBUS_CHECK_CONTEND_ON_ENABLE,
280     MHL_CBUS_CHECK_CONTEND_ON_DISABLE,
281 };
282 
283 enum MHL_CBUS_STATUS_FLAG_TYPE
284 {
285     MHL_CBUS_STATUS_FLAG_CABLE_DETECT = 0,
286     MHL_CBUS_STATUS_FLAG_CBUS_CONNECT,
287     MHL_CBUS_STATUS_FLAG_PATH_EN,
288     MHL_CBUS_STATUS_FLAG_RECEIVE_PATH_EN,
289     MHL_CBUS_STATUS_FLAG_RECEIVE_MUTED,
290     MHL_CBUS_STATUS_FLAG_COMMUNICATE_BUSY,
291 };
292 
293 enum MHL_CABLE_DETECT_USE_TYPE
294 {
295     MHL_CABLE_DETECT_USE_PORTA = 0x01,
296     MHL_CABLE_DETECT_USE_PORTB = 0x02,
297     MHL_CABLE_DETECT_USE_PORTC = 0x04,
298     MHL_CABLE_DETECT_USE_PORTD = 0x08,
299 };
300 
301 typedef enum
302 {
303     //MHL property
304     MAPI_CMD_MHL_SUPPORT_PATH,
305     MAPI_CMD_MHL_INITIAL,
306     MAPI_CMD_MHL_HANDLER,
307     MAPI_CMD_MHL_AUTO_SWITCH,
308     MAPI_CMD_MHL_SET_POWER_STATE,
309     MAPI_CMD_MHL_CBUS_CONTROL,
310     MAPI_CMD_MHL_LOAD_EDID,
311     MAPI_CMD_MHL_READ_EDID,
312     MAPI_CMD_MHL_LOAD_DEVCAP,
313     MAPI_CMD_MHL_SET_VENDER_ID,
314     MAPI_CMD_MHL_SET_CABLE_DETECT_INVERT,
315     MAPI_CMD_MHL_VBUS_CONFIG_SETTING,
316     MAPI_CMD_MHL_ADJUST_I_CONTROL,
317     MAPI_CMD_MHL_ADJUST_IMPEDANCE,
318     MAPI_CMD_MHL_CABLE_DETECT_FLAG,
319     MAPI_CMD_MHL_CBUS_CONNECT_FLAG,
320     MAPI_CMD_MHL_CBUS_WAKEUP_INT_FLAG,
321     MAPI_CMD_MHL_SOURCE_SUPPORT_RCP,
322     MAPI_CMD_MHL_SOURCE_SUPPORT_RAP,
323     MAPI_CMD_MHL_GET_STATUS_FLAG,
324     MAPI_CMD_MHL_SEND_RAP_COMMAND,
325     MAPI_CMD_MHL_SEND_RCP_COMMAND,
326     MAPI_CMD_MHL_SEND_UCP_COMMAND,
327     MAPI_CMD_MHL_SEND_WRITE_BURST,
328     MAPI_CMD_MHL_SEND_USER_WRITE_BURST,
329     MAPI_CMD_MHL_GET_DEVICE_CAPABILITY,
330     MAPI_CMD_MHL_GET_EXTEND_DEVICE_CAPABILITY,
331     MAPI_CMD_MHL_GET_VENDER_ID,
332     MAPI_CMD_MHL_GET_WRITE_BURST_DATA,
333     MAPI_CMD_MHL_CALL_BACK_FUNCTION,
334     MAPI_CMD_MHL_RCP_CALL_BACK_FUNCTION,
335     MAPI_CMD_MHL_RAP_CALL_BACK_FUNCTION,
336     MAPI_CMD_MHL_UCP_CALL_BACK_FUNCTION,
337     MAPI_CMD_MHL_ATT_CALL_BACK_FUNCTION,
338     MAPI_CMD_MHL_RBP_CALL_BACK_FUNCTION,
339     MAPI_CMD_MHL_GET_CONFIGURATION,
340 }E_MHL_API_CMD_TYPE;
341 
342 typedef struct
343 {
344     MS_U8 ucSupportPath;
345 } stMHL_SET_SUPPORT_PATH, *pstMHL_SET_SUPPORT_PATH;
346 
347 typedef struct DLL_PACKED
348 {
349     MS_U8 *ucEDIDTable;
350     MS_U8 *ucDevcapTable;
351 } stMHL_INITIAL_SETTING, *pstMHL_INITIAL_SETTING;
352 
353 typedef struct
354 {
355     MS_U16 usMSGKeyInfo;
356 } stMHL_POLLING_HANDLER, *pstMHL_POLLING_HANDLER;
357 
358 typedef struct DLL_PACKED
359 {
360     MS_BOOL bAutoSwitchFlag;
361     MS_BOOL bResetFlag;
362     MS_U8 *ucCbusPath;
363 } stMHL_AUTO_SWITCH_HANDLER, *pstMHL_AUTO_SWITCH_HANDLER;
364 
365 typedef struct
366 {
367     MS_U32 ulFailFlag;
368     EN_POWER_MODE usPowerState;
369 } stMHL_SET_POWER_STATE, *pstMHL_SET_POWER_STATE;
370 
371 typedef struct
372 {
373     MS_U8 ucState;
374 } stMHL_CBUS_CONTROL, *pstMHL_CBUS_CONTROL;
375 
376 typedef struct DLL_PACKED
377 {
378     MS_U8 *ucEDIDTable;
379 } stMHL_LOAD_EDID, *pstMHL_LOAD_EDID;
380 
381 typedef struct DLL_PACKED
382 {
383     MS_U8 ucEDIDSize;
384     MS_U8 *ucEDIDTable;
385 } stMHL_READ_EDID, *pstMHL_READ_EDID;
386 
387 typedef struct DLL_PACKED
388 {
389     MS_U8 *ucDevcapTable;
390 } stMHL_LOAD_DEVCAP, *pstMHL_LOAD_DEVCAP;
391 
392 typedef struct
393 {
394     MS_U8 ucVenderID;
395 } stMHL_SET_VENDER_ID, *pstMHL_SET_VENDER_ID;
396 
397 typedef struct
398 {
399     MS_BOOL bCableDetectInvert;
400 } stMHL_SET_CABLE_DETECT_INVERT, *pstMHL_SET_CABLE_DETECT_INVERT;
401 
402 typedef struct
403 {
404     MS_U8 ucConfigMode;
405 } stMHL_VBUS_CONFIG_SETTING, *pstMHL_VBUS_CONFIG_SETTING;
406 
407 typedef struct
408 {
409     MS_U8 ucIControlValue;
410 } stMHL_ADJUST_I_CONTROL, *pstMHL_ADJUST_I_CONTROL;
411 
412 typedef struct
413 {
414     MS_U8 ucImpedanceValue;
415 } stMHL_ADJUST_IMPEDANCE, *pstMHL_ADJUST_IMPEDANCE;
416 
417 typedef struct
418 {
419     MS_BOOL bCableDetectFlag;
420 } stMHL_CABLE_DETECT_FLAG, *pstMHL_CABLE_DETECT_FLAG;
421 
422 typedef struct
423 {
424     MS_BOOL bCbusConnectFlag;
425 } stMHL_CBUS_CONNECT_FLAG, *pstMHL_CBUS_CONNECT_FLAG;
426 
427 typedef struct
428 {
429     MS_BOOL bCbusWakeupFlag;
430 } stMHL_CBUS_WAKEUP_INT_FLAG, *pstMHL_CBUS_WAKEUP_INT_FLAG;
431 
432 typedef struct
433 {
434     MS_BOOL bSourceSupportRCP;
435 } stMHL_SOURCE_SUPPORT_RCP, *pstMHL_SOURCE_SUPPORT_RCP;
436 
437 typedef struct
438 {
439     MS_BOOL bSourceSupportRAP;
440 } stMHL_SOURCE_SUPPORT_RAP, *pstMHL_SOURCE_SUPPORT_RAP;
441 
442 typedef struct
443 {
444     MS_BOOL bStatusFlag;
445     MS_U8 ucStatusType;
446 } stMHL_GET_STATUS_FLAG, *pstMHL_GET_STATUS_FLAG;
447 
448 typedef struct
449 {
450     MS_BOOL bSendFlag;
451     MS_U8 ucKeyCode;
452 } stMHL_SEND_RAP_COMMAND, *pstMHL_SEND_RAP_COMMAND;
453 
454 typedef struct
455 {
456     MS_BOOL bSendFlag;
457     MS_U8 ucKeyCode;
458 } stMHL_SEND_RCP_COMMAND, *pstMHL_SEND_RCP_COMMAND;
459 
460 typedef struct
461 {
462     MS_BOOL bSendFlag;
463     MS_U8 ucKeyCode;
464 } stMHL_SEND_UCP_COMMAND, *pstMHL_SEND_UCP_COMMAND;
465 
466 typedef struct DLL_PACKED
467 {
468     MS_BOOL bSendFlag;
469     MS_U8 ucAddress;
470     MS_U8 ucLength;
471     MS_U8 *ucData;
472 } stMHL_SEND_WRITE_BURST, *pstMHL_SEND_WRITE_BURST;
473 
474 typedef struct DLL_PACKED
475 {
476     MS_BOOL bSendFlag;
477     MS_U8 ucLength;
478     MS_U8 *ucData;
479 } stMHL_SEND_USER_WRITE_BURST, *pstMHL_SEND_USER_WRITE_BURST;
480 
481 typedef struct DLL_PACKED
482 {
483     MS_BOOL bObtainFlag;
484     MS_U16 usDevcapMask;
485     MS_U8 *ucDeviceCapability;
486 } stMHL_GET_DEVICE_CAPABILITY, *pstMHL_GET_DEVICE_CAPABILITY;
487 
488 typedef struct DLL_PACKED
489 {
490     MS_BOOL bObtainFlag;
491     MS_U16 usExtendDevcapMask;
492     MS_U8 *ucExtendDeviceCapability;
493 } stMHL_GET_EXTEND_DEVICE_CAPABILITY, *pstMHL_GET_EXTEND_DEVICE_CAPABILITY;
494 
495 typedef struct DLL_PACKED
496 {
497     MS_BOOL bObtainFlag;
498     MS_U8 *ucVenderID;
499 } stMHL_GET_VENDER_ID, *pstMHL_GET_VENDER_ID;
500 
501 typedef struct DLL_PACKED
502 {
503     MS_BOOL bObtainFlag;
504     MS_U8 *ucWriteBurstData;
505 } stMHL_GET_WRITE_BURST_DATA, *pstMHL_GET_WRITE_BURST_DATA;
506 
507 typedef struct
508 {
509     MS_BOOL bRCPfunctionFlag;
510     MS_BOOL bRAPfunctionFlag;
511 } stMHL_CALL_BACK_FUNCTION, *pstMHL_CALL_BACK_FUNCTION;
512 
513 typedef struct
514 {
515     MS_BOOL bRCPfunctionFlag;
516 } stMHL_RCP_CALL_BACK_FUNCTION, *pstMHL_RCP_CALL_BACK_FUNCTION;
517 
518 typedef struct
519 {
520     MS_BOOL bRAPfunctionFlag;
521 } stMHL_RAP_CALL_BACK_FUNCTION, *pstMHL_RAP_CALL_BACK_FUNCTION;
522 
523 typedef struct
524 {
525     MS_BOOL bUCPfunctionFlag;
526 } stMHL_UCP_CALL_BACK_FUNCTION, *pstMHL_UCP_CALL_BACK_FUNCTION;
527 
528 typedef struct
529 {
530     MS_BOOL bATTfunctionFlag;
531 } stMHL_ATT_CALL_BACK_FUNCTION, *pstMHL_ATT_CALL_BACK_FUNCTION;
532 
533 typedef struct
534 {
535     MS_BOOL bRBPfunctionFlag;
536 } stMHL_RBP_CALL_BACK_FUNCTION, *pstMHL_RBP_CALL_BACK_FUNCTION;
537 
538 typedef struct
539 {
540     stMHL_INITIAL_CONFIG_INFO stInitialConfigInfo;
541 } stMHL_GET_CONFIGURATION, *pstMHL_GET_CONFIGURATION;
542 
543 //-------------------------------------------------------------------------------------------------
544 //  Function Prototype
545 //-------------------------------------------------------------------------------------------------
546 //-------------------------------------------------------------------------------------------------
547 /// Assign which HDMI port support MHL
548 /// @ingroup MHL_BASIC
549 /// @param  ucSelect          \b IN: MHL support port
550 /// @return None
551 //-------------------------------------------------------------------------------------------------
552 void mapi_mhl_MHLSupportPath(MS_U8 ucSelect);
553 
554 //-------------------------------------------------------------------------------------------------
555 /// Initialize MHL
556 /// @ingroup MHL_BASIC
557 /// @param  edid                \b IN: point to MHL EDID
558 /// @param  DevCap          \b IN: point to MHL capability
559 /// @return None
560 //-------------------------------------------------------------------------------------------------
561 void mapi_mhl_init(MS_U8 *edid, MS_U8 *DevCap);
562 
563 //-------------------------------------------------------------------------------------------------
564 /// MHL polling function
565 /// @ingroup MHL_BASIC
566 /// @return None
567 //-------------------------------------------------------------------------------------------------
568 void mapi_mhl_handler(void);
569 
570 //-------------------------------------------------------------------------------------------------
571 /// MHL auto switch handler function
572 /// @ingroup MHL_BASIC
573 /// @param  bReset              \b IN: Reset auto switch
574 /// @param  ucCbusPath       \b IN: Which port support auto switch
575 /// @return TRUE : MHL auto switch happen
576 /// @return FALSE : MHL auto switch not happen
577 //-------------------------------------------------------------------------------------------------
578 MS_BOOL mapi_mhl_AutoSwitchHandler(MS_BOOL bReset, MS_U8 *ucCbusPath);
579 
580 //-------------------------------------------------------------------------------------------------
581 /// MHL set power state function
582 /// @ingroup MHL_BASIC
583 /// @param  u16PowerState  \b IN: Power state
584 /// @return TRUE : MHL set power state pass
585 /// @return FALSE : MHL set power state fail
586 //-------------------------------------------------------------------------------------------------
587 MS_U32 mapi_mhl_SetPowerState(EN_POWER_MODE u16PowerState);
588 
589 //-------------------------------------------------------------------------------------------------
590 /// MHL Cbus control function
591 /// @ingroup MHL_BASIC
592 /// @param  ucState         \b IN: Cbus control state
593 /// @return None
594 //-------------------------------------------------------------------------------------------------
595 void mapi_mhl_CbusControl(MS_U8 ucState);
596 
597 //-------------------------------------------------------------------------------------------------
598 /// MHL load EDID
599 /// @ingroup MHL_CAPABILITY
600 /// @param  edid                \b IN: point to MHL EDID
601 /// @return None
602 //-------------------------------------------------------------------------------------------------
603 void mapi_mhl_LoadEDID(MS_U8 *edid);
604 
605 //-------------------------------------------------------------------------------------------------
606 /// MHL read EDID
607 /// @ingroup MHL_CAPABILITY
608 /// @param  usSize             \b IN: Size of EDID want to read back
609 /// @param  edid                \b IN: point to MHL EDID
610 /// @return None
611 //-------------------------------------------------------------------------------------------------
612 void mapi_mhl_ReadEDID(MS_U16 usSize, MS_U8 *edid);
613 
614 //-------------------------------------------------------------------------------------------------
615 /// MHL load device capability
616 /// @ingroup MHL_CAPABILITY
617 /// @param  DevCap          \b IN: point to MHL capability
618 /// @return None
619 //-------------------------------------------------------------------------------------------------
620 void mapi_mhl_LoadDeviceCapability(MS_U8 *devcap);
621 
622 //-------------------------------------------------------------------------------------------------
623 /// MHL load vender ID
624 /// @ingroup MHL_CAPABILITY
625 /// @param  ucVenderID     \b IN: point to MHL capability
626 /// @return None
627 //-------------------------------------------------------------------------------------------------
628 void mapi_mhl_SetVenderID(MS_U8 ucVenderID);
629 
630 //-------------------------------------------------------------------------------------------------
631 /// MHL set cable detect invert
632 /// @ingroup MHL_CONFIG
633 /// @param  bCableDetectInvert     \b IN: cable detect invert flag
634 /// @return None
635 //-------------------------------------------------------------------------------------------------
636 void mapi_mhl_InvertCableDetect(MS_BOOL bCableDetectInvert);
637 
638 //-------------------------------------------------------------------------------------------------
639 /// MHL set Vbus config mode
640 /// @ingroup MHL_CONFIG
641 /// @param  ucState         \b IN: Vbus config mode
642 /// @return None
643 //-------------------------------------------------------------------------------------------------
644 void mapi_mhl_VbusConfigSetting(MS_U8 ucState);
645 
646 //-------------------------------------------------------------------------------------------------
647 /// MHL I-control adjust setting
648 /// @ingroup MHL_CONFIG
649 /// @param  ucIControl    \b IN: I-control adjust value
650 /// @return None
651 //-------------------------------------------------------------------------------------------------
652 void mapi_mhl_AdjustSettingIControl(MS_U8 ucIControl);
653 
654 //-------------------------------------------------------------------------------------------------
655 /// MHL impedance adjust setting
656 /// @ingroup MHL_CONFIG
657 /// @param  ucImpedance    \b IN: Impedance adjust value
658 /// @return None
659 //-------------------------------------------------------------------------------------------------
660 void mapi_mhl_AdjustImpedanceSetting(MS_U8 ucImpedance);
661 
662 //-------------------------------------------------------------------------------------------------
663 /// MHL get cable detect flag
664 /// @ingroup MHL_STATUS
665 /// @return TRUE : MHL cable plugged
666 /// @return FALSE : MHL cable unplugged
667 //-------------------------------------------------------------------------------------------------
668 MS_BOOL mapi_mhl_CableDetect(void);
669 
670 //-------------------------------------------------------------------------------------------------
671 /// MHL get Cbus connection flag
672 /// @ingroup MHL_STATUS
673 /// @return TRUE : MHL Cbus connection
674 /// @return FALSE : MHL Cbus disconnection
675 //-------------------------------------------------------------------------------------------------
676 MS_BOOL mapi_mhl_CbusStatus(void);
677 
678 //-------------------------------------------------------------------------------------------------
679 /// MHL get wake up pulse interrupt  flag
680 /// @ingroup MHL_STATUS
681 /// @return TRUE : MHL receive wake up pulse
682 /// @return FALSE : MHL not receive wake up pulse
683 //-------------------------------------------------------------------------------------------------
684 MS_BOOL mapi_mhl_CbusWakeupIntFlag(void);
685 
686 //-------------------------------------------------------------------------------------------------
687 /// MHL source support RCP flag
688 /// @ingroup MHL_STATUS
689 /// @return TRUE : MHL source support RCP
690 /// @return FALSE : MHL source not support RCP or unknow
691 //-------------------------------------------------------------------------------------------------
692 MS_BOOL mapi_mhl_SrcRCPSupportFlag(void);
693 
694 //-------------------------------------------------------------------------------------------------
695 /// MHL source support RAP flag
696 /// @ingroup MHL_STATUS
697 /// @return TRUE : MHL source support RAP
698 /// @return FALSE : MHL source nots support RAP or unknow
699 //-------------------------------------------------------------------------------------------------
700 MS_BOOL mapi_mhl_SrcRAPSupportFlag(void);
701 
702 //-------------------------------------------------------------------------------------------------
703 /// MHL get some flag
704 /// @ingroup MHL_STATUS
705 /// @param  ucState         \b IN: status type
706 /// @return TRUE : MHL status type happen
707 /// @return FALSE : MHL status type not happen
708 //-------------------------------------------------------------------------------------------------
709 MS_BOOL mapi_mhl_CbusGetStatusFlag(MS_U8 ucState);
710 
711 //-------------------------------------------------------------------------------------------------
712 /// MHL send RAP command
713 /// @ingroup MHL_SEND
714 /// @param  databuf         \b IN: key code
715 /// @return TRUE : MHL send RAP success
716 /// @return FALSE : MHL send RAP fail or not ready
717 //-------------------------------------------------------------------------------------------------
718 MS_BOOL mapi_mhl_SendRAPCmd(MS_U8 databuf);
719 
720 //-------------------------------------------------------------------------------------------------
721 /// MHL send RCP command
722 /// @ingroup MHL_SEND
723 /// @param  ucKeyCode      \b IN: key code
724 /// @return TRUE : MHL send RCP success
725 /// @return FALSE : MHL send RCP fail or not ready
726 //-------------------------------------------------------------------------------------------------
727 MS_BOOL mapi_mhl_SendRCPAutoReleaseCmd(MS_U8 ucKeyCode);
728 
729 //-------------------------------------------------------------------------------------------------
730 /// MHL send UCP command
731 /// @ingroup MHL_SEND
732 /// @param  databuf         \b IN: key code
733 /// @return TRUE : MHL send UCP success
734 /// @return FALSE : MHL send UCP fail or not ready
735 //-------------------------------------------------------------------------------------------------
736 MS_BOOL mapi_mhl_SendUCPCmd(MS_U8 databuf);
737 
738 //-------------------------------------------------------------------------------------------------
739 /// MHL send write burst command directly
740 /// @ingroup MHL_SEND
741 /// @param  ucAddr          \b IN: Write burst address always 0x40
742 /// @param  ucLength       \b IN: Write burst data length
743 /// @param  buffer           \b IN: Write burst data content
744 /// @return TRUE : MHL send write burst success
745 /// @return FALSE : MHL send write burst fail or not ready
746 //-------------------------------------------------------------------------------------------------
747 MS_BOOL mapi_mhl_SendWriteBurst(MS_U8 ucAddr, MS_U8 ucLength, MS_U8 *buffer);
748 
749 //-------------------------------------------------------------------------------------------------
750 /// MHL send write burst command use write request / write grant
751 /// @ingroup MHL_SEND
752 /// @param  ucLength       \b IN: Write burst data length
753 /// @param  pBuffer          \b IN: Write burst data content
754 /// @return TRUE : MHL send write burst success
755 /// @return FALSE : MHL send write burst fail or not ready
756 //-------------------------------------------------------------------------------------------------
757 MS_BOOL SYMBOL_WEAK mapi_mhl_CbusSendUserWriteBurst(MS_U8 ucLength, MS_U8 *pBuffer);
758 
759 //-------------------------------------------------------------------------------------------------
760 /// MHL send write read device capability
761 /// @ingroup MHL_SEND
762 /// @param  usDevcapMask     \b IN: Which data want to read
763 /// @param  ucDevcap            \b IN: Read device capability buffer
764 /// @return TRUE : MHL read device capability success
765 /// @return FALSE : MHL read device capability fail or not ready
766 //-------------------------------------------------------------------------------------------------
767 MS_BOOL mapi_mhl_GetDeviceCapacibility(MS_U16 usDevcapMask, MS_U8 *ucDevcap);
768 
769 //-------------------------------------------------------------------------------------------------
770 /// MHL send write read extend device capability
771 /// @ingroup MHL_SEND
772 /// @param  usExtendDevcapMask     \b IN: Which data want to read
773 /// @param  ucExtendDevcap            \b IN: Read extend device capability buffer
774 /// @return TRUE : MHL read extend device capability success
775 /// @return FALSE : MHL read extend device capability fail or not ready
776 //-------------------------------------------------------------------------------------------------
777 MS_BOOL SYMBOL_WEAK mapi_mhl_GetExtendDeviceCapacibility(MS_U16 usExtendDevcapMask, MS_U8 *ucExtendDevcap);
778 
779 //-------------------------------------------------------------------------------------------------
780 /// MHL send get vender ID
781 /// @ingroup MHL_SEND
782 /// @param  ucVenderID     \b IN: Vender buffer
783 /// @return TRUE : MHL get vender ID success
784 /// @return FALSE : MHL get vender ID fail or not ready
785 //-------------------------------------------------------------------------------------------------
786 MS_BOOL mapi_mhl_GetDeviceVenderID(MS_U8 *ucVenderID);
787 
788 //-------------------------------------------------------------------------------------------------
789 /// MHL receive write burst data
790 /// @ingroup MHL_RECEIVE
791 /// @param  ucData      \b IN: Write burst data buffer
792 /// @return TRUE : MHL receive write burst data success
793 /// @return FALSE : MHL receive write burst data fail or not yeah
794 //-------------------------------------------------------------------------------------------------
795 MS_BOOL mapi_mhl_GetWriteBurstData(MS_U8 *ucData);
796 
797 //-------------------------------------------------------------------------------------------------
798 /// MHL set RCP and RAP call back function
799 /// @ingroup MHL_CALLBACK
800 /// @param  rcp         \b IN: RCP function pointer
801 /// @param  rap         \b IN: RAP function pointer
802 /// @return None
803 //-------------------------------------------------------------------------------------------------
804 void mapi_mhl_RegisterCallBackFunctions(link_cbus_event_handle_func rcp, link_cbus_event_handle_func rap);
805 
806 //-------------------------------------------------------------------------------------------------
807 /// MHL set RCP call back function
808 /// @ingroup MHL_CALLBACK
809 /// @param  rcp         \b IN: RCP function pointer
810 /// @return None
811 //-------------------------------------------------------------------------------------------------
812 void mapi_mhl_RegisterRcpCallBackFunction(link_cbus_event_handle_func rcp);
813 
814 //-------------------------------------------------------------------------------------------------
815 /// MHL set RAP call back function
816 /// @ingroup MHL_CALLBACK
817 /// @param  rap         \b IN: RAP function pointer
818 /// @return None
819 //-------------------------------------------------------------------------------------------------
820 void mapi_mhl_RegisterRapCallBackFunction(link_cbus_event_handle_func rap);
821 
822 //-------------------------------------------------------------------------------------------------
823 /// MHL set UCP call back function
824 /// @ingroup MHL_CALLBACK
825 /// @param  Ucp         \b IN: UCP function pointer
826 /// @return None
827 //-------------------------------------------------------------------------------------------------
828 void mapi_mhl_RegisterUcpCallBackFunction(link_cbus_event_handle_func Ucp);
829 
830 //-------------------------------------------------------------------------------------------------
831 /// MHL set ATT call back function
832 /// @ingroup MHL_CALLBACK
833 /// @param  Att         \b IN: ATT function pointer
834 /// @return None
835 //-------------------------------------------------------------------------------------------------
836 void SYMBOL_WEAK mapi_mhl_RegisterAttCallBackFunction(link_cbus_event_handle_func Att);
837 
838 //-------------------------------------------------------------------------------------------------
839 /// MHL set RBP call back function
840 /// @ingroup MHL_CALLBACK
841 /// @param  Rbp         \b IN: RBP function pointer
842 /// @return None
843 //-------------------------------------------------------------------------------------------------
844 void SYMBOL_WEAK mapi_mhl_RegisterRbpCallBackFunction(link_cbus_event_handle_func Rbp);
845 
846 //-------------------------------------------------------------------------------------------------
847 /// Get MHL init parameter
848 /// @ingroup MHL_BASIC
849 /// @param  stInitialConfig: Init parameters
850 /// @return UTOPIA_STATUS_ERR_NOT_AVAIL: MHL not system init
851 /// @return UTOPIA_STATUS_SUCCESS: MHL system init ready
852 //-------------------------------------------------------------------------------------------------
853 MS_U32 SYMBOL_WEAK mapi_mhl_GetConfig(stMHL_INITIAL_CONFIG *stInitialConfig);
854 
855 void mapi_mhl_Send3DInformation(void);
856 void mapi_mhl_CbusWakeupIntSetting(void);
857 void mapi_mhl_PowerCtrl(E_MHL_POWERCTRL_Mode pctrl);
858 
859 #ifdef __cplusplus
860 }
861 #endif
862 
863 #endif //_API_MHL_H_
864