pub struct Sqspi<'d> { /* private fields */ }Expand description
sQSPI flash driver.
Implementations§
Source§impl<'d> Sqspi<'d>
impl<'d> Sqspi<'d>
Sourcepub fn new<T: Instance>(
peri: Peri<'d, T>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
firmware: &[u8],
ram: &'d mut [MaybeUninit<u8>],
sck: Peri<'d, impl GpioPin>,
csn: Peri<'d, impl GpioPin>,
io0: Peri<'d, impl GpioPin>,
io1: Peri<'d, impl GpioPin>,
io2: Peri<'d, impl GpioPin>,
io3: Peri<'d, impl GpioPin>,
config: Config,
) -> Result<Self, Error>
pub fn new<T: Instance>( peri: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, firmware: &[u8], ram: &'d mut [MaybeUninit<u8>], sck: Peri<'d, impl GpioPin>, csn: Peri<'d, impl GpioPin>, io0: Peri<'d, impl GpioPin>, io1: Peri<'d, impl GpioPin>, io2: Peri<'d, impl GpioPin>, io3: Peri<'d, impl GpioPin>, config: Config, ) -> Result<Self, Error>
Create a new sQSPI driver.
Loads firmware into ram, boots the FLPR, routes the pins to it, and
configures the SPI core per config. See the module docs for
the firmware / ram requirements.
Sourcepub async fn custom_instruction(
&mut self,
opcode: u8,
req: &[u8],
resp: &mut [u8],
) -> Result<(), Error>
pub async fn custom_instruction( &mut self, opcode: u8, req: &[u8], resp: &mut [u8], ) -> Result<(), Error>
Do a custom SPI instruction (single line).
Like the hardware qspi driver this issues WREN before the opcode and
waits for WIP to clear afterwards, so state-changing commands (WRSR, …)
work without extra orchestration. If resp is non-empty the command
reads into it; otherwise req is transmitted.
Sourcepub fn blocking_custom_instruction(
&mut self,
opcode: u8,
req: &[u8],
resp: &mut [u8],
) -> Result<(), Error>
pub fn blocking_custom_instruction( &mut self, opcode: u8, req: &[u8], resp: &mut [u8], ) -> Result<(), Error>
Do a custom SPI instruction, blocking version.
Sourcepub fn blocking_custom_opcode(&mut self, opcode: u8) -> Result<(), Error>
pub fn blocking_custom_opcode(&mut self, opcode: u8) -> Result<(), Error>
Send a single bare opcode (no address, no data) on a single line, without issuing WREN first or polling WIP afterwards.
Unlike custom_instruction this does not
touch the status register, which is what makes it usable for power-state
commands such as deep power-down (0xB9): once the flash is in DPD it
stops answering RDSR, so the usual trailing WIP poll would hang forever.
Sourcepub async fn read_raw(
&mut self,
address: u32,
data: &mut [u8],
) -> Result<(), Error>
pub async fn read_raw( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error>
Raw read: no bounds check against the configured capacity.
Sourcepub async fn write_raw(
&mut self,
address: u32,
data: &[u8],
) -> Result<(), Error>
pub async fn write_raw( &mut self, address: u32, data: &[u8], ) -> Result<(), Error>
Raw write: no bounds check against the configured capacity.
Sourcepub fn blocking_read_raw(
&mut self,
address: u32,
data: &mut [u8],
) -> Result<(), Error>
pub fn blocking_read_raw( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error>
Raw read, blocking version.
Sourcepub fn blocking_write_raw(
&mut self,
address: u32,
data: &[u8],
) -> Result<(), Error>
pub fn blocking_write_raw( &mut self, address: u32, data: &[u8], ) -> Result<(), Error>
Raw write, blocking version.
Sourcepub async fn read(&mut self, address: u32, data: &mut [u8]) -> Result<(), Error>
pub async fn read(&mut self, address: u32, data: &mut [u8]) -> Result<(), Error>
Read from flash, bounds-checked against the configured capacity.
Sourcepub async fn write(&mut self, address: u32, data: &[u8]) -> Result<(), Error>
pub async fn write(&mut self, address: u32, data: &[u8]) -> Result<(), Error>
Write to flash, bounds-checked against the configured capacity.
Sourcepub async fn erase(&mut self, address: u32) -> Result<(), Error>
pub async fn erase(&mut self, address: u32) -> Result<(), Error>
Erase a 4 KiB sector (opcode 0x20).
Sourcepub fn blocking_read(
&mut self,
address: u32,
data: &mut [u8],
) -> Result<(), Error>
pub fn blocking_read( &mut self, address: u32, data: &mut [u8], ) -> Result<(), Error>
Read from flash, blocking + bounds-checked.