Skip to main content

RdramBus

Trait RdramBus 

Source
pub trait RdramBus {
    // Required methods
    fn rdram_read(&self, addr: u32) -> u8;
    fn rdram_write(&mut self, addr: u32, val: u8);

    // Provided methods
    fn rdram_read_u32(&self, addr: u32) -> u32 { ... }
    fn rdram_read_hidden(&self, addr: u32) -> u8 { ... }
    fn rdram_write_hidden(&mut self, addr: u32, val: u8) { ... }
}
Expand description

The shared RDRAM memory bus, as seen by chips that DMA into/out of main RAM.

The RDP (framebuffer + texture fetches via the RDRAM) and the PI/SI DMA engines all read and write RDRAM through this narrow trait. rustyn64-core owns the concrete 8 MiB (4 MiB base + 4 MiB Expansion Pak) backing store and implements this; keeping the trait in rustyn64-cart lets rustyn64-rdp depend on exactly one chip crate, preserving the one-directional graph.

Required Methods§

Source

fn rdram_read(&self, addr: u32) -> u8

Read a byte from RDRAM at a physical address.

Source

fn rdram_write(&mut self, addr: u32, val: u8)

Write a byte to RDRAM at a physical address.

Provided Methods§

Source

fn rdram_read_u32(&self, addr: u32) -> u32

Read a big-endian 32-bit word from RDRAM. Default composes four byte reads; rustyn64-core overrides with a fast slice path.

Source

fn rdram_read_hidden(&self, addr: u32) -> u8

Read the RDRAM “hidden” bits for the 16-bit halfword at addr — the 9th bit RDRAM carries per byte, which the RDP Z-buffer uses for the low 2 bits of the per-pixel dz. Returns the 2-bit value (0..=3).

Default returns 0, so an impl that does not model the hidden bits behaves as if they read back clear (which is also the power-on state).

Source

fn rdram_write_hidden(&mut self, addr: u32, val: u8)

Write the RDRAM hidden bits (0..=3) for the halfword at addr. Default no-op for impls that do not model them.

Implementors§