1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MB - demos - multiboot-wfs - common
3   File:     common.h
4 
5   Copyright 2005-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: 8575 $
15   $Author: nishimoto_takashi $
16  *---------------------------------------------------------------------------*/
17 #ifndef __NITROSDK_DEMO_MB_MULTIBOOT_WFS_COMMON_H
18 #define __NITROSDK_DEMO_MB_MULTIBOOT_WFS_COMMON_H
19 
20 
21 #ifdef SDK_TWL
22 #include	<twl.h>
23 #else
24 #include	<nitro.h>
25 #endif
26 #include "util.h"
27 
28 
29 /******************************************************************************/
30 /* Constants */
31 
32 /* Wireless communication parameters */
33 #define		WC_PARENT_DATA_SIZE_MAX		128
34 #define		WC_CHILD_DATA_SIZE_MAX		256
35 
36 #if	!defined(SDK_MAKEGGID_SYSTEM)
37 #define SDK_MAKEGGID_SYSTEM(num)    (0x003FFF00 | (num))
38 #endif
39 #define GGID_WBT_FS                 SDK_MAKEGGID_SYSTEM(0x23)
40 
41 extern const WMParentParam def_parent_param[1];
42 
43 
44 /* Communication settings for WFS */
45 #define	port_wbt            5
46 #define	parent_packet_max   WC_PARENT_DATA_SIZE_MAX
47 
48 
49 /* Screen transition mode */
50 enum
51 {
52     MODE_SELECT,                       /* Select start options */
53     MODE_ERROR,                        /* Stop due to error */
54     MODE_BUSY,                         /* Startup processing under way */
55     MODE_PARENT,                       /* Parent processing under way */
56     MODE_CHILD,                        /* Child processing under way */
57     MODE_MAX
58 };
59 
60 
61 /******************************************************************************/
62 /* Functions */
63 
64 #if	defined(__cplusplus)
65 extern  "C"
66 {
67 #endif
68 
69 /*---------------------------------------------------------------------------*
70   Name:         StateCallbackForWFS
71 
72   Description:  WFS callback function.
73                 This is called when the state became WFS_STATE_READY.
74                 The WFS_GetStatus function can be used at any position to make a determination without receiving notification with this callback.
75 
76 
77   Arguments:    arg       User-defined argument specified in the callback.
78 
79   Returns:      None.
80  *---------------------------------------------------------------------------*/
81     void    StateCallbackForWFS(void *arg);
82 
83 /*---------------------------------------------------------------------------*
84   Name:         AllocatorForWFS
85 
86   Description:  Dynamic allocation function for memory specified in WFS.
87 
88   Arguments:    arg       User-defined argument specified in the allocator.
89                 size      Required size if requesting memory allocation.
90                 ptr       If NULL, allocates memory. Otherwise, requests deallocation.
91 
92   Returns:      If ptr is NULL, the amount of memory in size is allocated and its pointer returned.
93                 If not, the ptr memory is released.
94                 If deallocation, the return value is simply ignored.
95  *---------------------------------------------------------------------------*/
96     void   *AllocatorForWFS(void *arg, u32 size, void *ptr);
97 
98 /*---------------------------------------------------------------------------*
99   Name:         WHCallbackForWFS
100 
101   Description:  Callback that receives status notification from the WC's wireless automatic drive.
102 
103   Arguments:    arg       Callback pointer for the notification source WM function.
104 
105   Returns:      None.
106  *---------------------------------------------------------------------------*/
107     void    WHCallbackForWFS(void *arg);
108 
109 /*---------------------------------------------------------------------------*
110   Name:         InitFrameLoop
111 
112   Description:  Initialization for game frame loop.
113 
114   Arguments:    p_key           Key information structure to initialize.
115 
116   Returns:      None.
117  *---------------------------------------------------------------------------*/
118     void    InitFrameLoop(KeyInfo * p_key);
119 
120 /*---------------------------------------------------------------------------*
121   Name:         WaitForNextFrame
122 
123   Description:  Wait until next rendering frame.
124 
125   Arguments:    p_key           Key information structure to update.
126 
127   Returns:      None.
128  *---------------------------------------------------------------------------*/
129     void    WaitForNextFrame(KeyInfo * p_key);
130 
131 /*---------------------------------------------------------------------------*
132   Name:         ModeInitialize
133 
134   Description:  Initializes the wireless module.
135 
136   Arguments:    None.
137 
138   Returns:      None.
139  *---------------------------------------------------------------------------*/
140     void    ModeInitialize(void);
141 
142 /*---------------------------------------------------------------------------*
143   Name:         ModeError
144 
145   Description:  Processing in error display screen.
146 
147   Arguments:    None.
148 
149   Returns:      None.
150  *---------------------------------------------------------------------------*/
151     void    ModeError(void);
152 
153 /*---------------------------------------------------------------------------*
154   Name:         ModeWorking
155 
156   Description:  Processing in busy screen.
157 
158   Arguments:    None.
159 
160   Returns:      None.
161  *---------------------------------------------------------------------------*/
162     void    ModeWorking(void);
163 
164 /*---------------------------------------------------------------------------*
165   Name:         ModeSelect
166 
167   Description:  Process in parent/child selection screen.
168 
169   Arguments:    None.
170 
171   Returns:      None.
172  *---------------------------------------------------------------------------*/
173     void    ModeSelect(void);
174 
175 /*---------------------------------------------------------------------------*
176   Name:         ModeMultiboot
177 
178   Description:  DS Single-Card play parent processing.
179 
180   Arguments:    None.
181 
182   Returns:      None.
183  *---------------------------------------------------------------------------*/
184     void    ModeMultiboot(void);
185 
186 /*---------------------------------------------------------------------------*
187   Name:         ModeParent
188 
189   Description:  Processing in parent communication screen.
190 
191   Arguments:    None.
192 
193   Returns:      None.
194  *---------------------------------------------------------------------------*/
195     void    ModeParent(void);
196 
197 /*---------------------------------------------------------------------------*
198   Name:         ModeChild
199 
200   Description:  Child communication screen.
201 
202   Arguments:    None.
203 
204   Returns:      None.
205  *---------------------------------------------------------------------------*/
206     void    ModeChild(void);
207 
208 
209 #if	defined(__cplusplus)
210 }                                      /* extern "C" */
211 #endif
212 
213 
214 /******************************************************************************/
215 
216 
217 #endif                                 /* __NITROSDK_DEMO_WBT_WBT_FS_COMMON_H */
218