1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - WM - libraries
3 File: wm_arm9_private.h
4
5 Copyright 2003-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-11-19#$
14 $Rev: 9342 $
15 $Author: okajima_manabu $
16 *---------------------------------------------------------------------------*/
17
18 #ifndef LIBRARIES_WM_ARM9_WM_ARM9_PRIVATE_H__
19 #define LIBRARIES_WM_ARM9_WM_ARM9_PRIVATE_H__
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 /*===========================================================================*/
26
27 #include "wm_private.h"
28
29
30 /*---------------------------------------------------------------------------*
31 Constant Definitions
32 *---------------------------------------------------------------------------*/
33 #define WM_GET_ALLOWED_CHANNEL_BEFORE_INIT 0x8000
34
35
36 /*---------------------------------------------------------------------------*
37 Macro Definitions
38 *---------------------------------------------------------------------------*/
39 #define WM_CHECK_RESULT( res ) \
40 if( ( res ) != WM_ERRCODE_SUCCESS ) \
41 { \
42 return ( res ); \
43 }
44
45
46 #ifdef WM_DEBUG_DATASHARING
47 #define WM_DPRINTF_DATASHARING WMi_Printf
48 #else
49 #define WM_DPRINTF_DATASHARING(...) ((void) 0)
50 #endif
51 #ifdef WM_DEBUG_CALLBACK
52 #define WM_DPRINTF_CALLBACK WMi_Printf
53 #else
54 #define WM_DPRINTF_CALLBACK(...) ((void) 0)
55 #endif
56 #ifdef WM_DEBUG_AIDBITMAP
57 #define WM_DPRINTF_AIDBITMAP WMi_Printf
58 #else
59 #define WM_DPRINTF_AIDBITMAP(...) ((void) 0)
60 #endif
61
62
63 #define WMi_LOG(cat, msg) \
64 do { s32 _SDK_WM_vcount = GX_GetVCount(); (void)WMi_Printf( "%02x:%03d| " cat msg "\n", ((OS_GetVBlankCount()+(_SDK_WM_vcount<192))&0xff), _SDK_WM_vcount );} while ( FALSE )
65
66 #define WMi_LOGF(cat, msg, ...) \
67 do { s32 _SDK_WM_vcount = GX_GetVCount(); (void)WMi_Printf( "%02x:%03d| " cat msg "\n", ((OS_GetVBlankCount()+(_SDK_WM_vcount<192))&0xff), _SDK_WM_vcount, __VA_ARGS__ );} while ( FALSE )
68
69 #define WM_LOG(msg) WMi_LOG("", msg)
70 #define WM_LOGF(msg, ...) WMi_LOGF("", msg, __VA_ARGS__)
71
72 #ifdef WM_DEBUG
73 #define WM_DLOG WM_LOG
74 #define WM_DLOGF WM_LOGF
75 #else
76 #define WM_DLOG(...) ((void) 0)
77 #define WM_DLOGF(...) ((void) 0)
78 #endif
79 #ifdef WM_DEBUG_DATASHARING
80 #define WM_DLOG_DATASHARING(msg) WMi_LOG("[DS]", msg);
81 #define WM_DLOGF_DATASHARING(msg, ...) WMi_LOGF("[DS]", msg, __VA_ARGS__);
82 #else
83 #define WM_DLOG_DATASHARING(...) ((void) 0)
84 #define WM_DLOGF_DATASHARING(...) ((void) 0)
85 #endif
86 #ifdef WM_DEBUG_CALLBACK
87 #define WM_DLOG_CALLBACK WM_LOG
88 #define WM_DLOGF_CALLBACK WM_LOGF
89 #define WM_DLOGF2_CALLBACK(from, msg, ...) \
90 do { s32 _SDK_WM_vcount = GX_GetVCount(); (void)WMi_Printf( "%02x:%03d-%03d| " msg "\n", ((OS_GetVBlankCount()+(_SDK_WM_vcount<192))&0xff), from, _SDK_WM_vcount, __VA_ARGS__ );} while ( FALSE )
91 // ((void) ( WMi_Printf( "%02x:%03d-%03d| " msg "\n", ((OS_GetVBlankCount()+(GX_GetVCount()<192))&0xff), from, GX_GetVCount(), __VA_ARGS__) ))
92 #else
93 #define WM_DLOG_CALLBACK(...) ((void) 0)
94 #define WM_DLOGF_CALLBACK(...) ((void) 0)
95 #define WM_DLOGF2_CALLBACK(...) ((void) 0)
96 #endif
97 #ifdef WM_DEBUG_AIDBITMAP
98 #define WM_DLOG_AIDBITMAP(msg) WMi_LOG("[AID]", msg);
99 #define WM_DLOGF_AIDBITMAP(msg, ...) WMi_LOGF("[AID]", msg, __VA_ARGS__);
100 #else
101 #define WM_DLOG_AIDBITMAP(...) ((void) 0)
102 #define WM_DLOGF_AIDBITMAP(...) ((void) 0)
103 #endif
104
105
106 /*---------------------------------------------------------------------------*
107 Private Function Prototypes
108 *---------------------------------------------------------------------------*/
109 void WMi_SetCallbackTable(WMApiid id, WMCallbackFunc callback);
110 WMErrCode WMi_SendCommand(WMApiid id, u16 paramNum, ...);
111 WMErrCode WMi_SendCommandDirect(void *data, u32 length);
112 WMArm9Buf *WMi_GetSystemWork(void);
113 WMErrCode WMi_CheckStateEx(s32 paramNum, ...);
114 WMErrCode WMi_CheckInitialized(void);
115 WMErrCode WMi_CheckIdle(void);
116 WMErrCode WMi_StartMP(WMCallbackFunc callback,
117 u16 *recvBuf,
118 u16 recvBufSize, u16 *sendBuf, u16 sendBufSize, WMMPTmpParam* tmpParam);
119
120 void WMi_RegisterSleepCallback(void);
121 void WMi_DeleteSleepCallback(void);
122
123 #ifdef SDK_TWL
124 BOOL WMi_CheckEnableFlag(void);
125 #endif
126
127 /*---------------------------------------------------------------------------*
128 Inline Function Definitions
129 *---------------------------------------------------------------------------*/
WMi_CheckState(u32 state)130 static inline WMErrCode WMi_CheckState(u32 state)
131 {
132 return WMi_CheckStateEx(1, state);
133 }
134
135
136 /*===========================================================================*/
137
138 #ifdef __cplusplus
139 } /* extern "C" */
140 #endif
141
142 #endif /* LIBRARIES_WM_ARM9_WM_ARM9_PRIVATE_H__ */
143
144 /*---------------------------------------------------------------------------*
145 End of file
146 *---------------------------------------------------------------------------*/
147