xref: /utopia/UTPA2-700.0.x/modules/cpu/drv/cpu/mailbox.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) 2006-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 /// @file  mailbox.h
94 /// @brief CPU mailbox header File
95 /// @author MStar Semiconductor Inc.
96 ///
97 ////////////////////////////////////////////////////////////////////////////////
98 
99 #ifndef _MAILBOX_H_
100 #define _MAILBOX_H_
101 
102 #include "MsTypes.h"
103 
104 #define INTERFACE extern
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 // Define
108 ////////////////////////////////////////////////////////////////////////////////
109 
110 #define MB_CMDBIT_FIRE                          0x01
111 #define MB_CMDBIT_INSTANT_READ                  0x02
112 #define MB_CMDBIT_INSTANT_HANDLE                0x04
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 // Mail Box Structure
116 ////////////////////////////////////////////////////////////////////////////////
117 
118 typedef struct _mail_box {
119     MS_U8 u8CmdClass;
120     MS_U8 u8CmdIdx;
121     MS_U8 u8Param[10];
122     MS_U8 ParamCnt         : 4;
123     MS_U8 CMDType          : 3;
124     MS_U8 Busy             : 1;
125 } MailBox, *PMailBox;
126 
127 typedef struct _Mail_Box_Cmd_Queue {
128     MS_U8 u8CmdIdx;
129     MS_U8 u8ParamCnt;
130     MS_U8 u8Param[10];
131 } MailBoxCmdQueue, *PMailBoxCmdQueue;
132 
133 typedef struct _Cmd_Queue_Info
134 {
135     MS_U8 ReadPtr;
136     MS_U8 QLen;
137 } CmdQueueInfo, *pCmdQueueInfo;
138 /*
139 typedef struct _Cmd_Queue_Info
140 {
141     MS_U8 ReadPtr   :4;
142     MS_U8 QLen        :4;
143 } CmdQueueInfo, *pCmdQueueInfo;
144 */
145 
146 typedef enum
147 {
148     MB_CMD_TYPE_DEFAULT,
149     MB_CMD_TYPE_INSTANT_READ,
150     MB_CMD_TYPE_INSTANT_HANDLE,
151 } MB_CMD_TYPE;
152 
153 //-------------------------------
154 // MB_CLASS
155 //-------------------------------
156 
157 //-------------------------------
158 // MB_CLASS_JPEG
159 //-------------------------------
160 typedef enum
161 {
162     MB_JPEG_CMD_NONE                     = 0x00,
163 
164     // 51 --> Aeon
165     MB_JPEG_CMD_RESET                    = 0x11,
166     MB_JPEG_CMD_GET_STATUS               = 0x12,
167     MB_JPEG_CMD_FEED_DATA_SUCCESS        = 0x13,
168     MB_JPEG_CMD_DECODE_HEADER            = 0x15,
169     MB_JPEG_CMD_DECODE_LINE              = 0x16,
170     MB_JPEG_CMD_GET_PIC_INFO             = 0x17,
171     MB_JPEG_CMD_GET_PIC_ORIGINAL_SIZE    = 0x18,
172     MB_JPEG_CMD_SET_RATIO                = 0x19,
173     MB_JPEG_CMD_DECODE_INIT              = 0x20,
174     MB_JPEG_CMD_STOP_DECODE              = 0x21,
175 
176     // Aeon --> 51
177     MB_JPEG_CMD_ASK_4_DATA               = 0x80,
178     MB_JPEG_CMD_RETURN_STATUS            = 0x81,
179     MB_JPEG_CMD_RETURN_PIC_INFO          = 0x82,
180     MB_JPEG_CMD_RETURN_PIC_ORIGINAL_SIZE = 0x83,
181     MB_JPEG_CMD_RETURN_LOOP_OVER         = 0x84,
182     MB_JPEG_CMD_GET_RESOLUTION           = 0x85,
183     MB_JPEG_CMD_STOP_DECODE_ACK          = 0x86,
184 } MB_JPEG_CMD;
185 
186 typedef enum
187 {
188     e_Idle          = 0x01,
189     e_DecodeErr     = 0x02,
190     e_DecodeHeader  = 0x03,
191     e_DecodeLine    = 0x04,
192     e_DecodeDone    = 0x05,
193     e_Init          = 0x06,
194 } EN_DECODE_STATE;
195 
196 //-------------------------------
197 // MB_CLASS_JPEG_EN
198 //-------------------------------
199 typedef enum
200 {
201     MB_JPEG_EN_CMD_NONE                     = 0x00,
202 
203     // 51 --> Aeon
204     MB_JPEG_EN_CMD_SET_READ_BUFF_INFO       = 0x11,
205     MB_JPEG_EN_CMD_SET_INTERNAL_BUFF_INFO   = 0x12,
206     MB_JPEG_EN_CMD_SET_WRITE_BUFF_INFO      = 0x13,
207     MB_JPEG_EN_CMD_SET_RESOLUTION_INFO      = 0x14,
208 
209     // Aeon --> 51
210     MB_JPEG_EN_RESULT                       = 0x80,
211 } MB_JPEG_EN_CMD;
212 
213 typedef enum
214 {
215     MB_CLASS_SYSTEM         = 0,
216     MB_CLASS_INPUT          = 1,
217     MB_CLASS_TSP            = 2,
218     MB_CLASS_CHANNEL        = 3,
219     MB_CLASS_MEMORY         = 4,
220     MB_CLASS_MPEG           = 5,
221     MB_CLASS_VIDEO          = 6,
222     MB_CLASS_AUDIO          = 7,
223     MB_CLASS_MHEG5_STATE    = 8,
224     MB_CLASS_MVF            = 9,
225     MB_CLASS_GE             = 10,
226     MB_CLASS_CI             = 11, // rename unused "MB_CLASS_NUM" as "MB_CLASS_CI" for CIMHEG usage
227     MB_CLASS_TEST           = 12,
228     MB_CLASS_MAD            = 13,
229     MB_CLASS_MPEG2_FS       = 14,
230     MB_CLASS_MPEG2          = 15,
231     MB_CLASS_BMP            = 16,
232     MB_CLASS_PNG            = 17,
233     MB_CLASS_JPEG           = 18,
234     MB_CLASS_MJPEG          = 19,
235     MB_CLASS_JPEG_ENCODER   = 20,
236     MB_CLASS_VDPLAYER_FS    = 21,
237     MB_CLASS_VDPLAYER       = 22,
238     MB_CLASS_RMPLAYER_FS    = 23,
239     MB_CLASS_RMPLAYER       = 24,
240     MB_CLASS_TSPLAYER_FS    = 25,
241     MB_CLASS_TSPLAYER       = 26,
242     MB_CLASS_LZSS           = 27,
243     MB_CLASS_CAPE           = 28,
244     MB_CLASS_CC             = 29,
245     MB_CLASS_DLNA           = 30,
246     MB_CLASS_DUMMY_LOOP     = 31,
247     MB_CLASS_CHAKRA_SUBSYS  = 32,
248     MB_CLASS_FCNTL          = 33,
249     MB_CLASS_IRKEY          = 34,
250     MB_CLASS_BTPD           = 35,
251     MB_CLASS_OBAMA_CMD      =36,
252     MB_CLASS_OBAMA_APP      =37,
253     MB_CLASS_KTV               = 38,
254     MB_CLASS_CIPLUS         =39,
255     MB_CLASS_PRINT_MESSAGE      =40,
256     MB_CLASS_SHWFS         =41,
257     // 42: reserved
258     MB_CLASS_STILLIMAGE             = 43,
259     MB_CLASS_MAILBOX_FILE_IO_FAST   = 44,
260     MB_CLASS_MAILBOX_FILE_IO        = 45,
261 
262     MB_CLASS_NET_DEBUG = 46, //add by Ian //46
263 } MB_CLASS;
264 
265 //-------------------------------
266 // MB_CLASS_SYSTEM
267 //-------------------------------
268 typedef enum
269 {
270     MB_SYS_CMD_QUERY_STATUS,
271     MB_SYS_CMD_SYS_TIMER,
272     MB_SYS_CMD_PAUSE_AEON,
273 } MB_SYSTEM_CLASS;
274 
275 //-----------------------------------------------
276 // Class :: MPEG
277 //-----------------------------------------------
278 typedef enum
279 {
280     MB_MPEG_IFRAME_DECODE            = 0x80,
281     MB_MPEG_IFRAME_ENABLE            = 0x81,
282     MB_MPEG_IFRAME_SET_POSITION      = 0x82,
283     MB_MPEG_IFRAME_SCALE             = 0x83,
284     MB_MPEG_IFRAME_SET_POSITION_CROP = 0x84,
285     MB_MPEG_IFRAME_SCALE_CROP        = 0x85,
286     MB_MPEG_IFRAME_SET_VIDOFFSET     = 0x86,
287     MB_MPEG_IFRAME_BOXSIZE           = 0x87
288 } MB_MPEG;
289 
290 //-------------------------------
291 // MB_CLASS_INPUT
292 //-------------------------------
293 typedef enum
294 {
295     MB_INPUT_CMD_IR,
296     MB_INPUT_CMD_KEYPAD,
297     MB_INPUT_CMD_JOYSTICK,
298     MB_INPUT_CMD_BIKE_IR
299 
300 } MB_INPUT_CLASS;
301 
302 //-------------------------------
303 // MB_CLASS_TSP
304 //-------------------------------
305 typedef enum
306 {
307     MB_TSP_CMD_ADD_PID,
308     MB_TSP_CMD_DEL_PID,
309 } MB_TSP_CLASS;
310 
311 //-------------------------------
312 // MB_CLASS_MEMORY
313 //-------------------------------
314 typedef enum
315 {
316     MB_MEM_CMD_MAPINFO,
317 } MB_INPUT_MEMORY;
318 
319 //-------------------------------
320 // MB_CLASS_VIDEO
321 //-------------------------------
322 typedef enum
323 {
324     MB_VID_CMD_CHANGESTREAM     = 0,
325     MB_VID_CMD_SETAFD           = 1,
326     MB_VID_CMD_SETARC_PART1     = 2,
327     MB_VID_CMD_SETARC_PART2     = 3,
328     MB_VID_CMD_SETVTG           = 4,
329     MB_VID_CMD_SETVTG2          = 5,
330     MB_VID_CMD_SETVTG_SETTING   = 6,
331 } MB_VIDEO_CMD_INDEX;
332 
333 //-------------------------------
334 // MB_CLASS_MHEG5_STATE
335 //-------------------------------
336 typedef enum
337 {
338     //HK => CP
339     MB_MHEG5_STATE_CMD_AUD_PID_PNL_RATIO    = 0x00,
340     MB_MHEG5_STATE_CMD_OS_FB                = 0x01,
341     MB_MHEG5_STATE_CMD_SETARC_PART1         = 0x02,
342     MB_MHEG5_STATE_CMD_SETARC_PART2         = 0x03,
343 
344     MB_MHEG5_STATE_CMD_PNL_INFO             = 0x05,
345     MB_MHEG5_STATE_CMD_SEMAPHORE            = 0x06,
346     MB_MHEG5_STATE_CMD_OS_BAK_COLOR         = 0x07,
347     MB_MHEG5_STATE_CMD_RT_FB                = 0x08,
348     MB_MHEG5_STATE_CMD_DLA_FB               = 0x09,
349     MB_MHEG5_STATE_CMD_IFRAME_CONTROL       = 0x0A,
350     MB_MHEG5_STATE_CMD_SETARC_SETTING       = 0x0B,
351     MB_MHEG5_STATE_CMD_MMAP                 = 0x0C,
352     MB_MHEG5_STATE_CMD_HKMB_READY           = 0x0D,
353 
354     //CP => HK
355     MB_MHEG5_STATE_CMD_EXIT                 = 0x80,
356     MB_MHEG5_STATE_CMD_AUTOBOOT             = 0x81,
357     MB_MHEG5_STATE_CMD_CHANNEL_CHANGE       = 0x82,
358     MB_MHEG5_STATE_CMD_MHEG5_TO_MENU        = 0x83,
359     MB_MHEG5_STATE_CMD_RESOURCE_CHANGE      = 0x84,
360     MB_MHEG5_STATE_CMD_KEY_REGISTER         = 0x85,
361 
362 
363 
364     MB_MHEG5_STATE_CMD_MMAP_OK              = 0x8C,
365     MB_MHEG5_STATE_CMD_CPMB_READY           = 0x8D,
366 } MB_MHEG5_STATE_CLASS;
367 
368 //-------------------------------
369 // MB_CLASS_CAPE
370 //-------------------------------
371 typedef enum
372 {
373     //HK51 => AEON
374     MB_CAPE_INIT_RES                 = 0x00,
375     MB_CAPE_GWIN_CREATE_RES          = 0x10,
376     MB_CAPE_GWIN_ENABLE_RES          = 0x11,
377     MB_CAPE_GWIN_MOVE_RES            = 0x12,
378     MB_CAPE_GWIN_DESTROY_RES         = 0x13,
379     MB_CAPE_VOP_INIT_RES             = 0x14,
380     MB_CAPE_VOP_SETBLUESCREEN_RES    = 0x15,
381     MB_CAPE_VOP_MOVE_RES             = 0x16,
382     MB_CAPE_VOP_DESTROY_RES          = 0x17,
383     MB_CAPE_I8_SET_RES               = 0x20,
384     MB_CAPE_I8_GET_RES               = 0x21,
385     MB_CAPE_FILE_LEN_RES             = 0x30,
386     MB_CAPE_FILE_COPY_RES            = 0x31,
387     #ifdef ENABLE_BIKEIR
388     MB_CAPE_INIT_BIKEIR_RES          = 0x40,
389     #endif
390     #ifdef ENABLE_DMP
391     MB_CAPE_AUDIO_INIT_RES           = 0x50,
392     #endif
393 
394     //AEON => HK51
395     MB_CAPE_INIT_REQ                 = 0x80,
396     MB_CAPE_GWIN_CREATE_REQ          = 0x90,
397     MB_CAPE_GWIN_ENABLE_REQ          = 0x91,
398     MB_CAPE_GWIN_MOVE_REQ            = 0x92,
399     MB_CAPE_GWIN_DESTROY_REQ         = 0x93,
400     MB_CAPE_VOP_INIT_REQ             = 0x94,
401     MB_CAPE_VOP_SETBLUESCREEN_REQ    = 0x95,
402     MB_CAPE_VOP_MOVE_REQ             = 0x96,
403     MB_CAPE_VOP_DESTROY_REQ          = 0x97,
404     MB_CAPE_AUDIO_INIT_REQ           = 0xA0,
405     MB_CAPE_I8_SET_REQ               = 0xB0,
406     MB_CAPE_I8_GET_REQ               = 0xB1,
407     MB_CAPE_APP_FINALIZED_SIG        = 0xC0,
408     MB_CAPE_APP_ALIVE_SIG            = 0xC1,
409     MB_CAPE_APP_INITIALIZED_SIG      = 0xC2,
410     MB_CAPE_FILE_LEN_REQ             = 0xD0,
411     MB_CAPE_FILE_COPY_REQ            = 0xD1,
412     #ifdef ENABLE_BIKEIR
413     MB_CAPE_INIT_BIKEIR_REQ          = 0xD2,
414     #endif
415     MB_CAPE_NET_IP_INFO              = 0xE0,
416     MB_CAPE_NET_MASK_INFO            = 0xE1,
417     MB_CAPE_NET_GATEWAY_INFO         = 0xE2,
418     MB_CAPE_NET_DNS_INFO             = 0xE3,
419 
420 } MB_CAPE_CLASS;
421 
422 //-------------------------------
423 // MB_CLASS_GE_STATE
424 //-------------------------------
425 typedef enum
426 {
427     MB_GE_STATUS                       = 0,
428     MB_Relase_GE_Mutex_BY_HK51         = 1,
429     MB_Request_GE_Mutex_BY_HK51        = 2,
430 } MB_GE_STATE_CLASS;
431 
432 //-------------------------------
433 // MB_CLASS_MVF
434 //-------------------------------
435 typedef enum
436 {
437     //HK51 => AEON
438     MB_MVF_CMD_LOAD_FACE           = 0,
439     MB_MVF_CMD_GENERATE_BITMAP     = 1,
440     MB_MVF_CMD_DONE_FACE           = 2,
441 
442     //AEON => HK51
443     MB_MVF_CMD_LOAD_DONE           = 0x80,
444     MB_MVF_CMD_GENERATE_DONE       = 0x81,
445 
446 } MB_MVF_CLASS;
447 
448 /// Mail box return state
449 typedef enum
450 {
451     MB_RETURN_OK,                                               ///< Mail box return OK
452     MB_RETURN_MHEG5_EXIT,                                               ///< Mail box return EXIT
453     MB_RETURN_MHEG5_AUTOBOOT,                                               ///< Mail box return AUTOBOOT
454     MB_RETURN_MHEG5_CHANNELCHANGE,                                               ///< Mail box return Channelchange
455     MB_RETURN_MVF_DONE,                                               ///< Mail box return MVF Done
456     MB_RETURN_MVF_ERROR,                                               ///< Mail box return MVF Erroe
457     MB_RETURN_MHEG5_SELECTED_QUIT_SEL,                                               ///< Mail box return quit by "select key"
458     MB_RETURN_MHEG5_SELECTED_QUIT_0,                                               ///< Mail box return quit by selected state "0 key"
459     MB_RETURN_MHEG5_SELECTED_QUIT_1,                                               ///< Mail box return quit by selected state "1 key"
460     MB_RETURN_MHEG5_SELECTED_QUIT_2,                                               ///< Mail box return quit by selected state "2 key"
461     MB_RETURN_MHEG5_SELECTED_QUIT_3,                                               ///< Mail box return quit by selected state "3 key"
462     MB_RETURN_MHEG5_SELECTED_QUIT_4,                                               ///< Mail box return quit by selected state "4 key"
463     MB_RETURN_MHEG5_SELECTED_QUIT_5,                                               ///< Mail box return quit by selected state "5 key"
464     MB_RETURN_MHEG5_SELECTED_QUIT_6,                                               ///< Mail box return quit by selected state "6 key"
465     MB_RETURN_MHEG5_SELECTED_QUIT_7,                                               ///< Mail box return quit by selected state "7 key"
466     MB_RETURN_MHEG5_SELECTED_QUIT_8,                                               ///< Mail box return quit by selected state "8 key"
467     MB_RETURN_MHEG5_SELECTED_QUIT_9,                                               ///< Mail box return quit by selected state "9 key"
468     MB_RETURN_51_STATE_CHANNEL_CHANGE,                                               ///< Mail box return 51 state channel change
469     MB_RETURN_51_STATE_MHEG5_TO_MENU,                                               ///< Mail box return 51 state MHEG5 to Menu
470     MB_RETURN_LZSS_COMPRESS_DONE,
471     MB_RETURN_LZSS_COMPRESS_FAILED,
472 } MB_RETURN_STATE;
473 
474 //-------------------------------
475 // MB_CLASS_MPEG2_FS
476 //-------------------------------
477 //Issue Command Index
478 #define MB_MPEG2_FS_PARSE                       0x01        //[0]~[3]: PS buffer start
479                                                             //[4]~[7]: PS buffer end
480 #define MB_MPEG2_FS_INFO                        0x02        //[0]~[3]: File length
481 #define MB_MPEG2_FS_SET_POS                     0x03        //[0]~[3]: File position
482 #define MB_MPEG2_FS_PRE_PARSE                   0x04        //[0]~[3]: PS buffer start
483                                                             //[4]~[7]: PS buffer end
484 //Receive Command Index
485 #define MB_MPEG2_FS_PARSE_COMPLETED             0x80        //[0]: 0: forward Seek. 1: backward Seek.
486                                                             //[1]~[4]: Offset
487                                                             //[5]~[8]: Request size
488 #define MB_MPEG2_FS_PARSE_COMPLETED_DATA        0x83        //[0]: 0: forward Seek. 1: backward Seek.
489  															//[1]~[4]: video demux num
490                                                             //[5]~[8]: audio demux num
491 #define MB_MPEG2_FS_PRE_PARSE_COMPLETED         0x81        //[0]: 0: Can't support decode, 1: Can support decode.
492                                                             //[1]: MPEG file type.
493                                                             //[2]: MPEG file audio count.
494 #define MB_MPEG2_FS_PRE_PARSE_COMPLETED_DATA    0x84        //[0]: subpic count
495                                                             //[1]~[3]: sub pic ID
496 
497 
498 #define MB_MPEG2_FS_PRE_PARSE_NEXT_BUFF         0x82        //
499 //-------------------------------
500 // MB_CLASS_MPEG2
501 //-------------------------------
502 //Issue Command Index
503 #define MB_MPEG2_SET_VID_PARS_TYPE              0x01        //[0]: Parse type.
504                                                             //[1]~[4]: Output buffer start
505                                                             //[5]~[8]: Output buffer end
506 #define MB_MPEG2_SET_VID_RD_PTR                 0x03        //[0]~[3]: TSP Read buffer pointer
507 #define MB_MPEG2_SET_AUD_PARS_TYPE              0x04        //[0]: Parse type.
508                                                             //[1]~[4]: Output buffer start
509                                                             //[5]~[8]: Output buffer end
510 #define MB_MPEG2_SET_AUD_RD_PTR                 0x06
511 #define MB_MPEG2_PARS_ENABLE                    0x08        //[0]: 0x1, enable video parsing. 0x2, enable audio parsing.
512                                                             //[1]~[2]: Video PID (type is TS)
513                                                             //[3]~[4]: Audio PID (type is TS)
514 #define MB_MPEG2_PARS_DISABLE                   0x09        //[0]: 0x1, disable video parsing. 0x2, disable audio parsing.
515 #define MB_MPEG2_PARS_CTL                       0x0a        //[0]: 0x0, Stop parsing process.
516                                                             //     0x1, Normal parsing process.
517                                                             //     0x2, Forward I frame parsing process.
518                                                             //     0x3, Backward I frame parsing process.
519 #define MB_MPEG2_GET_PTS_POS                    0x0b        //[0]~[3]: PTS
520 
521 #define MB_MPEG2_SET_AUD_INFO                   0x0c        //[0]: Audio Type
522                                                             //[1]: Audio stream_id or sub_Stream_id
523 
524 #define MB_MPEG2_SET_PCR_INFO                   0x0d        //[0]~[1]: PCR PID
525 
526 #define MB_MPEG2_RESET_TSP_BUFF_PTR             0x0e        //[0]~[3]: TSP buffer pointer
527 #define MB_MPEG2_SET_PTS_SHARE_ADR             	0x0f        //[0]~[3]: PTS buffer pointer
528 #define MB_MPEG2_SET_SUBPIC_INFO                0x10        //[0]: subpic stream_id
529 
530 
531 
532 //Receive Command Index
533 #define MB_MPEG2_SET_STC                        0x80        //[0]: STC bit 32, [1]: STC bit 31~24,
534                                                             //[2]: STC bit 23~16, [3]: STC bit 15~8, [4]: STC bit 7~0,
535 #define MB_MPEG2_SET_TSP_PTR                    0x81        //[0]~[3]: TSP buffer write pointer
536 #define MB_MPEG2_SET_VID_ES_PTR                 0x82
537 #define MB_MPEG2_SET_AUD_ES_PTR                 0x83        //[0]~[3]: ES buffer write pointer
538                                                             //[4]~[7]: PTS
539 
540 #define MB_MPEG2_SET_TS_PGINFO                  0x84        //[0]: Program Index
541                                                             //[1]~[2]: Program number
542                                                             //[3]~[4]: PCR Pid
543                                                             //[5]~[6]: Video Pid
544                                                             //[7]~[8]: Audio Pid
545                                                             //[9]: Audio type
546 #define MB_MPEG2_SET_TS_PGINFO2                 0x85        //[0]: Program Index
547                                                             //[1]~[2]: Sub-pic Pid
548 #define MB_MPEG2_SET_TS_PGCOUNT                 0x86        //[0]~[3]: Program count
549 #define MB_MPEG2_SET_DMA_REQUEST                0x87        //[0]~[2]: Dst addr (256 bytes alignment)
550                                                             //[3]~[5]: Src addr (256 bytes alignment)
551                                                             //[6]~[9]: DMA size (byte unit)
552 #define MB_MPEG2_PARS_SPU                       0x88
553 
554 //-------------------------------
555 // MB_CLASS_TSPLAYER
556 //-------------------------------
557 //MB_VDPLAYER_SETUP_DISPLAY  Params[0]
558 //#define MB_TS_SET_DISPLAY                       0x01
559 //#define MB_TS_SETUP_DISPLAY                     0x02
560 //#define MB_TS_SET_FREEZEIMG                     0x03
561 //#define MB_TS_VIDMONITOR                        0x04
562 //#define MB_TS_VID_SETH264OUTPUT                 0x05
563 //#define MB_TS_SET_STC                           0x06
564 
565 //MB_VDPLAYER_SCALER_API CommandIndex
566 //Params[0]
567 //#define MB_msAPI_Scaler_SetBlueScreen               0x01//arg 2( ENABLE, FREE_RUN_COLOR_BLACK );
568 //#define MB_msAPI_Scaler_SetDisplayWindowStatus      0x02//arg 1 ( displayWindowStatue |= DISPLAYWINDOW_HDTV);
569 //#define MB_msAPI_Scaler_SetCustomerDisplayWindow    0x03//arg 5(TRUE, MOVIE_PREVIEW_X, MOVIE_PREVIEW_Y, MOVIE_PREVIEW_WIDTH, MOVIE_PREVIEW_HEIGHT);
570 //#define MB_msAPI_Scaler_SetTimingAndWindow          0x04//arg 3 ( SYS_INPUT_SOURCE_TYPE, &stVOPTiming, stSystemInfo.enAspectRatio);
571 //#define MB_msAPI_Scaler_GetDisplayWindowStatus      0x05//arg 0;
572 //#define msAPI_Scaler_SetFreezeImg                 0x06//arg 1;
573 //#define MB_msAPI_Scaler_GenerateBlackVideo          0x07//arg 1 (DISABLE);
574 
575 //MB_VDPLAYER_AUD_API CommandIndex
576 //Params[0]
577 #define MB_msAPI_AUD_AdjustAudioFactor       0x01//msAPI_AUD_AdjustAudioFactor(E_ADJUST_SWITCH_AUDIOSTREAMMODE, tsSrvInfo.stAudInfo[m_u8SoundTrackIdx].wAudType, 0);
578 //#define MB_msAPI_AUD_SPDIF_SetMode           0x02//msAPI_AUD_SPDIF_SetMode(MSAPI_AUD_SPDIF_NONPCM);
579 //#define MB_msAPI_AUD_SetStreamID_Mod         0x03//msAPI_AUD_SetStreamID_Mod(TRUE);
580 //#define MB_msAPI_AUD_DTV_HDMI_CFG            0x04//msAPI_AUD_DTV_HDMI_CFG(FALSE);  // DTV mod set False
581 //#define MB_msAPI_AUD_SetDecCommand           0x05//msAPI_AUD_SetDecCommand(MSAPI_AUD_RESYNC);
582 //#define MB_msAPI_AUD_SetPaser                0x06//msAPI_AUD_SetPaser(MSAPI_AUD_PASER_PLAY);
583 //#define MB_msAPI_AUD_SetFreeRun              0x07//msAPI_AUD_SetFreeRun(MSAPI_AUD_DVB_FreeRunMode_FreeRun);
584 
585 //MB_VDPLAYER_VID_API CommandIndex
586 //Params[0]
587 //#define MB_msAPI_VID_MVDInit                 0x01//msAPI_VID_MVDInit();
588 //#define MB_msAPI_VID_VOPInit                 0x02//msAPI_VID_VOPInit();
589 //#define MB_msAPI_VID_VOPEnable               0x03//emsAPI_VID_VOPEnable( TRUE );
590 //#define MB_msAPI_VID_SetVOPClk               0x04//msAPI_VID_SetVOPClk( ENABLE );
591 //#define MB_msAPI_VID_Command                 0x05//msAPI_VID_Command(MSAPI_VID_STOP);
592 //#define MB_msAPI_VID_Init                    0x06//msAPI_VID_Init();
593 //#define MB_msAPI_VID_AVCH264EnableParserStop 0x07//msAPI_VID_AVCH264EnableParserStop(x) MDrv_AVCH264_EnableParserStop(x)
594 //#define MB_msAPI_VID_MVDResetBuffAddr        0x08//msAPI_VID_MVDResetBuffAddr();
595 //#define MB_msAPI_VID_MVDCommand              0x08//msAPI_VID_MVDCommand(MSAPI_VID_PLAY);//only mpeg2, need change as msAPI_VID_Command(MSAPI_VID_PLAY) if h264 add in;
596 //#define MB_msAPI_VID_GetPicCount             0x09//msAPI_VID_GetPicCount();
597 //#define MB_msAPI_VID_AVCH264GetDispRdy       0x0A//msAPI_VID_AVCH264GetDispRdy()
598 //#define MB_msAPI_VID_AVCH264GetSeqInfo       0x0B//(msAPI_VID_AVCH264GetSeqInfo(&stVidInfo))
599 //#define MB_msAPI_VID_GetDispRdy              0x0C//(msAPI_VID_GetDispRdy())
600 //#define MB_msAPI_VID_GetVidInfo              0x0D//(msAPI_VID_GetVidInfo(&stVidInfo))
601 //#define MB_msAPI_VID_SetH264Output           0x0E//( msAPI_VID_SetH264Output(&stVOPTiming, &stVidInfo ) == PASS )
602 //#define MB_msAPI_VID_VOPSetBlackBG           0x0F//msAPI_VID_VOPSetBlackBG();
603 //#define MB_msAPI_VID_AVCH264GetDispInfoDone  0x10//msAPI_VID_AVCH264GetDispInfoDone();
604 //#define MB_msAPI_VID_SetMVDOutput            0x11//( msAPI_VID_SetMVDOutput(&stVOPTiming, &stVidInfo) == PASS )
605 //#define MB_msAPI_VID_GetGOPCount             0x12//msAPI_VID_GetGOPCount();
606 //#define MB_msAPI_VID_SetTrickModeInfo        0x13//msAPI_VID_SetTrickModeInfo(1,1);
607 //#define MB_msAPI_VID_GetFirstFrame           0x14//msAPI_VID_GetFirstFrame()
608 
609 //-------------------------------
610 // MB_CLASS_VDPLAYER_FS
611 //-------------------------------
612 //Receive Command Index
613 #define MB_VDPLAYER_FS_INIT                        0x01         //[0]~[3]: VDPlayer info buffer start
614                                                                 //[4]~[7]: VDPlayer data buffer start
615 
616 #define MB_VDPLAYER_FS_PAR_STREAM_INFO             0x02         //[0]: no. of stream
617 
618 #define MB_VDPLAYER_FS_PAR_FRAME_INFO              0x03         //[0]~[3]: Frame info buffer address
619 
620 #define MB_VDPLAYER_INIT_INDEX                     0x04
621 
622 #define MB_VDPLAYER_INIT_AUDIO                     0x05
623 #define MB_VDPLAYER_INIT_AUDIO_2                   0x06
624 #define MB_VDPLAYER_INIT_AUDIO_3                   0x07
625 #define MB_VDPLAYER_INIT_AC3                       0x08
626 
627 //Issue Command Index
628 #define MB_VDPLAYER_FS_INIT_DONE                   0x80         //[0]: 0: success. 1: fail.
629 
630 
631 //-------------------------------
632 // MB_CLASS_VDPLAYER
633 //-------------------------------
634 //51-->Aeon Command Index
635 #define MB_VDPLAYER_INIT                    0x01
636 #define MB_VDPLAYER_MEM_INIT                0x02
637 #define MB_VDPLAYER_STATE_INIT              0x03
638 #define MB_VDPLAYER_RESET                   0x04
639 #define MB_VDPLAYER_SET_PREVIEW_MODE        0x05
640 
641 #define MB_VDPLAYER_PLAY                    0x10
642 #define MB_VDPLAYER_STOP                    0x11
643 #define MB_VDPLAYER_PAUSE                   0x12
644 #define MB_VDPLAYER_RESUME                  0x13
645 #define MB_VDPLAYER_FF                      0x14
646 #define MB_VDPLAYER_REW                     0x15
647 #define MB_VDPLAYER_SET_TRICK_MODE          0x16
648 #define MB_VDPLAYER_GET_TRICK_MODE          0x17
649 #define MB_VDPLAYER_REPEAT_AB               0x18
650 
651 #define MB_VDPLAYER_SET_SUBTITLE_TRACKID    0x21
652 #define MB_VDPLAYER_GET_SUBTITLE_STATE      0x22
653 #define MB_VDPLAYER_GET_VDPLAYER_INFO       0x23
654 #define MB_VDPLAYER_BEFORE_CAPTURE_VIDEO    0x24
655 #define MB_VDPLAYER_AFTER_CAPTURE_VIDEO     0x25
656 #define MB_VDPLAYER_SET_PLAYER_POSITION     0x26
657 
658 #define MB_VDPLAYER_ACK_51ToAEON            0x30
659 
660 //DivX MM Function
661 #define MB_VDPLAYER_GET_AUDIO_TRACK_COUNT_TO_AEON       0x41
662 #define MB_VDPLAYER_GET_AUDIO_TRACK_ID_TO_AEON          0x42
663 #define MB_VDPLAYER_SET_AUDIO_TRACK_ID_TO_AEON          0x43
664 //Subtitle
665 #define MB_VDPLAYER_SPUQUEUE_GET_DRAM_ADDR_TO_AEON      0x44
666 #define MB_VDPLAYER_SPUQUEUE_PUSH                       0x45
667 #define MB_VDPLAYER_MPEG_SUBTITLE_MAIN                  0x46
668 #define MB_VDPLAYER_MPEG_SET_SUBTITLE_SHOW              0x47
669 #define MB_VDPLAYER_MPEG_SUBTITLE_INIT_DEINIT           0x48//Init: 0 deinit:1
670 #define MB_VDPLAYER_MPEG_SUBTITLE_RESET                 0x49
671 #define MB_VDPLAYER_MPEG_SUBTITLE_SETHEADERINFO         0x4A
672 #define MB_VDPLAYER_MPEG_SUBTITLE_GETQUEUEINFO          0x4B
673 #define MB_VDPLAYER_MPEG_SUBTITLE_FILEPROCESS           0x4C
674 // DRM
675 #define MB_VDPLAYER_GET_DRM_REG_CODE                    0x50
676 #define MB_VDPLAYER_CHECK_DRM_AUTHORIZATION             0x51
677 #define MB_VDPLAYER_QUERY_DRM_RENTAL_STATUS             0x52
678 #define MB_VDPLAYER_GET_DRM_REG_CODE_2                  0x53
679 #define MB_VDPLAYER_GET_DRM_DEACTIVATION_CODE           0x54
680 
681 #define MB_VDPLAYER_TS_SET_PROGRAM                      0x60
682 
683 //Aeon->51 Command Index
684 #define MB_VDPLAYER_FILE_READ               0x80
685 #define MB_VDPLAYER_FILE_SEEK               0x81
686 #define MB_VDPLAYER_FILE_OPEN               0x82
687 #define MB_VDPLAYER_FILE_CLOSE              0x83
688 #define MB_VDPLAYER_VIDEO_INIT              0x84
689 #define MB_VDPLAYER_AUDIO_INIT              0x85
690 #define MB_VDPLAYER_SETUP_DISPLAY           0x86
691 #define MB_VDPLAYER_CLOSE_DISPLAY           0x87
692 #define MB_VDPLAYER_AUDIO_START             0x88
693 #define MB_VDPLAYER_FILE_READ_NONBLOCKING   0X89
694 #define MB_VDPLAYER_FILE_DUMP_RAW           0x8A
695 #define MB_VDPLAYER_GET_DISPLAY_INFO        0x8B
696 #define MB_VDPLAYER_SET_DISPLAY_INFO        0x8C
697 #define MB_VDPLAYER_FILE_SEEK_NONBLOCKING   0x8D
698 
699 
700 #define MB_VDPLAYER_ACK_AEONTo51                    0xA0
701 #define MB_VDPLAYER_STATE_RET                       0xA1
702 #define MB_VDPLAYER_STATE_RET_WAIT                  0xA2
703 #define MB_VDPLAYER_STATE_RET_EXIT                  0xA3
704 #define MB_VDPLAYER_FILE_READ_NONBLOCKING_DONE      0XA4
705 #define MB_VDPLAYER_FILE_SEEK_NONBLOCKING_DONE      0XA5
706 
707 //TS MM Function
708 //#define MB_VDPLAYER_SET_INTERRUPT    0xA5
709 //#define MB_VDPLAYER_AUDIO_SETTING    0xA6
710 //#define MB_VDPLAYER_SCALER_API       0xA7
711 #define MB_VDPLAYER_AUD_API                             0xA8
712 //#define MB_VDPLAYER_VID_API          0xA9
713 
714 //DivX MM Function
715 #define MB_VDPLAYER_GET_AUDIO_TRACK_COUNT_FROM_AEON     0x90
716 #define MB_VDPLAYER_GET_AUDIO_TRACK_ID_FROM_AEON        0x91
717 
718 #define MB_51_PARALLEL_QLENGTH              1
719 #define MB_51_PARALLEL_QSIZE                13
720 
721 #define MB_51_STATE_QLENGTH                 10
722 #define MB_51_STATE_QSIZE                   13
723 #define MB_MHEG5_EXIT_SELECTED              2
724 
725 #define MB_51_MPEG2_QLENGTH                 24
726 #define MB_51_MPEG2_QSIZE                   13
727 
728 #define MB_51_MPEG2_FS_QLENGTH              6
729 #define MB_51_MPEG2_FS_QSIZE                13
730 
731 #define MB_51_TSPLAYER_QLENGTH              MB_51_MPEG2_QLENGTH
732 #define MB_51_TSPLAYER_QSIZE                MB_51_MPEG2_QSIZE
733 
734 #define MB_51_TSPLAYER_FS_QLENGTH           MB_51_MPEG2_FS_QLENGTH
735 #define MB_51_TSPLAYER_FS_QSIZE             MB_51_MPEG2_FS_QSIZE
736 #define MB_51_VDPLAYER_QLENGTH              MB_51_MPEG2_QLENGTH // 24
737 #define MB_51_VDPLAYER_QSIZE                MB_51_MPEG2_QSIZE // 13
738 
739 #define MB_51_VDPLAYER_FS_QLENGTH           MB_51_MPEG2_FS_QLENGTH // 4
740 #define MB_51_VDPLAYER_FS_QSIZE             MB_51_MPEG2_FS_QSIZE // 13
741 
742 #define MB_51_IR_QLENGTH                    13
743 #define MB_51_IR_QSIZE                      13
744 
745 #define MB_OBAMA_QLENGTH                    13
746 #define MB_OBAMA_QSIZE                      13
747 
748 #define MB_51_MBFS_QLENGTH                  10
749 #define MB_51_MBFS_QSIZE                    13
750 
751 #define SHWFS_CMD_QLENGTH                  10
752 #define SHWFS_CMD_QSIZE                    13
753 
754 //Add by Ian
755 #define NWDEBUG_CMD_QLENGTH                  3
756 #define NWDEBUG_CMD_QSIZE                    13
757 
758 #define MB_PRINT_MESSAGE_QLENGTH                    13
759 #define MB_PRINT_MESSAGE_QSIZE                      13
760 
761 #define MB_CIPLUS_QLENGTH                    13
762 #define MB_CIPLUS_QSIZE                      13
763 
764 #define MB_DLNA_QLENGTH                    24
765 #define MB_DLNA_QSIZE                      13
766 
767 #define MB_BTPD_QLENGTH                 10
768 #define MB_BTPD_QSIZE                   13
769 
770 #define MB_KTV_QLENGTH                 10
771 #define MB_KTV_QSIZE                   13
772 
773 #define MB_51_APENGINE_QLENGTH                 10
774 #define MB_51_APENGINE_QSIZE                   13
775 
776 #define MB_51_MM_QLENGTH                 10
777 #define MB_51_MM_QSIZE                   13
778 
779 #define MB_51_MHEG5_QLENGTH                 10
780 #define MB_51_MHEG5_QSIZE                   13
781 
782 //-----------------------------------------------
783 // Class :: BMP
784 //-----------------------------------------------
785 //8051->Aeon
786 //set bmp decoding output parameters
787 //para 0~3: output buffer address (para0:LSB  ;  para3:MSB)
788 //para 4~5: output imgage max width (para4:LSB  ;  para5:MSB)
789 //para 6~7: output imgage max height (para6:LSB  ;  para7:MSB)
790 #define MB_BMP_SET_OUTPUT_INFO      0x01
791 
792 
793 //8051->Aeon
794 //set bmp file data buffer parameters
795 //para 0: buffer index (0 or 1, please use 0 at begining of file decoding)
796 //para 1~4: data buffer address (para1:LSB  ;  para4:MSB)
797 //para 5~6: data buffer length (para5:LSB  ;  para6:MSB ; max:2048)
798 #define MB_BMP_SET_DATA_BUF         0x02
799 
800 
801 //Aeon->8051
802 //Notify 8051 that data in buffer is consumed
803 //para 0: buffer index (0 or 1)
804 #define MB_BMP_NOTIFY_BUFFER_EMPTY  0x03
805 
806 //Aeon->8051
807 //Report this bmp image size
808 //para 0~1: image width (para0:LSB  ;  para1:MSB)
809 //para 2~3: image height (para2:LSB  ;  para3:MSB)
810 #define MB_BMP_NOTIFY_IMG_INFO      0x04
811 #define MB_BMP_STOP_DECODE          0x05
812 #define MB_BMP_STOP_DECODE_ACK      0x06
813 
814 //-----------------------------------------------
815 // Class :: PNG
816 //-----------------------------------------------
817 #define MB_PNG_SET_OUTPUT_INFO      0x01
818 #define MB_PNG_SET_DATA_BUF         0x02
819 #define MB_PNG_NOTIFY_BUFFER_EMPTY  0x03
820 #define MB_PNG_NOTIFY_IMG_INFO      0x04
821 #define MB_PNG_STOP_DECODE          0x05
822 #define MB_PNG_NOTIFY_DECODE_END    0x06
823 
824 //----------------------------------
825 // Get MailBox Message Return Value
826 //----------------------------------
827 typedef enum
828 {
829     MB_GET_MSG_OK,
830     MB_QUEUE_EMPTY,
831     MB_ERROR_CLASS,
832 } MB_GETMSG_RET;
833 
834 //-----------------------------------------------
835 //INTERFACE
836 //-----------------------------------------------
837 
838 INTERFACE MailBox MailBoxPara;
839 INTERFACE void MDrv_InitMailBoxQueue(void);
840 INTERFACE void MDrv_SendMailBoxMsg(void);
841 INTERFACE void MDrv_HandleMailBox(void);
842 INTERFACE MS_U8 MDrv_GetMailBoxMsg(MS_U8 u8QueueType, MS_U8 *Msg);
843 INTERFACE MS_BOOL MDrv_IsMailBoxMsgEmpty(MS_U8 u8QueueType);
844 INTERFACE MS_BOOL MDrv_CheckMailBoxIdle(void);
845 INTERFACE MS_BOOL MDrv_CheckMailBoxReady(void);
846 INTERFACE MS_U8 MDrv_GetMailBoxMsgCount(MS_U8 u8QueueType);
847 INTERFACE void MDrv_ClearMailBoxStatus(void);
848 INTERFACE MS_BOOL MDrv_WaitMailBoxReady(void);
849 
850 #undef INTERFACE
851 #endif //_MAILBOX_H_
852 
853