PS2SDK
PS2 Homebrew Libraries
packet2_types.h
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # (c) 2020 h4570 Sandro SobczyÅ„ski <sandro.sobczynski@gmail.com>
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
19 #ifndef __PACKET2_DATA_TYPES_H__
20 #define __PACKET2_DATA_TYPES_H__
21 
22 #include <tamtypes.h>
23 
32 {
33  P2_MODE_NORMAL = 0,
34  P2_MODE_CHAIN = 1,
35 };
36 
39 {
41  P2_TYPE_NORMAL = 0x00000000,
43  P2_TYPE_UNCACHED = 0x20000000,
45  P2_TYPE_UNCACHED_ACCL = 0x30000000,
47  P2_TYPE_SPRAM = 0x70000000
48 };
49 
52 {
86 };
87 
89 typedef struct
90 {
92  u64 QWC : 16;
93  u64 PAD : 10;
101  u64 PCE : 2;
103  u64 ID : 3;
109  u64 IRQ : 1;
115  u64 ADDR : 31;
121  u64 SPR : 1;
122  u32 OPT1;
123  u32 OPT2;
125 
132 {
133  P2_UNPACK_S_32 = 0x00,
134  P2_UNPACK_S_16 = 0x01,
135  P2_UNPACK_S_8 = 0x02,
136  P2_UNPACK_V2_32 = 0x04,
137  P2_UNPACK_V2_16 = 0x05,
138  P2_UNPACK_V2_8 = 0x06,
139  P2_UNPACK_V3_32 = 0x08,
140  P2_UNPACK_V3_16 = 0x09,
141  P2_UNPACK_V3_8 = 0x0A,
142  P2_UNPACK_V4_32 = 0x0C,
143  P2_UNPACK_V4_16 = 0x0D,
144  P2_UNPACK_V4_8 = 0x0E,
145  P2_UNPACK_V4_5 = 0x0F,
146 };
147 
150 {
275 };
276 
278 typedef struct
279 {
281  u32 immediate : 16;
288  u32 num : 8;
293  u32 cmd : 8;
294 } vif_code_t;
295 
300 typedef struct
301 {
305  enum Packet2Type type;
307  enum Packet2Mode mode;
315  u8 tte;
317  qword_t *base __attribute__((aligned(64)));
319  qword_t *next;
330 } packet2_t;
331 
333 typedef union
334 {
335  struct
336  {
337  unsigned int m0 : 2;
338  unsigned int m1 : 2;
339  unsigned int m2 : 2;
340  unsigned int m3 : 2;
341  unsigned int m4 : 2;
342  unsigned int m5 : 2;
343  unsigned int m6 : 2;
344  unsigned int m7 : 2;
345  unsigned int m8 : 2;
346  unsigned int m9 : 2;
347  unsigned int m10 : 2;
348  unsigned int m11 : 2;
349  unsigned int m12 : 2;
350  unsigned int m13 : 2;
351  unsigned int m14 : 2;
352  unsigned int m15 : 2;
353  };
354  unsigned int m;
355 } Mask;
356 
357 #endif /* __PACKET2_DATA_TYPES_H__ */
358  // end of packet2_types subgroup
P2_VIF_STROW
@ P2_VIF_STROW
Definition: packet2_types.h:247
P2_TYPE_UNCACHED_ACCL
@ P2_TYPE_UNCACHED_ACCL
Definition: packet2_types.h:45
UnpackMode
UnpackMode
Definition: packet2_types.h:131
P2_DMA_TAG_END
@ P2_DMA_TAG_END
Definition: packet2_types.h:85
P2_VIF_FLUSH
@ P2_VIF_FLUSH
Definition: packet2_types.h:211
P2_VIF_STCOL
@ P2_VIF_STCOL
Definition: packet2_types.h:253
packet2_t::tte
u8 tte
Definition: packet2_types.h:315
dma_tag_t::QWC
u64 QWC
Definition: packet2_types.h:92
P2_DMA_TAG_REFS
@ P2_DMA_TAG_REFS
Definition: packet2_types.h:66
Mask
Definition: packet2_types.h:333
P2_DMA_TAG_RET
@ P2_DMA_TAG_RET
Definition: packet2_types.h:83
DmaTagType
DmaTagType
Definition: packet2_types.h:51
Packet2Mode
Packet2Mode
Definition: packet2_types.h:31
P2_VIF_STCYCL
@ P2_VIF_STCYCL
Definition: packet2_types.h:161
P2_VIF_MSCAL
@ P2_VIF_MSCAL
Definition: packet2_types.h:223
P2_VIF_FLUSHE
@ P2_VIF_FLUSHE
Definition: packet2_types.h:204
dma_tag_t::PCE
u64 PCE
Definition: packet2_types.h:101
P2_DMA_TAG_CNT
@ P2_DMA_TAG_CNT
Definition: packet2_types.h:56
vif_code_t::cmd
u32 cmd
Definition: packet2_types.h:293
P2_DMA_TAG_NEXT
@ P2_DMA_TAG_NEXT
Definition: packet2_types.h:58
P2_VIF_FLUSHA
@ P2_VIF_FLUSHA
Definition: packet2_types.h:217
packet2_t
Definition: packet2_types.h:300
vif_code_t::immediate
u32 immediate
Definition: packet2_types.h:281
P2_DMA_TAG_REFE
@ P2_DMA_TAG_REFE
Definition: packet2_types.h:54
__attribute__
typedef __attribute__
Definition: tlbfunc.c:60
vif_code_t
Definition: packet2_types.h:278
packet2_t::next
qword_t * next
Definition: packet2_types.h:319
P2_DMA_TAG_REF
@ P2_DMA_TAG_REF
Definition: packet2_types.h:60
P2_DMA_TAG_CALL
@ P2_DMA_TAG_CALL
Definition: packet2_types.h:73
P2_VIF_ITOP
@ P2_VIF_ITOP
Definition: packet2_types.h:180
P2_VIF_OFFSET
@ P2_VIF_OFFSET
Definition: packet2_types.h:168
VIFOpcode
VIFOpcode
Definition: packet2_types.h:149
tamtypes.h
P2_VIF_BASE
@ P2_VIF_BASE
Definition: packet2_types.h:174
P2_VIF_MPG
@ P2_VIF_MPG
Definition: packet2_types.h:259
dma_tag_t::IRQ
u64 IRQ
Definition: packet2_types.h:109
vif_code_t::num
u32 num
Definition: packet2_types.h:288
dma_tag_t
Definition: packet2_types.h:89
packet2_t::tag_opened_at
dma_tag_t * tag_opened_at
Definition: packet2_types.h:324
P2_VIF_MSCALF
@ P2_VIF_MSCALF
Definition: packet2_types.h:235
dma_tag_t::SPR
u64 SPR
Definition: packet2_types.h:121
packet2_t::vif_code_opened_at
vif_code_t * vif_code_opened_at
Definition: packet2_types.h:329
P2_TYPE_UNCACHED
@ P2_TYPE_UNCACHED
Definition: packet2_types.h:43
dma_tag_t::ID
u64 ID
Definition: packet2_types.h:103
P2_VIF_STMOD
@ P2_VIF_STMOD
Definition: packet2_types.h:186
__attribute__
Definition: gif_registers.h:38
packet2_t::max_qwords_count
u16 max_qwords_count
Definition: packet2_types.h:303
P2_VIF_DIRECTHL
@ P2_VIF_DIRECTHL
Definition: packet2_types.h:274
P2_VIF_DIRECT
@ P2_VIF_DIRECT
Definition: packet2_types.h:265
P2_VIF_STMASK
@ P2_VIF_STMASK
Definition: packet2_types.h:241
dma_tag_t::ADDR
u64 ADDR
Definition: packet2_types.h:115
P2_TYPE_SPRAM
@ P2_TYPE_SPRAM
Definition: packet2_types.h:47
P2_VIF_NOP
@ P2_VIF_NOP
Definition: packet2_types.h:156
P2_VIF_MSCNT
@ P2_VIF_MSCNT
Definition: packet2_types.h:229
P2_VIF_MARK
@ P2_VIF_MARK
Definition: packet2_types.h:199
P2_TYPE_NORMAL
@ P2_TYPE_NORMAL
Definition: packet2_types.h:41
Packet2Type
Packet2Type
Definition: packet2_types.h:38
P2_VIF_MSKPATH3
@ P2_VIF_MSKPATH3
Definition: packet2_types.h:192