1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - GX -
3   File:     gxstate.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 #ifndef NITRO_GXSTATE_H_
19 #define NITRO_GXSTATE_H_
20 
21 #include <nitro/gx/gx.h>
22 #include <nitro/gx/gx_vramcnt.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct
29 {
30     u16     lcdc;
31     u16     bg;
32     u16     obj;
33     u16     arm7;
34     u16     tex;
35     u16     texPltt;
36     u16     clrImg;
37     u16     bgExtPltt;
38     u16     objExtPltt;
39 
40     u16     sub_bg;
41     u16     sub_obj;
42     u16     sub_bgExtPltt;
43     u16     sub_objExtPltt;
44 }
45 GX_VRAMCnt_;
46 
47 
48 typedef struct
49 {
50     GX_VRAMCnt_ vramCnt;
51 }
52 GX_State;
53 
54 extern GX_State gGXState;
55 
56 void    GX_InitGXState();
57 
58 #ifdef SDK_DEBUG
59 void    GX_StateCheck_VRAMCnt_();
60 void    GX_RegionCheck_BG_(u32 first, u32 last);
61 void    GX_RegionCheck_OBJ_(u32 first, u32 last);
62 void    GX_RegionCheck_SubBG_(u32 first, u32 last);
63 void    GX_RegionCheck_SubOBJ_(u32 first, u32 last);
64 void    GX_RegionCheck_Tex_(GXVRamTex tex, u32 first, u32 last);
65 void    GX_RegionCheck_TexPltt_(GXVRamTexPltt texPltt, u32 first, u32 last);
66 #endif
67 
68 #ifdef SDK_DEBUG
GX_StateCheck_VRAMCnt()69 static inline void GX_StateCheck_VRAMCnt()
70 {
71     GX_StateCheck_VRAMCnt_();
72 }
73 
GX_RegionCheck_BG(u32 first,u32 last)74 static inline void GX_RegionCheck_BG(u32 first, u32 last)
75 {
76     GX_RegionCheck_BG_(first, last);
77 }
78 
GX_RegionCheck_OBJ(u32 first,u32 last)79 static inline void GX_RegionCheck_OBJ(u32 first, u32 last)
80 {
81     GX_RegionCheck_OBJ_(first, last);
82 }
83 
GX_RegionCheck_SubBG(u32 first,u32 last)84 static inline void GX_RegionCheck_SubBG(u32 first, u32 last)
85 {
86     GX_RegionCheck_SubBG_(first, last);
87 }
88 
GX_RegionCheck_SubOBJ(u32 first,u32 last)89 static inline void GX_RegionCheck_SubOBJ(u32 first, u32 last)
90 {
91     GX_RegionCheck_SubOBJ_(first, last);
92 }
93 
GX_RegionCheck_Tex(GXVRamTex tex,u32 first,u32 last)94 static inline void GX_RegionCheck_Tex(GXVRamTex tex, u32 first, u32 last)
95 {
96     GX_RegionCheck_Tex_(tex, first, last);
97 }
98 
GX_RegionCheck_TexPltt(GXVRamTexPltt texPltt,u32 first,u32 last)99 static inline void GX_RegionCheck_TexPltt(GXVRamTexPltt texPltt, u32 first, u32 last)
100 {
101     GX_RegionCheck_TexPltt_(texPltt, first, last);
102 }
103 
104 #else
GX_StateCheck_VRAMCnt()105 static inline void GX_StateCheck_VRAMCnt()
106 {
107 }
GX_RegionCheck_BG(u32,u32)108 static inline void GX_RegionCheck_BG(u32, u32)
109 {
110 }
GX_RegionCheck_OBJ(u32,u32)111 static inline void GX_RegionCheck_OBJ(u32, u32)
112 {
113 }
GX_RegionCheck_SubBG(u32,u32)114 static inline void GX_RegionCheck_SubBG(u32, u32)
115 {
116 }
GX_RegionCheck_SubOBJ(u32,u32)117 static inline void GX_RegionCheck_SubOBJ(u32, u32)
118 {
119 }
GX_RegionCheck_Tex(GXVRamTex,u32,u32)120 static inline void GX_RegionCheck_Tex(GXVRamTex, u32, u32)
121 {
122 }
GX_RegionCheck_TexPltt(GXVRamTexPltt,u32,u32)123 static inline void GX_RegionCheck_TexPltt(GXVRamTexPltt, u32, u32)
124 {
125 }
126 #endif
127 
128 
129 #ifdef __cplusplus
130 } /* extern "C" */
131 #endif
132 
133 #endif
134