#[repr(C)]
pub struct esp_eth_mac_s {
Show 20 fields pub set_mediator: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, eth: *mut esp_eth_mediator_t) -> esp_err_t>, pub init: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>, pub deinit: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>, pub start: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>, pub stop: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>, pub transmit: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, buf: *mut u8, length: u32) -> esp_err_t>, pub transmit_vargs: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, argc: u32, args: va_list) -> esp_err_t>, pub receive: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, buf: *mut u8, length: *mut u32) -> esp_err_t>, pub read_phy_reg: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, phy_addr: u32, phy_reg: u32, reg_value: *mut u32) -> esp_err_t>, pub write_phy_reg: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, phy_addr: u32, phy_reg: u32, reg_value: u32) -> esp_err_t>, pub set_addr: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, addr: *mut u8) -> esp_err_t>, pub get_addr: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, addr: *mut u8) -> esp_err_t>, pub set_speed: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, speed: eth_speed_t) -> esp_err_t>, pub set_duplex: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, duplex: eth_duplex_t) -> esp_err_t>, pub set_link: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, link: eth_link_t) -> esp_err_t>, pub set_promiscuous: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, enable: bool) -> esp_err_t>, pub enable_flow_ctrl: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, enable: bool) -> esp_err_t>, pub set_peer_pause_ability: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, ability: u32) -> esp_err_t>, pub custom_ioctl: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, cmd: u32, data: *mut c_void) -> esp_err_t>, pub del: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>,
}
Expand description

@brief Ethernet MAC

Fields§

§set_mediator: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, eth: *mut esp_eth_mediator_t) -> esp_err_t>

@brief Set mediator for Ethernet MAC

@param[in] mac: Ethernet MAC instance @param[in] eth: Ethernet mediator

@return - ESP_OK: set mediator for Ethernet MAC successfully - ESP_ERR_INVALID_ARG: set mediator for Ethernet MAC failed because of invalid argument

§init: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>

@brief Initialize Ethernet MAC

@param[in] mac: Ethernet MAC instance

@return - ESP_OK: initialize Ethernet MAC successfully - ESP_ERR_TIMEOUT: initialize Ethernet MAC failed because of timeout - ESP_FAIL: initialize Ethernet MAC failed because some other error occurred

§deinit: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>

@brief Deinitialize Ethernet MAC

@param[in] mac: Ethernet MAC instance

@return - ESP_OK: deinitialize Ethernet MAC successfully - ESP_FAIL: deinitialize Ethernet MAC failed because some error occurred

§start: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>

@brief Start Ethernet MAC

@param[in] mac: Ethernet MAC instance

@return - ESP_OK: start Ethernet MAC successfully - ESP_FAIL: start Ethernet MAC failed because some other error occurred

§stop: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>

@brief Stop Ethernet MAC

@param[in] mac: Ethernet MAC instance

@return - ESP_OK: stop Ethernet MAC successfully - ESP_FAIL: stop Ethernet MAC failed because some error occurred

§transmit: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, buf: *mut u8, length: u32) -> esp_err_t>

@brief Transmit packet from Ethernet MAC

@param[in] mac: Ethernet MAC instance @param[in] buf: packet buffer to transmit @param[in] length: length of packet

@return - ESP_OK: transmit packet successfully - ESP_ERR_INVALID_SIZE: number of actually sent bytes differs to expected - ESP_FAIL: transmit packet failed because some other error occurred

@note Returned error codes may differ for each specific MAC chip.

§transmit_vargs: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, argc: u32, args: va_list) -> esp_err_t>

@brief Transmit packet from Ethernet MAC constructed with special parameters at Layer2.

@param[in] mac: Ethernet MAC instance @param[in] argc: number variable arguments @param[in] args: variable arguments

@note Typical intended use case is to make possible to construct a frame from multiple higher layer buffers without a need of buffer reallocations. However, other use cases are not limited.

@return - ESP_OK: transmit packet successfully - ESP_ERR_INVALID_SIZE: number of actually sent bytes differs to expected - ESP_FAIL: transmit packet failed because some other error occurred

@note Returned error codes may differ for each specific MAC chip.

§receive: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, buf: *mut u8, length: *mut u32) -> esp_err_t>

@brief Receive packet from Ethernet MAC

@param[in] mac: Ethernet MAC instance @param[out] buf: packet buffer which will preserve the received frame @param[out] length: length of the received packet

@note Memory of buf is allocated in the Layer2, make sure it get free after process. @note Before this function got invoked, the value of “length” should set by user, equals the size of buffer. After the function returned, the value of “length” means the real length of received data.

@return - ESP_OK: receive packet successfully - ESP_ERR_INVALID_ARG: receive packet failed because of invalid argument - ESP_ERR_INVALID_SIZE: input buffer size is not enough to hold the incoming data. in this case, value of returned “length” indicates the real size of incoming data. - ESP_FAIL: receive packet failed because some other error occurred

§read_phy_reg: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, phy_addr: u32, phy_reg: u32, reg_value: *mut u32) -> esp_err_t>

@brief Read PHY register

@param[in] mac: Ethernet MAC instance @param[in] phy_addr: PHY chip address (0~31) @param[in] phy_reg: PHY register index code @param[out] reg_value: PHY register value

