Skip to main content

SfcDriver

Struct SfcDriver 

Source
pub struct SfcDriver<'d> { /* private fields */ }
Expand description

SFC driver.

Implementations§

Source§

impl<'d> SfcDriver<'d>

Source

pub fn new(sfc: SfcCfg<'d>) -> Self

Create a new SFC driver.

Source

pub fn configure_global( &mut self, spi_mode: FlashSpiMode, addr_mode: AddressMode, read_delay: ReadDelay, write_protect: bool, )

Configure the global SFC settings.

Source

pub fn configure_timing(&mut self, tshsl: u8, tcss: u8, tcsh: u8)

Configure the SFC timing parameters.

  • tshsl — Inter-operation delay: (tshsl + 2) clock cycles
  • tcss — CS setup time: (tcss + 1) clock cycles
  • tcsh — CS hold time: (tcsh + 1) clock cycles
Source

pub fn configure_bus(&mut self, config: &BusConfig)

Configure the bus read/write parameters for memory-mapped access.

Source

pub fn release_bus_reset(&mut self)

Release the SFC bus from soft reset.

Source

pub fn hold_bus_reset(&mut self)

Hold the SFC bus in soft reset.

Source

pub fn send_command( &mut self, instruction: u8, address: u32, address_enable: bool, )

Execute a flash command (no data phase).

  • instruction — Flash operation code.
  • address — Operation address (for commands with address phase).
  • address_enable — Whether the command includes an address phase.
Source

pub fn command_with_data( &mut self, instruction: u8, address: u32, write_data: &[u8], read: bool, ) -> Result<[u8; 64], SfcError>

Execute a flash command with data phase.

  • instruction — Flash operation code.
  • address — Operation address.
  • write_data — Data to write (for write commands).
  • readtrue for read commands, false for write commands.

Returns the read data (up to 64 bytes) for read commands.

Source

pub fn bus_dma_start( &mut self, mem_addr: u32, flash_addr: u32, length: u32, read: bool, )

Start a bus DMA transfer between flash and memory.

  • mem_addr — Memory address (must be in valid range).
  • flash_addr — Flash address.
  • length — Number of bytes to transfer.
  • readtrue for flash-to-memory read, false for memory-to-flash write.
Source

pub fn bus_dma_wait(&self)

Wait for bus DMA to complete.

Source

pub fn dma_done(&self) -> bool

Check if the DMA transfer is complete.

Source

pub fn command_done(&self) -> bool

Check if a flash command is complete.

Source

pub fn clear_interrupts(&self)

Clear all SFC interrupts.

Source

pub fn enable_interrupts(&mut self, cmd_done: bool, dma_done: bool)

Enable specific SFC interrupts.

  • cmd_done — Command operation complete interrupt.
  • dma_done — DMA transfer complete interrupt.
Source

pub fn raw_interrupt_status(&self) -> (bool, bool)

Check raw interrupt status.

Returns (cmd_done_raw, dma_done_raw).

Source

pub fn enable_aes_low_power(&mut self)

Enable AES low-power mode (for XIP encrypted execution).

Source

pub fn disable_aes_low_power(&mut self)

Disable AES low-power mode.

Source

pub fn set_iv_valid(&mut self)

Set AES IV valid flag.

Source

pub fn read_aes_dfx(&self) -> u32

Read AES DFX information (for debugging).

Auto Trait Implementations§

§

impl<'d> Freeze for SfcDriver<'d>

§

impl<'d> RefUnwindSafe for SfcDriver<'d>

§

impl<'d> Send for SfcDriver<'d>

§

impl<'d> Sync for SfcDriver<'d>

§

impl<'d> Unpin for SfcDriver<'d>

§

impl<'d> UnsafeUnpin for SfcDriver<'d>

§

impl<'d> UnwindSafe for SfcDriver<'d>

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
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.

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.