libdragon
rspq_internal.h
Go to the documentation of this file.
1
7#ifndef __LIBDRAGON_RSPQ_INTERNAL_H
8#define __LIBDRAGON_RSPQ_INTERNAL_H
9
10#include "rsp.h"
11#include "rspq_constants.h"
12
16enum {
24
31
40
51
60
72
80
98
110
122
135
143};
144
146#define rspq_int_write(cmd_id, ...) rspq_write(0, cmd_id, ##__VA_ARGS__)
147
149typedef struct rdpq_block_s rdpq_block_t;
151
160typedef struct rspq_block_s {
161 uint32_t nesting_level;
163 uint32_t cmds[];
165
171typedef struct __attribute__((packed)) {
172 uint64_t combiner;
173 uint64_t combiner_mipmapmask;
174 uint32_t blend_step0;
175 uint32_t blend_step1;
176 uint64_t other_modes;
178
179// TODO: We could save 4 bytes in the overlay descriptor by assuming that data == code + code_size and that code_size is always a multiple of 8
182typedef struct rspq_overlay_t {
183 uint32_t code;
184 uint32_t data;
185 uint32_t state;
186 uint16_t code_size;
187 uint16_t data_size;
189
191_Static_assert(sizeof(rspq_overlay_t) == RSPQ_OVERLAY_DESC_SIZE);
193
200typedef struct rspq_overlay_tables_s {
202 uint8_t overlay_table[RSPQ_OVERLAY_TABLE_SIZE];
204 rspq_overlay_t overlay_descriptors[RSPQ_MAX_OVERLAY_COUNT];
206
213typedef struct rsp_queue_s {
216 uint32_t rspq_pointer_stack[RSPQ_MAX_BLOCK_NESTING_LEVEL];
219 uint32_t rspq_dram_addr;
223 uint32_t rspq_rdp_buffers[2];
225 uint32_t rdp_fill_color;
228 uint8_t rdpq_debug;
229 uint8_t __padding0;
230 int16_t current_ovl;
231} __attribute__((aligned(16), packed)) rsp_queue_t;
232
234#define RSPQ_DATA_ADDRESS 32
235
237extern volatile int __rspq_syncpoints_done;
238
240static inline bool rspq_in_block(void) {
241 extern rspq_block_t *rspq_block;
242 return rspq_block != NULL;
243}
244
252
256void rspq_block_run_rsp(int nesting_level);
257
258#endif
A buffer that piggybacks onto rspq_block_t to store RDP commands.
Definition: rdpq_internal.h:73
Low-level RSP hardware library.
rspq_block_t * rspq_block
Pointer to the current block being built, or NULL.
Definition: rspq.c:327
struct rspq_block_s rspq_block_t
A preconstructed block of commands.
Definition: rspq.h:200
uint32_t rspq_rdp_sentinel
Current RDP RDRAM end pointer (when rdp_current reaches this, the buffer is full)
Definition: rspq_internal.h:220
uint32_t rspq_rdp_current
Current RDP RDRAM write pointer (normally DP_END)
Definition: rspq_internal.h:224
uint32_t rspq_dram_highpri_addr
Address of the highpri queue (special slot in the pointer stack)
Definition: rspq_internal.h:218
volatile int __rspq_syncpoints_done
ID of the last syncpoint reached by RSP.
Definition: rspq.c:334
rspq_overlay_tables_t tables
Overlay table.
Definition: rspq_internal.h:214
uint32_t rspq_dram_lowpri_addr
Address of the lowpri queue (special slot in the pointer stack)
Definition: rspq_internal.h:217
uint8_t rdp_syncfull_ongoing
True if a SYNC_FULL is currently ongoing.
Definition: rspq_internal.h:227
rdpq_block_t * rdp_block
Option RDP static buffer (with RDP commands)
Definition: rspq_internal.h:162
uint8_t rdp_target_bitdepth
Current RDP target buffer bitdepth.
Definition: rspq_internal.h:226
rspq_rdp_mode_t rdp_mode
RDP current render mode definition.
Definition: rspq_internal.h:221
void rspq_block_run_rsp(int nesting_level)
Notify that a RSP command is going to run a block.
Definition: rspq.c:1214
uint32_t rspq_dram_addr
Current RDRAM address being processed.
Definition: rspq_internal.h:219
int16_t current_ovl
Current overlay index.
Definition: rspq_internal.h:230
uint16_t code_size
Size of the code in bytes - 1.
Definition: rspq_internal.h:186
uint32_t nesting_level
Nesting level of the block.
Definition: rspq_internal.h:161
uint64_t rdp_scissor_rect
Current RDP scissor rectangle.
Definition: rspq_internal.h:222
uint32_t data
Address of the overlay data in RDRAM.
Definition: rspq_internal.h:184
@ RSPQ_CMD_TEST_WRITE_STATUS
RSPQ Command: Test and write SP_STATUS register.
Definition: rspq_internal.h:109
@ RSPQ_CMD_INVALID
RSPQ command: Invalid.
Definition: rspq_internal.h:23
@ RSPQ_CMD_CALL
RSPQ command: Call a block.
Definition: rspq_internal.h:50
@ RSPQ_CMD_DMA
RSPQ command: DMA transfer.
Definition: rspq_internal.h:71
@ RSPQ_CMD_JUMP
RSPQ command: Jump to another buffer.
Definition: rspq_internal.h:39
@ RSPQ_CMD_RDP_WAIT_IDLE
RSPQ command: Wait for RDP to be idle.
Definition: rspq_internal.h:121
@ RSPQ_CMD_SWAP_BUFFERS
RSPQ Command: Swap lowpri/highpri buffers.
Definition: rspq_internal.h:97
@ RSPQ_CMD_RDP_SET_BUFFER
RSPQ Command: send a new buffer to RDP and/or configure it for new commands.
Definition: rspq_internal.h:134
@ RSPQ_CMD_RDP_APPEND_BUFFER
RSPQ Command: send more data to RDP (appended to the end of the current buffer)
Definition: rspq_internal.h:142
@ RSPQ_CMD_NOOP
RSPQ command: No-op.
Definition: rspq_internal.h:30
@ RSPQ_CMD_WRITE_STATUS
RSPQ Command: write SP_STATUS register.
Definition: rspq_internal.h:79
@ RSPQ_CMD_RET
RSPQ command: Return from a block.
Definition: rspq_internal.h:59
uint32_t rdp_fill_color
Current RDP fill color.
Definition: rspq_internal.h:225
uint32_t code
Address of the overlay code in RDRAM.
Definition: rspq_internal.h:183
uint32_t state
Address of the overlay state in RDRAM (within data)
Definition: rspq_internal.h:185
rsp_queue_t * __rspq_get_state(void)
Return a pointer to a copy of the current RSPQ state.
Definition: rspq.c:734
uint16_t data_size
Size of the data in bytes - 1.
Definition: rspq_internal.h:187
uint8_t rdpq_debug
Debug mode flag.
Definition: rspq_internal.h:228
RSP Queue data in DMEM.
Definition: rspq_internal.h:213
A rspq block: pre-recorded array of commands.
Definition: rspq_internal.h:160
A RSPQ overlay ucode. This is similar to rsp_ucode_t, but is used internally to managed it as a RSPQ ...
Definition: rspq_internal.h:182
The overlay table in DMEM.
Definition: rspq_internal.h:200
RDP render mode definition.
Definition: rspq_internal.h:171