#[repr(C)]pub struct eth_spi_custom_driver_config_t {
pub config: *mut c_void,
pub init: Option<unsafe extern "C" fn(spi_config: *const c_void) -> *mut c_void>,
pub deinit: Option<unsafe extern "C" fn(spi_ctx: *mut c_void) -> esp_err_t>,
pub read: Option<unsafe extern "C" fn(spi_ctx: *mut c_void, cmd: u32, addr: u32, data: *mut c_void, data_len: u32) -> esp_err_t>,
pub write: Option<unsafe extern "C" fn(spi_ctx: *mut c_void, cmd: u32, addr: u32, data: *const c_void, data_len: u32) -> esp_err_t>,
}
Expand description
@brief Custom SPI Driver Configuration. This structure declares configuration and callback functions to access Ethernet SPI module via user’s custom SPI driver.
Fields§
§config: *mut c_void
@brief Custom driver specific configuration data used by init()
function.
@note Type and its content is fully under user’s control
init: Option<unsafe extern "C" fn(spi_config: *const c_void) -> *mut c_void>
@brief Custom driver SPI Initialization
@param[in] spi_config: Custom driver specific configuration
@return - spi_ctx: when initialization is successful, a pointer to context structure holding all variables needed for subsequent SPI access operations (e.g. SPI bus identification, mutexes, etc.) - NULL: driver initialization failed
@note return type and its content is fully under user’s control
deinit: Option<unsafe extern "C" fn(spi_ctx: *mut c_void) -> esp_err_t>
@brief Custom driver De-initialization
@param[in] spi_ctx: a pointer to driver specific context structure
@return - ESP_OK: driver de-initialization was successful - ESP_FAIL: driver de-initialization failed - any other failure codes are allowed to be used to provide failure isolation
read: Option<unsafe extern "C" fn(spi_ctx: *mut c_void, cmd: u32, addr: u32, data: *mut c_void, data_len: u32) -> esp_err_t>
@brief Custom driver SPI read
@note The read function is responsible to construct command, address and data fields of the SPI frame in format expected by particular SPI Ethernet module
@param[in] spi_ctx: a pointer to driver specific context structure @param[in] cmd: command @param[in] addr: register address @param[out] data: read data @param[in] data_len: read data length in bytes
@return - ESP_OK: read was successful - ESP_FAIL: read failed - any other failure codes are allowed to be used to provide failure isolation
write: Option<unsafe extern "C" fn(spi_ctx: *mut c_void, cmd: u32, addr: u32, data: *const c_void, data_len: u32) -> esp_err_t>
@brief Custom driver SPI write
@note The write function is responsible to construct command, address and data fields of the SPI frame in format expected by particular SPI Ethernet module
@param[in] spi_ctx: a pointer to driver specific context structure @param[in] cmd: command @param[in] addr: register address @param[in] data: data to write @param[in] data_len: length of data to write in bytes
@return - ESP_OK: write was successful - ESP_FAIL: write failed - any other failure codes are allowed to be used to provide failure isolation
Trait Implementations§
source§impl Clone for eth_spi_custom_driver_config_t
impl Clone for eth_spi_custom_driver_config_t
source§fn clone(&self) -> eth_spi_custom_driver_config_t
fn clone(&self) -> eth_spi_custom_driver_config_t
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for eth_spi_custom_driver_config_t
impl Debug for eth_spi_custom_driver_config_t
source§impl Default for eth_spi_custom_driver_config_t
impl Default for eth_spi_custom_driver_config_t
impl Copy for eth_spi_custom_driver_config_t
Auto Trait Implementations§
impl Freeze for eth_spi_custom_driver_config_t
impl RefUnwindSafe for eth_spi_custom_driver_config_t
impl !Send for eth_spi_custom_driver_config_t
impl !Sync for eth_spi_custom_driver_config_t
impl Unpin for eth_spi_custom_driver_config_t
impl UnwindSafe for eth_spi_custom_driver_config_t
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
)