#[repr(transparent)]pub struct DirectCsr(pub u32);
Expand description
Control and status for direct serial mode Direct serial mode allows the processor to send and receive raw serial frames, for programming, configuration and control of the external memory devices. Only SPI mode 0 (CPOL=0 CPHA=0) is supported.
Tuple Fields§
§0: u32
Implementations§
Source§impl DirectCsr
impl DirectCsr
Sourcepub const fn en(&self) -> bool
pub const fn en(&self) -> bool
Enable direct mode. In direct mode, software controls the chip select lines, and can perform direct SPI transfers by pushing data to the DIRECT_TX FIFO, and popping the same amount of data from the DIRECT_RX FIFO. Memory-mapped accesses will generate bus errors when direct serial mode is enabled.
Sourcepub fn set_en(&mut self, val: bool)
pub fn set_en(&mut self, val: bool)
Enable direct mode. In direct mode, software controls the chip select lines, and can perform direct SPI transfers by pushing data to the DIRECT_TX FIFO, and popping the same amount of data from the DIRECT_RX FIFO. Memory-mapped accesses will generate bus errors when direct serial mode is enabled.
Sourcepub const fn busy(&self) -> bool
pub const fn busy(&self) -> bool
Direct mode busy flag. If 1, data is currently being shifted in/out (or would be if the interface were not stalled on the RX FIFO), and the chip select must not yet be deasserted. The busy flag will also be set to 1 if a memory-mapped transfer is still in progress when direct mode is enabled. Direct mode blocks new memory-mapped transfers, but can’t halt a transfer that is already in progress. If there is a chance that memory-mapped transfers may be in progress, the busy flag should be polled for 0 before asserting the chip select. (In practice you will usually discover this timing condition through other means, because any subsequent memory-mapped transfers when direct mode is enabled will return bus errors, which are difficult to ignore.)
Sourcepub fn set_busy(&mut self, val: bool)
pub fn set_busy(&mut self, val: bool)
Direct mode busy flag. If 1, data is currently being shifted in/out (or would be if the interface were not stalled on the RX FIFO), and the chip select must not yet be deasserted. The busy flag will also be set to 1 if a memory-mapped transfer is still in progress when direct mode is enabled. Direct mode blocks new memory-mapped transfers, but can’t halt a transfer that is already in progress. If there is a chance that memory-mapped transfers may be in progress, the busy flag should be polled for 0 before asserting the chip select. (In practice you will usually discover this timing condition through other means, because any subsequent memory-mapped transfers when direct mode is enabled will return bus errors, which are difficult to ignore.)
Sourcepub const fn assert_cs0n(&self) -> bool
pub const fn assert_cs0n(&self) -> bool
When 1, assert (i.e. drive low) the CS0n chip select line. Note that this applies even when DIRECT_CSR_EN is 0.
Sourcepub fn set_assert_cs0n(&mut self, val: bool)
pub fn set_assert_cs0n(&mut self, val: bool)
When 1, assert (i.e. drive low) the CS0n chip select line. Note that this applies even when DIRECT_CSR_EN is 0.
Sourcepub const fn assert_cs1n(&self) -> bool
pub const fn assert_cs1n(&self) -> bool
When 1, assert (i.e. drive low) the CS1n chip select line. Note that this applies even when DIRECT_CSR_EN is 0.
Sourcepub fn set_assert_cs1n(&mut self, val: bool)
pub fn set_assert_cs1n(&mut self, val: bool)
When 1, assert (i.e. drive low) the CS1n chip select line. Note that this applies even when DIRECT_CSR_EN is 0.
Sourcepub const fn auto_cs0n(&self) -> bool
pub const fn auto_cs0n(&self) -> bool
When 1, automatically assert the CS0n chip select line whenever the BUSY flag is set.
Sourcepub fn set_auto_cs0n(&mut self, val: bool)
pub fn set_auto_cs0n(&mut self, val: bool)
When 1, automatically assert the CS0n chip select line whenever the BUSY flag is set.
Sourcepub const fn auto_cs1n(&self) -> bool
pub const fn auto_cs1n(&self) -> bool
When 1, automatically assert the CS1n chip select line whenever the BUSY flag is set.
Sourcepub fn set_auto_cs1n(&mut self, val: bool)
pub fn set_auto_cs1n(&mut self, val: bool)
When 1, automatically assert the CS1n chip select line whenever the BUSY flag is set.
Sourcepub const fn txfull(&self) -> bool
pub const fn txfull(&self) -> bool
When 1, the DIRECT_TX FIFO is currently full. If the processor tries to write more data, that data will be ignored.
Sourcepub fn set_txfull(&mut self, val: bool)
pub fn set_txfull(&mut self, val: bool)
When 1, the DIRECT_TX FIFO is currently full. If the processor tries to write more data, that data will be ignored.
Sourcepub const fn txempty(&self) -> bool
pub const fn txempty(&self) -> bool
When 1, the DIRECT_TX FIFO is currently empty. Unless the processor pushes more data, transmission will stop and BUSY will go low once the current 8-bit serial frame completes.
Sourcepub fn set_txempty(&mut self, val: bool)
pub fn set_txempty(&mut self, val: bool)
When 1, the DIRECT_TX FIFO is currently empty. Unless the processor pushes more data, transmission will stop and BUSY will go low once the current 8-bit serial frame completes.
Sourcepub fn set_txlevel(&mut self, val: u8)
pub fn set_txlevel(&mut self, val: u8)
Current level of DIRECT_TX FIFO
Sourcepub const fn rxempty(&self) -> bool
pub const fn rxempty(&self) -> bool
When 1, the DIRECT_RX FIFO is currently empty. If the processor attempts to read more data, the FIFO state is not affected, but the value returned to the processor is undefined.
Sourcepub fn set_rxempty(&mut self, val: bool)
pub fn set_rxempty(&mut self, val: bool)
When 1, the DIRECT_RX FIFO is currently empty. If the processor attempts to read more data, the FIFO state is not affected, but the value returned to the processor is undefined.
Sourcepub const fn rxfull(&self) -> bool
pub const fn rxfull(&self) -> bool
When 1, the DIRECT_RX FIFO is currently full. The serial interface will be stalled until data is popped; the interface will not begin a new serial frame when the DIRECT_TX FIFO is empty or the DIRECT_RX FIFO is full.
Sourcepub fn set_rxfull(&mut self, val: bool)
pub fn set_rxfull(&mut self, val: bool)
When 1, the DIRECT_RX FIFO is currently full. The serial interface will be stalled until data is popped; the interface will not begin a new serial frame when the DIRECT_TX FIFO is empty or the DIRECT_RX FIFO is full.
Sourcepub fn set_rxlevel(&mut self, val: u8)
pub fn set_rxlevel(&mut self, val: u8)
Current level of DIRECT_RX FIFO
Sourcepub const fn clkdiv(&self) -> u8
pub const fn clkdiv(&self) -> u8
Clock divisor for direct serial mode. Divisors of 1..255 are encoded directly, and the maximum divisor of 256 is encoded by a value of CLKDIV=0. The clock divisor can be changed on-the-fly by software, without halting or otherwise coordinating with the serial interface. The serial interface will sample the latest clock divisor each time it begins the transmission of a new byte.
Sourcepub fn set_clkdiv(&mut self, val: u8)
pub fn set_clkdiv(&mut self, val: u8)
Clock divisor for direct serial mode. Divisors of 1..255 are encoded directly, and the maximum divisor of 256 is encoded by a value of CLKDIV=0. The clock divisor can be changed on-the-fly by software, without halting or otherwise coordinating with the serial interface. The serial interface will sample the latest clock divisor each time it begins the transmission of a new byte.
Sourcepub const fn rxdelay(&self) -> u8
pub const fn rxdelay(&self) -> u8
Delay the read data sample timing, in units of one half of a system clock cycle. (Not necessarily half of an SCK cycle.)
Sourcepub fn set_rxdelay(&mut self, val: u8)
pub fn set_rxdelay(&mut self, val: u8)
Delay the read data sample timing, in units of one half of a system clock cycle. (Not necessarily half of an SCK cycle.)