PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
dma.h File Reference
#include <tamtypes.h>
#include <packet2_types.h>
+ Include dependency graph for dma.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DMA_CHANNEL_VIF0   0x00
 
#define DMA_CHANNEL_VIF1   0x01
 
#define DMA_CHANNEL_GIF   0x02
 
#define DMA_CHANNEL_fromIPU   0x03
 
#define DMA_CHANNEL_toIPU   0x04
 
#define DMA_CHANNEL_fromSIF0   0x05
 
#define DMA_CHANNEL_toSIF1   0x06
 
#define DMA_CHANNEL_SIF2   0x07
 
#define DMA_CHANNEL_fromSPR   0x08
 
#define DMA_CHANNEL_toSPR   0x09
 
#define DMA_FLAG_TRANSFERTAG   0x01
 
#define DMA_FLAG_INTERRUPTSAFE   0x02
 

Functions

int dma_reset (void)
 
int dma_channel_initialize (int channel, void *handler, int flags)
 
void dma_channel_fast_waits (int channel)
 
void dma_wait_fast (void)
 
int dma_channel_wait (int channel, int timeout)
 
void dma_channel_send_packet2 (packet2_t *packet2, int channel, u8 flush_cache)
 
int dma_channel_send_chain (int channel, void *data, int qwc, int flags, int spr)
 
int dma_channel_send_chain_ucab (int channel, void *data, int qwc, int flags)
 
int dma_channel_send_normal (int channel, void *data, int qwc, int flags, int spr)
 
int dma_channel_send_normal_ucab (int channel, void *data, int qwc, int flags)
 
int dma_channel_receive_normal (int channel, void *data, int data_size, int flags, int spr)
 
int dma_channel_receive_chain (int channel, void *data, int data_size, int flags, int spr)
 
int dma_channel_shutdown (int channel, int flags)
 

Detailed Description

DMA channel utilities

Definition in file dma.h.

Macro Definition Documentation

◆ DMA_CHANNEL_VIF0

#define DMA_CHANNEL_VIF0   0x00

Definition at line 22 of file dma.h.

◆ DMA_CHANNEL_VIF1

#define DMA_CHANNEL_VIF1   0x01

Definition at line 23 of file dma.h.

◆ DMA_CHANNEL_GIF

#define DMA_CHANNEL_GIF   0x02

Definition at line 24 of file dma.h.

◆ DMA_CHANNEL_fromIPU

#define DMA_CHANNEL_fromIPU   0x03

Definition at line 25 of file dma.h.

◆ DMA_CHANNEL_toIPU

#define DMA_CHANNEL_toIPU   0x04

Definition at line 26 of file dma.h.

◆ DMA_CHANNEL_fromSIF0

#define DMA_CHANNEL_fromSIF0   0x05

Definition at line 27 of file dma.h.

◆ DMA_CHANNEL_toSIF1

#define DMA_CHANNEL_toSIF1   0x06

Definition at line 28 of file dma.h.

◆ DMA_CHANNEL_SIF2

#define DMA_CHANNEL_SIF2   0x07

Definition at line 29 of file dma.h.

◆ DMA_CHANNEL_fromSPR

#define DMA_CHANNEL_fromSPR   0x08

Definition at line 30 of file dma.h.

◆ DMA_CHANNEL_toSPR

#define DMA_CHANNEL_toSPR   0x09

Definition at line 31 of file dma.h.

◆ DMA_FLAG_TRANSFERTAG

#define DMA_FLAG_TRANSFERTAG   0x01

Definition at line 33 of file dma.h.

◆ DMA_FLAG_INTERRUPTSAFE

#define DMA_FLAG_INTERRUPTSAFE   0x02

Definition at line 34 of file dma.h.

Function Documentation

◆ dma_reset()

int dma_reset ( void  )

Definition at line 40 of file dma.c.

◆ dma_channel_initialize()

int dma_channel_initialize ( int  channel,
void *  handler,
int  flags 
)

Initializes the specified dma channel.

Definition at line 58 of file dma.c.

References dma_channel_initialize(), and dma_channel_shutdown().

Referenced by dma_channel_initialize(), dma_channel_receive_chain(), and dma_channel_receive_normal().

◆ dma_channel_fast_waits()

void dma_channel_fast_waits ( int  channel)

Enables dma fast waits for that channel

Definition at line 108 of file dma.c.

References dma_channel_fast_waits(), and DMA_REG_PCR.

Referenced by dma_channel_fast_waits().

◆ dma_wait_fast()

void dma_wait_fast ( void  )

Waits until channel is usable based on coprocessor status

Definition at line 115 of file dma.c.

References dma_wait_fast().

Referenced by dma_wait_fast().

◆ dma_channel_wait()

int dma_channel_wait ( int  channel,
int  timeout 
)

Wait until the specified dma channel is ready.

Definition at line 130 of file dma.c.

References dma_channel_wait().

Referenced by dma_channel_wait().

◆ dma_channel_send_packet2()

void dma_channel_send_packet2 ( packet2_t packet2,
int  channel,
u8  flush_cache 
)

Send packet2. Type chain/normal is choosen from packet2_t.

Parameters
packet2Pointer to packet.
channelDMA channel.
flush_cacheShould be cache flushed before send?

Definition at line 158 of file dma.c.

References dma_channel_send_chain(), dma_channel_send_normal(), dma_channel_send_packet2(), packet2_t::mode, packet2_t::next, and packet2_t::tte.

Referenced by dma_channel_send_packet2().

◆ dma_channel_send_chain()

int dma_channel_send_chain ( int  channel,
void *  data,
int  qwc,
int  flags,
int  spr 
)

Send a dmachain to the specified dma channel.

Definition at line 185 of file dma.c.

References dma_channel_send_chain(), DMA_REG_STAT, and DMA_SET_CHCR.

Referenced by dma_channel_send_chain(), and dma_channel_send_packet2().

◆ dma_channel_send_chain_ucab()

int dma_channel_send_chain_ucab ( int  channel,
void *  data,
int  qwc,
int  flags 
)

Send a ucab dmachain to the specified dma channel.

Definition at line 216 of file dma.c.

References dma_channel_send_chain_ucab(), DMA_REG_STAT, and DMA_SET_CHCR.

Referenced by dma_channel_send_chain_ucab().

◆ dma_channel_send_normal()

int dma_channel_send_normal ( int  channel,
void *  data,
int  qwc,
int  flags,
int  spr 
)

Send data to the specified dma channel.

Definition at line 240 of file dma.c.

References dma_channel_send_normal(), DMA_REG_STAT, and DMA_SET_CHCR.

Referenced by dma_channel_send_normal(), and dma_channel_send_packet2().

◆ dma_channel_send_normal_ucab()

int dma_channel_send_normal_ucab ( int  channel,
void *  data,
int  qwc,
int  flags 
)

Send ucab data to the specified dma channel.

Definition at line 269 of file dma.c.

References dma_channel_send_normal_ucab(), DMA_REG_STAT, and DMA_SET_CHCR.

Referenced by dma_channel_send_normal_ucab().

◆ dma_channel_receive_normal()

int dma_channel_receive_normal ( int  channel,
void *  data,
int  data_size,
int  flags,
int  spr 
)

Receive data from the specified dma channel.

Definition at line 327 of file dma.c.

References dma_channel_initialize(), dma_channel_receive_normal(), and DMA_SET_CHCR.

Referenced by dma_channel_receive_normal().

◆ dma_channel_receive_chain()

int dma_channel_receive_chain ( int  channel,
void *  data,
int  data_size,
int  flags,
int  spr 
)

Receive data from the specified dma channel.

Definition at line 298 of file dma.c.

References dma_channel_initialize(), dma_channel_receive_chain(), and DMA_SET_CHCR.

Referenced by dma_channel_receive_chain().

◆ dma_channel_shutdown()

int dma_channel_shutdown ( int  channel,
int  flags 
)

Shut down the specified dma channel.

Definition at line 356 of file dma.c.

References dma_channel_shutdown().

Referenced by dma_channel_initialize(), and dma_channel_shutdown().