LibDriver LAN8720  1.0.0
LAN8720 full-featured driver
lan8720 base driver function

lan8720 base driver modules More...

Enumerations

enum  lan8720_bool_t { LAN8720_BOOL_FALSE = 0x00 , LAN8720_BOOL_TRUE = 0x01 }
 lan8720 bool enumeration definition More...
 
enum  lan8720_speed_t { LAN8720_SPEED_10M = 0x00 , LAN8720_SPEED_100M = 0x01 }
 lan8720 speed enumeration definition More...
 
enum  lan8720_duplex_t { LAN8720_DUPLEX_HALF = 0x00 , LAN8720_DUPLEX_FULL = 0x01 }
 lan8720 duplex enumeration definition More...
 
enum  lan8720_link_t { LAN8720_LINK_DOWN = 0x00 , LAN8720_LINK_UP = 0x01 }
 lan8720 link enumeration definition More...
 

Functions

uint8_t lan8720_info (lan8720_info_t *info)
 get chip's information More...
 
uint8_t lan8720_set_address (lan8720_handle_t *handle, uint8_t addr)
 set the chip address More...
 
uint8_t lan8720_get_address (lan8720_handle_t *handle, uint8_t *addr)
 get the chip address More...
 
uint8_t lan8720_init (lan8720_handle_t *handle)
 initialize the chip More...
 
uint8_t lan8720_deinit (lan8720_handle_t *handle)
 close the chip More...
 
uint8_t lan8720_set_soft_reset (lan8720_handle_t *handle, lan8720_bool_t enable)
 enable or disable soft reset More...
 
