KallistiOS
##version##
|
G2 bus memory interface. More...
Go to the source code of this file.
Macros | |
#define | SPU_DMA_MODE |
#define | SPU_DMA_G2CHN 0 |
#define | SPU_DMA_SHCHN 3 |
#define | BBA_DMA_MODE 4 |
#define | BBA_DMA_G2CHN 1 |
#define | BBA_DMA_SHCHN 1 |
#define | BBA_DMA2_MODE 3 |
#define | BBA_DMA2_G2CHN 2 |
#define | BBA_DMA2_SHCHN 0 |
Typedefs | |
typedef void(* | g2_dma_callback_t )(ptr_t data) |
Functions | |
int | g2_dma_transfer (void *from, void *dest, uint32 length, int block, g2_dma_callback_t callback, ptr_t cbdata, uint32 dir, uint32 mode, uint32 g2chn, uint32 sh4chn) |
uint8 | g2_read_8 (uint32 address) |
Read one byte from G2. More... | |
void | g2_write_8 (uint32 address, uint8 value) |
Write a single byte to G2. More... | |
uint16 | g2_read_16 (uint32 address) |
Read one 16-bit word from G2. More... | |
void | g2_write_16 (uint32 address, uint16 value) |
Write a 16-bit word to G2. More... | |
uint32 | g2_read_32 (uint32 address) |
Read one 32-bit dword from G2. More... | |
void | g2_write_32 (uint32 address, uint32 value) |
Write a 32-bit dword to G2. More... | |
void | g2_read_block_8 (uint8 *output, uint32 address, int amt) |
Read a block of bytes from G2. More... | |
void | g2_write_block_8 (const uint8 *input, uint32 address, int amt) |
Write a block of bytes to G2. More... | |
void | g2_read_block_16 (uint16 *output, uint32 address, int amt) |
Read a block of words from G2. More... | |
void | g2_write_block_16 (const uint16 *input, uint32 address, int amt) |
Write a block of words to G2. More... | |
void | g2_read_block_32 (uint32 *output, uint32 address, int amt) |
Read a block of dwords from G2. More... | |
void | g2_write_block_32 (const uint32 *input, uint32 address, int amt) |
Write a block of dwords to G2. More... | |
void | g2_memset_8 (uint32 address, uint8 c, int amt) |
Set a block of bytes to G2. More... | |
void | g2_fifo_wait () |
Wait for the G2 write FIFO to empty. More... | |
G2 bus memory interface.
This file provides low-level support for accessing devices on the G2 bus in the Dreamcast. The G2 bus contains the AICA, as well as the expansion port. Generally, you won't be dealing with things at this level, but rather on the level of the device you're actually interested in working with. Most of the expansion port devices (the modem, bba, and lan adapter) all have their own drivers that work off of this functionality.
The G2 bus is notoroiously picky about a lot of things. You have to be careful to use the right access size for whatever you're working with. Also you can't be doing PIO and DMA at the same time. Finally, there's a FIFO to contend with when you're doing PIO stuff as well. Generally, G2 is a pain in the rear, so you really do want to be using the higher-level stuff related to each device if at all possible!
#define BBA_DMA2_G2CHN 2 |
#define BBA_DMA2_MODE 3 |
#define BBA_DMA2_SHCHN 0 |
#define BBA_DMA_G2CHN 1 |
#define BBA_DMA_MODE 4 |
#define BBA_DMA_SHCHN 1 |
#define SPU_DMA_G2CHN 0 |
#define SPU_DMA_MODE |
#define SPU_DMA_SHCHN 3 |
typedef void(* g2_dma_callback_t)(ptr_t data) |
int g2_dma_transfer | ( | void * | from, |
void * | dest, | ||
uint32 | length, | ||
int | block, | ||
g2_dma_callback_t | callback, | ||
ptr_t | cbdata, | ||
uint32 | dir, | ||
uint32 | mode, | ||
uint32 | g2chn, | ||
uint32 | sh4chn | ||
) |
void g2_fifo_wait | ( | ) |
Wait for the G2 write FIFO to empty.
This function will spinwait until the G2 FIFO indicates that it has been drained. The FIFO is 32 bytes in length, and thus when accessing AICA you must do this at least for every 8 32-bit writes that you execute.
Set a block of bytes to G2.
This function acts as memset() for setting a block of bytes on G2. It will take the necessary precautions for accessing G2.
address | The address in G2-space to write to. |
c | The byte to write. |
amt | The number of bytes to write. |
Read one 16-bit word from G2.
This function reads a single word from the specified address, taking all necessary precautions that are required for accessing G2.
address | The address in memory to read. |
Read one 32-bit dword from G2.
This function reads a single dword from the specified address, taking all necessary precautions that are required for accessing G2.
address | The address in memory to read. |
Read one byte from G2.
This function reads a single byte from the specified address, taking all necessary precautions that are required for accessing G2.
address | The address in memory to read. |
Read a block of words from G2.
This function acts as memcpy() for copying data from G2 to system memory, but it copies 16 bits at a time. It will take the necessary precautions before accessing G2 for you as well.
output | Pointer in system memory to write to. |
address | The address in G2-space to read from. |
amt | The number of words to read. |
Read a block of dwords from G2.
This function acts as memcpy() for copying data from G2 to system memory, but it copies 32 bits at a time. It will take the necessary precautions before accessing G2 for you as well.
output | Pointer in system memory to write to. |
address | The address in G2-space to read from. |
amt | The number of dwords to read. |
Read a block of bytes from G2.
This function acts as memcpy() for copying data from G2 to system memory. It will take the necessary precautions before accessing G2 for you as well.
output | Pointer in system memory to write to. |
address | The address in G2-space to read from. |
amt | The number of bytes to read. |
Write a 16-bit word to G2.
This function writes one word to the specified address, taking all the necessary precautions to ensure your write actually succeeds.
address | The address in memory to write to. |
value | The value to write to that address. |
Write a 32-bit dword to G2.
This function writes one dword to the specified address, taking all the necessary precautions to ensure your write actually succeeds.
address | The address in memory to write to. |
value | The value to write to that address. |
Write a single byte to G2.
This function writes one byte to the specified address, taking all the necessary precautions to ensure your write actually succeeds.
address | The address in memory to write to. |
value | The value to write to that address. |
Write a block of words to G2.
This function acts as memcpy() for copying data to G2 from system memory, copying 16 bits at a time. It will take the necessary precautions for accessing G2.
input | The pointer in system memory to read from. |
address | The address in G2-space to write to. |
amt | The number of words to write. |
Write a block of dwords to G2.
This function acts as memcpy() for copying data to G2 from system memory, copying 32 bits at a time. It will take the necessary precautions for accessing G2.
input | The pointer in system memory to read from. |
address | The address in G2-space to write to. |
amt | The number of dwords to write. |
Write a block of bytes to G2.
This function acts as memcpy() for copying data to G2 from system memory. It will take the necessary precautions for accessing G2.
input | The pointer in system memory to read from. |
address | The address in G2-space to write to. |
amt | The number of bytes to write. |