1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MB - include
3   File:     mb_wm.h
4 
5   Copyright 2007-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef _MB_WM_H_
19 #define _MB_WM_H_
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <nitro/types.h>
26 #include <nitro/mb.h>
27 #include <nitro/wm.h>
28 
29 /*
30   MB_CALLBACK_CONNECT_FAILED
31   MB_CALLBACK_CONNECTED_TO_PARENT
32   MB_CALLBACK_DISCONNECTED_FROM_PARENT
33   MB_CALLBACK_MP_SEND_ENABLE,
34   MB_CALLBACK_MP_CHILD_RECV,
35   MB_CALLBACK_MP_CHILD_SENT,
36   MB_CALLBACK_MP_CHILD_SENT_TIMEOUT,
37   MB_CALLBACK_MP_CHILD_SENT_ERR,
38   MB_CALLBACK_API_ERROR,
39   MB_CALLBACK_ERROR
40 */
41 /* Format of functions used for MB callbacks */
42 typedef void (*MBWMCallbackFunc) (u16 type, void *arg);
43 
44 
45 
46 typedef struct
47 {
48     MBWMCallbackFunc mpCallback;
49     u32    *sendBuf;
50     u32    *recvBuf;
51     BOOL    start_mp_busy;
52     u16     sendBufSize;               // Size of send buffer
53     u16     recvBufSize;               // Size of receive buffer
54     u16     pSendLen;                  // Child receive size in one MP
55     u16     pRecvLen;                  // Parent receive size in one MP
56     u16     blockSizeMax;              //
57     u16     mpStarted;                 // Flag indicating that MP has started
58     u16     endReq;                    // End request
59     u16     child_bitmap;              // Child connection state
60     u16     mpBusy;                    // MP sending (busy) flag
61     u8      _padding[2];
62 }
63 MBWMWork;
64 
65 void    MBi_WMSetBuffer(void *buf);
66 void    MBi_WMSetCallback(MBWMCallbackFunc callback);
67 void    MBi_WMStartConnect(WMBssDesc *bssDesc);
68 void    MBi_ChildStartMP(u16 *sendBuf, u16 *recvBuf);
69 WMErrCode MBi_MPSendToParent(u32 body_len, u16 pollbmp, u32 *sendbuf);
70 void    MBi_WMDisconnect(void);
71 void    MBi_WMReset(void);
72 void    MBi_WMClearCallback(void);
73 
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif /*  _MB_WM_H_    */
80