uint8_t lan8720_get_soft_reset (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get soft reset status More...
 
uint8_t lan8720_set_loop_back (lan8720_handle_t *handle, lan8720_bool_t enable)
 enable or disable loop back More...
 
uint8_t lan8720_get_loop_back (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get loop back status More...
 
uint8_t lan8720_set_speed_select (lan8720_handle_t *handle, lan8720_speed_t speed)
 set speed select More...
 
uint8_t lan8720_get_speed_select (lan8720_handle_t *handle, lan8720_speed_t *speed)
 get speed select status More...
 
uint8_t lan8720_set_auto_negotiation (lan8720_handle_t *handle, lan8720_bool_t enable)
 enable or disable auto negotiation More...
 
uint8_t lan8720_get_auto_negotiation (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get auto negotiation status More...
 
uint8_t lan8720_set_power_down (lan8720_handle_t *handle, lan8720_bool_t enable)
 enable or disable power down More...
 
uint8_t lan8720_get_power_down (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get power down status More...
 
uint8_t lan8720_set_electrical_isolation (lan8720_handle_t *handle, lan8720_bool_t enable)
 enable or disable electrical isolation More...
 
uint8_t lan8720_get_electrical_isolation (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get electrical isolation status More...
 
uint8_t lan8720_set_restart_auto_negotiate (lan8720_handle_t *handle, lan8720_bool_t enable)
 enable or disable restart auto negotiate More...
 
uint8_t lan8720_get_restart_auto_negotiate (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get restart auto negotiate status More...
 
uint8_t lan8720_set_duplex_mode (lan8720_handle_t *handle, lan8720_duplex_t mode)
 set duplex mode More...
 
uint8_t lan8720_get_duplex_mode (lan8720_handle_t *handle, lan8720_duplex_t *mode)
 get duplex mode More...
 
uint8_t lan8720_get_100base_t4 (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get 100base t4 status More...
 
uint8_t lan8720_get_100base_tx_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get 100base tx full duplex status More...
 
uint8_t lan8720_get_100base_tx_half_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get 100base tx half duplex status More...
 
uint8_t lan8720_get_10base_t_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get 10base t full duplex status More...
 
uint8_t lan8720_get_10base_t_half_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get 10base t half duplex status More...
 
uint8_t lan8720_get_100base_t2_full_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get 100base t2 full duplex status More...
 
uint8_t lan8720_get_100base_t2_half_duplex (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get 100base t2 half duplex status More...
 
uint8_t lan8720_get_extended_status_information (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get extended status information status More...
 
uint8_t lan8720_get_auto_negotiate_complete (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get auto negotiate complete status More...
 
uint8_t lan8720_get_remote_fault (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get remote fault status More...
 
uint8_t lan8720_get_auto_negotiate_ability (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get auto negotiate ability status More...
 
uint8_t lan8720_get_link_status (lan8720_handle_t *handle, lan8720_link_t *status)
 get link status More...
 
uint8_t lan8720_get_jabber_detect (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get jabber detect status More...
 
uint8_t lan8720_get_extended_capabilities (lan8720_handle_t *handle, lan8720_bool_t *enable)
 get extended capabilities status More...
 

Detailed Description

lan8720 base driver modules

Enumeration Type Documentation

◆ lan8720_bool_t

lan8720 bool enumeration definition

Enumerator
LAN8720_BOOL_FALSE 

disable

LAN8720_BOOL_TRUE 

enable

Definition at line 62 of file driver_lan8720.h.

◆ lan8720_duplex_t

lan8720 duplex enumeration definition

Enumerator
LAN8720_DUPLEX_HALF 

half duplex

LAN8720_DUPLEX_FULL 

full duplex

Definition at line 80 of file driver_lan8720.h.

◆ lan8720_link_t

lan8720 link enumeration definition

Enumerator
LAN8720_LINK_DOWN 

link is down

LAN8720_LINK_UP 

link is up

Definition at line 89 of file driver_lan8720.h.

◆ lan8720_speed_t

lan8720 speed enumeration definition

Enumerator
LAN8720_SPEED_10M 

10mbps

LAN8720_SPEED_100M 

100mbps

Definition at line 71 of file driver_lan8720.h.

Function Documentation

◆ lan8720_deinit()

uint8_t lan8720_deinit ( lan8720_handle_t handle)

close the chip

Parameters
[in]*handlepointer to an lan8720 handle structure
Returns
status code
  • 0 success
  • 1 smi deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 311 of file driver_lan8720.c.

◆ lan8720_get_100base_t2_full_duplex()

uint8_t lan8720_get_100base_t2_full_duplex ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get 100base t2 full duplex status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get 100base t2 full duplex failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1210 of file driver_lan8720.c.

◆ lan8720_get_100base_t2_half_duplex()

uint8_t lan8720_get_100base_t2_half_duplex ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get 100base t2 half duplex status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get 100base t2 half duplex failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1247 of file driver_lan8720.c.

◆ lan8720_get_100base_t4()

uint8_t lan8720_get_100base_t4 ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get 100base t4 status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get 100base t4 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1025 of file driver_lan8720.c.

◆ lan8720_get_100base_tx_full_duplex()

uint8_t lan8720_get_100base_tx_full_duplex ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get 100base tx full duplex status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get 100base tx full duplex failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1062 of file driver_lan8720.c.

◆ lan8720_get_100base_tx_half_duplex()

uint8_t lan8720_get_100base_tx_half_duplex ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get 100base tx half duplex status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get 100base tx half duplex failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1099 of file driver_lan8720.c.

◆ lan8720_get_10base_t_full_duplex()

uint8_t lan8720_get_10base_t_full_duplex ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get 10base t full duplex status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get 10base t full duplex failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1136 of file driver_lan8720.c.

◆ lan8720_get_10base_t_half_duplex()

uint8_t lan8720_get_10base_t_half_duplex ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get 10base t half duplex status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get 10base t half duplex failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1173 of file driver_lan8720.c.

◆ lan8720_get_address()

uint8_t lan8720_get_address ( lan8720_handle_t handle,
uint8_t *  addr 
)

get the chip address

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*addrpointer to a chip address
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 146 of file driver_lan8720.c.

◆ lan8720_get_auto_negotiate_ability()

uint8_t lan8720_get_auto_negotiate_ability ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get auto negotiate ability status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get auto negotiate ability failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1395 of file driver_lan8720.c.

◆ lan8720_get_auto_negotiate_complete()

uint8_t lan8720_get_auto_negotiate_complete ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get auto negotiate complete status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get auto negotiate complete failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1321 of file driver_lan8720.c.

◆ lan8720_get_auto_negotiation()

uint8_t lan8720_get_auto_negotiation ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get auto negotiation status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get auto negotiation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 660 of file driver_lan8720.c.

◆ lan8720_get_duplex_mode()

uint8_t lan8720_get_duplex_mode ( lan8720_handle_t handle,
lan8720_duplex_t mode 
)

get duplex mode

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*modepointer to a mode buffer
Returns
status code
  • 0 success
  • 1 get duplex mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 988 of file driver_lan8720.c.

◆ lan8720_get_electrical_isolation()

uint8_t lan8720_get_electrical_isolation ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get electrical isolation status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get electrical isolation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 824 of file driver_lan8720.c.

◆ lan8720_get_extended_capabilities()

uint8_t lan8720_get_extended_capabilities ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get extended capabilities status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get extended capabilities failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1506 of file driver_lan8720.c.

◆ lan8720_get_extended_status_information()

uint8_t lan8720_get_extended_status_information ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get extended status information status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get extended status information failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1284 of file driver_lan8720.c.

◆ lan8720_get_jabber_detect()

uint8_t lan8720_get_jabber_detect ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get jabber detect status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get jabber detect failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1469 of file driver_lan8720.c.

◆ lan8720_get_link_status()

uint8_t lan8720_get_link_status ( lan8720_handle_t handle,
lan8720_link_t status 
)

get link status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*statuspointer to a status buffer
Returns
status code
  • 0 success
  • 1 get link status failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1432 of file driver_lan8720.c.

◆ lan8720_get_loop_back()

uint8_t lan8720_get_loop_back ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get loop back status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get loop back failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 496 of file driver_lan8720.c.

◆ lan8720_get_power_down()

uint8_t lan8720_get_power_down ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get power down status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get power down failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 742 of file driver_lan8720.c.

◆ lan8720_get_remote_fault()

uint8_t lan8720_get_remote_fault ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get remote fault status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get remote fault failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1358 of file driver_lan8720.c.

◆ lan8720_get_restart_auto_negotiate()

uint8_t lan8720_get_restart_auto_negotiate ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get restart auto negotiate status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get restart auto negotiate failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 906 of file driver_lan8720.c.

◆ lan8720_get_soft_reset()

uint8_t lan8720_get_soft_reset ( lan8720_handle_t handle,
lan8720_bool_t enable 
)

get soft reset status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get soft reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 414 of file driver_lan8720.c.

◆ lan8720_get_speed_select()

uint8_t lan8720_get_speed_select ( lan8720_handle_t handle,
lan8720_speed_t speed 
)

get speed select status

Parameters
[in]*handlepointer to an lan8720 handle structure
[out]*speedpointer to a speed buffer
Returns
status code
  • 0 success
  • 1 get speed select failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 578 of file driver_lan8720.c.

◆ lan8720_info()

uint8_t lan8720_info ( lan8720_info_t info)

get chip's information

Parameters
[out]*infopointer to an lan8720 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 3833 of file driver_lan8720.c.

◆ lan8720_init()

uint8_t lan8720_init ( lan8720_handle_t handle)

initialize the chip

Parameters
[in]*handlepointer to an lan8720 handle structure
Returns
status code
  • 0 success
  • 1 smi initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 reset failed
Note
none

Definition at line 169 of file driver_lan8720.c.

◆ lan8720_set_address()

uint8_t lan8720_set_address ( lan8720_handle_t handle,
uint8_t  addr 
)

set the chip address

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]addrchip address
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 4 addr > 0x1F
Note
none

Definition at line 119 of file driver_lan8720.c.

◆ lan8720_set_auto_negotiation()

uint8_t lan8720_set_auto_negotiation ( lan8720_handle_t handle,
lan8720_bool_t  enable 
)

enable or disable auto negotiation

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set auto negotiation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 615 of file driver_lan8720.c.

◆ lan8720_set_duplex_mode()

uint8_t lan8720_set_duplex_mode ( lan8720_handle_t handle,
lan8720_duplex_t  mode 
)

set duplex mode

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]modeset mode
Returns
status code
  • 0 success
  • 1 set duplex mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 943 of file driver_lan8720.c.

◆ lan8720_set_electrical_isolation()

uint8_t lan8720_set_electrical_isolation ( lan8720_handle_t handle,
lan8720_bool_t  enable 
)

enable or disable electrical isolation

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set electrical isolation failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 779 of file driver_lan8720.c.

◆ lan8720_set_loop_back()

uint8_t lan8720_set_loop_back ( lan8720_handle_t handle,
lan8720_bool_t  enable 
)

enable or disable loop back

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set loop back failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 451 of file driver_lan8720.c.

◆ lan8720_set_power_down()

uint8_t lan8720_set_power_down ( lan8720_handle_t handle,
lan8720_bool_t  enable 
)

enable or disable power down

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set power down failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 697 of file driver_lan8720.c.

◆ lan8720_set_restart_auto_negotiate()

uint8_t lan8720_set_restart_auto_negotiate ( lan8720_handle_t handle,
lan8720_bool_t  enable 
)

enable or disable restart auto negotiate

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set restart auto negotiate failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 861 of file driver_lan8720.c.

◆ lan8720_set_soft_reset()

uint8_t lan8720_set_soft_reset ( lan8720_handle_t handle,
lan8720_bool_t  enable 
)

enable or disable soft reset

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set soft reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 369 of file driver_lan8720.c.

◆ lan8720_set_speed_select()

uint8_t lan8720_set_speed_select ( lan8720_handle_t handle,
lan8720_speed_t  speed 
)

set speed select

Parameters
[in]*handlepointer to an lan8720 handle structure
[in]speedset speed
Returns
status code
  • 0 success
  • 1 set speed select failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 533 of file driver_lan8720.c.