1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - MB - demos - cloneboot
3 File: common.h
4
5 Copyright 2006-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 #ifndef MB_DEMO_COMMON_H_
18 #define MB_DEMO_COMMON_H_
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #include <nitro.h>
25
26 //============================================================================
27 // Function Declarations
28 //============================================================================
29
30
31 /*
32 * This function is called NitroMain() on the multiboot-Model parent.
33 * It is called in this sample when MB_IsMultiBootChild() == FALSE.
34 */
35 void ParentMain(void);
36
37 /*
38 * This function is called NitroMain() on the multiboot-Model child.
39 * It is called in this sample when MB_IsMultiBootChild() == TRUE.
40 */
41 void ChildMain(void);
42
43 /*
44 * This function is located in the .parent section (an area reserved for the parent device).
45 * It simply calls the ParentMain function.
46 */
47 void ParentIdentifier(void);
48
49 /* Everything else is identical to the multiboot-model. */
50
51 void CommonInit();
52 void ReadKey(void);
53 u16 GetPressKey(void);
54 u16 GetTrigKey(void);
55 void InitAllocateSystem(void);
56
57 /*---------------------------------------------------------------------------*
58 Name: IS_PAD_PRESS
59
60 Description: Key determination
61
62 Arguments: Key flag to determine
63
64 Returns: TRUE if specified key is held down
65 Otherwise, FALSE
66 *---------------------------------------------------------------------------*/
IS_PAD_PRESS(u16 flag)67 static inline BOOL IS_PAD_PRESS(u16 flag)
68 {
69 return (GetPressKey() & flag) == flag;
70 }
71
72 /*---------------------------------------------------------------------------*
73 Name: IS_PAD_TRIGGER
74
75 Description: Determines key trigger
76
77 Arguments: Key flag to determine
78
79 Returns: If specified key trigger is enabled, TRUE
80 Otherwise, FALSE
81 *---------------------------------------------------------------------------*/
IS_PAD_TRIGGER(u16 flag)82 static inline BOOL IS_PAD_TRIGGER(u16 flag)
83 {
84 return (GetTrigKey() & flag) == flag;
85 }
86
87
88 #ifdef __cplusplus
89 }/* extern "C" */
90 #endif
91
92 #endif // MB_DEMO_COMMON_H_
93