1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - MI - include
3   File:     wram.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-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16 
17  *---------------------------------------------------------------------------*/
18 
19 #ifndef NITRO_MI_WRAM_H_
20 #define NITRO_MI_WRAM_H_
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #ifdef SDK_NITRO
27 #include <nitro/ioreg.h>
28 #else
29 #include <twl/ioreg.h>
30 #endif
31 
32 //----------------------------------------------------------------
33 //    enum definition
34 //
35 #ifdef SDK_ARM9
36 typedef enum
37 {
38     MI_WRAM_ARM9_ALL = 0 << REG_GX_VRAMCNT_WRAM_BANK_SHIFT,
39     MI_WRAM_1616_1 = 1 << REG_GX_VRAMCNT_WRAM_BANK_SHIFT,
40     MI_WRAM_1616_2 = 2 << REG_GX_VRAMCNT_WRAM_BANK_SHIFT,
41     MI_WRAM_ARM7_ALL = 3 << REG_GX_VRAMCNT_WRAM_BANK_SHIFT
42 }
43 MIWram;
44 #else  // SDK_ARM9
45 typedef enum
46 {
47     MI_WRAM_ARM9_ALL = (REG_MI_WVRAMSTAT_WRAM_1_MASK | REG_MI_WVRAMSTAT_WRAM_0_MASK),
48     MI_WRAM_1616_1 = (REG_MI_WVRAMSTAT_WRAM_0_MASK),
49     MI_WRAM_1616_2 = (REG_MI_WVRAMSTAT_WRAM_1_MASK),
50     MI_WRAM_ARM7_ALL = 0
51 }
52 MIWram;
53 #endif // SDK_ARM9
54 
55 
56 /*---------------------------------------------------------------------------*
57   Name:         MI_SetWramBank
58 
59   Description:  set common-Wram bank status
60 
61   Arguments:    cnt      status of common-Wram.
62                    MI_WRAM_ARM9_ALL :  allocate all blocks for ARM9
63                    MI_WRAM_1616_1   :  allocate block1 for ARM9, block for ARM7
64                    MI_WRAM_1616_2   :  allocate block0 for ARM9, block for ARM7
65                    MI_WRAM_ARM7_ALL :  allocate all blocks for ARM7
66 
67   Returns:      None.
68 
69       *Notice: only ARM9 can set common-Wram status.
70                ARM7 can read only.
71  *---------------------------------------------------------------------------*/
72 #ifdef SDK_ARM9
73 void    MI_SetWramBank(MIWram cnt);
74 #endif
75 
76 /*---------------------------------------------------------------------------*
77   Name:         MI_GetWramBank
78 
79   Description:  get common-Wram bank status
80 
81   Arguments:    None.
82 
83   Returns:      status of common-Wram.
84                    MI_WRAM_ARM9_ALL :  allocate all blocks for ARM9
85                    MI_WRAM_1616_1   :  allocate block1 for ARM9, block for ARM7
86                    MI_WRAM_1616_2   :  allocate block0 for ARM9, block for ARM7
87                    MI_WRAM_ARM7_ALL :  allocate all blocks for ARM7
88  *---------------------------------------------------------------------------*/
89 MIWram  MI_GetWramBank(void);
90 
91 
92 
93 #ifdef __cplusplus
94 } /* extern "C" */
95 #endif
96 
97 /* NITRO_MI_WRAM_H_ */
98 #endif
99