libdragon
Loading...
Searching...
No Matches
rspq_internal.h
Go to the documentation of this file.
1
9#ifndef __LIBDRAGON_RSPQ_INTERNAL_H
10#define __LIBDRAGON_RSPQ_INTERNAL_H
11
12#include "rsp.h"
13#include "rspq_constants.h"
14
18enum {
26
33
42
53
62
74
82
100
112
124
137
145};
146
148#define rspq_int_write(cmd_id, ...) rspq_write(0, cmd_id, ##__VA_ARGS__)
149
151typedef struct rdpq_block_s rdpq_block_t;
153
162typedef struct rspq_block_s {
163 uint32_t nesting_level;
165 uint32_t cmds[];
167
173typedef struct __attribute__((packed)) {
174 uint64_t combiner;
175 uint64_t combiner_mipmapmask;
176 uint32_t blend_step0;
177 uint32_t blend_step1;
178 uint64_t other_modes;
180
181// 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
184typedef struct rspq_overlay_t {
185 uint32_t code;
186 uint32_t data;
187 uint32_t state;
188 uint16_t code_size;
189 uint16_t data_size;
191
193_Static_assert(sizeof(rspq_overlay_t) == RSPQ_OVERLAY_DESC_SIZE);
195
202typedef struct rspq_overlay_tables_s {
204 uint8_t overlay_table[RSPQ_OVERLAY_TABLE_SIZE];
208
215typedef struct rsp_queue_s {
218 uint32_t rspq_pointer_stack[RSPQ_MAX_BLOCK_NESTING_LEVEL];
221 uint32_t rspq_dram_addr;
225 uint32_t rspq_rdp_buffers[2];
227 uint32_t rdp_fill_color;
230 uint8_t rdpq_debug;
231 uint8_t __padding0;
232 int16_t current_ovl;
233} __attribute__((aligned(16), packed)) rsp_queue_t;
234
236#define RSPQ_DATA_ADDRESS 32
237
239extern volatile int __rspq_syncpoints_done;
240
242static inline bool rspq_in_block(void) {
243 extern rspq_block_t *rspq_block;
244 return rspq_block != NULL;
245}
246
254
258void rspq_block_run_rsp(int nesting_level);
259
260#endif
A buffer that piggybacks onto rspq_block_t to store RDP commands.
Definition rdpq_internal.h:74
Low-level RSP hardware library.
rspq_block_t * rspq_block
Pointer to the current block being built, or NULL.
Definition rspq.c:329
Constants for the RSPQ subsystem.
#define RSPQ_OVERLAY_TABLE_SIZE
Number of overlay IDs (0-F)
Definition rspq_constants.h:16
#define RSPQ_OVERLAY_DESC_SIZE
Size of a single overlay descriptor.
Definition rspq_constants.h:17
#define RSPQ_MAX_BLOCK_NESTING_LEVEL
Maximum number of nested block calls.
Definition rspq_constants.h:30
#define RSPQ_MAX_OVERLAY_COUNT
Definition rspq_constants.h:20
uint32_t rspq_rdp_sentinel
Current RDP RDRAM end pointer (when rdp_current reaches this, the buffer is full)
Definition rspq_internal.h:222
uint32_t rspq_rdp_current
Current RDP RDRAM write pointer (normally DP_END)
Definition rspq_internal.h:226
uint32_t rspq_dram_highpri_addr
Address of the highpri queue (special slot in the pointer stack)
Definition rspq_internal.h:220
@ RSPQ_CMD_TEST_WRITE_STATUS
RSPQ Command: Test and write SP_STATUS register.
Definition rspq_internal.h:111
@ RSPQ_CMD_INVALID
RSPQ command: Invalid.
Definition rspq_internal.h:25
@ RSPQ_CMD_CALL
RSPQ command: Call a block.
Definition rspq_internal.h:52
@ RSPQ_CMD_DMA
RSPQ command: DMA transfer.
Definition rspq_internal.h:73
@ RSPQ_CMD_JUMP
RSPQ command: Jump to another buffer.
Definition rspq_internal.h:41
@ RSPQ_CMD_RDP_WAIT_IDLE
RSPQ command: Wait for RDP to be idle.
Definition rspq_internal.h:123
@ RSPQ_CMD_SWAP_BUFFERS
RSPQ Command: Swap lowpri/highpri buffers.
Definition rspq_internal.h:99
@ RSPQ_CMD_RDP_SET_BUFFER
RSPQ Command: send a new buffer to RDP and/or configure it for new commands.
Definition rspq_internal.h:136
@ RSPQ_CMD_RDP_APPEND_BUFFER
RSPQ Command: send more data to RDP (appended to the end of the current buffer)
Definition rspq_internal.h:144
@ RSPQ_CMD_NOOP
RSPQ command: No-op.
Definition rspq_internal.h:32
@ RSPQ_CMD_WRITE_STATUS
RSPQ Command: write SP_STATUS register.
Definition rspq_internal.h:81
@ RSPQ_CMD_RET
RSPQ command: Return from a block.
Definition rspq_internal.h:61
volatile int __rspq_syncpoints_done
ID of the last syncpoint reached by RSP.
Definition rspq.c:336
rspq_overlay_tables_t tables
Overlay table.
Definition rspq_internal.h:216
uint32_t rspq_dram_lowpri_addr
Address of the lowpri queue (special slot in the pointer stack)
Definition rspq_internal.h:219
uint8_t rdp_syncfull_ongoing
True if a SYNC_FULL is currently ongoing.
Definition rspq_internal.h:229
rdpq_block_t * rdp_block
Option RDP static buffer (with RDP commands)
Definition rspq_internal.h:164
uint8_t rdp_target_bitdepth
Current RDP target buffer bitdepth.
Definition rspq_internal.h:228
rspq_rdp_mode_t rdp_mode
RDP current render mode definition.
Definition rspq_internal.h:223
void rspq_block_run_rsp(int nesting_level)
Notify that a RSP command is going to run a block.
Definition rspq.c:1216
uint32_t rspq_dram_addr
Current RDRAM address being processed.
Definition rspq_internal.h:221
int16_t current_ovl
Current overlay index.
Definition rspq_internal.h:232
uint16_t code_size
Size of the code in bytes - 1.
Definition rspq_internal.h:188
uint32_t nesting_level
Nesting level of the block.
Definition rspq_internal.h:163
uint64_t rdp_scissor_rect
Current RDP scissor rectangle.
Definition rspq_internal.h:224
uint32_t data
Address of the overlay data in RDRAM.
Definition rspq_internal.h:186
uint32_t rdp_fill_color
Current RDP fill color.
Definition rspq_internal.h:227
uint32_t code
Address of the overlay code in RDRAM.
Definition rspq_internal.h:185
uint32_t state
Address of the overlay state in RDRAM (within data)
Definition rspq_internal.h:187
rsp_queue_t * __rspq_get_state(void)
Return a pointer to a copy of the current RSPQ state.
Definition rspq.c:736
uint16_t data_size
Size of the data in bytes - 1.
Definition rspq_internal.h:189
uint8_t rdpq_debug
Debug mode flag.
Definition rspq_internal.h:230
RSP Queue data in DMEM.
Definition rspq_internal.h:215
A rspq block: pre-recorded array of commands.
Definition rspq_internal.h:162
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:184
The overlay table in DMEM.
Definition rspq_internal.h:202
RDP render mode definition.
Definition rspq_internal.h:173