NXP LPC LWIP port documentation  v1.10
LWIP port for LPC devices
PHY status and control for the LAN8720.

Defines

#define LAN8_BCR_REG   0x0
 LAN8720 PHY register offsets.
#define LAN8_BSR_REG   0x1
#define LAN8_PHYID1_REG   0x2
#define LAN8_PHYID2_REG   0x3
#define LAN8_PHYSPLCTL_REG   0x1F
#define LAN8_RESET   (1 << 15)
#define LAN8_LOOPBACK   (1 << 14)
#define LAN8_SPEED_SELECT   (1 << 13)
#define LAN8_AUTONEG   (1 << 12)
#define LAN8_POWER_DOWN   (1 << 11)
#define LAN8_ISOLATE   (1 << 10)
#define LAN8_RESTART_AUTONEG   (1 << 9)
#define LAN8_DUPLEX_MODE   (1 << 8)
#define LAN8_100BASE_T4   (1 << 15)
#define LAN8_100BASE_TX_FD   (1 << 14)
#define LAN8_100BASE_TX_HD   (1 << 13)
#define LAN8_10BASE_T_FD   (1 << 12)
#define LAN8_10BASE_T_HD   (1 << 11)
#define LAN8_AUTONEG_COMP   (1 << 5)
#define LAN8_RMT_FAULT   (1 << 4)
#define LAN8_AUTONEG_ABILITY   (1 << 3)
#define LAN8_LINK_STATUS   (1 << 2)
#define LAN8_JABBER_DETECT   (1 << 1)
#define LAN8_EXTEND_CAPAB   (1 << 0)
#define LAN8_SPEEDMASK   (7 << 2)
#define LAN8_SPEED100F   (6 << 2)
#define LAN8_SPEED10F   (5 << 2)
#define LAN8_SPEED100H   (2 << 2)
#define LAN8_SPEED10H   (1 << 2)
#define LAN8_PHYID1_OUI   0x0007
#define LAN8_PHYID2_OUI   0xC0F0

Functions

err_t lpc_phy_init (struct netif *netif)
 Initialize the LAN8720 PHY.
s32_t lpc_phy_sts_sm (struct netif *netif)
 Phy status update state machine.

Detailed Description

Various functions for controlling and monitoring the status of the LAN8720 PHY. In polled (standalone) systems, the PHY state must be monitored as part of the application. In a threaded (RTOS) system, the PHY state is monitored by the PHY handler thread. The MAC driver will not transmit unless the PHY link is active.


Define Documentation

#define LAN8_100BASE_T4   (1 << 15)

T4 mode

#define LAN8_100BASE_TX_FD   (1 << 14)

100MBps full duplex

#define LAN8_100BASE_TX_HD   (1 << 13)

100MBps half duplex

#define LAN8_10BASE_T_FD   (1 << 12)

100Bps full duplex

#define LAN8_10BASE_T_HD   (1 << 11)

10MBps half duplex

#define LAN8_AUTONEG   (1 << 12)

1=Enable auto-negotiation

#define LAN8_AUTONEG_ABILITY   (1 << 3)

Auto-negotation supported

#define LAN8_AUTONEG_COMP   (1 << 5)

Auto-negotation complete

#define LAN8_BCR_REG   0x0

LAN8720 PHY register offsets.

Basic Control Register

#define LAN8_BSR_REG   0x1

Basic Status Reg

#define LAN8_DUPLEX_MODE   (1 << 8)

1=Full duplex mode

#define LAN8_EXTEND_CAPAB   (1 << 0)

Supports extended capabilities

#define LAN8_ISOLATE   (1 << 10)

1=Isolate PHY

#define LAN8_JABBER_DETECT   (1 << 1)

Jabber detect

#define LAN8_LINK_STATUS   (1 << 2)

1=Link active

#define LAN8_LOOPBACK   (1 << 14)

1=loopback Enabled

#define LAN8_PHYID1_OUI   0x0007

Expected PHY ID1

#define LAN8_PHYID1_REG   0x2

PHY ID 1 Reg

#define LAN8_PHYID2_OUI   0xC0F0

Expected PHY ID2, except last 4 bits

#define LAN8_PHYID2_REG   0x3

PHY ID 2 Reg

#define LAN8_PHYSPLCTL_REG   0x1F

PHY special control/status Reg

#define LAN8_POWER_DOWN   (1 << 11)

1=Power down PHY

#define LAN8_RESET   (1 << 15)

1= S/W Reset

#define LAN8_RESTART_AUTONEG   (1 << 9)

1=Restart auto-negoatiation

#define LAN8_RMT_FAULT   (1 << 4)

Fault

#define LAN8_SPEED100F   (6 << 2)

100BT full duplex

#define LAN8_SPEED100H   (2 << 2)

100BT half duplex

#define LAN8_SPEED10F   (5 << 2)

10BT full duplex

#define LAN8_SPEED10H   (1 << 2)

10BT half duplex

#define LAN8_SPEED_SELECT   (1 << 13)

1=Select 100MBps

#define LAN8_SPEEDMASK   (7 << 2)

Speed and duplex mask


Function Documentation

err_t lpc_phy_init ( struct netif *  netif)

Initialize the LAN8720 PHY.

Initialize the PHY.

This function initializes the LAN8720 PHY. It will block until complete. This function is called as part of the EMAC driver initialization. Configuration of the PHY at startup is controlled by setting up configuration defines in lpc_emac_config.h.

Parameters:
[in]netifNETIF structure
Returns:
ERR_OK if the setup was successful, otherwise ERR_TIMEOUT
s32_t lpc_phy_sts_sm ( struct netif *  netif)

Phy status update state machine.

This function provides a state machine for maintaining the PHY status without blocking. It must be occasionally called for the PHY status to be maintained.

Parameters:
[in]netifNETIF structure