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
impl Clone for spi_flash_host_driver_s
source§fn clone(&self) -> spi_flash_host_driver_s
fn clone(&self) -> spi_flash_host_driver_s
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for spi_flash_host_driver_s
impl Debug for spi_flash_host_driver_s
source§impl Default for spi_flash_host_driver_s
impl Default for spi_flash_host_driver_s
source§fn default() -> spi_flash_host_driver_s
fn default() -> spi_flash_host_driver_s
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 Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)