libdragon
Functions

Low-level RSP hardware library. More...

Functions

 DEFINE_RSP_UCODE (rsp_crash)
 
void rsp_init (void)
 Initialize the RSP subsytem.
 
void rsp_load (rsp_ucode_t *ucode)
 Load a RSP ucode. More...
 
void rsp_load_code (void *start, unsigned long size, unsigned int imem_offset)
 Do a DMA transfer to load a piece of code into RSP IMEM. More...
 
void rsp_load_data (void *start, unsigned long size, unsigned int dmem_offset)
 Do a DMA transfer to load a piece of data into RSP DMEM. More...
 
void rsp_read_code (void *start, unsigned long size, unsigned int imem_offset)
 Do a DMA transfer to load a piece of code from RSP IMEM to RDRAM. More...
 
void rsp_read_data (void *start, unsigned long size, unsigned int dmem_offset)
 Do a DMA transfer to load a piece of data from RSP DMEM to RDRAM. More...
 
void __rsp_run_async (uint32_t status_flags)
 Internal implementation of rsp_run_async.
 
void rsp_wait (void)
 Wait until RSP has finished processing. More...
 
void rsp_run (void)
 Run RSP ucode. More...
 
void rsp_run_async (void)
 Run RSP async. More...
 

Detailed Description

Low-level RSP hardware library.

Function Documentation

◆ DEFINE_RSP_UCODE()

DEFINE_RSP_UCODE ( rsp_crash  )

RSP crash handler ucode (rsp_crash.S)

◆ rsp_load()

void rsp_load ( rsp_ucode_t ucode)

Load a RSP ucode.

This function allows to load a RSP ucode into the RSP internal memory. The function executes the transfer right away, so it is responsibility of the caller making sure that it's a good time to do it.

The function internally keeps a pointer to the last loaded ucode. If the ucode passed is the same, it does nothing. This makes it easier to write code that optimistically switches between different ucodes, but without forcing transfers every time.

Parameters
[in]ucodeUcode to load into RSP

◆ rsp_load_code()

void rsp_load_code ( void *  code,
unsigned long  size,
unsigned int  imem_offset 
)

Do a DMA transfer to load a piece of code into RSP IMEM.

This is a lower-level function that actually executes a DMA transfer from RDRAM to IMEM. Prefer using rsp_load instead.

Note
in order for this function to be interoperable with rsp_load, it will reset the last loaded ucode cache.
Parameters
[in]codePointer to buffer in RDRAM containing code. Must be aligned to 8 bytes.
[in]sizeSize of the code to load. Must be a multiple of 8.
[in]imem_offsetByte offset in IMEM where to load the code. Must be a multiple of 8.

◆ rsp_load_data()

void rsp_load_data ( void *  data,
unsigned long  size,
unsigned int  dmem_offset 
)

Do a DMA transfer to load a piece of data into RSP DMEM.

This is a lower-level function that actually executes a DMA transfer from RDRAM to DMEM. Prefer using rsp_load instead.

Parameters
[in]dataPointer to buffer in RDRAM containing data. Must be aligned to 8 bytes.
[in]sizeSize of the data to load. Must be a multiple of 8.
[in]dmem_offsetOffset in DMEM where to load the code. Must be a multiple of 8.

◆ rsp_read_code()

void rsp_read_code ( void *  code,
unsigned long  size,
unsigned int  imem_offset 
)

Do a DMA transfer to load a piece of code from RSP IMEM to RDRAM.

This is a lower-level function that actually executes a DMA transfer from IMEM to RDRAM.

Parameters
[in]codePointer to buffer in RDRAM where to write code. Must be aligned to 8 bytes.
[in]sizeSize of the code to load. Must be a multiple of 8.
[in]imem_offsetByte offset in IMEM where where the code will be loaded from. Must be a multiple of 8.

◆ rsp_read_data()

void rsp_read_data ( void *  data,
unsigned long  size,
unsigned int  dmem_offset 
)

Do a DMA transfer to load a piece of data from RSP DMEM to RDRAM.

This is a lower-level function that actually executes a DMA transfer from DMEM to RDRAM.

Parameters
[in]dataPointer to buffer in RDRAM where to write data. Must be aligned to 8 bytes.
[in]sizeSize of the data to load. Must be a multiple of 8.
[in]dmem_offsetByte offset in IMEM where where the data will be loaded from. Must be a multiple of 8.

◆ rsp_wait()

void rsp_wait ( void  )

Wait until RSP has finished processing.

This function will wait until the RSP is halted. It contains a fixed timeout of 500 ms, after which rsp_crash is invoked to abort the program.

◆ rsp_run()

void rsp_run ( void  )

Run RSP ucode.

This function starts running the RSP, and wait until the ucode is finished.

◆ rsp_run_async()

void rsp_run_async ( void  )
inline

Run RSP async.

This function starts running the RSP in background. Use rsp_wait() to synchronize later.