Skip to main content

Moxtet

Struct Moxtet 

Source
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/0 reads/writes the TX/RX buffer slot of module 0,
  • offsets >= module_count are rejected with BusError::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: PowerState

Implementations§

Source§

impl Moxtet

Source

pub fn new() -> Self

Creates a new instance.

Source

pub fn discover_topology(&mut self, spi_data: &[u8])

Performs the discover topology operation.

Source

pub fn module_read(&self, index: usize) -> Result<u8, BusError>

Performs the module read operation.

Source

pub fn module_write(&mut self, index: usize, value: u8) -> Result<(), BusError>

Performs the module write operation.

Source

pub fn set_irq_mask(&mut self, index: usize, masked: bool)

Sets irq mask.

Trait Implementations§

Source§

impl BusDriver for Moxtet

Source§

fn name(&self) -> &str

Performs the name operation.

Source§

fn compatible(&self) -> &[&str]

Performs the compatible operation.

Source§

fn probe(&self) -> bool

Requires explicit SPI backend configuration; no auto-detect.

Source§

fn init(&mut self, _base: usize) -> Result<(), BusError>

Performs the init operation.

Source§

fn shutdown(&mut self) -> Result<(), BusError>

Performs the shutdown operation.

Source§

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>

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 children(&self) -> Vec<BusChild>

Performs the children operation.

Source§

fn handle_irq(&mut self) -> bool

Handles irq.

Source§

fn as_firewall(&self) -> Option<&dyn FirewallController>

Returns the optional [FirewallController] capability, if any. Read more
Source§

fn suspend(&mut self) -> Result<(), BusError>

Performs the suspend operation.
Source§

fn resume(&mut self) -> Result<(), BusError>

Performs the resume operation.
Source§

fn error_count(&self) -> u64

Performs the error count operation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.