pub type spi_flash_host_driver_t = spi_flash_host_driver_s;
Expand description

Host driver configuration and context structure.

Aliased Type§

struct spi_flash_host_driver_t {
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>,
}

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.