xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/drvMBX.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 
96 ///////////////////////////////////////////////////////////////////////////////////////////////////
97 /// @file   drvMBX.h
98 /// @brief  MStar Mailbox Driver DDI
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 /*! \defgroup G_MBX MBX interface
103     \ingroup  G_PERIPHERAL
104 
105     \brief
106 
107     This drvMBX.h provided function for one processor to send a message to another processor, also
108     receive messages from others processor.
109 
110     <b>Features</b>
111     - Mailbox Initialize & De-initialize function
112     - Mailbox Class Register function
113     - Mailbox Send & Receive function
114 
115     <b> Operation Code Flow: </b> \n
116     -# MBX initialize with configuration.
117     -# Correct MBX class for specific thread.
118     -# Send MBX message.
119     -# Receive MBX message.
120 
121     \defgroup G_MBX_INIT Initialization Task relative
122     \ingroup  G_MBX
123     \defgroup G_MBX_COMMON Common Task relative
124     \ingroup  G_MBX
125     \defgroup G_MBX_CONTROL Control relative
126     \ingroup  G_MBX
127     \defgroup G_MBX_OTHER  other relative
128     \ingroup  G_MBX
129     \defgroup G_MBX_ToBeModified MBX api to be modified
130     \ingroup  G_MBX
131     \defgroup G_MBX_ToBeRemove MBX api to be removed
132     \ingroup  G_MBX
133 */
134 
135 #ifndef _DRV_MBX_H
136 #define _DRV_MBX_H
137 
138 #ifdef _DRV_MBX_C
139 #define INTERFACE
140 #else
141 #define INTERFACE extern
142 #endif
143 
144 
145 
146 #ifdef __cplusplus
147 extern "C"
148 {
149 #endif
150 
151 //=============================================================================
152 // Includs
153 //=============================================================================
154 #include "MsTypes.h"
155 #include "MsDevice.h"
156 
157 
158 //=============================================================================
159 // Defines & Macros
160 //=============================================================================
161 /// Version string.
162 #define MBX_DRV_VERSION               /* Character String for DRV/API version             */  \
163     MSIF_TAG,                           /* 'MSIF'                                           */  \
164     MSIF_CLASS,                         /* '00'                                             */  \
165     MSIF_CUS,                           /* 0x6666                                           */  \
166     MSIF_MOD,                           /* 0x0000                                           */  \
167     MSIF_CHIP,                                                                                  \
168     MSIF_CPU,                                                                                   \
169     {'M','B','X','_'},                  /* IP__                                             */  \
170     {'0','2'},                          /* 0.0 ~ Z.Z                                        */  \
171     {'0','4'},                          /* 00 ~ 99                                          */  \
172     {'0','0','5','4','6','1','0','2'},  /* CL#                                              */  \
173     MSIF_OS
174 
175 /// Max Mailbox Queque Size for one Mail Class
176 #define MAX_MBX_QUEUE_SIZE      256
177 /// Max Parameter Size ( in bytes ) for one Mail Message
178 #define MAX_MBX_PARAM_SIZE      10
179 /// Max Size ( in bytes ) for SetInformation
180 #define MAX_MBX_INFORMATION_SIZE    8
181 
182 /// Define The Queue Status of The Mail Class queue
183 /// Queue overflow: new incoming mail will be skip
184 #define MBX_STATUS_QUEUE_OVER_FLOW       0x00000001
185 /// Queque Has Instant Msg: there has new instant message in queue
186 #define MBX_STATUS_QUEUE_HAS_INSTANT_MSG 0x00000002
187 /// Queue Has Normal Msg: there has new normal message in queue
188 #define MBX_STATUS_QUEUE_HAS_NORMAL_MSG  0x00000004
189 
190 /// Define The Flags for Receive Message from Message Queue
191 /// Recv any message class, this means, the targetClass is useless if this bit is set
192 //#define MBX_CHECK_ALL_MSG_CLASS 0x00000001
193 /// Check Instant Message
194 #define MBX_CHECK_INSTANT_MSG   0x00000002
195 /// Check Normal Message
196 #define MBX_CHECK_NORMAL_MSG    0x00000004
197 /// Recv any message class, this means, the targetClass is useless if this bit is set
198 #define MBX_CHECK_ALL_MSG_CLASS (MBX_CHECK_INSTANT_MSG|MBX_CHECK_NORMAL_MSG)
199 /// Block Receive function call until time out if no message available
200 #define MBX_CHECK_BLOCK_RECV    0x80000000
201 
202 /// Define debug level:
203 /// Default Debug Level: No any Debug Message Print out
204 #define MBX_DBG_LEVEL_NONE       0x00
205 /// HAL Debug Level: Print out MBX Hal Error/Warning
206 #define MBX_DBG_LEVEL_MBXHAL     0x01
207 /// Message Queue Debug Level: Print out Message Queue Error/Warning
208 #define MBX_DBG_LEVEL_MSGQ       0x02
209 /// Interrupt HAL Debug Level: Print out Inerrut HAL Error/Warning
210 #define MBX_DBG_LEVEL_MBXINT     0x04
211 /// Critical Debug Level: Print out any Critical Error/Warning
212 #define MBX_DBG_LEVEL_CRITICAL   0x08
213 /// All Debug Level: Print out any Error/Wanring, That is, All above Debug Level Errors/Warnings
214 #define MBX_DBG_LEVEL_ALL        0x0F
215 
216 //=============================================================================
217 // Type and Structure Declaration
218 //=============================================================================
219 
220 //=============================================================================
221 // Enums
222 
223 /// Mail Message Class Defines
224 typedef enum
225 {
226     /// MBX_CLASS_SYSTEM
227     E_MBX_CLASS_SYSTEM         = 0,
228     /// MBX_CLASS_INPUT
229     E_MBX_CLASS_INPUT          = 1,
230     /// MBX_CLASS_TSP
231     E_MBX_CLASS_TSP            = 2,
232     /// MBX_CLASS_CHANNEL
233     E_MBX_CLASS_CHANNEL        = 3,
234     /// MBX_CLASS_MEMORY
235     E_MBX_CLASS_MEMORY         = 4,
236     /// MBX_CLASS_MPEG
237     E_MBX_CLASS_MPEG           = 5,
238     /// MBX_CLASS_VIDEO
239     E_MBX_CLASS_VIDEO          = 6,
240     /// MBX_CLASS_AUDIO
241     E_MBX_CLASS_AUDIO          = 7,
242     /// MBX_CLASS_MHEG5_STATE
243     E_MBX_CLASS_MHEG5_STATE    = 8,
244     /// MBX_CLASS_MVF
245     E_MBX_CLASS_MVF            = 9,
246     /// MBX_CLASS_GE
247     E_MBX_CLASS_GE             = 10,
248     /// MBX_CLASS_CI
249     E_MBX_CLASS_CI            = 11,  //rename unused "MBX_CLASS_NUM" as "MBX_CLASS_CI" for CIMHEG usage
250     /// MBX_CLASS_TEST
251     E_MBX_CLASS_TEST           = 12,
252     /// MBX_CLASS_MAD
253     E_MBX_CLASS_MAD            = 13,
254 
255     /// MBX_CLASS_MPEG2_FS
256     E_MBX_CLASS_MPEG2_FS       = 14,
257     /// MBX_CLASS_MPEG2
258     E_MBX_CLASS_MPEG2          = 15,
259     /// MBX_CLASS_BMP
260     E_MBX_CLASS_BMP            = 16,
261     /// MBX_CLASS_PNG
262     E_MBX_CLASS_PNG            = 17,
263     /// MBX_CLASS_JPEG
264     E_MBX_CLASS_JPEG           = 18,
265     /// MBX_CLASS_MJPEG
266     E_MBX_CLASS_MJPEG          = 19,
267     /// MBX_CLASS_JPEG_ENCODER
268     E_MBX_CLASS_JPEG_ENCODER   = 20,
269     ///
270     E_MBX_CLASS_VDPLAYER_FS    = 21,
271     /// MBX_CLASS_VDPLAYER_FS
272     E_MBX_CLASS_VDPLAYER       = 22,
273     /// MBX_CLASS_RMPLAYER_FS
274     E_MBX_CLASS_RMPLAYER_FS    = 23,
275     /// MBX_CLASS_RMPLAYER
276     E_MBX_CLASS_RMPLAYER       = 24,
277     /// MBX_CLASS_TSPLAYER_FS
278     E_MBX_CLASS_TSPLAYER_FS    = 25,
279     /// MBX_CLASS_TSPLAYER
280     E_MBX_CLASS_TSPLAYER       = 26,
281     /// MBX_CLASS_LZSS
282     E_MBX_CLASS_LZSS           = 27,
283     /// MBX_CLASS_CAPE
284     E_MBX_CLASS_CAPE           = 28,
285     /// MBX_CLASS_CC
286     E_MBX_CLASS_CC             = 29,
287     /// MBX_CLASS_DLNA
288     E_MBX_CLASS_DLNA           = 30,
289     /// MBX_CLASS_DUMMY_LOOP
290     E_MBX_CLASS_DUMMY_LOOP     = 31,
291     /// MBX_CLASS_CHAKRA_SUBSYS
292     E_MBX_CLASS_CHAKRA_SUBSYS  = 32,
293     /// MBX_CLASS_FCNTL
294     E_MBX_CLASS_FCNTL          = 33,
295     /// MBX_CLASS_IRKEY
296     E_MBX_CLASS_IRKEY          = 34,
297     /// MBX_CLASS_BTPD
298     E_MBX_CLASS_BTPD           = 35,
299     /// MBX_CLASS_OBAMA_CMD
300     E_MBX_CLASS_OBAMA_CMD      = 36,
301     /// MBX_CLASS_OBAMA_APP
302     E_MBX_CLASS_OBAMA_APP      = 37,
303     /// MBX_CLASS_KTV
304     E_MBX_CLASS_KTV             = 38,
305     /// MBX_CLASS_CIPLUS
306     E_MBX_CLASS_CIPLUS         = 39,
307     /// MBX_CLASS_PRINT_MESSAGE
308     E_MBX_CLASS_PRINT_MESSAGE = 40,
309     /// MBX_CLASS_SHWFS
310     E_MBX_CLASS_SHWFS          = 41,
311     /// MBX_CLASS_AUTO_TEST
312     E_MBX_CLASS_AUTO_TEST = 42,
313     /// MBX_CLASS_STILLIMAGE_CMD_IO
314     E_MBX_CLASS_STILLIMAGE_CMD_IO = 43,
315     /// MBX_CLASS_STILLIMAGE_DATA_IO_FAST
316     E_MBX_CLASS_STILLIMAGE_DATA_IO_FAST = 44,
317     /// MBX_CLASS_MSTILLIMAGE_DATA_IO
318     E_MBX_CLASS_STILLIMAGE_DATA_IO = 45,
319     /// MBX_CLASS_NET_DEBUG
320     E_MBX_CLASS_NET_DEBUG = 46,
321     /// MBX_CLASS_PM_WAIT
322     E_MBX_CLASS_PM_WAIT        = 47,
323     /// MBX_CLASS_PM_NOWAIT
324     E_MBX_CLASS_PM_NOWAIT      = 48,
325     /// MBX_CLASS_IRKEY_NOWAIT
326     E_MBX_CLASS_IRKEY_NOWAIT   = 49,
327     /// MBX_CLASS_SAR
328     E_MBX_CLASS_SAR            = 50,
329     /// MBX_CLASS_SAR_NOWAIT
330     E_MBX_CLASS_SAR_NOWAIT     = 51,
331     /// MBX_CLASS_SECUREBOOT_WAIT
332     E_MBX_CLASS_SECURE_WAIT     = 52,
333     /// MBX_CLASS_SECUREBOOT_NOWAIT
334     E_MBX_CLASS_SECURE_NOWAIT     = 53,
335     /// MBX_CLASS_FRC
336     E_MBX_CLASS_FRC = 54,
337    //MBX_CLASS_PM_PWM_WAIT
338     E_MBX_CLASS_PM_PWM_WAIT= 55,
339     //MBX_CLASS_PM_PWM_NOWAIT
340     E_MBX_CLASS_PM_PWM_NOWAIT= 56,
341     //E_MBX_CLASS_DYNAMIC_ID
342     E_MBX_CLASS_DYNAMIC_ID     = 57,
343     //MBX_CLASS_QUERY_CLASS
344     E_MBX_CLASS_QUERY_CLASS = 58,
345      E_MBX_CLASS_CB_SECURE_WAIT =59,
346     E_MBX_CLASS_CB_SECURE_NOWAIT = 60,
347     //MBX_CLASS_CLEANBOOT_PNL_WAIT
348     E_MBX_CLASS_CB_PNL_WAIT= 61,
349     //MBX_CLASS_CLEANBOOT_PNL_NOWAIT
350     E_MBX_CLASS_CB_PNL_NOWAIT= 62,
351     E_MBX_CLASS_CB_LOGO_NOWAIT= 63,
352     E_MBX_CLASS_CB_MUSIC_NOWAIT= 64,
353     E_MBX_CLASS_CB_OSD_NOWAIT= 65,
354     E_MBX_CLASS_CB_HEARTBEAT_NOWAIT= 66,
355     E_MBX_CLASS_CB_CHECK_NOWAIT= 67,
356    /// Define the Number of Mail Class, It is very Import, must be at the end of the list!
357     //put the following two enum at the end of the list
358     E_MBX_CLASS_NUM,
359     /// The End NUmber of Max Class ID
360     E_MBX_CLASS_MAX = 0xFF
361 }MBX_Class;
362 
363 /// Mail Box Supported CPU ID Defins
364 typedef enum
365 {
366    /// CPU PM ID
367    E_MBX_CPU_PM = 0,
368    /// CPU AEON ID
369    E_MBX_CPU_AEON = 1,
370    /// CPU MIPS ID
371    E_MBX_CPU_MIPS = 2,
372    //  CPU  R2M (same as MIPS)
373    E_MBX_CPU_R2M = 2,
374    /// CPU MIPS VPE0 ID, T3 Only
375    E_MBX_CPU_MIPS_VPE0 = 2,
376    /// CPU MIPS VPE1 ID, T3 Only
377    E_MBX_CPU_MIPS_VPE1 = 3,
378    #if 1//frcr2_integration###
379    /// CPU  FRC-R2
380    E_MBX_CPU_R2FRC = 4,
381    #endif
382    E_MBX_CPU_MAX,
383 }MBX_CPU_ID;
384 
385 /// Mail Box Supported CPU ID Defins
386 typedef enum
387 {
388     /// House Keeping Identifier
389     E_MBX_ROLE_HK = 0,
390     /// Co-Processer Identifier
391     E_MBX_ROLE_CP = 1,
392     /// PM Identifier
393     E_MBX_ROLE_PM = 2,
394     E_MBX_ROLE_AEON = 3,
395      #if 1//frcr2_integration###
396     /// FRC
397     E_MBX_ROLE_FRC = 4,
398     #endif
399     E_MBX_ROLE_MAX
400 }MBX_ROLE_ID;
401 
402 /// Mail Message Class Type Defines
403 typedef enum
404 {
405     /// Normal Message Class Type
406     E_MBX_MSG_TYPE_NORMAL  = 0,
407     /// Instant Message Class Type
408     E_MBX_MSG_TYPE_INSTANT = 1
409 }MBX_MSG_Type;
410 
411 /// MB DDI return value
412 typedef enum
413 {
414     /// Success Call
415     E_MBX_SUCCESS                = 0,
416     /// Error: Not Initialized
417     E_MBX_ERR_NOT_INITIALIZED        = 1,
418     /// Error: No more Memory, Queue Memory Issue
419     E_MBX_ERR_NO_MORE_MEMORY         = 2,
420     /// Error: class has been used by other APP
421     E_MBX_ERR_SLOT_BUSY              = 3,
422     /// Error: class has been openned by this APP, you do not need to open it again
423     E_MBX_ERR_SLOT_AREADY_OPENNED    = 4,
424     /// Error: class not registered yet
425     E_MBX_ERR_SLOT_NOT_OPENNED       = 5,
426     /// Error: unknow cpu id
427     E_MBX_ERR_INVALID_CPU_ID         = 6,
428     /// Error: invalid parameter
429     E_MBX_ERR_INVALID_PARAM          = 7,
430     /// Error: peer cpu is peek Mail from Hardware, you can not send mail now
431     E_MBX_ERR_PEER_CPU_BUSY          = 8,
432     /// Error: peer cpu do not alive, Mail never peek out, Need check peer cpu is alive or not
433     E_MBX_ERR_PEER_CPU_NOT_ALIVE     = 9,
434     /// Error: peer cpu not initialized yet, not ready to receive mail message
435     E_MBX_ERR_PEER_CPU_NOTREADY = 10,
436     /// Error: peer cpu the dedicated class Overflow!
437     E_MBX_ERR_PEER_CPU_OVERFLOW = 11,
438     /// Error: the mail message has been fetched yet, there has no message in hardware
439     E_MBX_ERR_MSG_ALREADY_FETCHED = 12,
440     /// Error: time out with dedicated request
441     E_MBX_ERR_TIME_OUT               = 13,
442     /// Error: no mail message in message queue
443     E_MBX_ERR_NO_MORE_MSG            = 14,
444     /// Error: has mail message in queue when un-register mail class or DeInit MailBox Driver
445     E_MBX_ERR_HAS_MSG_PENDING        = 15,
446     /// Error: not implemente yet for request
447     E_MBX_ERR_NOT_IMPLEMENTED        = 16,
448     /// Error: unknow error, like system error
449     E_MBX_UNKNOW_ERROR           = 0xFFFF
450 } MBX_Result;
451 
452 //=============================================================================
453 // Structurs
454 
455 /// Mail Message Define
456 typedef struct  __attribute__((packed))
457 {
458     /// Role ID, for send, this is the Mail Target, for receive, this is the Source which sent this message
459     MBX_ROLE_ID      eRoleID;
460     /// Mail Message Type, Normal or Instant
461     MBX_MSG_Type     eMsgType;
462 
463     /// Ctrl Byte in Mail Message
464     MS_U8              u8Ctrl;
465     /// @ref MBX_Class
466     MS_U8              u8MsgClass; //should be MBX_Class, for alignment let it be S8, gcc default sizeof(enum) is 4 bytes.
467     /// Command Index defined by Apps
468     MS_U8              u8Index;
469     /// Parameter Count
470     MS_U8              u8ParameterCount;
471     /// Parameters, Max Number @ref MAX_MBX_PARAM_SIZE
472     MS_U8              u8Parameters[MAX_MBX_PARAM_SIZE];
473     /// Status 0 byte of Mail Message
474     MS_U8              u8S0;
475     /// Status 1 byte of Mail Message
476     MS_U8              u8S1;
477 }MBX_Msg;
478 
479 /// Mail Message Queue status
480 typedef struct  __attribute__((packed))
481 {
482     /// Mail message Queue status,
483     /// @ref MBX_STATUS_QUEUE_OVER_FLOW
484     /// @ref MBX_STATUS_QUEUE_HAS_INSTANT_MSG
485     /// @ref MBX_STATUS_QUEUE_HAS_NORMAL_MSG
486     MS_U32 status;
487     /// pended normal message count in class message queue
488     MS_U32 u32NormalMsgCount;
489     /// pended Instant message count in class message queue
490     MS_U32 u32InstantMsgCount;
491 }MBX_MSGQ_Status;
492 
493 /// MBX Driver Info
494 typedef struct  __attribute__((packed))
495 {
496     /// MBX HW Group Number
497     MS_U8 u8HWMBXGroupNum;
498 }MBX_DrvInfo;
499 
500 /// MBX Driver Status
501 typedef struct  __attribute__((packed))
502 {
503     /// MBX Driver is enabled or not
504     MS_BOOL bEnabled;
505     /// The reference Cnt with this driver:
506     MS_S32 s32RefCnt;
507 }MBX_DrvStatus;
508 
509 /// Type of Mail Message callback function Define
510 //typedef void (*MBX_QUEUE_STATUS_NOTIFY_FUNC)(MBX_Class eMsgClass, MBX_MSGQ_Status *pMsgQueueStatus);
511 typedef void (*MBX_MAIL_ARRIVE_NOTIFY_FUNC)( MBX_Msg *pMsg, MS_BOOL *pbAddToQueue);
512 
513 //-------------------------------------------------------------------------------------------------
514 /// MOBF Encrypt
515 /// @ingroup G_MBX_INIT
516 /// @param u32Key \b IN: Key
517 /// @param bEnable \b IN: TRUE/FLASE
518 /// @return DRVAESDMA_OK : Success
519 /// @return Others : Fail
520 //-------------------------------------------------------------------------------------------------
521 INTERFACE MBX_Result  MDrv_MBX_Init(MBX_CPU_ID eHKCPU, MBX_ROLE_ID eHostRole, MS_U32 u32TimeoutMillSecs);
522 //-------------------------------------------------------------------------------------------------
523 /// MOBF Encrypt
524 /// @ingroup G_MBX_INIT
525 /// @param u32Key \b IN: Key
526 /// @param bEnable \b IN: TRUE/FLASE
527 /// @return DRVAESDMA_OK : Success
528 /// @return Others : Fail
529 //-------------------------------------------------------------------------------------------------
530 INTERFACE MBX_Result  MDrv_MBX_DeInit(MS_BOOL bForceDiscardPendingMsg);
531 //-------------------------------------------------------------------------------------------------
532 /// MOBF Encrypt
533 /// @ingroup G_MBX_COMMON
534 /// @param u32Key \b IN: Key
535 /// @param bEnable \b IN: TRUE/FLASE
536 /// @return DRVAESDMA_OK : Success
537 /// @return Others : Fail
538 //-------------------------------------------------------------------------------------------------
539 INTERFACE MBX_Result  MDrv_MBX_RegisterMSG(MBX_Class eMsgClass, MS_U16 u16MsgQueueSize);
540 //INTERFACE MBX_Result  MDrv_MBX_RegisterMSGWithCallBack(MBX_Class eMsgClass, MS_U16 u16MsgQueueSize, MBX_QUEUE_STATUS_NOTIFY_FUNC notifier);
541 //-------------------------------------------------------------------------------------------------
542 /// MOBF Encrypt
543 /// @ingroup G_MBX_COMMON
544 /// @param u32Key \b IN: Key
545 /// @param bEnable \b IN: TRUE/FLASE
546 /// @return DRVAESDMA_OK : Success
547 /// @return Others : Fail
548 //-------------------------------------------------------------------------------------------------
549 INTERFACE MBX_Result  MDrv_MBX_RegisterMSGWithCallBack(MBX_Class eMsgClass, MS_U16 u16MsgQueueSize, MBX_MAIL_ARRIVE_NOTIFY_FUNC notifier);
550 //-------------------------------------------------------------------------------------------------
551 /// MOBF Encrypt
552 /// @ingroup G_MBX_COMMON
553 /// @param u32Key \b IN: Key
554 /// @param bEnable \b IN: TRUE/FLASE
555 /// @return DRVAESDMA_OK : Success
556 /// @return Others : Fail
557 //-------------------------------------------------------------------------------------------------
558 INTERFACE MBX_Result  MDrv_MBX_UnRegisterMSG(MBX_Class eMsgClass, MS_BOOL bForceDiscardMsgQueue);
559 //-------------------------------------------------------------------------------------------------
560 /// MOBF Encrypt
561 /// @ingroup G_MBX_COMMON
562 /// @param u32Key \b IN: Key
563 /// @param bEnable \b IN: TRUE/FLASE
564 /// @return DRVAESDMA_OK : Success
565 /// @return Others : Fail
566 //-------------------------------------------------------------------------------------------------
567 INTERFACE MBX_Result  MDrv_MBX_ClearMSG(MBX_Class eMsgClass);
568 //-------------------------------------------------------------------------------------------------
569 /// MOBF Encrypt
570 /// @ingroup G_MBX_CONTROL
571 /// @param u32Key \b IN: Key
572 /// @param bEnable \b IN: TRUE/FLASE
573 /// @return DRVAESDMA_OK : Success
574 /// @return Others : Fail
575 //-------------------------------------------------------------------------------------------------
576 INTERFACE MBX_Result  MDrv_MBX_SendMsg(MBX_Msg *pMsg);
577 //-------------------------------------------------------------------------------------------------
578 /// MOBF Encrypt
579 /// @ingroup G_MBX_CONTROL
580 /// @param u32Key \b IN: Key
581 /// @param bEnable \b IN: TRUE/FLASE
582 /// @return DRVAESDMA_OK : Success
583 /// @return Others : Fail
584 //-------------------------------------------------------------------------------------------------
585 INTERFACE MBX_Result  MDrv_MBX_GetMsgQueueStatus(MBX_Class eTargetClass, MBX_MSGQ_Status *pMsgQueueStatus);
586 //-------------------------------------------------------------------------------------------------
587 /// MOBF Encrypt
588 /// @ingroup G_MBX_CONTROL
589 /// @param u32Key \b IN: Key
590 /// @param bEnable \b IN: TRUE/FLASE
591 /// @return DRVAESDMA_OK : Success
592 /// @return Others : Fail
593 //-------------------------------------------------------------------------------------------------
594 INTERFACE MBX_Result  MDrv_MBX_RecvMsg(MBX_Class eTargetClass, MBX_Msg *pMsg, MS_U32 u32WaitMillSecs, MS_U32 u32Flag);
595 //-------------------------------------------------------------------------------------------------
596 /// MOBF Encrypt
597 /// @ingroup G_MBX_CONTROL
598 /// @param u32Key \b IN: Key
599 /// @param bEnable \b IN: TRUE/FLASE
600 /// @return DRVAESDMA_OK : Success
601 /// @return Others : Fail
602 //-------------------------------------------------------------------------------------------------
603 // INTERFACE MBX_Result  MDrv_MBX_CheckMsg(MBX_Class eTargetClass, MBX_Msg *pMsg, MS_U32 u32WaitMillSecs, MS_U32 u32Flag);
604 //-------------------------------------------------------------------------------------------------
605 /// MOBF Encrypt
606 /// @ingroup G_MBX_ToBeRemove
607 /// @param u32Key \b IN: Key
608 /// @param bEnable \b IN: TRUE/FLASE
609 /// @return DRVAESDMA_OK : Success
610 /// @return Others : Fail
611 //-------------------------------------------------------------------------------------------------
612 // INTERFACE MBX_Result  MDrv_MBX_SendMsgLoopback(MBX_Msg *pMsg, MBX_ROLE_ID eSrcRoleId);
613 //-------------------------------------------------------------------------------------------------
614 /// MOBF Encrypt
615 /// @ingroup G_MBX_CONTROL
616 /// @param u32Key \b IN: Key
617 /// @param bEnable \b IN: TRUE/FLASE
618 /// @return DRVAESDMA_OK : Success
619 /// @return Others : Fail
620 //-------------------------------------------------------------------------------------------------
621 INTERFACE MBX_Result  MDrv_MBX_Enable(MS_BOOL bEnable);//Enable receiving regisited messages in kernel
622 //-------------------------------------------------------------------------------------------------
623 /// MOBF Encrypt
624 /// @ingroup G_MBX_CONTROL
625 /// @param u32Key \b IN: Key
626 /// @param bEnable \b IN: TRUE/FLASE
627 /// @return DRVAESDMA_OK : Success
628 /// @return Others : Fail
629 //-------------------------------------------------------------------------------------------------
630 // INTERFACE MBX_Result  MDrv_MBX_RemoveLatestMsg(void);
631 //for FastBoot
632 //-------------------------------------------------------------------------------------------------
633 /// MOBF Encrypt
634 /// @ingroup G_MBX_COMMON
635 /// @param u32Key \b IN: Key
636 /// @param bEnable \b IN: TRUE/FLASE
637 /// @return DRVAESDMA_OK : Success
638 /// @return Others : Fail
639 //-------------------------------------------------------------------------------------------------
640 INTERFACE MS_U16 MDrv_MBX_SetPowerState(EN_POWER_MODE u16PowerState);
641 
642 // For Application Set/Get Information API:
643 //-------------------------------------------------------------------------------------------------
644 /// MOBF Encrypt
645 /// @ingroup G_MBX_COMMON
646 /// @param u32Key \b IN: Key
647 /// @param bEnable \b IN: TRUE/FLASE
648 /// @return DRVAESDMA_OK : Success
649 /// @return Others : Fail
650 //-------------------------------------------------------------------------------------------------
651 // INTERFACE MBX_Result  MDrv_MBX_SetInformation(MBX_ROLE_ID eTargetRole, MS_U8 *pU8Info, MS_U8 u8Size);
652 //-------------------------------------------------------------------------------------------------
653 /// MOBF Encrypt
654 /// @ingroup G_MBX_COMMON
655 /// @param u32Key \b IN: Key
656 /// @param bEnable \b IN: TRUE/FLASE
657 /// @return DRVAESDMA_OK : Success
658 /// @return Others : Fail
659 //-------------------------------------------------------------------------------------------------
660 // INTERFACE MBX_Result  MDrv_MBX_GetInformation(MBX_ROLE_ID eTargetRole, MS_U8 *pU8Info, MS_U8 u8Size);
661 
662 // For Debug & Version Control:
663 //-------------------------------------------------------------------------------------------------
664 /// MOBF Encrypt
665 /// @ingroup G_MBX_COMMON
666 /// @param u32Key \b IN: Key
667 /// @param bEnable \b IN: TRUE/FLASE
668 /// @return DRVAESDMA_OK : Success
669 /// @return Others : Fail
670 //-------------------------------------------------------------------------------------------------
671 INTERFACE void        MDrv_MBX_SetDbgLevel(MS_U8 u8DbgLevel);
672 //-------------------------------------------------------------------------------------------------
673 /// MOBF Encrypt
674 /// @ingroup G_MBX_COMMON
675 /// @param u32Key \b IN: Key
676 /// @param bEnable \b IN: TRUE/FLASE
677 /// @return DRVAESDMA_OK : Success
678 /// @return Others : Fail
679 //-------------------------------------------------------------------------------------------------
680 // INTERFACE MS_BOOL     MDrv_MBX_GetLibVer(const MSIF_Version **ppVersion);
681 //-------------------------------------------------------------------------------------------------
682 /// MOBF Encrypt
683 /// @ingroup G_MBX_COMMON
684 /// @param u32Key \b IN: Key
685 /// @param bEnable \b IN: TRUE/FLASE
686 /// @return DRVAESDMA_OK : Success
687 /// @return Others : Fail
688 //-------------------------------------------------------------------------------------------------
689 // INTERFACE MS_BOOL     MDrv_MBX_GetInfo(MBX_DrvInfo *pMbxDrvInfo);
690 //-------------------------------------------------------------------------------------------------
691 /// MOBF Encrypt
692 /// @ingroup G_MBX_COMMON
693 /// @param u32Key \b IN: Key
694 /// @param bEnable \b IN: TRUE/FLASE
695 /// @return DRVAESDMA_OK : Success
696 /// @return Others : Fail
697 //-------------------------------------------------------------------------------------------------
698 INTERFACE MS_BOOL     MDrv_MBX_GetStatus(MBX_DrvStatus *pMbxDrvStatus);
699 //-------------------------------------------------------------------------------------------------
700 /// MOBF Encrypt
701 /// @ingroup G_MBX_COMMON
702 /// @param u32Key \b IN: Key
703 /// @param bEnable \b IN: TRUE/FLASE
704 /// @return DRVAESDMA_OK : Success
705 /// @return Others : Fail
706 //-------------------------------------------------------------------------------------------------
707 // INTERFACE void        MDrv_MBX_SetCallDrvFlag(MS_BOOL bEnable);
708 //-------------------------------------------------------------------------------------------------
709 /// MOBF Encrypt
710 /// @ingroup G_MBX_ToBeRemove
711 /// @param u32Key \b IN: Key
712 /// @param bEnable \b IN: TRUE/FLASE
713 /// @return DRVAESDMA_OK : Success
714 /// @return Others : Fail
715 //-------------------------------------------------------------------------------------------------
716 // INTERFACE MS_BOOL     MDrv_MBX_GetCallDrvFlag(void);
717 
718 #undef INTERFACE
719 
720 
721 #ifdef __cplusplus
722 }
723 #endif
724 
725 #endif //_DRV_MBX_H
726 
727