mycelium_pci/
express.rs

1// this module is mostly not yet implemented...
2#![allow(dead_code)]
3use crate::{
4    device::{self, CardBusDetails, PciBridgeDetails, StandardDetails},
5    register,
6};
7use volatile::Volatile;
8
9pub struct MemoryMappedDevice<'device> {
10    header: Volatile<&'device mut device::Header>,
11    details: MmKind<'device>,
12}
13
14enum MmKind<'device> {
15    Standard(Volatile<&'device mut StandardDetails>),
16    CardBusBridge(Volatile<&'device mut CardBusDetails>),
17    PciBridge(Volatile<&'device mut PciBridgeDetails>),
18}
19
20impl MemoryMappedDevice<'_> {
21    pub fn header(&self) -> device::Header {
22        self.header.read()
23    }
24
25    pub fn send_command(&mut self, command: register::Command) {
26        // suppress unused warning
27        let _ = command;
28        todo!()
29    }
30}
31
32#[cfg(test)]
33mod tests {
34    // use super::Device;
35    // use core::mem;
36
37    // #[test]
38    // fn device_is_256_bytes() {
39    //     assert_eq!(mem::size_of::<Device>(), 256);
40    // }
41}