| 1 | /* |
| 2 | Copyright (C) 2003 Rice1964 |
| 3 | |
| 4 | This program is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU General Public License |
| 6 | as published by the Free Software Foundation; either version 2 |
| 7 | of the License, or (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program; if not, write to the Free Software |
| 16 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | |
| 18 | */ |
| 19 | |
| 20 | #ifndef _UCODE_DEFS_H_ |
| 21 | #define _UCODE_DEFS_H_ |
| 22 | |
| 23 | typedef struct { |
| 24 | union { |
| 25 | unsigned int w0; |
| 26 | struct { |
| 27 | unsigned int arg0:24; |
| 28 | unsigned int cmd:8; |
| 29 | }; |
| 30 | }; |
| 31 | unsigned int w1; |
| 32 | } Gwords; |
| 33 | |
| 34 | typedef struct { |
| 35 | unsigned int w0; |
| 36 | unsigned int v2:8; |
| 37 | unsigned int v1:8; |
| 38 | unsigned int v0:8; |
| 39 | unsigned int flag:8; |
| 40 | } GGBI0_Tri1; |
| 41 | |
| 42 | typedef struct { |
| 43 | unsigned int v0:8; |
| 44 | unsigned int v1:8; |
| 45 | unsigned int v2:8; |
| 46 | unsigned int cmd:8; |
| 47 | unsigned int pad:24; |
| 48 | unsigned int flag:8; |
| 49 | } GGBI2_Tri1; |
| 50 | |
| 51 | typedef struct { |
| 52 | unsigned int :1; |
| 53 | unsigned int v3:7; |
| 54 | unsigned int :1; |
| 55 | unsigned int v4:7; |
| 56 | unsigned int :1; |
| 57 | unsigned int v5:7; |
| 58 | unsigned int cmd:8; |
| 59 | unsigned int :1; |
| 60 | unsigned int v0:7; |
| 61 | unsigned int :1; |
| 62 | unsigned int v1:7; |
| 63 | unsigned int :1; |
| 64 | unsigned int v2:7; |
| 65 | unsigned int flag:8; |
| 66 | } GGBI2_Tri2; |
| 67 | |
| 68 | typedef struct { |
| 69 | unsigned int w0; |
| 70 | unsigned int v2:8; |
| 71 | unsigned int v1:8; |
| 72 | unsigned int v0:8; |
| 73 | unsigned int v3:8; |
| 74 | } GGBI0_Ln3DTri2; |
| 75 | |
| 76 | typedef struct { |
| 77 | unsigned int v5:8; |
| 78 | unsigned int v4:8; |
| 79 | unsigned int v3:8; |
| 80 | unsigned int cmd:8; |
| 81 | |
| 82 | unsigned int v2:8; |
| 83 | unsigned int v1:8; |
| 84 | unsigned int v0:8; |
| 85 | unsigned int flag:8; |
| 86 | } GGBI1_Tri2; |
| 87 | |
| 88 | typedef struct { |
| 89 | unsigned int v3:8; |
| 90 | unsigned int v4:8; |
| 91 | unsigned int v5:8; |
| 92 | unsigned int cmd:8; |
| 93 | |
| 94 | unsigned int v0:8; |
| 95 | unsigned int v1:8; |
| 96 | unsigned int v2:8; |
| 97 | unsigned int flag:8; |
| 98 | } GGBI2_Line3D; |
| 99 | |
| 100 | typedef struct { |
| 101 | unsigned int len:16; |
| 102 | unsigned int v0:4; |
| 103 | unsigned int n:4; |
| 104 | unsigned int cmd:8; |
| 105 | unsigned int addr; |
| 106 | } GGBI0_Vtx; |
| 107 | |
| 108 | typedef struct { |
| 109 | unsigned int len:10; |
| 110 | unsigned int n:6; |
| 111 | unsigned int :1; |
| 112 | unsigned int v0:7; |
| 113 | unsigned int cmd:8; |
| 114 | unsigned int addr; |
| 115 | } GGBI1_Vtx; |
| 116 | |
| 117 | typedef struct { |
| 118 | unsigned int vend:8; |
| 119 | unsigned int :4; |
| 120 | unsigned int n:8; |
| 121 | unsigned int :4; |
| 122 | unsigned int cmd:8; |
| 123 | unsigned int addr; |
| 124 | } GGBI2_Vtx; |
| 125 | |
| 126 | typedef struct { |
| 127 | unsigned int width:12; |
| 128 | unsigned int :7; |
| 129 | unsigned int siz:2; |
| 130 | unsigned int fmt:3; |
| 131 | unsigned int cmd:8; |
| 132 | unsigned int addr; |
| 133 | } GSetImg; |
| 134 | |
| 135 | typedef struct { |
| 136 | unsigned int prim_level:8; |
| 137 | unsigned int prim_min_level:8; |
| 138 | unsigned int pad:8; |
| 139 | unsigned int cmd:8; |
| 140 | |
| 141 | union { |
| 142 | unsigned int color; |
| 143 | struct { |
| 144 | unsigned int fillcolor:16; |
| 145 | unsigned int fillcolor2:16; |
| 146 | }; |
| 147 | struct { |
| 148 | unsigned int a:8; |
| 149 | unsigned int b:8; |
| 150 | unsigned int g:8; |
| 151 | unsigned int r:8; |
| 152 | }; |
| 153 | }; |
| 154 | } GSetColor; |
| 155 | |
| 156 | typedef struct { |
| 157 | unsigned int :16; |
| 158 | unsigned int param:8; |
| 159 | unsigned int cmd:8; |
| 160 | unsigned int addr; |
| 161 | } GGBI0_Dlist; |
| 162 | |
| 163 | typedef struct { |
| 164 | unsigned int len:16; |
| 165 | unsigned int projection:1; |
| 166 | unsigned int load:1; |
| 167 | unsigned int push:1; |
| 168 | unsigned int :5; |
| 169 | unsigned int cmd:8; |
| 170 | unsigned int addr; |
| 171 | } GGBI0_Matrix; |
| 172 | |
| 173 | typedef struct { |
| 174 | unsigned int :24; |
| 175 | unsigned int cmd:8; |
| 176 | unsigned int projection:1; |
| 177 | unsigned int :31; |
| 178 | } GGBI0_PopMatrix; |
| 179 | |
| 180 | typedef struct { |
| 181 | union { |
| 182 | struct { |
| 183 | unsigned int param:8; |
| 184 | unsigned int len:16; |
| 185 | unsigned int cmd:8; |
| 186 | }; |
| 187 | struct { |
| 188 | unsigned int nopush:1; |
| 189 | unsigned int load:1; |
| 190 | unsigned int projection:1; |
| 191 | unsigned int :5; |
| 192 | unsigned int len2:16; |
| 193 | unsigned int cmd2:8; |
| 194 | }; |
| 195 | }; |
| 196 | unsigned int addr; |
| 197 | } GGBI2_Matrix; |
| 198 | |
| 199 | typedef struct { |
| 200 | unsigned int type:8; |
| 201 | unsigned int offset:16; |
| 202 | unsigned int cmd:8; |
| 203 | unsigned int value; |
| 204 | } GGBI0_MoveWord; |
| 205 | |
| 206 | typedef struct { |
| 207 | unsigned int offset:16; |
| 208 | unsigned int type:8; |
| 209 | unsigned int cmd:8; |
| 210 | unsigned int value; |
| 211 | } GGBI2_MoveWord; |
| 212 | |
| 213 | typedef struct { |
| 214 | unsigned int enable_gbi0:1; |
| 215 | unsigned int enable_gbi2:1; |
| 216 | unsigned int :6; |
| 217 | unsigned int tile:3; |
| 218 | unsigned int level:3; |
| 219 | unsigned int :10; |
| 220 | unsigned int cmd:8; |
| 221 | unsigned int scaleT:16; |
| 222 | unsigned int scaleS:16; |
| 223 | } GTexture; |
| 224 | |
| 225 | typedef struct { |
| 226 | unsigned int tl:12; |
| 227 | unsigned int sl:12; |
| 228 | unsigned int cmd:8; |
| 229 | |
| 230 | unsigned int th:12; |
| 231 | unsigned int sh:12; |
| 232 | unsigned int tile:3; |
| 233 | unsigned int pad:5; |
| 234 | } Gloadtile; |
| 235 | |
| 236 | typedef struct { |
| 237 | unsigned int tmem:9; |
| 238 | unsigned int line:9; |
| 239 | unsigned int pad0:1; |
| 240 | unsigned int siz:2; |
| 241 | unsigned int fmt:3; |
| 242 | unsigned int cmd:8; |
| 243 | |
| 244 | unsigned int shifts:4; |
| 245 | unsigned int masks:4; |
| 246 | unsigned int ms:1; |
| 247 | unsigned int cs:1; |
| 248 | unsigned int shiftt:4; |
| 249 | unsigned int maskt:4; |
| 250 | unsigned int mt:1; |
| 251 | unsigned int ct:1; |
| 252 | unsigned int palette:4; |
| 253 | unsigned int tile:3; |
| 254 | unsigned int pad1:5; |
| 255 | } Gsettile; |
| 256 | |
| 257 | typedef union { |
| 258 | Gwords words; |
| 259 | GGBI0_Tri1 tri1; |
| 260 | GGBI0_Ln3DTri2 ln3dtri2; |
| 261 | GGBI1_Tri2 gbi1tri2; |
| 262 | GGBI2_Tri1 gbi2tri1; |
| 263 | GGBI2_Tri2 gbi2tri2; |
| 264 | GGBI2_Line3D gbi2line3d; |
| 265 | GGBI0_Vtx gbi0vtx; |
| 266 | GGBI1_Vtx gbi1vtx; |
| 267 | GGBI2_Vtx gbi2vtx; |
| 268 | GSetImg setimg; |
| 269 | GSetColor setcolor; |
| 270 | GGBI0_Dlist gbi0dlist; |
| 271 | GGBI0_Matrix gbi0matrix; |
| 272 | GGBI0_PopMatrix gbi0popmatrix; |
| 273 | GGBI2_Matrix gbi2matrix; |
| 274 | GGBI0_MoveWord gbi0moveword; |
| 275 | GGBI2_MoveWord gbi2moveword; |
| 276 | GTexture texture; |
| 277 | Gloadtile loadtile; |
| 278 | Gsettile settile; |
| 279 | /* |
| 280 | Gdma dma; |
| 281 | Gsegment segment; |
| 282 | GsetothermodeH setothermodeH; |
| 283 | GsetothermodeL setothermodeL; |
| 284 | Gtexture texture; |
| 285 | Gperspnorm perspnorm; |
| 286 | Gsetcombine setcombine; |
| 287 | Gfillrect fillrect; |
| 288 | Gsettile settile; |
| 289 | Gloadtile loadtile; |
| 290 | Gsettilesize settilesize; |
| 291 | Gloadtlut loadtlut; |
| 292 | */ |
| 293 | long long int force_structure_alignment; |
| 294 | } Gfx; |
| 295 | |
| 296 | typedef union { |
| 297 | struct { |
| 298 | unsigned int w0; |
| 299 | unsigned int w1; |
| 300 | unsigned int w2; |
| 301 | unsigned int w3; |
| 302 | }; |
| 303 | struct { |
| 304 | unsigned int yl:12; /* Y coordinate of upper left */ |
| 305 | unsigned int xl:12; /* X coordinate of upper left */ |
| 306 | unsigned int cmd:8; /* command */ |
| 307 | |
| 308 | unsigned int yh:12; /* Y coordinate of lower right */ |
| 309 | unsigned int xh:12; /* X coordinate of lower right */ |
| 310 | unsigned int tile:3; /* Tile descriptor index */ |
| 311 | unsigned int pad1:5; /* Padding */ |
| 312 | |
| 313 | unsigned int t:16; /* T texture coord at top left */ |
| 314 | unsigned int s:16; /* S texture coord at top left */ |
| 315 | |
| 316 | unsigned int dtdy:16;/* Change in T per change in Y */ |
| 317 | unsigned int dsdx:16;/* Change in S per change in X */ |
| 318 | }; |
| 319 | } Gtexrect; |
| 320 | |
| 321 | #endif |
| 322 | |