Use psx-io when you need to control a peripheral directly or write a subsystem driver. Most game code can start with psx-gpu, psx-spu and psx-pad instead.
How the crate is organized
The root contains volatile reads and writes at 8-, 16- and 32-bit widths. Register addresses and bit layouts live in the shared psx-hw crate; the modules here wrap them for the GPU, DMA, interrupts, timers and the controller port. periph defines the zero-size ownership tokens (GpuDma, Cd, ControllerPort, SpuDma, MdecDma, OrderingTableClearDma) that psx_rt::Peripherals::take() hands out once. cd is the CD-ROM driver, with cd::audio for CD-DA, cd::xa for streaming XA-ADPCM music and cd::reader for polled data sectors; disc_base handles where a program's data sits on a shared disc. cdrom and cdda are the old names for cd and cd::audio, kept as deprecated forwarders.
Integration notes
A volatile access is not a complete device protocol. The caller must use a valid mapped address and width, observe readiness and acknowledgements, and coordinate interrupts. DMA channels and the CD-ROM controller have owners, so an API that drives one takes its token by &mut and a second driver fails to compile. These functions can compile for a host without being safe to execute there: they still address PS1 hardware.
Read CD audio and XA music streaming for real callers, and CD command contention for a diagnostic that deliberately exercises an edge case.
API, dependencies and source structure
SDK revision f2fec1c301f1. Structure, dependencies and features below come from this revision.
The PS1 reference includes all Cargo features. The manifest below shows which features are enabled by default.
Dependencies
psx-hw(shared repository crate): all targets
Cargo features
| Feature | Enables |
|---|---|
default | No additional dependency features |
present-queue | No additional dependency features |
Read the complete manifest and feature comments.
Source layout
The list includes internal implementation and test files. Public modules, types, functions and their signatures are indexed in the API reference above.
16 source and manifest files
Cargo.tomlsrc/cd/audio.rs: CD-DA playback helpers: a start-handshake state machine and ansrc/cd/reader.rs: Polled CD-ROM data-sector reads: seek, stream and pop 2048-byte sectors.src/cd/xa.rs: XA-ADPCM music: stream one channel of an interleaved XA file through thesrc/cd.rs: CD-ROM drive: commands, responses, sector polling, CD-DA playback insrc/cdda.rs: Renamed tocrate::cd::audio.src/cdrom.rs: Renamed tocrate::cd.src/controller_port.rs: The controller and memory-card port: one serial transport shared by everysrc/disc_base.rs: Where this program's data sits on the disc it was booted from.src/dma.rs: DMA controller.src/gpu/handoff.rs: Command recording and the direct-access guard: what lets a frame's GPUsrc/gpu.rs: GPU MMIO:GP0,GP1,GPUREAD,GPUSTAT.src/irq.rs: Interrupt controller: pending and enabled sources.src/lib.rs: Volatile MMIO primitives.src/periph.rs: Zero-size ownership tokens for peripherals with shared state.src/timers.rs: Root counter (timer) MMIO. Three 16-bit counters, each with counter /