#[non_exhaustive]pub struct Peripherals {
pub gpu_dma: GpuDma,
pub ordering_table_clear_dma: OrderingTableClearDma,
pub mdec_dma: MdecDma,
pub spu_dma: SpuDma,
pub cd: Cd,
pub controller_port: ControllerPort,
}Expand description
Every shared-state peripheral token, handed out once.
let p = psx_rt::Peripherals::take().unwrap();
let mut gpu = psx_gpu::Gpu::new(p.gpu_dma, display);
let mut port = p.controller_port; // pads and memory cards borrow it
let mut spu = psx_spu::Spu::new(p.spu_dma);
let cd = p.cd; // or `SectorReader::with_cd(cd)`, `xa::Player::new(cd)`Each token is owned by the driver that programs its device; see
psx_io::periph for who that is.
The tokens are zero-sized, so Peripherals is too; moving it or its
fields around costs nothing.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.gpu_dma: GpuDmaDMA channel 2 and the GP0 stream it feeds.
ordering_table_clear_dma: OrderingTableClearDmaDMA channel 6, the ordering-table clear.
mdec_dma: MdecDmaDMA channels 0 and 1 (MDEC in and out).
spu_dma: SpuDmaDMA channel 4 and the SPU transfer port.
cd: CdThe CD-ROM controller and DMA channel 3.
controller_port: ControllerPortThe pad and memory-card port (SIO0).
Implementations§
Source§impl Peripherals
impl Peripherals
Sourcepub fn take() -> Option<Self>
pub fn take() -> Option<Self>
The token set, the first time this is called; None after that.
One flag test inside a short critical section.
Sourcepub fn dma_owners(&mut self) -> DmaOwners<'_>
pub fn dma_owners(&mut self) -> DmaOwners<'_>
Borrow every DMA owner token at once, for crate::cache::with_dma_quiesced.
For a program that kept its Peripherals whole. A program that handed the tokens to
drivers lends them back through the drivers (Gpu::dma_mut, SectorReader::cd_mut, …)
into crate::cache::DmaOwners::new.