Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
eth_adin2111.h File Reference
#include <stdint.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>

Go to the source code of this file.

Functions

int eth_adin2111_lock (const struct device *dev, k_timeout_t timeout)
 Locks device access.
 
int eth_adin2111_unlock (const struct device *dev)
 Unlocks device access.
 
int eth_adin2111_reg_write (const struct device *dev, const uint16_t reg, uint32_t val)
 Writes host MAC interface register over SPI.
 
int eth_adin2111_reg_read (const struct device *dev, const uint16_t reg, uint32_t *val)
 Reads host MAC interface register over SPI.
 
int eth_adin2111_reg_update (const struct device *dev, const uint16_t reg, uint32_t mask, uint32_t data)
 Update host MAC interface register over SPI.
 
int eth_adin2111_sw_reset (const struct device *dev, uint16_t delay)
 Reset both the MAC and PHY.
 
int eth_adin2111_mac_reset (const struct device *dev)
 Reset the MAC device.
 
int eth_adin2111_broadcast_filter (const struct device *dev, bool enable)
 Enable/disable the forwarding (to host) of broadcast frames.
 
struct net_ifeth_adin2111_get_iface (const struct device *dev, const uint16_t port_idx)
 Get the port-related net_if reference.
 

Function Documentation

◆ eth_adin2111_broadcast_filter()

int eth_adin2111_broadcast_filter ( const struct device * dev,
bool enable )

Enable/disable the forwarding (to host) of broadcast frames.

Frames who's DA doesn't match are dropped.

Note
The caller is responsible for device lock. Shall not be called from ISR.
Parameters
[in]devADIN2111 device.
enableSet to 0 to disable and to nonzero to enable.
Return values
0Successful write.
<0Error, a negative errno code.

◆ eth_adin2111_get_iface()

struct net_if * eth_adin2111_get_iface ( const struct device * dev,
const uint16_t port_idx )

Get the port-related net_if reference.

Parameters
[in]devADIN2111 device.
port_idxPort index.
Return values
astruct net_if pointer, or NULL on error.

◆ eth_adin2111_lock()

int eth_adin2111_lock ( const struct device * dev,
k_timeout_t timeout )

Locks device access.

Parameters
[in]devADIN2111 device.
timeoutWaiting period to lock the device, or one of the special values K_NO_WAIT and K_FOREVER.
Return values
0Device locked.
-EBUSYReturned without waiting.
-EAGAINWaiting period timed out.

◆ eth_adin2111_mac_reset()

int eth_adin2111_mac_reset ( const struct device * dev)

Reset the MAC device.

Note that PHY 1 must be out of software power-down for the MAC subsystem reset to take effect.

Note
The caller is responsible for device lock. Shall not be called from ISR.
Parameters
[in]devADIN2111 device.
Return values
0Successful write.
<0Error, a negative errno code.

◆ eth_adin2111_reg_read()

int eth_adin2111_reg_read ( const struct device * dev,
const uint16_t reg,
uint32_t * val )

Reads host MAC interface register over SPI.

Note
The caller is responsible for device lock. Shall not be called from ISR.
Parameters
[in]devADIN2111 device.
regRegister address.
[out]valRead value output.
Return values
0Successful write.
<0Error, a negative errno code.

◆ eth_adin2111_reg_update()

int eth_adin2111_reg_update ( const struct device * dev,
const uint16_t reg,
uint32_t mask,
uint32_t data )

Update host MAC interface register over SPI.

Note
The caller is responsible for device lock. Shall not be called from ISR.
Parameters
[in]devADIN2111 device.
regRegister address.
maskBitmask for bits that may be modified.
dataData to apply in the masked range.
Return values
0Successful write.
<0Error, a negative errno code.

◆ eth_adin2111_reg_write()

int eth_adin2111_reg_write ( const struct device * dev,
const uint16_t reg,
uint32_t val )

Writes host MAC interface register over SPI.

Note
The caller is responsible for device lock. Shall not be called from ISR.
Parameters
[in]devADIN2111 device.
regRegister address.
valValue to write.
Return values
0Successful write.
<0Error, a negative errno code.

◆ eth_adin2111_sw_reset()

int eth_adin2111_sw_reset ( const struct device * dev,
uint16_t delay )

Reset both the MAC and PHY.

Parameters
[in]devADIN2111 device.
delayDelay in milliseconds.
Note
The caller is responsible for device lock. Shall not be called from ISR.
Return values
0Successful write.
<0Error, a negative errno code.

◆ eth_adin2111_unlock()

int eth_adin2111_unlock ( const struct device * dev)

Unlocks device access.

Parameters
[in]devADIN2111 device.
Return values
0Device unlocked.
-EPERMThe current thread does not own the device lock.
-EINVALThe device is not locked.