![]() |
no-OS
|
Source file of the ADIN1110 driver. More...
#include <errno.h>#include <stdlib.h>#include <stdint.h>#include <string.h>#include "no_os_spi.h"#include "adin1110.h"#include "no_os_alloc.h"#include "no_os_crc8.h"#include "no_os_delay.h"#include "no_os_util.h"#include "oa_tc6.h"Classes | |
| struct | _adin1110_priv |
Macros | |
| #define | ADIN1110_CRC_POLYNOMIAL 0x7 |
Functions | |
| NO_OS_DECLARE_CRC8_TABLE (_crc_table) | |
| int | adin1110_reg_write (struct adin1110_desc *desc, uint16_t addr, uint32_t data) |
| Write a register's value. | |
| int | adin1110_reg_read (struct adin1110_desc *desc, uint16_t addr, uint32_t *data) |
| Read a register's value. | |
| int | adin1110_reg_update (struct adin1110_desc *desc, uint16_t addr, uint32_t mask, uint32_t data) |
| Update a register's value based on a mask. | |
| int | adin1110_mdio_read (struct adin1110_desc *desc, uint32_t phy_id, uint32_t reg, uint16_t *data) |
| Read a PHY register using clause 22. | |
| int | adin1110_mdio_write (struct adin1110_desc *desc, uint32_t phy_id, uint32_t reg, uint16_t data) |
| Write a PHY register using clause 22. | |
| int | adin1110_mdio_write_c45 (struct adin1110_desc *desc, uint32_t phy_id, uint32_t dev_id, uint32_t reg, uint16_t data) |
| Write a PHY register using clause 45. | |
| int | adin1110_mdio_read_c45 (struct adin1110_desc *desc, uint32_t phy_id, uint32_t dev_id, uint16_t reg, uint16_t *data) |
| Read a PHY register using clause 45. | |
| int | adin1110_set_mac_addr (struct adin1110_desc *desc, uint8_t mac_address[ADIN1110_ETH_ALEN]) |
| Set a MAC address destination filter, frames who's DA doesn't match are dropped. | |
| int | adin1110_clear_mac_addr (struct adin1110_desc *desc, uint8_t mac_address[ADIN1110_ETH_ALEN]) |
| Drop a MAC address filter. | |
| int | adin1110_broadcast_filter (struct adin1110_desc *desc, bool enabled) |
| Set/clear a broadcast filter. By enabling this, broadcast frames will be forwarded to the host. | |
| int | adin1110_write_fifo (struct adin1110_desc *desc, uint32_t port, struct adin1110_eth_buff *eth_buff) |
| Write a frame to the TX FIFO. | |
| int | adin1110_read_fifo (struct adin1110_desc *desc, uint32_t port, struct adin1110_eth_buff *eth_buff) |
| Read a frame from the RX FIFO. | |
| int | adin1110_mac_reset (struct adin1110_desc *desc) |
| Reset the MAC device. | |
| int | adin1110_phy_reset (struct adin1110_desc *desc) |
| Reset the PHY device. | |
| int | adin1110_sw_reset (struct adin1110_desc *desc) |
| Reset both the MAC and PHY. | |
| int | adin1110_link_state (struct adin1110_desc *desc, uint32_t *state) |
| Reset both the MAC and PHY. | |
| int | adin1110_set_promisc (struct adin1110_desc *desc, uint32_t port, bool promisc) |
| Set a port in promiscuous mode. All MAC filters are dropped. | |
| int | adin1110_init (struct adin1110_desc **desc, struct adin1110_init_param *param) |
| Initialize the device. | |
| int | adin1110_remove (struct adin1110_desc *desc) |
| Free a device descriptor. | |
Source file of the ADIN1110 driver.
Copyright 2023(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define ADIN1110_CRC_POLYNOMIAL 0x7 |
| int adin1110_broadcast_filter | ( | struct adin1110_desc * | desc, |
| bool | enabled ) |
Set/clear a broadcast filter. By enabling this, broadcast frames will be forwarded to the host.
| desc | - the device descriptor |
| enabled | - the set/clear option |
| int adin1110_clear_mac_addr | ( | struct adin1110_desc * | desc, |
| uint8_t | mac_address[ADIN1110_ETH_ALEN] ) |
Drop a MAC address filter.
| desc | - the device descriptor |
| mac_address | - the MAC filter to be cleared |
| int adin1110_init | ( | struct adin1110_desc ** | desc, |
| struct adin1110_init_param * | param ) |
Initialize the device.
| desc | - the device descriptor to be initialized |
| param | - the device's parameter |
| int adin1110_link_state | ( | struct adin1110_desc * | desc, |
| uint32_t * | state ) |
Reset both the MAC and PHY.
| desc | - the device descriptor |
| state | - status (up/down) of the link |
| int adin1110_mac_reset | ( | struct adin1110_desc * | desc | ) |
Reset the MAC device.
| desc | - the device descriptor |
| int adin1110_mdio_read | ( | struct adin1110_desc * | desc, |
| uint32_t | phy_id, | ||
| uint32_t | reg, | ||
| uint16_t * | data ) |
Read a PHY register using clause 22.
| desc | - the device descriptor |
| phy_id | - the phy device's id |
| reg | - register's address |
| data | - register's value |
| int adin1110_mdio_read_c45 | ( | struct adin1110_desc * | desc, |
| uint32_t | phy_id, | ||
| uint32_t | dev_id, | ||
| uint16_t | reg, | ||
| uint16_t * | data ) |
Read a PHY register using clause 45.
| desc | - the device descriptor |
| phy_id | - the phy device's MDIO id |
| dev_id | - the device id of the register |
| reg | - register's address |
| data | - register's value |
| int adin1110_mdio_write | ( | struct adin1110_desc * | desc, |
| uint32_t | phy_id, | ||
| uint32_t | reg, | ||
| uint16_t | data ) |
Write a PHY register using clause 22.
| desc | - the device descriptor |
| phy_id | - the phy device's id |
| reg | - register's address |
| data | - register's value |
| int adin1110_mdio_write_c45 | ( | struct adin1110_desc * | desc, |
| uint32_t | phy_id, | ||
| uint32_t | dev_id, | ||
| uint32_t | reg, | ||
| uint16_t | data ) |
Write a PHY register using clause 45.
| desc | - the device descriptor |
| phy_id | - the phy device's MDIO id |
| dev_id | - the device id of the register |
| reg | - register's address |
| data | - register's value |
| int adin1110_phy_reset | ( | struct adin1110_desc * | desc | ) |
Reset the PHY device.
| desc | - the device descriptor |
| int adin1110_read_fifo | ( | struct adin1110_desc * | desc, |
| uint32_t | port, | ||
| struct adin1110_eth_buff * | eth_buff ) |
Read a frame from the RX FIFO.
| desc | - the device descriptor |
| port | - the port from which the frame shall be received. |
| eth_buff | - the frame to be received. |
Burst read the whole frame
| int adin1110_reg_read | ( | struct adin1110_desc * | desc, |
| uint16_t | addr, | ||
| uint32_t * | data ) |
Read a register's value.
| desc | - the device descriptor |
| addr | - register's address |
| data | - register's value |
| int adin1110_reg_update | ( | struct adin1110_desc * | desc, |
| uint16_t | addr, | ||
| uint32_t | mask, | ||
| uint32_t | data ) |
Update a register's value based on a mask.
| desc | - the device descriptor |
| addr | - register's address |
| mask | - the bits that may be modified |
| data | - register's value |
| int adin1110_reg_write | ( | struct adin1110_desc * | desc, |
| uint16_t | addr, | ||
| uint32_t | data ) |
Write a register's value.
| desc | - the device descriptor |
| addr | - register's address |
| data | - register's value |
| int adin1110_remove | ( | struct adin1110_desc * | desc | ) |
Free a device descriptor.
| desc | - the device descriptor to be removed. |
| int adin1110_set_mac_addr | ( | struct adin1110_desc * | desc, |
| uint8_t | mac_address[ADIN1110_ETH_ALEN] ) |
Set a MAC address destination filter, frames who's DA doesn't match are dropped.
| desc | - the device descriptor |
| mac_address | - the MAC filter to be set |
| int adin1110_set_promisc | ( | struct adin1110_desc * | desc, |
| uint32_t | port, | ||
| bool | promisc ) |
Set a port in promiscuous mode. All MAC filters are dropped.
| desc | - the device descriptor |
| port | - the port for which the mode will be applied |
| promisc | - either enable or disable the promiscuous mode. |
| int adin1110_sw_reset | ( | struct adin1110_desc * | desc | ) |
Reset both the MAC and PHY.
| desc | - the device descriptor |
| int adin1110_write_fifo | ( | struct adin1110_desc * | desc, |
| uint32_t | port, | ||
| struct adin1110_eth_buff * | eth_buff ) |
Write a frame to the TX FIFO.
| desc | - the device descriptor |
| port | - the port for the frame to be transmitted on. |
| eth_buff | - the frame to be transmitted. |
Align the frame length to 4 bytes
| NO_OS_DECLARE_CRC8_TABLE | ( | _crc_table | ) |