Struct esp_idf_svc::sys::eth_spi_custom_driver_config_t

source ·
#[repr(C)]
pub struct eth_spi_custom_driver_config_t { pub config: *mut c_void, pub init: Option<unsafe extern "C" fn(_: *const c_void) -> *mut c_void>, pub deinit: Option<unsafe extern "C" fn(_: *mut c_void) -> i32>, pub read: Option<unsafe extern "C" fn(_: *mut c_void, _: u32, _: u32, _: *mut c_void, _: u32) -> i32>, pub write: Option<unsafe extern "C" fn(_: *mut c_void, _: u32, _: u32, _: *const c_void, _: u32) -> i32>, }
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(_: *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(_: *mut c_void) -> i32>

@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(_: *mut c_void, _: u32, _: u32, _: *mut c_void, _: u32) -> i32>

@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(_: *mut c_void, _: u32, _: u32, _: *const c_void, _: u32) -> i32>

@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

source§

fn clone(&self) -> eth_spi_custom_driver_config_t

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for eth_spi_custom_driver_config_t

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for eth_spi_custom_driver_config_t

source§

fn default() -> eth_spi_custom_driver_config_t

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

impl Copy for eth_spi_custom_driver_config_t

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CloneToUninit for T
where T: Copy,

§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.