1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - MB - demos - multiboot-wfs - parent
3 File: main.c
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-12-08#$
14 $Rev: 9555 $
15 $Author: kitase_hirotake $
16 *---------------------------------------------------------------------------*/
17
18
19 /*---------------------------------------------------------------------------*
20 This sample program runs the WBT library so that wireless multiboot children can use a file system
21
22
23 HOWTO:
24 1. To start communications as a parent, press the A button.
25 When a child is found in the surrounding area with the same multiboot-wfs demo, communication automatically begins.
26 Communication with up to 15 children is possible at the same time.
27 2. For information on various features while connected, refer to the parent and child screens as well as comments in the source code.
28
29 *---------------------------------------------------------------------------*/
30
31
32 #ifdef SDK_TWL
33 #include <twl.h>
34 #else
35 #include <nitro.h>
36 #endif
37 #include <nitro/wm.h>
38 #include <nitro/wbt.h>
39 #include <nitro/fs.h>
40
41 #include "mbp.h"
42 #include "wfs.h"
43 #include "wh.h"
44
45 #include "util.h"
46 #include "common.h"
47
48
49 /*---------------------------------------------------------------------------*
50 Function Definitions
51 *---------------------------------------------------------------------------*/
52
53
54 /*---------------------------------------------------------------------------*
55 Name: NitroMain
56
57 Description: Initialization and main loop.
58
59 Arguments: None.
60
61 Returns: None.
62 *---------------------------------------------------------------------------*/
NitroMain(void)63 void NitroMain(void)
64 {
65 /* Initialize render framework for sample */
66 UTIL_Init();
67
68 /*
69 * Initialize the file system.
70 * As a parent, you can also specify the valid DMA channels.
71 * As a child, this will not be used and is simply ignored.
72 */
73 FS_Init(FS_DMA_NOT_USE);
74
75 /* LCD display start */
76 GX_DispOn();
77 GXS_DispOn();
78
79 /* State transition main loop */
80 for (;;)
81 {
82 /* If previous WFS is already running, stop it once. */
83 if (WFS_GetStatus() != WFS_STATE_STOP)
84 {
85 WFS_End();
86 (void)WH_End();
87 while (WH_GetSystemState() != WH_SYSSTATE_STOP) {}
88 }
89
90 /* Start DS download play */
91 ModeMultiboot();
92
93 /* Initialize the WH module */
94 ModeInitialize();
95 /* Wait until parent termination is complete */
96 ModeWorking();
97
98 /* Set the mode and start the parent */
99 ModeSelect();
100 /* Wait until parent termination is complete */
101 ModeWorking();
102
103 /* If started, display parent screen */
104 ModeParent();
105
106 /* If there is an error, stop here */
107 ModeError();
108 }
109 }
110
111 /*---------------------------------------------------------------------------*
112 End of file
113 *---------------------------------------------------------------------------*/
114