Struct esp_idf_hal::sys::spi_flash_host_driver_s

source ·
#[repr(C)]
pub struct spi_flash_host_driver_s {
Show 22 fields pub dev_config: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t) -> i32>, pub common_command: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut spi_flash_trans_t) -> i32>, pub read_id: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut u32) -> i32>, pub erase_chip: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>, pub erase_sector: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32)>, pub erase_block: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32)>, pub read_status: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut u8) -> i32>, pub set_write_protect: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: bool) -> i32>, pub program_page: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const c_void, _: u32, _: u32)>, pub supports_direct_write: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const c_void) -> bool>, pub write_data_slicer: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32, _: *mut u32, _: u32) -> i32>, pub read: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut c_void, _: u32, _: u32) -> i32>, pub supports_direct_read: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const c_void) -> bool>, pub read_data_slicer: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32, _: *mut u32, _: u32) -> i32>, pub host_status: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t) -> u32>, pub configure_host_io_mode: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32, _: i32, _: u32) -> i32>, pub poll_cmd_done: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>, pub flush_cache: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32) -> i32>, pub check_suspend: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>, pub resume: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>, pub suspend: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>, pub sus_setup: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const spi_flash_sus_cmd_conf) -> i32>,
}
Expand description

Host driver configuration and context structure.

Fields§

§dev_config: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t) -> i32>

Configure the device-related register before transactions. This saves some time to re-configure those registers when we send continuously

§common_command: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut spi_flash_trans_t) -> i32>

Send an user-defined spi transaction to the device.

§read_id: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut u32) -> i32>

Read flash ID.

§erase_chip: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>

Erase whole flash chip.

§erase_sector: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32)>

Erase a specific sector by its start address.

§erase_block: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32)>

Erase a specific block by its start address.

§read_status: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut u8) -> i32>

Read the status of the flash chip.

§set_write_protect: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: bool) -> i32>

Disable write protection.

§program_page: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const c_void, _: u32, _: u32)>

Program a page of the flash. Check max_write_bytes for the maximum allowed writing length.

§supports_direct_write: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const c_void) -> bool>

@brief Check whether the SPI host supports direct write

When cache is disabled, SPI1 doesn’t support directly write when buffer isn’t internal.

§write_data_slicer: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32, _: *mut u32, _: u32) -> i32>

Slicer for write data. The program_page should be called iteratively with the return value of this function.

@param address Beginning flash address to write @param len Length request to write @param align_addr Output of the aligned address to write to @param page_size Physical page size of the flash chip @return Length that can be actually written in one program_page call

§read: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *mut c_void, _: u32, _: u32) -> i32>

Read data from the flash. Check max_read_bytes for the maximum allowed reading length.

§supports_direct_read: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const c_void) -> bool>

@brief Check whether the SPI host supports direct read

When cache is disabled, SPI1 doesn’t support directly read when the given buffer isn’t internal.

§read_data_slicer: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32, _: *mut u32, _: u32) -> i32>

Slicer for read data. The read should be called iteratively with the return value of this function.

@param address Beginning flash address to read @param len Length request to read @param align_addr Output of the aligned address to read @param page_size Physical page size of the flash chip @return Length that can be actually read in one read call

§host_status: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t) -> u32>

Check the host status, 0:busy, 1:idle, 2:suspended.

§configure_host_io_mode: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32, _: i32, _: u32) -> i32>

Configure the host to work at different read mode. Responsible to compensate the timing and set IO mode.

§poll_cmd_done: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>

Internal use, poll the HW until the last operation is done.

§flush_cache: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: u32, _: u32) -> i32>

For some host (SPI1), they are shared with a cache. When the data is modified, the cache needs to be flushed. Left NULL if not supported.

§check_suspend: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>

Suspend check erase/program operation, reserved for ESP32-C3 and ESP32-S3 spi flash ROM IMPL.

§resume: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>

Resume flash from suspend manually

§suspend: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t)>

Set flash in suspend status manually

§sus_setup: Option<unsafe extern "C" fn(_: *mut spi_flash_host_inst_t, _: *const spi_flash_sus_cmd_conf) -> i32>

Suspend feature setup for setting cmd and status register mask.

Trait Implementations§

source§

impl Clone for spi_flash_host_driver_s

source§

fn clone(&self) -> spi_flash_host_driver_s

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for spi_flash_host_driver_s

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for spi_flash_host_driver_s

source§

fn default() -> spi_flash_host_driver_s

Returns the “default value” for a type. Read more
source§

impl Copy for spi_flash_host_driver_s

Auto Trait Implementations§

§

impl Freeze for spi_flash_host_driver_s

§

impl RefUnwindSafe for spi_flash_host_driver_s

§

impl Send for spi_flash_host_driver_s

§

impl Sync for spi_flash_host_driver_s

§

impl Unpin for spi_flash_host_driver_s

§

impl UnwindSafe for spi_flash_host_driver_s

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CloneToUninit for T
where T: Copy,

§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.