![]() |
LibDriver LAN8720
|
driver lan8720 source file More...
#include "driver_lan8720.h"Go to the source code of this file.
Macros | |
| #define | CHIP_NAME "Microchip LAN8720" |
| chip information definition | |
| #define | MANUFACTURER_NAME "Microchip" |
| #define | SUPPLY_VOLTAGE_MIN 3.0f |
| #define | SUPPLY_VOLTAGE_MAX 3.6f |
| #define | MAX_CURRENT 60.0f |
| #define | TEMPERATURE_MIN -40.0f |
| #define | TEMPERATURE_MAX 85.0f |
| #define | DRIVER_VERSION 1000 |
| #define | LAN8720_REG_BASIC_CONTROL 0x00 |
| chip register definition | |
| #define | LAN8720_REG_BASIC_STATUS 0x01 |
| #define | LAN8720_REG_PHY_IDENTIFIER_1 0x02 |
| #define | LAN8720_REG_PHY_IDENTIFIER_2 0x03 |
| #define | LAN8720_REG_AUTO_NEGOTIATION_ADVERTISEMENT 0x04 |
| #define | LAN8720_REG_AUTO_NEGOTIATION_LINK_PARTNER_ABILITY 0x05 |
| #define | LAN8720_REG_AUTO_NEGOTIATION_EXPANSION 0x06 |
| #define | LAN8720_REG_MODE_CONTROL_STATUS 0x11 |
| #define | LAN8720_REG_SPECIAL_MODES 0x12 |
| #define | LAN8720_REG_SYMBOL_ERROR_COUNTER_REGISTER 0x1A |
| #define | LAN8720_REG_SPECIAL_CONTROL_STATUS_INDICATIONS 0x1B |
| #define | LAN8720_REG_INTERRUPT_SOURCE_FLAG 0x1D |
| #define | LAN8720_REG_INTERRUPT_MASK 0x1E |
| #define | LAN8720_REG_PHY_SPECIAL_CONTROL_STATUS 0x1F |
Functions | |
| uint8_t | lan8720_set_address (lan8720_handle_t *handle, uint8_t addr) |
| set the chip address | |
| uint8_t | lan8720_get_address (lan8720_handle_t *handle, uint8_t *addr) |
| get the chip address | |
| uint8_t | lan8720_init (lan8720_handle_t *handle) |
| initialize the chip | |
| uint8_t | lan8720_deinit (lan8720_handle_t *handle) |
| close the chip | |
| uint8_t | lan8720_set_soft_reset (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable soft reset | |
| uint8_t | lan8720_get_soft_reset (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get soft reset status | |
| uint8_t | lan8720_set_loop_back (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable loop back | |
| uint8_t | lan8720_get_loop_back (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get loop back status | |
| uint8_t | lan8720_set_speed_select (lan8720_handle_t *handle, lan8720_speed_t speed) |
| set speed select | |
| uint8_t | lan8720_get_speed_select (lan8720_handle_t *handle, lan8720_speed_t *speed) |
| get speed select status | |
| uint8_t | lan8720_set_auto_negotiation (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable auto negotiation | |
| uint8_t | lan8720_get_auto_negotiation (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation status | |
| uint8_t | lan8720_set_power_down (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable power down | |
| uint8_t | lan8720_get_power_down (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get power down status | |
| uint8_t | lan8720_set_electrical_isolation (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable electrical isolation | |
| uint8_t | lan8720_get_electrical_isolation (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get electrical isolation status | |
| uint8_t | lan8720_set_restart_auto_negotiate (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable restart auto negotiate | |
| uint8_t | lan8720_get_restart_auto_negotiate (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get restart auto negotiate status | |
| uint8_t | lan8720_set_duplex_mode (lan8720_handle_t *handle, lan8720_duplex_t mode) |
| set duplex mode | |
| uint8_t | lan8720_get_duplex_mode (lan8720_handle_t *handle, lan8720_duplex_t *mode) |
| get duplex mode | |
| uint8_t | lan8720_get_100base_t4 (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get 100base t4 status | |
| uint8_t | lan8720_get_100base_tx_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get 100base tx full duplex status | |
| uint8_t | lan8720_get_100base_tx_half_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get 100base tx half duplex status | |
| uint8_t | lan8720_get_10base_t_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get 10base t full duplex status | |
| uint8_t | lan8720_get_10base_t_half_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get 10base t half duplex status | |
| uint8_t | lan8720_get_100base_t2_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get 100base t2 full duplex status | |
| uint8_t | lan8720_get_100base_t2_half_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get 100base t2 half duplex status | |
| uint8_t | lan8720_get_extended_status_information (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get extended status information status | |
| uint8_t | lan8720_get_auto_negotiate_complete (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiate complete status | |
| uint8_t | lan8720_get_remote_fault (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get remote fault status | |
| uint8_t | lan8720_get_auto_negotiate_ability (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiate ability status | |
| uint8_t | lan8720_get_link_status (lan8720_handle_t *handle, lan8720_link_t *status) |
| get link status | |
| uint8_t | lan8720_get_jabber_detect (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get jabber detect status | |
| uint8_t | lan8720_get_extended_capabilities (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get extended capabilities status | |
| uint8_t | lan8720_set_identifier (lan8720_handle_t *handle, uint32_t phy_id, uint8_t model_number, uint8_t revision_number) |
| set identifier | |
| uint8_t | lan8720_get_identifier (lan8720_handle_t *handle, uint32_t *phy_id, uint8_t *model_number, uint8_t *revision_number) |
| get identifier | |
| uint8_t | lan8720_set_auto_negotiation_advertisement_remote_fault (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable auto negotiation advertisement remote fault | |
| uint8_t | lan8720_get_auto_negotiation_advertisement_remote_fault (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation advertisement remote fault status | |
| uint8_t | lan8720_set_auto_negotiation_advertisement_pause (lan8720_handle_t *handle, lan8720_pause_t pause) |
| set auto negotiation advertisement pause | |
| uint8_t | lan8720_get_auto_negotiation_advertisement_pause (lan8720_handle_t *handle, lan8720_pause_t *pause) |
| get auto negotiation advertisement pause | |
| uint8_t | lan8720_set_auto_negotiation_advertisement_100base_tx_full_duplex (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable auto negotiation advertisement 100base tx full duplex | |
| uint8_t | lan8720_get_auto_negotiation_advertisement_100base_tx_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation advertisement 100base tx full duplex status | |
| uint8_t | lan8720_set_auto_negotiation_advertisement_100base_tx (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable auto negotiation advertisement 100base tx | |
| uint8_t | lan8720_get_auto_negotiation_advertisement_100base_tx (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation advertisement 100base tx status | |
| uint8_t | lan8720_set_auto_negotiation_advertisement_10base_t_full_duplex (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable auto negotiation advertisement 10base t full duplex | |
| uint8_t | lan8720_get_auto_negotiation_advertisement_10base_t_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation advertisement 10base t full duplex status | |
| uint8_t | lan8720_set_auto_negotiation_advertisement_10base_t (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable auto negotiation advertisement 10base t | |
| uint8_t | lan8720_get_auto_negotiation_advertisement_10base_t (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation advertisement 10base t status | |
| uint8_t | lan8720_set_auto_negotiation_advertisement_selector_field (lan8720_handle_t *handle, uint8_t selector) |
| set auto negotiation advertisement selector field | |
| uint8_t | lan8720_get_auto_negotiation_advertisement_selector_field (lan8720_handle_t *handle, uint8_t *selector) |
| get auto negotiation advertisement selector field | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_next_page (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability next page status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_acknowledge (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability acknowledge status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_remote_fault (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability remote fault status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_pause (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability pause status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_100base_t4 (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability 100base t4 status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_100base_tx_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability 100base tx full duplex status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_100base_tx (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability 100base tx status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_10base_t_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability 10base t full duplex status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_10base_t (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation link partner ability 10base t status | |
| uint8_t | lan8720_get_auto_negotiation_link_partner_ability_selector_field (lan8720_handle_t *handle, uint8_t *selector) |
| get auto negotiation link partner ability selector field | |
| uint8_t | lan8720_get_auto_negotiation_expansion_parallel_detection_fault (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation expansion parallel detection fault status | |
| uint8_t | lan8720_get_auto_negotiation_expansion_link_partner_next_page_able (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation expansion link partner next page able status | |
| uint8_t | lan8720_get_auto_negotiation_expansion_next_page_able (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation expansion next page able status | |
| uint8_t | lan8720_get_auto_negotiation_expansion_page_received (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation expansion page received status | |
| uint8_t | lan8720_get_auto_negotiation_expansion_link_partner_auto_negotiation_able (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation expansion link partner auto negotiation able status | |
| uint8_t | lan8720_set_energy_detect_power_down_mode (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable energy detect power down mode | |
| uint8_t | lan8720_get_energy_detect_power_down_mode (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get energy detect power down mode status | |
| uint8_t | lan8720_set_far_loop_back (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable far loop back | |
| uint8_t | lan8720_get_far_loop_back (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get far loop back status | |
| uint8_t | lan8720_set_alternate_interrupt_mode (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable alternate interrupt mode | |
| uint8_t | lan8720_get_alternate_interrupt_mode (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get alternate interrupt mode status | |
| uint8_t | lan8720_get_energy_detected (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get energy detected status | |
| uint8_t | lan8720_set_mode (lan8720_handle_t *handle, lan8720_mode_t mode) |
| set mode | |
| uint8_t | lan8720_get_mode (lan8720_handle_t *handle, lan8720_mode_t *mode) |
| get mode | |
| uint8_t | lan8720_set_phy_address (lan8720_handle_t *handle, uint8_t addr) |
| set phy address | |
| uint8_t | lan8720_get_phy_address (lan8720_handle_t *handle, uint8_t *addr) |
| get phy address | |
| uint8_t | lan8720_get_symbol_error_counter (lan8720_handle_t *handle, uint16_t *cnt) |
| get symbol error counter | |
| uint8_t | lan8720_set_auto_mdix (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable auto mdix | |
| uint8_t | lan8720_get_auto_mdix (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto mdix status | |
| uint8_t | lan8720_set_manual_channel_select (lan8720_handle_t *handle, lan8720_manual_channel_select_t select) |
| set manual channel select | |
| uint8_t | lan8720_get_manual_channel_select (lan8720_handle_t *handle, lan8720_manual_channel_select_t *select) |
| get manual channel select | |
| uint8_t | lan8720_set_sqe_test_off (lan8720_handle_t *handle, lan8720_bool_t enable) |
| enable or disable sqe test off | |
| uint8_t | lan8720_get_sqe_test_off (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get sqe test off status | |
| uint8_t | lan8720_get_polarity (lan8720_handle_t *handle, lan8720_polarity_t *polarity) |
| get polarity | |
| uint8_t | lan8720_get_interrupt_flag (lan8720_handle_t *handle, lan8720_interrupt_t interrupt, lan8720_bool_t *enable) |
| get interrupt flag status | |
| uint8_t | lan8720_set_interrupt_mask (lan8720_handle_t *handle, lan8720_interrupt_t interrupt, lan8720_bool_t enable) |
| set interrupt mask | |
| uint8_t | lan8720_get_interrupt_mask (lan8720_handle_t *handle, lan8720_interrupt_t interrupt, lan8720_bool_t *enable) |
| get interrupt mask status | |
| uint8_t | lan8720_get_auto_negotiation_done (lan8720_handle_t *handle, lan8720_bool_t *enable) |
| get auto negotiation done status | |
| uint8_t | lan8720_get_speed_indication (lan8720_handle_t *handle, lan8720_speed_indication_t *speed) |
| get speed indication | |
| uint8_t | lan8720_set_reg (lan8720_handle_t *handle, uint8_t reg, uint16_t value) |
| set the chip register | |
| uint8_t | lan8720_get_reg (lan8720_handle_t *handle, uint8_t reg, uint16_t *value) |
| get the chip register | |
| uint8_t | lan8720_info (lan8720_info_t *info) |
| get chip's information | |
driver lan8720 source file
Copyright (c) 2015 - present LibDriver All rights reserved
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Date | Version | Author | Description |
|---|---|---|---|
| 2023/08/15 | 1.0 | Shifeng Li | first upload |
Definition in file driver_lan8720.c.
| #define CHIP_NAME "Microchip LAN8720" |
| #define DRIVER_VERSION 1000 |
driver version
Definition at line 49 of file driver_lan8720.c.
| #define LAN8720_REG_AUTO_NEGOTIATION_ADVERTISEMENT 0x04 |
auto-negotiation advertisement register
Definition at line 58 of file driver_lan8720.c.
| #define LAN8720_REG_AUTO_NEGOTIATION_EXPANSION 0x06 |
auto-negotiation expansion register
Definition at line 60 of file driver_lan8720.c.
| #define LAN8720_REG_AUTO_NEGOTIATION_LINK_PARTNER_ABILITY 0x05 |
auto-negotiation link partner ability register
Definition at line 59 of file driver_lan8720.c.
| #define LAN8720_REG_BASIC_CONTROL 0x00 |
| #define LAN8720_REG_BASIC_STATUS 0x01 |
basic status register
Definition at line 55 of file driver_lan8720.c.
| #define LAN8720_REG_INTERRUPT_MASK 0x1E |
interrupt mask register
Definition at line 66 of file driver_lan8720.c.
| #define LAN8720_REG_INTERRUPT_SOURCE_FLAG 0x1D |
interrupt source register
Definition at line 65 of file driver_lan8720.c.
| #define LAN8720_REG_MODE_CONTROL_STATUS 0x11 |
mode control/status register
Definition at line 61 of file driver_lan8720.c.
| #define LAN8720_REG_PHY_IDENTIFIER_1 0x02 |
phy identifier 1 register
Definition at line 56 of file driver_lan8720.c.
| #define LAN8720_REG_PHY_IDENTIFIER_2 0x03 |
phy identifier 2 register
Definition at line 57 of file driver_lan8720.c.
| #define LAN8720_REG_PHY_SPECIAL_CONTROL_STATUS 0x1F |
phy special control/status register
Definition at line 67 of file driver_lan8720.c.
| #define LAN8720_REG_SPECIAL_CONTROL_STATUS_INDICATIONS 0x1B |
control/status indication register
Definition at line 64 of file driver_lan8720.c.
| #define LAN8720_REG_SPECIAL_MODES 0x12 |
special modes register
Definition at line 62 of file driver_lan8720.c.
| #define LAN8720_REG_SYMBOL_ERROR_COUNTER_REGISTER 0x1A |
symbol error counter register
Definition at line 63 of file driver_lan8720.c.
| #define MANUFACTURER_NAME "Microchip" |
manufacturer name
Definition at line 43 of file driver_lan8720.c.
| #define MAX_CURRENT 60.0f |
chip max current
Definition at line 46 of file driver_lan8720.c.
| #define SUPPLY_VOLTAGE_MAX 3.6f |
chip max supply voltage
Definition at line 45 of file driver_lan8720.c.
| #define SUPPLY_VOLTAGE_MIN 3.0f |
chip min supply voltage
Definition at line 44 of file driver_lan8720.c.
| #define TEMPERATURE_MAX 85.0f |
chip max operating temperature
Definition at line 48 of file driver_lan8720.c.
| #define TEMPERATURE_MIN -40.0f |
chip min operating temperature
Definition at line 47 of file driver_lan8720.c.