ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).

Data Structures

struct  dma_tag_t
 
struct  vif_code_t
 
struct  packet2_t
 
union  Mask
 

Enumerations

enum  Packet2Mode {
  P2_MODE_NORMAL = 0 ,
  P2_MODE_CHAIN = 1
}
 
enum  Packet2Type {
  P2_TYPE_NORMAL = 0x00000000 ,
  P2_TYPE_UNCACHED = 0x20000000 ,
  P2_TYPE_UNCACHED_ACCL = 0x30000000 ,
  P2_TYPE_SPRAM = 0x70000000
}
 
enum  DmaTagType {
  P2_DMA_TAG_REFE = 0 ,
  P2_DMA_TAG_CNT = 1 ,
  P2_DMA_TAG_NEXT = 2 ,
  P2_DMA_TAG_REF = 3 ,
  P2_DMA_TAG_REFS = 4 ,
  P2_DMA_TAG_CALL = 5 ,
  P2_DMA_TAG_RET = 6 ,
  P2_DMA_TAG_END = 7
}
 
enum  UnpackMode {
  P2_UNPACK_S_32 = 0x00 ,
  P2_UNPACK_S_16 = 0x01 ,
  P2_UNPACK_S_8 = 0x02 ,
  P2_UNPACK_V2_32 = 0x04 ,
  P2_UNPACK_V2_16 = 0x05 ,
  P2_UNPACK_V2_8 = 0x06 ,
  P2_UNPACK_V3_32 = 0x08 ,
  P2_UNPACK_V3_16 = 0x09 ,
  P2_UNPACK_V3_8 = 0x0A ,
  P2_UNPACK_V4_32 = 0x0C ,
  P2_UNPACK_V4_16 = 0x0D ,
  P2_UNPACK_V4_8 = 0x0E ,
  P2_UNPACK_V4_5 = 0x0F
}
 
enum  VIFOpcode {
  P2_VIF_NOP = 0 ,
  P2_VIF_STCYCL = 1 ,
  P2_VIF_OFFSET = 2 ,
  P2_VIF_BASE = 3 ,
  P2_VIF_ITOP = 4 ,
  P2_VIF_STMOD = 5 ,
  P2_VIF_MSKPATH3 = 6 ,
  P2_VIF_MARK = 7 ,
  P2_VIF_FLUSHE = 16 ,
  P2_VIF_FLUSH = 17 ,
  P2_VIF_FLUSHA = 18 ,
  P2_VIF_MSCAL = 20 ,
  P2_VIF_MSCNT = 23 ,
  P2_VIF_MSCALF = 21 ,
  P2_VIF_STMASK = 32 ,
  P2_VIF_STROW = 48 ,
  P2_VIF_STCOL = 49 ,
  P2_VIF_MPG = 74 ,
  P2_VIF_DIRECT = 80 ,
  P2_VIF_DIRECTHL = 81
}
 

Detailed Description

Structures and enums used in libpacket2.

Enumeration Type Documentation

◆ DmaTagType

enum DmaTagType

DMA tag types

Enumerator
P2_DMA_TAG_REFE 

Transfers the QWC qword from the ADDR field, clears the Dn_CHCR.STR to 0, and ends transfer.

P2_DMA_TAG_CNT 

Transfers the QWC qword following the tag and reads the succeeding qword as the next tag.

P2_DMA_TAG_NEXT 

Transfers the QWC qword following the tag and reads the qword of the ADDR field as the next tag.

P2_DMA_TAG_REF 

Transfers the QWC qword from the ADDR field and reads the qword following the tag as the next tag.

P2_DMA_TAG_REFS 

Transfers the QWC qword from the ADDR field while controlling stalls and reads the qword following the tag as the next tag.

Note
Effective only on the VIF1, GIF, and SIF1 channels.
P2_DMA_TAG_CALL 

Transfers the QWC qword following the tag, pushes the next field into the Dn_ASR register, and reads the qword of the ADDR field as the next tag.

Note
Effective only on the VIF0, VIF1, and GIF channels. Addresses can be pushed up to 2 levels
P2_DMA_TAG_RET 

Transfers the QWC qword following the tag and reads the qword of the field popped from the Dn_ASR register as the next tag. Transfers the QWC qword following the tag, clears the Dn_CHCR.STR to 0, and ends transfer when there is no pushed address.

Note
Effective only on the VIF0, VIF1, and GIF channels.
P2_DMA_TAG_END 

Transfers the QWC qword following the tag, clears the Dn_CHCR.STR to 0, and ends transfer.

Definition at line 51 of file packet2_types.h.

