libdragon
Data Fields
rsp_ucode_t Struct Reference

RSP ucode definition. More...

#include <rsp.h>

Data Fields

uint8_t * code
 Pointer to the code segment.
 
void * code_end
 Pointer past the end of the code segment.
 
uint8_t * data
 Pointer to the data segment.
 
void * data_end
 Pointer past the end of the data segment.
 
const char * name
 Name of the ucode.
 
uint32_t start_pc
 Initial RSP PC.
 
void(* crash_handler )(rsp_snapshot_t *state)
 Custom crash handler. More...
 
void(* assert_handler )(rsp_snapshot_t *state, uint16_t assert_code)
 Custom assert handler. More...
 

Detailed Description

RSP ucode definition.

This small structure holds the text/data pointers to a RSP ucode program in RDRAM. It also contains the name (for the debugging purposes) and the initial PC (usually 0).

If you're using libdragon's build system (n64.mk), use DEFINE_RSP_UCODE() to initialize one of these.

Field Documentation

◆ crash_handler

void(* rsp_ucode_t::crash_handler) (rsp_snapshot_t *state)

Custom crash handler.

If specified, this function is invoked when a RSP crash happens, while filling the information screen. It can be used to dump custom ucode-specific information.

Note
DO NOT ACCESS RSP hardware registers in the crash handler. To dump information, access the state provided as argument that contains a full snapshot of the RSP state at the point of crash.

◆ assert_handler

void(* rsp_ucode_t::assert_handler) (rsp_snapshot_t *state, uint16_t assert_code)

Custom assert handler.

If specified, this function is invoked when a RSP crash caused by an assert is triggered. This function should display information related to the assert using printf (max 2 lines).

Normally, the first line will be the assert message associated with the code (eg: "Invalid buffer pointer"), while the optional second line can contain a dump of a few important variables, maybe extracted from the register state (eg: "bufptr=0x00000000 prevptr=0x8003F780"). The assert handler will now which registers to inspect to extract information, given the exact position of the assert in the code.

Note
The crash handler, if specified, is called for all crashes, including asserts. That is the correct place where dump information on the ucode state in general.

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