[][src]Struct esp_idf_bindgen::spi_flash_host_driver_t

#[repr(C)]pub struct spi_flash_host_driver_t {
    pub driver_data: *mut c_void,
    pub dev_config: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t) -> esp_err_t>,
    pub common_command: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, t: *mut spi_flash_trans_t) -> esp_err_t>,
    pub read_id: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, id: *mut u32) -> esp_err_t>,
    pub erase_chip: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t)>,
    pub erase_sector: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, start_address: u32)>,
    pub erase_block: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, start_address: u32)>,
    pub read_status: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, out_sr: *mut u8) -> esp_err_t>,
    pub set_write_protect: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, wp: bool) -> esp_err_t>,
    pub program_page: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, buffer: *const c_void, address: u32, length: u32)>,
    pub supports_direct_write: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, p: *const c_void) -> bool>,
    pub supports_direct_read: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, p: *const c_void) -> bool>,
    pub max_write_bytes: c_int,
    pub read: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, buffer: *mut c_void, address: u32, read_len: u32) -> esp_err_t>,
    pub max_read_bytes: c_int,
    pub host_idle: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t) -> bool>,
    pub configure_host_io_mode: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_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(driver: *mut spi_flash_host_driver_t)>,
    pub flush_cache: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, addr: u32, size: u32) -> esp_err_t>,
}

Host driver configuration and context structure.

Fields

driver_data: *mut c_void

Configuration and static data used by the specific host driver. The type is determined by the host driver.

dev_config: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_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(driver: *mut spi_flash_host_driver_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(driver: *mut spi_flash_host_driver_t, id: *mut u32) -> esp_err_t>

Read flash ID.

erase_chip: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t)>

Erase whole flash chip.

erase_sector: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, start_address: u32)>

Erase a specific sector by its start address.

erase_block: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, start_address: u32)>

Erase a specific block by its start address.

read_status: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, out_sr: *mut u8) -> esp_err_t>

Read the status of the flash chip.

set_write_protect: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, wp: bool) -> esp_err_t>

Disable write protection.

program_page: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_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(driver: *mut spi_flash_host_driver_t, p: *const c_void) -> bool>

Check whether need to allocate new buffer to write

supports_direct_read: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t, p: *const c_void) -> bool>

Check whether need to allocate new buffer to read

max_write_bytes: c_int

maximum length of program_page

read: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_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.

max_read_bytes: c_int

maximum length of read

host_idle: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_t) -> bool>

Check whether the host is idle to perform new operations.

configure_host_io_mode: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_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(driver: *mut spi_flash_host_driver_t)>

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

flush_cache: Option<unsafe extern "C" fn(driver: *mut spi_flash_host_driver_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.

Trait Implementations

impl Clone for spi_flash_host_driver_t[src]

impl Copy for spi_flash_host_driver_t[src]

impl Debug for spi_flash_host_driver_t[src]

Auto Trait Implementations

impl !Send for spi_flash_host_driver_t

impl !Sync for spi_flash_host_driver_t

impl Unpin for spi_flash_host_driver_t

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.