Expand description
GPU MMIO: GP0, GP1, GPUREAD, GPUSTAT.
Thin wrappers over crate::read_u32 / crate::write_u32 that use
the register addresses from psx-hw. Each helper commits exactly
one MMIO access; higher-level SDK code composes them into commands.
Structs§
- Active
Recording - The open recording
start_recording_rawreturned.endcloses it and hands back the recorded nodes; dropping it closes it too, discarding the result. - Command
Recording - A command stream recorded by
start_recording_raw: DMA linked-list nodes that end the list untillink_tochains them onward. - Recording
Overflow - The recording ran out of buffer, so it was discarded: a command cut short would make the GPU take the words after it as its parameters.
- Recording
Pause - An open recording paused by
pause_recording; it resumes where it left off when this is dropped, provided that recording is still open.
Constants§
- READY_
SPINS - Spin budget for one GPUSTAT ready-wait. Long enough for the slowest legitimate primitive, short enough that a stuck GPU hands control back well inside a frame.
- RECORDING_
NODE_ WORDS - Payload words per recorded linked-list node. Silicon (hardware-tests v1.24) loses words from DMA nodes longer than 16 while drawing.
Functions§
- arm_
direct_ access_ guard - Arm the guard: the GPU may be busy with work the CPU handed off, so the next direct access must wait for it first.
- command_
reset_ count - How many times a ready-wait has timed out and reset the GPU’s command buffer since boot: a count of GPU hangs the SDK recovered from.
- gpustat
Deprecated - Renamed to
status. - is_
recording - True while a recording is open and not paused by
pause_recording. - pause_
recording - Pause any open recording until the returned guard is dropped, so command writes in between go to the port (behind the direct-access guard) instead of into the buffer. For VRAM uploads, which a recording cannot carry: a texture first drawn by a recorded HUD is uploaded at once, before the recording is walked, which is all a draw of it needs.
- read_
data - Read the GPU’s response latch: VRAM-to-CPU transfer data or a GP1(10h) info reply.
- run_
direct_ access_ guard - Run and disarm the guard if it is armed. Direct-access paths outside the port writes (GPU DMA setup) call it first.
- set_
direct_ access_ guard - Register the function that makes direct GPU access safe while a queued
frame may be walking (
psx_rt::presentregisters itswait_idle). It runs once, on the first direct command or display-control write or GPU DMA address store afterarm_direct_access_guard, and is then disarmed. - start_
recording_ ⚠raw - Record every
super::write_commandintobufferinstead of the port, until the returnedActiveRecordingis ended or dropped. The ready-waits return at once while recording. - status
- Read the GPU status register.
- try_
wait_ command_ ready - Poll command readiness without resetting the GPU on timeout.
Reads once, then retries at most
spin_limittimes. - try_
wait_ dma_ ready - Poll DMA receive readiness without resetting the GPU on timeout.
- wait_
cmd_ ready Deprecated - Renamed to
wait_command_ready. - wait_
command_ ready - Spin until the GPU is ready to accept a new command word.
- wait_
dma_ ready - Spin until the GPU can start a DMA block transfer.
- write_
command - Push a drawing or VRAM command word, or one of its parameters, to the
GPU’s command port (
GP0). Pairs with the word builders inpsx_hw::gpu::gp0:write_command(gp0::draw_mode(...)). - write_
command_ unguarded write_commandstraight to the port: never recorded, never behind the direct-access guard. For code that has already made the port safe, such as the present queue’s stall recovery, which the guard itself runs. Without thepresent-queuefeature it is the same store aswrite_command.- write_
display_ control - Write a display-control command (reset, display mode, display area,
DMA direction) to the GPU’s control port (
GP1). - write_
display_ control_ unguarded write_display_controlstraight to the port, past the direct-access guard; seewrite_command_unguarded.- write_
gp0 Deprecated - Renamed to
write_command. - write_
gp1 Deprecated - Renamed to
write_display_control.