Struct esp_idf_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(host: *mut spi_flash_host_inst_t) -> esp_err_t>, pub common_command: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, t: *mut spi_flash_trans_t) -> esp_err_t>, pub read_id: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, id: *mut u32) -> esp_err_t>, pub erase_chip: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t)>, pub erase_sector: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, start_address: u32)>, pub erase_block: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, start_address: u32)>, pub read_status: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, out_sr: *mut u8) -> esp_err_t>, pub set_write_protect: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, wp: bool) -> esp_err_t>, pub program_page: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, buffer: *const c_void, address: u32, length: u32)>, pub supports_direct_write: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, p: *const c_void) -> bool>, pub write_data_slicer: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, address: u32, len: u32, align_addr: *mut u32, page_size: u32) -> c_int>, pub read: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, buffer: *mut c_void, address: u32, read_len: u32) -> esp_err_t>, pub supports_direct_read: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, p: *const c_void) -> bool>, pub read_data_slicer: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, address: u32, len: u32, align_addr: *mut u32, page_size: u32) -> c_int>, pub host_status: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t) -> u32>, pub configure_host_io_mode: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, command: u32, addr_bitlen: u32, dummy_bitlen_base: c_int, io_mode: esp_flash_io_mode_t) -> esp_err_t>, pub poll_cmd_done: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t)>, pub flush_cache: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, addr: u32, size: u32) -> esp_err_t>, pub check_suspend: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t)>, pub resume: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t)>, pub suspend: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t)>, pub sus_setup: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, sus_conf: *const spi_flash_sus_cmd_conf) -> esp_err_t>,
}
Expand description

Host driver configuration and context structure.

Fields§

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

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(host: *mut spi_flash_host_inst_t, t: *mut spi_flash_trans_t) -> esp_err_t>

Send an user-defined spi transaction to the device.

§read_id: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, id: *mut u32) -> esp_err_t>

Read flash ID.

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

Erase whole flash chip.

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

Erase a specific sector by its start address.

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

Erase a specific block by its start address.

§read_status: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, out_sr: *mut u8) -> esp_err_t>

Read the status of the flash chip.

§set_write_protect: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, wp: bool) -> esp_err_t>

Disable write protection.

§program_page: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, buffer: *const c_void, address: u32, length: 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(host: *mut spi_flash_host_inst_t, p: *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(host: *mut spi_flash_host_inst_t, address: u32, len: u32, align_addr: *mut u32, page_size: u32) -> c_int>

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(host: *mut spi_flash_host_inst_t, buffer: *mut c_void, address: u32, read_len: u32) -> esp_err_t>

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

§supports_direct_read: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, p: *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(host: *mut spi_flash_host_inst_t, address: u32, len: u32, align_addr: *mut u32, page_size: u32) -> c_int>

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(host: *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(host: *mut spi_flash_host_inst_t, command: u32, addr_bitlen: u32, dummy_bitlen_base: c_int, io_mode: esp_flash_io_mode_t) -> esp_err_t>

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(host: *mut spi_flash_host_inst_t)>

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

§flush_cache: Option<unsafe extern "C" fn(host: *mut spi_flash_host_inst_t, addr: u32, size: u32) -> esp_err_t>

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(host: *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(host: *mut spi_flash_host_inst_t)>

Resume flash from suspend manually

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

Set flash in suspend status manually

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

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

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.