wavelength 1.0.0
Loading...
Searching...
No Matches
DmaPacket Class Reference

Builder of a DMA packet of GIF data, with DMA tags, GIF tags, and optional VIF DIRECT codes. More...

#include <dmapacket.h>

Public Types

enum  Mode { kModeNormal = 0 , kModeChain = 1 , kModeChainTagged = 2 }
 How Close() ends the packet and how the channel transfers it. More...

Public Member Functions

void OpenDmaTag ()
 Close the DMA tag being filled and open a new one at the cursor.
void CloseDmaTag (int nId, unsigned int nAddress, int nQwc)
 Close the DMA tag being filled.
void CloseGifTag (int bEop, int nLoops)
 Close the GIF tag being filled.
void OpenGifTag (int nFlg, int nRegs, unsigned long long nRegList, int nPrim)
 Close the GIF tag being filled and open a new one at the cursor.
void Init (DmaQuadword *pBase, int nChannel, int bVif)
 Set the buffer and the channel, and empty the packet.
void Reset ()
 Empty the packet.
void Wait ()
 Wait for the channel to stop.
unsigned int Close (Mode eMode, unsigned int nAddress)
 Close the packet and program the channel's registers for it.
void Send (Mode eMode, unsigned int nAddress)
 Close the packet and start the transfer.
DmaQuadword * GetBase () const
void SetBase (DmaQuadword *pBase)
DmaQuadword * GetCursor () const
void SetCursor (DmaQuadword *pCursor)
void Advance (int nQuadwords=1)
 Move the cursor past quadwords written in place.
DmaQuadword * GetGifTag () const

Static Public Member Functions

static DmaPacket & shared ()
 Report the instance at the start of the scratchpad.

Detailed Description

Builder of a DMA packet of GIF data, with DMA tags, GIF tags, and optional VIF DIRECT codes.

The class has no virtual and no RTTI, and its name is inferred. The renderer keeps its one instance at the start of the scratchpad and fills the two halves after it in turn.

Member Enumeration Documentation

◆ Mode

How Close() ends the packet and how the channel transfers it.

Enumerator
kModeNormal 

One block of quadwords from the base.

kModeChain 

A chain of DMA tags from the base.

kModeChainTagged 

A chain of DMA tags, with each tag transferred as well.

Member Function Documentation

◆ shared()

DmaPacket & DmaPacket::shared ( )
static

Report the instance at the start of the scratchpad.

Returns
The packet.

◆ OpenDmaTag()

void DmaPacket::OpenDmaTag ( )

Close the DMA tag being filled and open a new one at the cursor.

Ghidra address:
NTSC-U/C: 0x00211fb0
Ghidra address:
PAL: 0x0021adc8

◆ CloseDmaTag()

void DmaPacket::CloseDmaTag ( int nId,
unsigned int nAddress,
int nQwc )

Close the DMA tag being filled.

The open GIF tag is closed first with its end-of-packet bit.

Parameters
nIdThe tag ID.
nAddressThe tag's address field.
nQwcThe quadwords the tag covers, or 0 for those written since it was opened.
Ghidra address:
NTSC-U/C: 0x00211ff0
Ghidra address:
PAL: 0x0021ae08

◆ CloseGifTag()

void DmaPacket::CloseGifTag ( int bEop,
int nLoops )

Close the GIF tag being filled.

The loop count comes from the quadwords written since the tag was opened unless one is given. An open VIF DIRECT code grows by the tag's quadwords.

Parameters
bEopWhether the tag ends the GIF packet, which also ends the VIF DIRECT code.
nLoopsThe loop count, or 0 to count the quadwords written.
Ghidra address:
NTSC-U/C: 0x002120a0
Ghidra address:
PAL: 0x0021aeb8

◆ OpenGifTag()

void DmaPacket::OpenGifTag ( int nFlg,
int nRegs,
unsigned long long nRegList,
int nPrim )

Close the GIF tag being filled and open a new one at the cursor.

A packet sent through VIF opens a VIF DIRECT code first when none is open.

Parameters
nFlgThe data format of the tag.
nRegsThe number of register descriptors.
nRegListThe register descriptors.
nPrimThe PRIM value, or 0 for none.
Ghidra address:
NTSC-U/C: 0x002121b0
Ghidra address:
PAL: 0x0021afc8

◆ Init()

void DmaPacket::Init ( DmaQuadword * pBase,
int nChannel,
int bVif )

Set the buffer and the channel, and empty the packet.

Parameters
pBaseThe buffer.
nChannelThe DMA channel.
bVifWhether the channel is a VIF channel.
Ghidra address:
NTSC-U/C: 0x002122a8
Ghidra address:
PAL: 0x0021b0c0

◆ Reset()

void DmaPacket::Reset ( )

Empty the packet.

Ghidra address:
NTSC-U/C: 0x002122d0
Ghidra address:
PAL: 0x0021b0e8

◆ Wait()

void DmaPacket::Wait ( )

Wait for the channel to stop.

Ghidra address:
NTSC-U/C: 0x002122e8
Ghidra address:
PAL: 0x0021b100

◆ Close()

unsigned int DmaPacket::Close ( Mode eMode,
unsigned int nAddress )

Close the packet and program the channel's registers for it.

Parameters
eModeHow the packet is ended and sent.
nAddressThe main memory address of a scratchpad transfer, or 0.
Returns
The CHCR value that starts the transfer.
Ghidra address:
NTSC-U/C: 0x00212328
Ghidra address:
PAL: 0x0021b140

◆ Send()

void DmaPacket::Send ( Mode eMode,
unsigned int nAddress )

Close the packet and start the transfer.

Parameters
eModeHow the packet is ended and sent.
nAddressThe main memory address of a scratchpad transfer, or 0.
Ghidra address:
NTSC-U/C: 0x00212500
Ghidra address:
PAL: 0x0021b318

◆ GetBase()

DmaQuadword * DmaPacket::GetBase ( ) const
inline
Returns
The first quadword of the packet.

◆ SetBase()

void DmaPacket::SetBase ( DmaQuadword * pBase)
inline
Parameters
pBaseThe first quadword of the packet.

◆ GetCursor()

DmaQuadword * DmaPacket::GetCursor ( ) const
inline
Returns
The next quadword to write.

◆ SetCursor()

void DmaPacket::SetCursor ( DmaQuadword * pCursor)
inline
Parameters
pCursorThe next quadword to write.

◆ Advance()

void DmaPacket::Advance ( int nQuadwords = 1)
inline

Move the cursor past quadwords written in place.

Parameters
nQuadwordsThe number of quadwords.

◆ GetGifTag()

DmaQuadword * DmaPacket::GetGifTag ( ) const
inline
Returns
The GIF tag being filled, or null.

The documentation for this class was generated from the following file: