ps2sdk
1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
|
#include <tamtypes.h>
#include <dma.h>
#include <kernel.h>
#include <malloc.h>
#include <string.h>
#include <dma_registers.h>
Go to the source code of this file.
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 data_size, 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_chain (int channel, void *data, int data_size, int flags, int spr) |
int | dma_channel_receive_normal (int channel, void *data, int data_size, int flags, int spr) |
int | dma_channel_shutdown (int channel, int flags) |
Variables | |
static u32 | dma_chcr [10] = { 0x10008000, 0x10009000, 0x1000A000, 0x1000B000, 0x1000B400, 0x1000C000, 0x1000C400, 0x1000C800, 0x1000D000, 0x1000D400 } |
static u32 | dma_qwc [10] = { 0x10008020, 0x10009020, 0x1000A020, 0x1000B020, 0x1000B420, 0x1000C020, 0x1000C420, 0x1000C820, 0x1000D020, 0x1000D420 } |
static u32 | dma_madr [10] = { 0x10008010, 0x10009010, 0x1000A010, 0x1000B010, 0x1000B410, 0x1000C010, 0x1000C410, 0x1000C810, 0x1000D010, 0x1000D410 } |
static u32 | dma_tadr [10] = { 0x10008030, 0x10009030, 0x1000A030, 0x1000B030, 0x1000B430, 0x1000C030, 0x1000C430, 0x1000C830, 0x1000D030, 0x1000D430 } |
static u32 | dma_asr0 [10] = { 0x10008040, 0x10009040, 0x1000A040, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } |
static u32 | dma_asr1 [10] = { 0x10008050, 0x10009050, 0x1000A050, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } |
static u32 | dma_sadr [10] = { 0x10008080, 0x10009080, 0x1000A080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1000D080, 0x1000D480 } |
static int | dma_handler_id [10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
static int | dma_channel_initialized [10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
void dma_channel_fast_waits | ( | int | channel | ) |
Enables dma fast waits for that channel
Definition at line 108 of file dma.c.
References DMA_REG_PCR.
Referenced by main().
int dma_channel_initialize | ( | int | channel, |
void * | handler, | ||
int | flags | ||
) |
Initializes the specified dma channel.
Definition at line 58 of file dma.c.
References AddDmacHandler(), dma_asr0, dma_asr1, dma_channel_initialized, dma_channel_shutdown(), DMA_FLAG_INTERRUPTSAFE, dma_handler_id, dma_sadr, EnableDmac(), iEnableDmac(), and NULL.
Referenced by dma_channel_receive_chain(), dma_channel_receive_normal(), and main().
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 296 of file dma.c.
References data, dma_channel_initialize(), dma_channel_initialized, dma_chcr, dma_madr, dma_qwc, DMA_SET_CHCR, DMA_SET_MADR, DMA_SET_QWC, and NULL.
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 325 of file dma.c.
References data, dma_channel_initialize(), dma_channel_initialized, dma_chcr, dma_madr, dma_qwc, DMA_SET_CHCR, DMA_SET_MADR, DMA_SET_QWC, and NULL.
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 184 of file dma.c.
References data, dma_chcr, DMA_FLAG_INTERRUPTSAFE, DMA_FLAG_TRANSFERTAG, dma_madr, dma_qwc, DMA_REG_STAT, DMA_SET_CHCR, DMA_SET_MADR, DMA_SET_QWC, DMA_SET_STAT, DMA_SET_TADR, dma_tadr, iSyncDCache(), and SyncDCache().
Referenced by dma_channel_send_packet2(), init_texture(), load_texture(), main(), and render().
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 215 of file dma.c.
References data, dma_chcr, DMA_FLAG_TRANSFERTAG, dma_madr, dma_qwc, DMA_REG_STAT, DMA_SET_CHCR, DMA_SET_MADR, DMA_SET_QWC, DMA_SET_TADR, and dma_tadr.
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 238 of file dma.c.
References data, dma_chcr, DMA_FLAG_INTERRUPTSAFE, DMA_FLAG_TRANSFERTAG, dma_madr, dma_qwc, DMA_REG_STAT, DMA_SET_CHCR, DMA_SET_MADR, DMA_SET_QWC, DMA_SET_STAT, iSyncDCache(), and SyncDCache().
Referenced by dma_channel_send_packet2(), draw_init_env(), init_drawing_environment(), main(), render(), run_demo(), SetDMA(), and setup_texture().
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 267 of file dma.c.
References data, dma_chcr, DMA_FLAG_INTERRUPTSAFE, DMA_FLAG_TRANSFERTAG, dma_madr, dma_qwc, DMA_REG_STAT, DMA_SET_CHCR, DMA_SET_MADR, DMA_SET_QWC, DMA_SET_STAT, iSyncDCache(), and SyncDCache().
Referenced by flip_buffers().
Send packet2. Type chain/normal is choosen from packet2_t.
packet2 | Pointer to packet. |
channel | DMA channel. |
flush_cache | Should be cache flushed before send? |
Definition at line 157 of file dma.c.
References packet2_t::base, dma_channel_send_chain(), dma_channel_send_normal(), DMA_FLAG_TRANSFERTAG, FlushCache(), packet2_t::mode, packet2_t::next, P2_MODE_CHAIN, and packet2_t::tte.
Referenced by clear_screen(), draw_cube(), init_drawing_environment(), send_texture(), vu1_set_double_buffer_settings(), and vu1_upload_micro_program().
int dma_channel_shutdown | ( | int | channel, |
int | flags | ||
) |
Shut down the specified dma channel.
Definition at line 354 of file dma.c.
References DisableDmac(), dma_channel_initialized, DMA_FLAG_INTERRUPTSAFE, dma_handler_id, iDisableDmac(), and RemoveDmacHandler().
Referenced by dma_channel_initialize(), dma_reset(), and main().
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_chcr.
Referenced by draw_cube(), SetDMA(), vu1_set_double_buffer_settings(), and vu1_upload_micro_program().
int dma_reset | ( | void | ) |
Definition at line 40 of file dma.c.
References dma_channel_shutdown(), and ResetEE().
void dma_wait_fast | ( | void | ) |
Waits until channel is usable based on coprocessor status
Definition at line 115 of file dma.c.
Referenced by clear_screen(), draw_init_env(), flip_buffers(), init_drawing_environment(), init_texture(), load_texture(), main(), render(), run_demo(), send_texture(), and setup_texture().
|
static |
Definition at line 29 of file dma.c.
Referenced by dma_channel_initialize().
|
static |
Definition at line 31 of file dma.c.
Referenced by dma_channel_initialize().
|
static |
Definition at line 37 of file dma.c.
Referenced by dma_channel_initialize(), dma_channel_receive_chain(), dma_channel_receive_normal(), and dma_channel_shutdown().
|
static |
Definition at line 21 of file dma.c.
Referenced by dma_channel_receive_chain(), dma_channel_receive_normal(), dma_channel_send_chain(), dma_channel_send_chain_ucab(), dma_channel_send_normal(), dma_channel_send_normal_ucab(), and dma_channel_wait().
|
static |
Definition at line 35 of file dma.c.
Referenced by dma_channel_initialize(), and dma_channel_shutdown().
|
static |
Definition at line 25 of file dma.c.
Referenced by dma_channel_receive_chain(), dma_channel_receive_normal(), dma_channel_send_chain(), dma_channel_send_chain_ucab(), dma_channel_send_normal(), and dma_channel_send_normal_ucab().
|
static |
Definition at line 23 of file dma.c.
Referenced by dma_channel_receive_chain(), dma_channel_receive_normal(), dma_channel_send_chain(), dma_channel_send_chain_ucab(), dma_channel_send_normal(), and dma_channel_send_normal_ucab().
|
static |
Definition at line 33 of file dma.c.
Referenced by dma_channel_initialize().
|
static |
Definition at line 27 of file dma.c.
Referenced by dma_channel_send_chain(), and dma_channel_send_chain_ucab().