pub struct Moxtet {
modules: Vec<MoxtetModule>,
module_count: usize,
tx_buf: [u8; 7],
rx_buf: [u8; 7],
irq_mask: [bool; 6],
power_state: PowerState,
}Expand description
CZ.NIC Turris Omnia moxtet bus driver.
§Register-space semantics (/bus/moxtet/reg/<idx>)
The moxtet bus has no MMIO register file: it is a software-defined
FPGA bus where modules are enumerated at discovery time over SPI and
addressed by their position on the shift chain. Consequently, the
offset argument of BusDriver::read_reg/BusDriver::write_reg
(and therefore the /bus/moxtet/reg/<idx> scheme paths) is a
zero-based module index, not a byte/hex MMIO offset:
reg/0reads/writes the TX/RX buffer slot of module 0,- offsets
>= module_countare rejected withBusError::DeviceNotFound.
This deviates from MMIO-mapped buses where reg/<hex> is a hardware
offset; it is kept for compatibility with the BusDriver trait API.
Fields§
§modules: Vec<MoxtetModule>§module_count: usize§tx_buf: [u8; 7]§rx_buf: [u8; 7]§irq_mask: [bool; 6]§power_state: PowerStateImplementations§
Source§impl Moxtet
impl Moxtet
Sourcepub fn discover_topology(&mut self, spi_data: &[u8])
pub fn discover_topology(&mut self, spi_data: &[u8])
Performs the discover topology operation.
Sourcepub fn module_read(&self, index: usize) -> Result<u8, BusError>
pub fn module_read(&self, index: usize) -> Result<u8, BusError>
Performs the module read operation.
Sourcepub fn module_write(&mut self, index: usize, value: u8) -> Result<(), BusError>
pub fn module_write(&mut self, index: usize, value: u8) -> Result<(), BusError>
Performs the module write operation.
Sourcepub fn set_irq_mask(&mut self, index: usize, masked: bool)
pub fn set_irq_mask(&mut self, index: usize, masked: bool)
Sets irq mask.
Trait Implementations§
Source§impl BusDriver for Moxtet
impl BusDriver for Moxtet
Source§fn compatible(&self) -> &[&str]
fn compatible(&self) -> &[&str]
Performs the compatible operation.
Source§fn read_reg(&self, offset: usize) -> Result<u32, BusError>
fn read_reg(&self, offset: usize) -> Result<u32, BusError>
Reads the RX buffer slot of the module at offset.
offset is a module index (0-based position on the shift
chain), not an MMIO byte offset : see the Moxtet type docs.
Source§fn write_reg(&mut self, offset: usize, value: u32) -> Result<(), BusError>
fn write_reg(&mut self, offset: usize, value: u32) -> Result<(), BusError>
Writes the TX buffer slot of the module at offset.
offset is a module index (0-based position on the shift
chain), not an MMIO byte offset : see the Moxtet type docs.
Only the low 8 bits of value are significant: each module slot
is one byte wide in the SPI frame.
Source§fn handle_irq(&mut self) -> bool
fn handle_irq(&mut self) -> bool
Handles irq.
Source§fn as_firewall(&self) -> Option<&dyn FirewallController>
fn as_firewall(&self) -> Option<&dyn FirewallController>
FirewallController] capability, if any. Read more