mirror of
https://github.com/buhman/nds.git
synced 2025-06-18 14:35:38 -04:00
add graphics engine header files
This commit is contained in:
parent
710afdfc43
commit
f3b11ed49f
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
__pycache__
|
||||
*.gch
|
||||
*.o
|
@ -4,7 +4,7 @@
|
||||
0x006 VCOUNT 53 V count comparison
|
||||
0x008 BG0CNT 81 2D Graphics Engine A BG0 control
|
||||
0x00a BG1CNT 81 2D Graphics Engine A BG1 control
|
||||
0x00c BG2CNT 83 2DGraphics Engine A BG2 control
|
||||
0x00c BG2CNT 83 2D Graphics Engine A BG2 control
|
||||
0x00e BG3CNT 83 2D Graphics Engine A BG3 control
|
||||
0x010 BG0HOFS 105 2D Graphics Engine A BG0 display H offset
|
||||
0x012 BG0VOFS 105 2D Graphics Engine A BG0 display V offset
|
||||
|
52
registers/format.py
Normal file
52
registers/format.py
Normal file
@ -0,0 +1,52 @@
|
||||
import sys
|
||||
from parse import register_descriptions
|
||||
|
||||
struct_name = sys.argv[2]
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
buf = f.read()
|
||||
lines = buf.strip().split('\n')
|
||||
|
||||
registers = register_descriptions(lines)
|
||||
|
||||
def type_by_size(size):
|
||||
if size == 2:
|
||||
return 'volatile uint16_t'
|
||||
elif size == 4:
|
||||
return 'volatile uint32_t'
|
||||
elif size == 8:
|
||||
return 'volatile uint64_t'
|
||||
else:
|
||||
assert False, size
|
||||
|
||||
def c_source(registers):
|
||||
struct_offset = 0
|
||||
pad_ix = 0
|
||||
|
||||
for register in registers:
|
||||
assert register.offset >= struct_offset, register
|
||||
if register.offset != struct_offset:
|
||||
pad_size = register.offset - struct_offset
|
||||
yield f"volatile uint8_t _pad{pad_ix}[{pad_size}];"
|
||||
pad_ix += 1
|
||||
struct_offset += pad_size
|
||||
|
||||
type = type_by_size(register.size)
|
||||
yield f"{type} {register.name};"
|
||||
|
||||
struct_offset += register.size
|
||||
|
||||
def c_asserts(registers):
|
||||
for register in registers:
|
||||
yield f"static_assert((offsetof (struct {struct_name}, {register.name})) == {register.offset});"
|
||||
|
||||
print('#include <stdint.h>')
|
||||
print('#include <stddef.h>')
|
||||
print('#include <assert.h>')
|
||||
print('')
|
||||
print(f'struct {struct_name} {{')
|
||||
for line in c_source(registers):
|
||||
print(' ' + line)
|
||||
print('};')
|
||||
for line in c_asserts(registers):
|
||||
print(line)
|
2
registers/generate.sh
Normal file
2
registers/generate.sh
Normal file
@ -0,0 +1,2 @@
|
||||
python format.py 0x04000000.txt graphics_engine_a > graphics_engine_a.h
|
||||
python format.py 0x04001000.txt graphics_engine_a > graphics_engine_b.h
|
468
registers/graphics_engine_a.h
Normal file
468
registers/graphics_engine_a.h
Normal file
@ -0,0 +1,468 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct graphics_engine_a {
|
||||
volatile uint32_t DISPCNT;
|
||||
volatile uint16_t DISPSTAT;
|
||||
volatile uint16_t VCOUNT;
|
||||
volatile uint16_t BG0CNT;
|
||||
volatile uint16_t BG1CNT;
|
||||
volatile uint16_t BG2CNT;
|
||||
volatile uint16_t BG3CNT;
|
||||
volatile uint16_t BG0HOFS;
|
||||
volatile uint16_t BG0VOFS;
|
||||
volatile uint16_t BG1HOFS;
|
||||
volatile uint16_t BG1VOFS;
|
||||
volatile uint16_t BG2HOFS;
|
||||
volatile uint16_t BG2VOFS;
|
||||
volatile uint16_t BG3HOFS;
|
||||
volatile uint16_t BG3VOFS;
|
||||
volatile uint16_t BG2PA;
|
||||
volatile uint16_t BG2PB;
|
||||
volatile uint16_t BG2PC;
|
||||
volatile uint16_t BG2PD;
|
||||
volatile uint32_t BG2X;
|
||||
volatile uint32_t BG2Y;
|
||||
volatile uint16_t BG3PA;
|
||||
volatile uint16_t BG3PB;
|
||||
volatile uint16_t BG3PC;
|
||||
volatile uint16_t BG3PD;
|
||||
volatile uint32_t BG3X;
|
||||
volatile uint32_t BG3Y;
|
||||
volatile uint16_t WIN0H;
|
||||
volatile uint16_t WIN1H;
|
||||
volatile uint16_t WIN0V;
|
||||
volatile uint16_t WIN1V;
|
||||
volatile uint16_t WININ;
|
||||
volatile uint16_t WINOUT;
|
||||
volatile uint16_t MOSAIC;
|
||||
volatile uint8_t _pad0[2];
|
||||
volatile uint16_t BLDCNT;
|
||||
volatile uint16_t BLDALPHA;
|
||||
volatile uint16_t BLDY;
|
||||
volatile uint8_t _pad1[10];
|
||||
volatile uint16_t DISP3DCNT;
|
||||
volatile uint8_t _pad2[2];
|
||||
volatile uint32_t DISPCAPCNT;
|
||||
volatile uint32_t DISP_MMEM_FIFO;
|
||||
volatile uint16_t MASTER_BRIGHT;
|
||||
volatile uint8_t _pad3[66];
|
||||
volatile uint32_t DMA0SAD;
|
||||
volatile uint32_t DMA0DAD;
|
||||
volatile uint32_t DMA0CNT;
|
||||
volatile uint32_t DMA1SAD;
|
||||
volatile uint32_t DMA1DAD;
|
||||
volatile uint32_t DMA1CNT;
|
||||
volatile uint32_t DMA2SAD;
|
||||
volatile uint32_t DMA2DAD;
|
||||
volatile uint32_t DMA2CNT;
|
||||
volatile uint32_t DMA3SAD;
|
||||
volatile uint32_t DMA3DAD;
|
||||
volatile uint32_t DMA3CNT;
|
||||
volatile uint8_t _pad4[32];
|
||||
volatile uint16_t TM0CNT_L;
|
||||
volatile uint16_t TM0CNT_H;
|
||||
volatile uint16_t TM1CNT_L;
|
||||
volatile uint16_t TM1CNT_H;
|
||||
volatile uint16_t TM2CNT_L;
|
||||
volatile uint16_t TM2CNT_H;
|
||||
volatile uint16_t TM3CNT_L;
|
||||
volatile uint16_t TM3CNT_H;
|
||||
volatile uint8_t _pad5[32];
|
||||
volatile uint16_t KEYINPUT;
|
||||
volatile uint16_t KEYCNT;
|
||||
volatile uint8_t _pad6[208];
|
||||
volatile uint16_t EXMEMCNT;
|
||||
volatile uint8_t _pad7[2];
|
||||
volatile uint16_t IME;
|
||||
volatile uint8_t _pad8[6];
|
||||
volatile uint32_t IE;
|
||||
volatile uint32_t IF;
|
||||
volatile uint8_t _pad9[40];
|
||||
volatile uint32_t VRAMCNT;
|
||||
volatile uint32_t WVRAMCNT;
|
||||
volatile uint16_t VRAM_HI_CNT;
|
||||
volatile uint8_t _pad10[54];
|
||||
volatile uint16_t DIVCNT;
|
||||
volatile uint8_t _pad11[14];
|
||||
volatile uint64_t DIV_NUMER;
|
||||
volatile uint64_t DIV_DENOM;
|
||||
volatile uint64_t DIV_RESULT;
|
||||
volatile uint64_t DIVREM_RESULT;
|
||||
volatile uint16_t SQRTCNT;
|
||||
volatile uint8_t _pad12[2];
|
||||
volatile uint32_t SQRT_RESULT;
|
||||
volatile uint64_t SQRT_PARAM;
|
||||
volatile uint8_t _pad13[68];
|
||||
volatile uint16_t POWCNT;
|
||||
volatile uint8_t _pad14[26];
|
||||
volatile uint16_t RDLINES_COUNT;
|
||||
volatile uint8_t _pad15[14];
|
||||
volatile uint16_t EDGE_COLOR_0_L;
|
||||
volatile uint16_t EDGE_COLOR_0_H;
|
||||
volatile uint16_t EDGE_COLOR_1_L;
|
||||
volatile uint16_t EDGE_COLOR_1_H;
|
||||
volatile uint16_t EDGE_COLOR_2_L;
|
||||
volatile uint16_t EDGE_COLOR_2_H;
|
||||
volatile uint16_t EDGE_COLOR_3_L;
|
||||
volatile uint16_t EDGE_COLOR_3_H;
|
||||
volatile uint16_t ALPHA_TEST_REF;
|
||||
volatile uint8_t _pad16[14];
|
||||
volatile uint32_t CLEAR_COLOR;
|
||||
volatile uint16_t CLEAR_DEPTH;
|
||||
volatile uint16_t CLRIMAGE_OFFSET;
|
||||
volatile uint32_t FOG_COLOR;
|
||||
volatile uint16_t FOG_OFFSET;
|
||||
volatile uint8_t _pad17[2];
|
||||
volatile uint16_t FOG_TABLE_0_L;
|
||||
volatile uint16_t FOG_TABLE_0_H;
|
||||
volatile uint16_t FOG_TABLE_1_L;
|
||||
volatile uint16_t FOG_TABLE_1_H;
|
||||
volatile uint16_t FOG_TABLE_2_L;
|
||||
volatile uint16_t FOG_TABLE_2_H;
|
||||
volatile uint16_t FOG_TABLE_3_L;
|
||||
volatile uint16_t FOG_TABLE_3_H;
|
||||
volatile uint16_t FOG_TABLE_4_L;
|
||||
volatile uint16_t FOG_TABLE_4_H;
|
||||
volatile uint16_t FOG_TABLE_5_L;
|
||||
volatile uint16_t FOG_TABLE_5_H;
|
||||
volatile uint16_t FOG_TABLE_6_L;
|
||||
volatile uint16_t FOG_TABLE_6_H;
|
||||
volatile uint16_t FOG_TABLE_7_L;
|
||||
volatile uint16_t FOG_TABLE_7_H;
|
||||
volatile uint16_t TOON_TABLE_0_L;
|
||||
volatile uint16_t TOON_TABLE_0_H;
|
||||
volatile uint16_t TOON_TABLE_1_L;
|
||||
volatile uint16_t TOON_TABLE_1_H;
|
||||
volatile uint16_t TOON_TABLE_2_L;
|
||||
volatile uint16_t TOON_TABLE_2_H;
|
||||
volatile uint16_t TOON_TABLE_3_L;
|
||||
volatile uint16_t TOON_TABLE_3_H;
|
||||
volatile uint16_t TOON_TABLE_4_L;
|
||||
volatile uint16_t TOON_TABLE_4_H;
|
||||
volatile uint16_t TOON_TABLE_5_L;
|
||||
volatile uint16_t TOON_TABLE_5_H;
|
||||
volatile uint16_t TOON_TABLE_6_L;
|
||||
volatile uint16_t TOON_TABLE_6_H;
|
||||
volatile uint16_t TOON_TABLE_7_L;
|
||||
volatile uint16_t TOON_TABLE_7_H;
|
||||
volatile uint16_t TOON_TABLE_8_L;
|
||||
volatile uint16_t TOON_TABLE_8_H;
|
||||
volatile uint16_t TOON_TABLE_9_L;
|
||||
volatile uint16_t TOON_TABLE_9_H;
|
||||
volatile uint16_t TOON_TABLE_10_L;
|
||||
volatile uint16_t TOON_TABLE_10_H;
|
||||
volatile uint16_t TOON_TABLE_11_L;
|
||||
volatile uint16_t TOON_TABLE_11_H;
|
||||
volatile uint16_t TOON_TABLE_12_L;
|
||||
volatile uint16_t TOON_TABLE_12_H;
|
||||
volatile uint16_t TOON_TABLE_13_L;
|
||||
volatile uint16_t TOON_TABLE_13_H;
|
||||
volatile uint16_t TOON_TABLE_14_L;
|
||||
volatile uint16_t TOON_TABLE_14_H;
|
||||
volatile uint16_t TOON_TABLE_15_L;
|
||||
volatile uint16_t TOON_TABLE_15_H;
|
||||
volatile uint8_t _pad18[64];
|
||||
volatile uint32_t GXFIFO;
|
||||
volatile uint8_t _pad19[60];
|
||||
volatile uint32_t MTX_MODE;
|
||||
volatile uint32_t MTX_PUSH;
|
||||
volatile uint32_t MTX_POP;
|
||||
volatile uint32_t MTX_STORE;
|
||||
volatile uint32_t MTX_RESTORE;
|
||||
volatile uint32_t MTX_IDENTITY;
|
||||
volatile uint32_t MTX_LOAD_4X4;
|
||||
volatile uint32_t MTX_LOAD_4X3;
|
||||
volatile uint32_t MTX_MULT_4X4;
|
||||
volatile uint32_t MTX_MULT_4X3;
|
||||
volatile uint32_t MTX_MULT_3X3;
|
||||
volatile uint32_t MTX_SCALE;
|
||||
volatile uint32_t MTX_TRANS;
|
||||
volatile uint8_t _pad20[12];
|
||||
volatile uint32_t COLOR;
|
||||
volatile uint32_t NORMAL;
|
||||
volatile uint32_t TEXCOORD;
|
||||
volatile uint32_t VTX_16;
|
||||
volatile uint32_t VTX_10;
|
||||
volatile uint32_t VTX_XY;
|
||||
volatile uint32_t VTX_XZ;
|
||||
volatile uint32_t VTX_YZ;
|
||||
volatile uint32_t VTX_DIFF;
|
||||
volatile uint32_t POLYGON_ATTR;
|
||||
volatile uint32_t TEXIMAGE_PARAM;
|
||||
volatile uint32_t TEXPLTT_BASE;
|
||||
volatile uint8_t _pad21[16];
|
||||
volatile uint32_t DIF_AMB;
|
||||
volatile uint32_t SPE_EMI;
|
||||
volatile uint32_t LIGHT_VECTOR;
|
||||
volatile uint32_t LIGHT_COLOR;
|
||||
volatile uint32_t SHININESS;
|
||||
volatile uint8_t _pad22[44];
|
||||
volatile uint32_t BEGIN_VTXS;
|
||||
volatile uint32_t END_VTXS;
|
||||
volatile uint8_t _pad23[56];
|
||||
volatile uint32_t SWAP_BUFFERS;
|
||||
volatile uint8_t _pad24[60];
|
||||
volatile uint32_t VIEWPORT;
|
||||
volatile uint8_t _pad25[60];
|
||||
volatile uint32_t BOX_TEST;
|
||||
volatile uint32_t POS_TEST;
|
||||
volatile uint32_t VEC_TEST;
|
||||
volatile uint8_t _pad26[52];
|
||||
volatile uint32_t GXSTAT;
|
||||
volatile uint16_t LISTRAM_COUNT;
|
||||
volatile uint16_t VTXRAM_COUNT;
|
||||
volatile uint8_t _pad27[8];
|
||||
volatile uint16_t DISP_1DOT_DEPTH;
|
||||
volatile uint8_t _pad28[14];
|
||||
volatile uint32_t POS_RESULT_X;
|
||||
volatile uint32_t POS_RESULT_Y;
|
||||
volatile uint32_t POS_RESULT_Z;
|
||||
volatile uint32_t POS_RESULT_W;
|
||||
volatile uint16_t VEC_RESULT_X;
|
||||
volatile uint16_t VEC_RESULT_Y;
|
||||
volatile uint16_t VEC_RESULT_Z;
|
||||
volatile uint8_t _pad29[10];
|
||||
volatile uint32_t CLIPMTX_RESULT_0;
|
||||
volatile uint32_t CLIPMTX_RESULT_1;
|
||||
volatile uint32_t CLIPMTX_RESULT_2;
|
||||
volatile uint32_t CLIPMTX_RESULT_3;
|
||||
volatile uint32_t CLIPMTX_RESULT_4;
|
||||
volatile uint32_t CLIPMTX_RESULT_5;
|
||||
volatile uint32_t CLIPMTX_RESULT_6;
|
||||
volatile uint32_t CLIPMTX_RESULT_7;
|
||||
volatile uint32_t CLIPMTX_RESULT_8;
|
||||
volatile uint32_t CLIPMTX_RESULT_9;
|
||||
volatile uint32_t CLIPMTX_RESULT_10;
|
||||
volatile uint32_t CLIPMTX_RESULT_11;
|
||||
volatile uint32_t CLIPMTX_RESULT_12;
|
||||
volatile uint32_t CLIPMTX_RESULT_13;
|
||||
volatile uint32_t CLIPMTX_RESULT_14;
|
||||
volatile uint32_t CLIPMTX_RESULT_15;
|
||||
volatile uint32_t VECMTX_RESULT_0;
|
||||
volatile uint32_t VECMTX_RESULT_1;
|
||||
volatile uint32_t VECMTX_RESULT_2;
|
||||
volatile uint32_t VECMTX_RESULT_3;
|
||||
volatile uint32_t VECMTX_RESULT_4;
|
||||
volatile uint32_t VECMTX_RESULT_5;
|
||||
volatile uint32_t VECMTX_RESULT_6;
|
||||
volatile uint32_t VECMTX_RESULT_7;
|
||||
volatile uint32_t VECMTX_RESULT_8;
|
||||
};
|
||||
static_assert((offsetof (struct graphics_engine_a, DISPCNT)) == 0);
|
||||
static_assert((offsetof (struct graphics_engine_a, DISPSTAT)) == 4);
|
||||
static_assert((offsetof (struct graphics_engine_a, VCOUNT)) == 6);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG0CNT)) == 8);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG1CNT)) == 10);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2CNT)) == 12);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3CNT)) == 14);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG0HOFS)) == 16);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG0VOFS)) == 18);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG1HOFS)) == 20);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG1VOFS)) == 22);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2HOFS)) == 24);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2VOFS)) == 26);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3HOFS)) == 28);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3VOFS)) == 30);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2PA)) == 32);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2PB)) == 34);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2PC)) == 36);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2PD)) == 38);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2X)) == 40);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG2Y)) == 44);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3PA)) == 48);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3PB)) == 50);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3PC)) == 52);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3PD)) == 54);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3X)) == 56);
|
||||
static_assert((offsetof (struct graphics_engine_a, BG3Y)) == 60);
|
||||
static_assert((offsetof (struct graphics_engine_a, WIN0H)) == 64);
|
||||
static_assert((offsetof (struct graphics_engine_a, WIN1H)) == 66);
|
||||
static_assert((offsetof (struct graphics_engine_a, WIN0V)) == 68);
|
||||
static_assert((offsetof (struct graphics_engine_a, WIN1V)) == 70);
|
||||
static_assert((offsetof (struct graphics_engine_a, WININ)) == 72);
|
||||
static_assert((offsetof (struct graphics_engine_a, WINOUT)) == 74);
|
||||
static_assert((offsetof (struct graphics_engine_a, MOSAIC)) == 76);
|
||||
static_assert((offsetof (struct graphics_engine_a, BLDCNT)) == 80);
|
||||
static_assert((offsetof (struct graphics_engine_a, BLDALPHA)) == 82);
|
||||
static_assert((offsetof (struct graphics_engine_a, BLDY)) == 84);
|
||||
static_assert((offsetof (struct graphics_engine_a, DISP3DCNT)) == 96);
|
||||
static_assert((offsetof (struct graphics_engine_a, DISPCAPCNT)) == 100);
|
||||
static_assert((offsetof (struct graphics_engine_a, DISP_MMEM_FIFO)) == 104);
|
||||
static_assert((offsetof (struct graphics_engine_a, MASTER_BRIGHT)) == 108);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA0SAD)) == 176);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA0DAD)) == 180);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA0CNT)) == 184);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA1SAD)) == 188);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA1DAD)) == 192);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA1CNT)) == 196);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA2SAD)) == 200);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA2DAD)) == 204);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA2CNT)) == 208);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA3SAD)) == 212);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA3DAD)) == 216);
|
||||
static_assert((offsetof (struct graphics_engine_a, DMA3CNT)) == 220);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM0CNT_L)) == 256);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM0CNT_H)) == 258);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM1CNT_L)) == 260);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM1CNT_H)) == 262);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM2CNT_L)) == 264);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM2CNT_H)) == 266);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM3CNT_L)) == 268);
|
||||
static_assert((offsetof (struct graphics_engine_a, TM3CNT_H)) == 270);
|
||||
static_assert((offsetof (struct graphics_engine_a, KEYINPUT)) == 304);
|
||||
static_assert((offsetof (struct graphics_engine_a, KEYCNT)) == 306);
|
||||
static_assert((offsetof (struct graphics_engine_a, EXMEMCNT)) == 516);
|
||||
static_assert((offsetof (struct graphics_engine_a, IME)) == 520);
|
||||
static_assert((offsetof (struct graphics_engine_a, IE)) == 528);
|
||||
static_assert((offsetof (struct graphics_engine_a, IF)) == 532);
|
||||
static_assert((offsetof (struct graphics_engine_a, VRAMCNT)) == 576);
|
||||
static_assert((offsetof (struct graphics_engine_a, WVRAMCNT)) == 580);
|
||||
static_assert((offsetof (struct graphics_engine_a, VRAM_HI_CNT)) == 584);
|
||||
static_assert((offsetof (struct graphics_engine_a, DIVCNT)) == 640);
|
||||
static_assert((offsetof (struct graphics_engine_a, DIV_NUMER)) == 656);
|
||||
static_assert((offsetof (struct graphics_engine_a, DIV_DENOM)) == 664);
|
||||
static_assert((offsetof (struct graphics_engine_a, DIV_RESULT)) == 672);
|
||||
static_assert((offsetof (struct graphics_engine_a, DIVREM_RESULT)) == 680);
|
||||
static_assert((offsetof (struct graphics_engine_a, SQRTCNT)) == 688);
|
||||
static_assert((offsetof (struct graphics_engine_a, SQRT_RESULT)) == 692);
|
||||
static_assert((offsetof (struct graphics_engine_a, SQRT_PARAM)) == 696);
|
||||
static_assert((offsetof (struct graphics_engine_a, POWCNT)) == 772);
|
||||
static_assert((offsetof (struct graphics_engine_a, RDLINES_COUNT)) == 800);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_0_L)) == 816);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_0_H)) == 818);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_1_L)) == 820);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_1_H)) == 822);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_2_L)) == 824);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_2_H)) == 826);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_3_L)) == 828);
|
||||
static_assert((offsetof (struct graphics_engine_a, EDGE_COLOR_3_H)) == 830);
|
||||
static_assert((offsetof (struct graphics_engine_a, ALPHA_TEST_REF)) == 832);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLEAR_COLOR)) == 848);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLEAR_DEPTH)) == 852);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLRIMAGE_OFFSET)) == 854);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_COLOR)) == 856);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_OFFSET)) == 860);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_0_L)) == 864);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_0_H)) == 866);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_1_L)) == 868);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_1_H)) == 870);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_2_L)) == 872);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_2_H)) == 874);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_3_L)) == 876);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_3_H)) == 878);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_4_L)) == 880);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_4_H)) == 882);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_5_L)) == 884);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_5_H)) == 886);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_6_L)) == 888);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_6_H)) == 890);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_7_L)) == 892);
|
||||
static_assert((offsetof (struct graphics_engine_a, FOG_TABLE_7_H)) == 894);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_0_L)) == 896);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_0_H)) == 898);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_1_L)) == 900);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_1_H)) == 902);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_2_L)) == 904);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_2_H)) == 906);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_3_L)) == 908);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_3_H)) == 910);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_4_L)) == 912);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_4_H)) == 914);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_5_L)) == 916);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_5_H)) == 918);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_6_L)) == 920);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_6_H)) == 922);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_7_L)) == 924);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_7_H)) == 926);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_8_L)) == 928);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_8_H)) == 930);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_9_L)) == 932);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_9_H)) == 934);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_10_L)) == 936);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_10_H)) == 938);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_11_L)) == 940);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_11_H)) == 942);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_12_L)) == 944);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_12_H)) == 946);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_13_L)) == 948);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_13_H)) == 950);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_14_L)) == 952);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_14_H)) == 954);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_15_L)) == 956);
|
||||
static_assert((offsetof (struct graphics_engine_a, TOON_TABLE_15_H)) == 958);
|
||||
static_assert((offsetof (struct graphics_engine_a, GXFIFO)) == 1024);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_MODE)) == 1088);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_PUSH)) == 1092);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_POP)) == 1096);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_STORE)) == 1100);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_RESTORE)) == 1104);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_IDENTITY)) == 1108);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_LOAD_4X4)) == 1112);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_LOAD_4X3)) == 1116);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_MULT_4X4)) == 1120);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_MULT_4X3)) == 1124);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_MULT_3X3)) == 1128);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_SCALE)) == 1132);
|
||||
static_assert((offsetof (struct graphics_engine_a, MTX_TRANS)) == 1136);
|
||||
static_assert((offsetof (struct graphics_engine_a, COLOR)) == 1152);
|
||||
static_assert((offsetof (struct graphics_engine_a, NORMAL)) == 1156);
|
||||
static_assert((offsetof (struct graphics_engine_a, TEXCOORD)) == 1160);
|
||||
static_assert((offsetof (struct graphics_engine_a, VTX_16)) == 1164);
|
||||
static_assert((offsetof (struct graphics_engine_a, VTX_10)) == 1168);
|
||||
static_assert((offsetof (struct graphics_engine_a, VTX_XY)) == 1172);
|
||||
static_assert((offsetof (struct graphics_engine_a, VTX_XZ)) == 1176);
|
||||
static_assert((offsetof (struct graphics_engine_a, VTX_YZ)) == 1180);
|
||||
static_assert((offsetof (struct graphics_engine_a, VTX_DIFF)) == 1184);
|
||||
static_assert((offsetof (struct graphics_engine_a, POLYGON_ATTR)) == 1188);
|
||||
static_assert((offsetof (struct graphics_engine_a, TEXIMAGE_PARAM)) == 1192);
|
||||
static_assert((offsetof (struct graphics_engine_a, TEXPLTT_BASE)) == 1196);
|
||||
static_assert((offsetof (struct graphics_engine_a, DIF_AMB)) == 1216);
|
||||
static_assert((offsetof (struct graphics_engine_a, SPE_EMI)) == 1220);
|
||||
static_assert((offsetof (struct graphics_engine_a, LIGHT_VECTOR)) == 1224);
|
||||
static_assert((offsetof (struct graphics_engine_a, LIGHT_COLOR)) == 1228);
|
||||
static_assert((offsetof (struct graphics_engine_a, SHININESS)) == 1232);
|
||||
static_assert((offsetof (struct graphics_engine_a, BEGIN_VTXS)) == 1280);
|
||||
static_assert((offsetof (struct graphics_engine_a, END_VTXS)) == 1284);
|
||||
static_assert((offsetof (struct graphics_engine_a, SWAP_BUFFERS)) == 1344);
|
||||
static_assert((offsetof (struct graphics_engine_a, VIEWPORT)) == 1408);
|
||||
static_assert((offsetof (struct graphics_engine_a, BOX_TEST)) == 1472);
|
||||
static_assert((offsetof (struct graphics_engine_a, POS_TEST)) == 1476);
|
||||
static_assert((offsetof (struct graphics_engine_a, VEC_TEST)) == 1480);
|
||||
static_assert((offsetof (struct graphics_engine_a, GXSTAT)) == 1536);
|
||||
static_assert((offsetof (struct graphics_engine_a, LISTRAM_COUNT)) == 1540);
|
||||
static_assert((offsetof (struct graphics_engine_a, VTXRAM_COUNT)) == 1542);
|
||||
static_assert((offsetof (struct graphics_engine_a, DISP_1DOT_DEPTH)) == 1552);
|
||||
static_assert((offsetof (struct graphics_engine_a, POS_RESULT_X)) == 1568);
|
||||
static_assert((offsetof (struct graphics_engine_a, POS_RESULT_Y)) == 1572);
|
||||
static_assert((offsetof (struct graphics_engine_a, POS_RESULT_Z)) == 1576);
|
||||
static_assert((offsetof (struct graphics_engine_a, POS_RESULT_W)) == 1580);
|
||||
static_assert((offsetof (struct graphics_engine_a, VEC_RESULT_X)) == 1584);
|
||||
static_assert((offsetof (struct graphics_engine_a, VEC_RESULT_Y)) == 1586);
|
||||
static_assert((offsetof (struct graphics_engine_a, VEC_RESULT_Z)) == 1588);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_0)) == 1600);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_1)) == 1604);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_2)) == 1608);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_3)) == 1612);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_4)) == 1616);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_5)) == 1620);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_6)) == 1624);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_7)) == 1628);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_8)) == 1632);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_9)) == 1636);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_10)) == 1640);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_11)) == 1644);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_12)) == 1648);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_13)) == 1652);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_14)) == 1656);
|
||||
static_assert((offsetof (struct graphics_engine_a, CLIPMTX_RESULT_15)) == 1660);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_0)) == 1664);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_1)) == 1668);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_2)) == 1672);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_3)) == 1676);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_4)) == 1680);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_5)) == 1684);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_6)) == 1688);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_7)) == 1692);
|
||||
static_assert((offsetof (struct graphics_engine_a, VECMTX_RESULT_8)) == 1696);
|
81
registers/graphics_engine_b.h
Normal file
81
registers/graphics_engine_b.h
Normal file
@ -0,0 +1,81 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct graphics_engine_a {
|
||||
volatile uint32_t DB_DISPCNT;
|
||||
volatile uint8_t _pad0[4];
|
||||
volatile uint16_t DB_BG0CNT;
|
||||
volatile uint16_t DB_BG1CNT;
|
||||
volatile uint16_t DB_BG2CNT;
|
||||
volatile uint16_t DB_BG3CNT;
|
||||
volatile uint16_t DB_BG0HOFS;
|
||||
volatile uint16_t DB_BG0VOFS;
|
||||
volatile uint16_t DB_BG1HOFS;
|
||||
volatile uint16_t DB_BG1VOFS;
|
||||
volatile uint16_t DB_BG2HOFS;
|
||||
volatile uint16_t DB_BG2VOFS;
|
||||
volatile uint16_t DB_BG3HOFS;
|
||||
volatile uint16_t DB_BG3VOFS;
|
||||
volatile uint16_t DB_BG2PA;
|
||||
volatile uint16_t DB_BG2PB;
|
||||
volatile uint16_t DB_BG2PC;
|
||||
volatile uint16_t DB_BG2PD;
|
||||
volatile uint32_t DB_BG2X;
|
||||
volatile uint32_t DB_BG2Y;
|
||||
volatile uint16_t DB_BG3PA;
|
||||
volatile uint16_t DB_BG3PB;
|
||||
volatile uint16_t DB_BG3PC;
|
||||
volatile uint16_t DB_BG3PD;
|
||||
volatile uint32_t DB_BG3X;
|
||||
volatile uint32_t DB_BG3Y;
|
||||
volatile uint16_t DB_WIN0H;
|
||||
volatile uint16_t DB_WIN1H;
|
||||
volatile uint16_t DB_WIN0V;
|
||||
volatile uint16_t DB_WIN1V;
|
||||
volatile uint16_t DB_WININ;
|
||||
volatile uint16_t DB_WINOUT;
|
||||
volatile uint16_t DB_MOSAIC;
|
||||
volatile uint8_t _pad1[2];
|
||||
volatile uint16_t DB_BLDCNT;
|
||||
volatile uint16_t DB_BLDALPHA;
|
||||
volatile uint16_t DB_BLDY;
|
||||
volatile uint8_t _pad2[22];
|
||||
volatile uint16_t DB_MASTER_BRIGHT;
|
||||
};
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_DISPCNT)) == 0);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG0CNT)) == 8);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG1CNT)) == 10);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2CNT)) == 12);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3CNT)) == 14);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG0HOFS)) == 16);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG0VOFS)) == 18);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG1HOFS)) == 20);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG1VOFS)) == 22);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2HOFS)) == 24);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2VOFS)) == 26);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3HOFS)) == 28);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3VOFS)) == 30);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2PA)) == 32);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2PB)) == 34);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2PC)) == 36);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2PD)) == 38);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2X)) == 40);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG2Y)) == 44);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3PA)) == 48);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3PB)) == 50);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3PC)) == 52);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3PD)) == 54);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3X)) == 56);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BG3Y)) == 60);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_WIN0H)) == 64);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_WIN1H)) == 66);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_WIN0V)) == 68);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_WIN1V)) == 70);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_WININ)) == 72);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_WINOUT)) == 74);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_MOSAIC)) == 76);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BLDCNT)) == 80);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BLDALPHA)) == 82);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_BLDY)) == 84);
|
||||
static_assert((offsetof (struct graphics_engine_a, DB_MASTER_BRIGHT)) == 108);
|
46
registers/parse.py
Normal file
46
registers/parse.py
Normal file
@ -0,0 +1,46 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class Register:
|
||||
offset: int
|
||||
size: int
|
||||
name: str
|
||||
page: int
|
||||
description: str
|
||||
|
||||
def parse_fields(line):
|
||||
fields = line.split(' ', maxsplit=3)
|
||||
assert len(fields) in {1, 4}, fields
|
||||
if len(fields) == 1:
|
||||
offset, = fields
|
||||
return [int(offset, 16)]
|
||||
else:
|
||||
offset, name, page, description = fields
|
||||
return [int(offset, 16), name, int(page, 10), description]
|
||||
|
||||
def register_descriptions(lines):
|
||||
last_offset = -2
|
||||
result = []
|
||||
|
||||
for line in lines:
|
||||
if not line.strip():
|
||||
continue
|
||||
|
||||
fields = parse_fields(line)
|
||||
if len(fields) == 1:
|
||||
offset, = fields
|
||||
assert last_offset + 2 == offset, (last_offset, line)
|
||||
result[len(result) - 1].size += 2
|
||||
last_offset = offset
|
||||
else:
|
||||
offset, name, page, description = fields
|
||||
result.append(Register(
|
||||
offset,
|
||||
2, # size
|
||||
name.upper(),
|
||||
page,
|
||||
description,
|
||||
))
|
||||
last_offset = offset
|
||||
|
||||
return result
|
Loading…
Reference in New Issue
Block a user