@return - ESP_OK: read PHY register successfully - ESP_ERR_INVALID_ARG: read PHY register failed because of invalid argument - ESP_ERR_INVALID_STATE: read PHY register failed because of wrong state of MAC - ESP_ERR_TIMEOUT: read PHY register failed because of timeout - ESP_FAIL: read PHY register failed because some other error occurred

§write_phy_reg: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, phy_addr: u32, phy_reg: u32, reg_value: u32) -> esp_err_t>

@brief Write PHY register

@param[in] mac: Ethernet MAC instance @param[in] phy_addr: PHY chip address (0~31) @param[in] phy_reg: PHY register index code @param[in] reg_value: PHY register value

@return - ESP_OK: write PHY register successfully - ESP_ERR_INVALID_STATE: write PHY register failed because of wrong state of MAC - ESP_ERR_TIMEOUT: write PHY register failed because of timeout - ESP_FAIL: write PHY register failed because some other error occurred

§set_addr: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, addr: *mut u8) -> esp_err_t>

@brief Set MAC address

@param[in] mac: Ethernet MAC instance @param[in] addr: MAC address

@return - ESP_OK: set MAC address successfully - ESP_ERR_INVALID_ARG: set MAC address failed because of invalid argument - ESP_FAIL: set MAC address failed because some other error occurred

§get_addr: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, addr: *mut u8) -> esp_err_t>

@brief Get MAC address

@param[in] mac: Ethernet MAC instance @param[out] addr: MAC address

@return - ESP_OK: get MAC address successfully - ESP_ERR_INVALID_ARG: get MAC address failed because of invalid argument - ESP_FAIL: get MAC address failed because some other error occurred

§set_speed: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, speed: eth_speed_t) -> esp_err_t>

@brief Set speed of MAC

@param[in] ma:c Ethernet MAC instance @param[in] speed: MAC speed

@return - ESP_OK: set MAC speed successfully - ESP_ERR_INVALID_ARG: set MAC speed failed because of invalid argument - ESP_FAIL: set MAC speed failed because some other error occurred

§set_duplex: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, duplex: eth_duplex_t) -> esp_err_t>

@brief Set duplex mode of MAC

@param[in] mac: Ethernet MAC instance @param[in] duplex: MAC duplex

@return - ESP_OK: set MAC duplex mode successfully - ESP_ERR_INVALID_ARG: set MAC duplex failed because of invalid argument - ESP_FAIL: set MAC duplex failed because some other error occurred

§set_link: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, link: eth_link_t) -> esp_err_t>

@brief Set link status of MAC

@param[in] mac: Ethernet MAC instance @param[in] link: Link status

@return - ESP_OK: set link status successfully - ESP_ERR_INVALID_ARG: set link status failed because of invalid argument - ESP_FAIL: set link status failed because some other error occurred

§set_promiscuous: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, enable: bool) -> esp_err_t>

@brief Set promiscuous of MAC

@param[in] mac: Ethernet MAC instance @param[in] enable: set true to enable promiscuous mode; set false to disable promiscuous mode

@return - ESP_OK: set promiscuous mode successfully - ESP_FAIL: set promiscuous mode failed because some error occurred

§enable_flow_ctrl: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, enable: bool) -> esp_err_t>

@brief Enable flow control on MAC layer or not

@param[in] mac: Ethernet MAC instance @param[in] enable: set true to enable flow control; set false to disable flow control

@return - ESP_OK: set flow control successfully - ESP_FAIL: set flow control failed because some error occurred

§set_peer_pause_ability: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, ability: u32) -> esp_err_t>

@brief Set the PAUSE ability of peer node

@param[in] mac: Ethernet MAC instance @param[in] ability: zero indicates that pause function is supported by link partner; non-zero indicates that pause function is not supported by link partner

@return - ESP_OK: set peer pause ability successfully - ESP_FAIL: set peer pause ability failed because some error occurred

§custom_ioctl: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t, cmd: u32, data: *mut c_void) -> esp_err_t>

@brief Custom IO function of MAC driver. This function is intended to extend common options of esp_eth_ioctl to cover specifics of MAC chip.

@note This function may not be assigned when the MAC chip supports only most common set of configuration options.

@param[in] mac: Ethernet MAC instance @param[in] cmd: IO control command @param[in, out] data: address of data for set command or address where to store the data when used with get command

@return - ESP_OK: process io command successfully - ESP_ERR_INVALID_ARG: process io command failed because of some invalid argument - ESP_FAIL: process io command failed because some other error occurred - ESP_ERR_NOT_SUPPORTED: requested feature is not supported

§del: Option<unsafe extern "C" fn(mac: *mut esp_eth_mac_t) -> esp_err_t>

@brief Free memory of Ethernet MAC

@param[in] mac: Ethernet MAC instance

@return - ESP_OK: free Ethernet MAC instance successfully - ESP_FAIL: free Ethernet MAC instance failed because some error occurred

Trait Implementations§

source§

impl Clone for esp_eth_mac_s

source§

fn clone(&self) -> esp_eth_mac_s

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 esp_eth_mac_s

source§

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

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

impl Default for esp_eth_mac_s

source§

fn default() -> esp_eth_mac_s

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

impl Copy for esp_eth_mac_s

Auto Trait Implementations§

§

impl RefUnwindSafe for esp_eth_mac_s

§

impl Send for esp_eth_mac_s

§

impl Sync for esp_eth_mac_s

§

impl Unpin for esp_eth_mac_s

§

impl UnwindSafe for esp_eth_mac_s

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> 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.