#[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>

Check whether given buffer can be directly used to write

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>

Check whether given buffer can be directly used to read

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.