PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
vif_registers.h
Go to the documentation of this file.
1
6#ifndef __VIF_REGISTERS_H__
7#define __VIF_REGISTERS_H__
8
9#include <tamtypes.h>
10
11#define VU0_MEM0_START 0x11000000
12#define VU0_MICROMEM0_START 0x11004000
13
14#define VU1_MEM1_START 0x11008000
15#define VU1_MICROMEM1_START 0x1100C000
16
17#define VIF0_FIFO 0x10004000
18#define VIF1_FIFO 0x10005000
19
20#define VIF0_STAT *(volatile u32 *)0x10003800
21#define VIF0_FBRST *(volatile u32 *)0x10003810
22#define VIF0_ERR *(volatile u32 *)0x10003820
23#define VIF0_MARK *(volatile u32 *)0x10003830
24#define VIF0_CYCLE *(volatile u32 *)0x10003840
25#define VIF0_MODE *(volatile u32 *)0x10003850
26#define VIF0_NUM *(volatile u32 *)0x10003860
27#define VIF0_MASK *(volatile u32 *)0x10003870
28#define VIF0_CODE *(volatile u32 *)0x10003880
29#define VIF0_ITOPS *(volatile u32 *)0x10003890
30#define VIF0_ITOP *(volatile u32 *)0x100038d0
31#define VIF0_TOP *(volatile u32 *)0x100038e0
32#define VIF0_R0 *(volatile u32 *)0x10003900
33#define VIF0_R1 *(volatile u32 *)0x10003910
34#define VIF0_R2 *(volatile u32 *)0x10003920
35#define VIF0_R3 *(volatile u32 *)0x10003930
36#define VIF0_C0 *(volatile u32 *)0x10003940
37#define VIF0_C1 *(volatile u32 *)0x10003950
38#define VIF0_C2 *(volatile u32 *)0x10003960
39#define VIF0_C3 *(volatile u32 *)0x10003970
40
41#define VIF1_STAT *(volatile u32 *)0x10003c00
42#define VIF1_FBRST *(volatile u32 *)0x10003c10
43#define VIF1_ERR *(volatile u32 *)0x10003c20
44#define VIF1_MARK *(volatile u32 *)0x10003c30
45#define VIF1_CYCLE *(volatile u32 *)0x10003c40
46#define VIF1_MODE *(volatile u32 *)0x10003c50
47#define VIF1_NUM *(volatile u32 *)0x10003c60
48#define VIF1_MASK *(volatile u32 *)0x10003c70
49#define VIF1_CODE *(volatile u32 *)0x10003c80
50#define VIF1_ITOPS *(volatile u32 *)0x10003c90
51#define VIF1_BASE *(volatile u32 *)0x10003ca0
52#define VIF1_OFST *(volatile u32 *)0x10003cb0
53#define VIF1_TOPS *(volatile u32 *)0x10003cc0
54#define VIF1_ITOP *(volatile u32 *)0x10003cd0
55#define VIF1_TOP *(volatile u32 *)0x10003ce0
56#define VIF1_R0 *(volatile u32 *)0x10003d00
57#define VIF1_R1 *(volatile u32 *)0x10003d10
58#define VIF1_R2 *(volatile u32 *)0x10003d20
59#define VIF1_R3 *(volatile u32 *)0x10003d30
60#define VIF1_C0 *(volatile u32 *)0x10003d40
61#define VIF1_C1 *(volatile u32 *)0x10003d50
62#define VIF1_C2 *(volatile u32 *)0x10003d60
63#define VIF1_C3 *(volatile u32 *)0x10003d70
64
65#define VIF_SET_FBRST(RST, FBK, STP, STC) \
66 (u32)((RST)&0x00000001) << 0 | (u32)((FBK)&0x00000001) << 1 | \
67 (u32)((STP)&0x00000001) << 2 | (u32)((STC)&0x00000001) << 3
68
69#define VIF_SET_ERR(MII, ME0, ME1) \
70 (u32)((MII)&0x00000001) << 0 | (u32)((ME0)&0x00000001) << 1 | \
71 (u32)((ME1)&0x00000001) << 2
72
73#define VIF_SET_MARK(MARK) \
74 (u32)((MARK)&0x0000FFFF) << 0
75
76typedef struct
77{
78 u32 vps : 2;
79 u32 vew : 1;
80 u32 vgw : 1; // vif1
81 u32 pad0 : 2;
82 u32 mrk : 1;
83 u32 dbf : 1; // vif1
84 u32 vss : 1;
85 u32 vfs : 1;
86 u32 vis : 1;
87 u32 irq : 1;
88 u32 er0 : 1;
89 u32 er1 : 1;
90 u32 pad1 : 9;
91 u32 fdr : 1; // vif1
92 u32 fqc : 5;
93 u32 pad2 : 3;
94} __attribute__((packed)) VIFSTAT;
95
96typedef struct
97{
98 u32 cl : 8;
99 u32 wl : 8;
100 u32 pad0 : 16;
101} __attribute__((packed)) VIFCYCLE;
102
103typedef struct
104{
105 u32 mode : 2;
106 u32 pad0 : 30;
107} __attribute__((packed)) VIFMODE;
108
109typedef struct
110{
111 u32 m0 : 2;
112 u32 m1 : 2;
113 u32 m2 : 2;
114 u32 m3 : 2;
115 u32 m4 : 2;
116 u32 m5 : 2;
117 u32 m6 : 2;
118 u32 m7 : 2;
119 u32 m8 : 2;
120 u32 m9 : 2;
121 u32 m10 : 2;
122 u32 m11 : 2;
123 u32 m12 : 2;
124 u32 m13 : 2;
125 u32 m14 : 2;
126 u32 m15 : 2;
127} __attribute__((packed)) VIFMASK;
128
129typedef struct
130{
131 u32 imdt : 16;
132 u32 num : 8;
133 u32 cmd : 8;
134} __attribute__((packed)) VIFCODE;
135
136typedef struct
137{
138 u32 itops : 10;
139 u32 pad0 : 22;
140} __attribute__((packed)) VIFITOPS;
141
142typedef struct
143{
144 u32 base : 10;
145 u32 pad0 : 22;
146} __attribute__((packed)) VIF1BASE; // vif1
147
148typedef struct
149{
150 u32 offset : 10;
151 u32 pad0 : 22;
152} __attribute__((packed)) VIF1OFST; // vif1
153
154typedef struct
155{
156 u32 tops : 10;
157 u32 pad0 : 22;
158} __attribute__((packed)) VIF1TOPS; // vif1
159
160typedef struct
161{
162 u32 itop : 10;
163 u32 pad0 : 22;
164} __attribute__((packed)) VIFITOP;
165
166typedef struct
167{
168 u32 top : 10;
169 u32 pad0 : 22;
170} __attribute__((packed)) VIFTOP;
171
172typedef struct
173{
174 u32 row;
175} VIFR;
176
177typedef struct
178{
179 u32 column;
180} VIFC;
181
182#endif /* __VIF_REGISTERS_H__ */