52 {
54  P2_DMA_TAG_REFE = 0,
56  P2_DMA_TAG_CNT = 1,
58  P2_DMA_TAG_NEXT = 2,
60  P2_DMA_TAG_REF = 3,
66  P2_DMA_TAG_REFS = 4,
73  P2_DMA_TAG_CALL = 5,
83  P2_DMA_TAG_RET = 6,
85  P2_DMA_TAG_END = 7
86 };
@ P2_DMA_TAG_NEXT
Definition: packet2_types.h:58
@ P2_DMA_TAG_CNT
Definition: packet2_types.h:56
@ P2_DMA_TAG_RET
Definition: packet2_types.h:83
@ P2_DMA_TAG_CALL
Definition: packet2_types.h:73
@ P2_DMA_TAG_REF
Definition: packet2_types.h:60
@ P2_DMA_TAG_REFS
Definition: packet2_types.h:66
@ P2_DMA_TAG_END
Definition: packet2_types.h:85
@ P2_DMA_TAG_REFE
Definition: packet2_types.h:54

◆ Packet2Mode

Two modes are commonly used with the DMA Controller (DMAC): normal mode and chain mode. In normal mode, transfers are issued one at a time. In chain mode, a series of transfers are issued simultaneously by initiating a transfer that contains "DMA Tags", which in turn contains instructions for further transfers. You will probably use chain mode for the majority of your transfers.

Enumerator
P2_MODE_NORMAL 
P2_MODE_CHAIN 

Definition at line 31 of file packet2_types.h.

32 {
33  P2_MODE_NORMAL = 0,
34  P2_MODE_CHAIN = 1,
35 };
@ P2_MODE_NORMAL
Definition: packet2_types.h:33
@ P2_MODE_CHAIN
Definition: packet2_types.h:34

◆ Packet2Type

Types of memory mapping.

Enumerator
P2_TYPE_NORMAL 

Normal.

P2_TYPE_UNCACHED 

Uncached.

P2_TYPE_UNCACHED_ACCL 

Uncached accelerated.

P2_TYPE_SPRAM 

Scratchpad memory.

Definition at line 38 of file packet2_types.h.

39 {
41  P2_TYPE_NORMAL = 0x00000000,
43  P2_TYPE_UNCACHED = 0x20000000,
45  P2_TYPE_UNCACHED_ACCL = 0x30000000,
47  P2_TYPE_SPRAM = 0x70000000
48 };
@ P2_TYPE_UNCACHED_ACCL
Definition: packet2_types.h:45
@ P2_TYPE_UNCACHED
Definition: packet2_types.h:43
@ P2_TYPE_SPRAM
Definition: packet2_types.h:47
@ P2_TYPE_NORMAL
Definition: packet2_types.h:41

◆ UnpackMode

enum UnpackMode

Unpack modes. V2 = 2 dimensions, S = Single = 1 dimension _32 = 32 bits of data length.

Enumerator
P2_UNPACK_S_32 
P2_UNPACK_S_16 
P2_UNPACK_S_8 
P2_UNPACK_V2_32 
P2_UNPACK_V2_16 
P2_UNPACK_V2_8 
P2_UNPACK_V3_32 
P2_UNPACK_V3_16 
P2_UNPACK_V3_8 
P2_UNPACK_V4_32 
P2_UNPACK_V4_16 
P2_UNPACK_V4_8 
P2_UNPACK_V4_5 

Definition at line 131 of file packet2_types.h.

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 };
@ P2_UNPACK_V4_8
@ P2_UNPACK_S_8
@ P2_UNPACK_V3_32
@ P2_UNPACK_V4_16
@ P2_UNPACK_V2_16
@ P2_UNPACK_V4_32
@ P2_UNPACK_V2_32
@ P2_UNPACK_V3_16
@ P2_UNPACK_V3_8
@ P2_UNPACK_V4_5
@ P2_UNPACK_S_16
@ P2_UNPACK_V2_8
@ P2_UNPACK_S_32

◆ VIFOpcode

enum VIFOpcode

VIF opcodes.

Enumerator
P2_VIF_NOP 

No operation. No operation is performed. NOP is used to adjust the data alignment in the VIF packet.

P2_VIF_STCYCL 

Sets write recycle. STCYCL writes the value of the IMMEDIATE field to the VIFn_CYCLE register.

P2_VIF_OFFSET 

Sets the double buffer offset. OFFSET writes the lower 10 bits of the IMMEDIATE field to the VIF1_OFST register. At the same time, the DBF flag of the VIF1_STAT register is cleared to 0, and the VIF1_BASE register value is set to the VIF1_TOPS. That is, the pointer for the double buffer points to the BASE.

P2_VIF_BASE 

Sets the base address of the double buffer. BASE writes the lower 10 bits of the IMMEDIATE field to the VIF1_BASE register. These bits become the base address of the double buffers.

P2_VIF_ITOP 

Sets the data pointer. ITOP writes the lower 10 bits of the IMMEDIATE field to the VIFn_ITOPS register. This value is read from the VU by the XITOP instruction.

P2_VIF_STMOD 

Sets the addition decompression mode. STMOD writes the lower 2 bits of the IMMEDIATE field to the VIFn_MODE register. This becomes the addition decompression mode setting.

P2_VIF_MSKPATH3 

Sets the PATH3 mask. MSKPATH3 enables/disables transfer processing via the GIF PATH3. The setting of this register applies to the next data block or later.

P2_VIF_MARK 

Sets the MARK value. MARK writes the value of the IMMEDIATE field to the VIFn_MARK register. By properly setting the MARK value, it becomes possible to use this value for synchronization with the EE Core and debugging.

P2_VIF_FLUSHE 

Waits for end of the microprogram. FLUSHE waits for the state in which the microprogram in VU0/VU1 has been ended.

P2_VIF_FLUSH 

Waits for end of the microprogram. FLUSH waits for the state in which transfers to the GIF from PATH1 and PATH2 have been ended after end of microprogram in VU1. FLUSH does not wait for the end of the transfer via PATH1 by the XGKICK instruction with the E bit.

P2_VIF_FLUSHA 

Waits for end of the microprogram. FLUSHA waits for the state in which there is no transfer request from PATH3 after the end of micro program in VU1 and end of transfer to the GIF from PATH1 and PATH2.

P2_VIF_MSCAL 

Activates the microprogram. MSCAL waits for the end of the microprogram under execution and activates the micro program with the value of the IMMEDIATE field as the starting address.

P2_VIF_MSCNT 

Activates the microprogram. MSCNT waits for the end of the microprogram under execution and executes the next microprogram from the address following the most recently ended one in the PC (program counter).

P2_VIF_MSCALF 

Activates the microprogram. MSCALF waits for the end of both the microprogram and the GIF(PATH1/PATH2) transfer and executes the microprogram with the value of the IMMEDIATE field as the starting address.

P2_VIF_STMASK 

Sets the data mask pattern. STMASK stores the next 1 word of data in the VIFn_MASK register. This data becomes the mask pattern of the write data.

P2_VIF_STROW 

Sets the filling data. STROW stores the following 4 words of data in the VIFn_R0 - VIFn_R3 registers. These are used as filling data when decompressed by the VIFcode UNPACK.

P2_VIF_STCOL 

Sets the filling data. STCOL stores the following 4 words of data in the VIFn_C0 - VIFn_C3 registers. These are used as filling data when decompressed by the VIFcode UNPACK.

P2_VIF_MPG 

Transfers the microprogram. MPG waits for the end of the microprogram and transfers the following NUM pieces of 64-bit data. (microinstruction code) to the MicroMem address shown by the IMMEDIATE field.

P2_VIF_DIRECT 

Transfers data to the GIF(GS). DIRECT transfers the following IMMEDIATE pieces of 128-bit data to the GS via GIF PATH2. It is necessary to put the appropriate GIFtag to the data.

P2_VIF_DIRECTHL 

Transfers data to the GIF(GS). DIRECTHL transfers the following IMMEDIATE pieces of 128-bit data to the GS via GIF PATH2. The appropriate GIFtag must be attached to the data. Interruption of PATH3 IMAGE mode data does not occur during the data transfer via PATH2 by DIRECTHL. Moreover, when the IMAGE mode data is being transferred via PATH3, DIRECTHL stalls until the end of the transfer.

Definition at line 149 of file packet2_types.h.

150 {
156  P2_VIF_NOP = 0,
161  P2_VIF_STCYCL = 1,
168  P2_VIF_OFFSET = 2,
174  P2_VIF_BASE = 3,
180  P2_VIF_ITOP = 4,
186  P2_VIF_STMOD = 5,
192  P2_VIF_MSKPATH3 = 6,
199  P2_VIF_MARK = 7,
204  P2_VIF_FLUSHE = 16,
211  P2_VIF_FLUSH = 17,
217  P2_VIF_FLUSHA = 18,
223  P2_VIF_MSCAL = 20,
229  P2_VIF_MSCNT = 23,
235  P2_VIF_MSCALF = 21,
241  P2_VIF_STMASK = 32,
247  P2_VIF_STROW = 48,
253  P2_VIF_STCOL = 49,
259  P2_VIF_MPG = 74,
265  P2_VIF_DIRECT = 80,
274  P2_VIF_DIRECTHL = 81
275 };
@ P2_VIF_MSKPATH3
@ P2_VIF_STROW
@ P2_VIF_MPG
@ P2_VIF_STMASK
@ P2_VIF_MSCAL
@ P2_VIF_STCOL
@ P2_VIF_OFFSET
@ P2_VIF_MSCALF
@ P2_VIF_FLUSHE
@ P2_VIF_FLUSH
@ P2_VIF_NOP
@ P2_VIF_STCYCL
@ P2_VIF_STMOD
@ P2_VIF_DIRECTHL
@ P2_VIF_ITOP
@ P2_VIF_MSCNT
@ P2_VIF_DIRECT
@ P2_VIF_BASE
@ P2_VIF_FLUSHA
@ P2_VIF_MARK