LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
BOARD: PHY status and control driver for the DP83848

Macros

#define DP8_BMCR_REG   0x0
 DP83848 PHY register offsets.
 
#define DP8_BMSR_REG   0x1
 
#define DP8_ANADV_REG   0x4
 
#define DP8_ANLPA_REG   0x5
 
#define DP8_ANEEXP_REG   0x6
 
#define DP8_PHY_STAT_REG   0x10
 
#define DP8_PHY_INT_CTL_REG   0x11
 
#define DP8_PHY_RBR_REG   0x17
 
#define DP8_PHY_STS_REG   0x19
 
#define DP8_RESET   (1 << 15)
 
#define DP8_LOOPBACK   (1 << 14)
 
#define DP8_SPEED_SELECT   (1 << 13)
 
#define DP8_AUTONEG   (1 << 12)
 
#define DP8_POWER_DOWN   (1 << 11)
 
#define DP8_ISOLATE   (1 << 10)
 
#define DP8_RESTART_AUTONEG   (1 << 9)
 
#define DP8_DUPLEX_MODE   (1 << 8)
 
#define DP8_COLLISION_TEST   (1 << 7)
 
#define DP8_100BASE_T4   (1 << 15)
 
#define DP8_100BASE_TX_FD   (1 << 14)
 
#define DP8_100BASE_TX_HD   (1 << 13)
 
#define DP8_10BASE_T_FD   (1 << 12)
 
#define DP8_10BASE_T_HD   (1 << 11)
 
#define DP8_MF_PREAMB_SUPPR   (1 << 6)
 
#define DP8_AUTONEG_COMP   (1 << 5)
 
#define DP8_RMT_FAULT   (1 << 4)
 
#define DP8_AUTONEG_ABILITY   (1 << 3)
 
#define DP8_LINK_STATUS   (1 << 2)
 
#define DP8_JABBER_DETECT   (1 << 1)
 
#define DP8_EXTEND_CAPAB   (1 << 0)
 
#define DP8_RBR_RMII_MODE   (1 << 5)
 
#define DP8_REMOTEFAULT   (1 << 6)
 
#define DP8_FULLDUPLEX   (1 << 2)
 
#define DP8_SPEED10MBPS   (1 << 1)
 
#define DP8_VALID_LINK   (1 << 0)
 
#define DP8_PHYID1_OUI   0x2000
 
#define DP8_PHYID2_OUI   0x5c90
 

Functions

static Status lpc_mii_write (uint8_t reg, uint16_t data)
 
static Status lpc_mii_read (uint8_t reg, uint16_t *data)
 
static void lpc_update_phy_sts (uint16_t linksts)
 
uint32_t lpc_phy_init (bool rmii, p_msDelay_func_t pDelayMsFunc)
 Initialize the PHY.
 
uint32_t lpcPHYStsPoll (void)
 Phy status update state machine.
 

Variables

static uint32_t physts
 
static uint32_t olddphysts
 
static int32_t phyustate
 
static p_msDelay_func_t pDelayMs
 

Detailed Description

Various functions for controlling and monitoring the status of the DP83848 PHY.

Macro Definition Documentation

#define DP8_100BASE_T4   (1 << 15)

T4 mode

Definition at line 65 of file lpc_phy_dp83848.c.

#define DP8_100BASE_TX_FD   (1 << 14)

100MBps full duplex

Definition at line 66 of file lpc_phy_dp83848.c.

#define DP8_100BASE_TX_HD   (1 << 13)

100MBps half duplex

Definition at line 67 of file lpc_phy_dp83848.c.

#define DP8_10BASE_T_FD   (1 << 12)

100Bps full duplex

Definition at line 68 of file lpc_phy_dp83848.c.

#define DP8_10BASE_T_HD   (1 << 11)

10MBps half duplex

Definition at line 69 of file lpc_phy_dp83848.c.

#define DP8_ANADV_REG   0x4

Auto_Neg Advt Reg

Definition at line 45 of file lpc_phy_dp83848.c.

#define DP8_ANEEXP_REG   0x6

Auto-neg Expansion Reg

Definition at line 47 of file lpc_phy_dp83848.c.

#define DP8_ANLPA_REG   0x5

Auto_neg Link Partner Ability Reg

Definition at line 46 of file lpc_phy_dp83848.c.

#define DP8_AUTONEG   (1 << 12)

1=Enable auto-negotiation

Definition at line 57 of file lpc_phy_dp83848.c.

#define DP8_AUTONEG_ABILITY   (1 << 3)

Auto-negotation supported

Definition at line 73 of file lpc_phy_dp83848.c.

#define DP8_AUTONEG_COMP   (1 << 5)

Auto-negotation complete

Definition at line 71 of file lpc_phy_dp83848.c.

#define DP8_BMCR_REG   0x0

DP83848 PHY register offsets.

Basic Mode Control Register

Definition at line 43 of file lpc_phy_dp83848.c.

#define DP8_BMSR_REG   0x1

Basic Mode Status Reg

Definition at line 44 of file lpc_phy_dp83848.c.

#define DP8_COLLISION_TEST   (1 << 7)

1=Perform collsion test

Definition at line 62 of file lpc_phy_dp83848.c.

#define DP8_DUPLEX_MODE   (1 << 8)

1=Full duplex mode

Definition at line 61 of file lpc_phy_dp83848.c.

#define DP8_EXTEND_CAPAB   (1 << 0)

Supports extended capabilities

Definition at line 76 of file lpc_phy_dp83848.c.

#define DP8_FULLDUPLEX   (1 << 2)

1=full duplex

Definition at line 83 of file lpc_phy_dp83848.c.

#define DP8_ISOLATE   (1 << 10)

1=Isolate PHY

Definition at line 59 of file lpc_phy_dp83848.c.

#define DP8_JABBER_DETECT   (1 << 1)

Jabber detect

Definition at line 75 of file lpc_phy_dp83848.c.

#define DP8_LINK_STATUS   (1 << 2)

1=Link active

Definition at line 74 of file lpc_phy_dp83848.c.

#define DP8_LOOPBACK   (1 << 14)

1=loopback Enabled

Definition at line 55 of file lpc_phy_dp83848.c.

#define DP8_MF_PREAMB_SUPPR   (1 << 6)

Preamble suppress

Definition at line 70 of file lpc_phy_dp83848.c.

#define DP8_PHY_INT_CTL_REG   0x11

PHY Interrupt Control Register

Definition at line 49 of file lpc_phy_dp83848.c.

#define DP8_PHY_RBR_REG   0x17

PHY RMII and Bypass Register

Definition at line 50 of file lpc_phy_dp83848.c.

#define DP8_PHY_STAT_REG   0x10

PHY Status Register

Definition at line 48 of file lpc_phy_dp83848.c.

#define DP8_PHY_STS_REG   0x19

PHY Status Register

Definition at line 51 of file lpc_phy_dp83848.c.

#define DP8_PHYID1_OUI   0x2000

Expected PHY ID1

Definition at line 88 of file lpc_phy_dp83848.c.

#define DP8_PHYID2_OUI   0x5c90

Expected PHY ID2

Definition at line 89 of file lpc_phy_dp83848.c.

#define DP8_POWER_DOWN   (1 << 11)

1=Power down PHY

Definition at line 58 of file lpc_phy_dp83848.c.

#define DP8_RBR_RMII_MODE   (1 << 5)

Use RMII mode

Definition at line 79 of file lpc_phy_dp83848.c.

#define DP8_REMOTEFAULT   (1 << 6)

Remote fault

Definition at line 82 of file lpc_phy_dp83848.c.

#define DP8_RESET   (1 << 15)

1= S/W Reset

Definition at line 54 of file lpc_phy_dp83848.c.

#define DP8_RESTART_AUTONEG   (1 << 9)

1=Restart auto-negoatiation

Definition at line 60 of file lpc_phy_dp83848.c.

#define DP8_RMT_FAULT   (1 << 4)

Fault

Definition at line 72 of file lpc_phy_dp83848.c.

#define DP8_SPEED10MBPS   (1 << 1)

1=10MBps speed

Definition at line 84 of file lpc_phy_dp83848.c.

#define DP8_SPEED_SELECT   (1 << 13)

1=Select 100MBps

Definition at line 56 of file lpc_phy_dp83848.c.

#define DP8_VALID_LINK   (1 << 0)

1=Link active

Definition at line 85 of file lpc_phy_dp83848.c.

Function Documentation

static Status lpc_mii_read ( uint8_t  reg,
uint16_t *  data 
)
static

Definition at line 127 of file lpc_phy_dp83848.c.

static Status lpc_mii_write ( uint8_t  reg,
uint16_t  data 
)
static

Definition at line 102 of file lpc_phy_dp83848.c.

uint32_t lpc_phy_init ( bool  rmii,
p_msDelay_func_t  pDelayMsFunc 
)

Initialize the PHY.

Parameters
rmii: Initializes PHY for RMII mode if true, MII if false
pDelayMsFunc: Delay function (in mS) used for this driver
Returns
PHY_LINK_ERROR or 0 on success This function initializes the PHY. It will block until complete. It will not wait for the PHY to detect a connected cable and remain busy. Use lpcPHYStsPoll to detect cable insertion.

Definition at line 187 of file lpc_phy_dp83848.c.

static void lpc_update_phy_sts ( uint16_t  linksts)
static

Definition at line 152 of file lpc_phy_dp83848.c.

uint32_t lpcPHYStsPoll ( void  )

Phy status update state machine.

Returns
An Or'ed value of PHY_LINK_* statuses This function can be called at any rate and will poll the the PHY status. Multiple calls may be needed to determine PHY status.

Definition at line 253 of file lpc_phy_dp83848.c.

Variable Documentation

uint32_t olddphysts
static

Definition at line 92 of file lpc_phy_dp83848.c.

p_msDelay_func_t pDelayMs
static

Definition at line 98 of file lpc_phy_dp83848.c.

uint32_t physts
static

Definition at line 92 of file lpc_phy_dp83848.c.

int32_t phyustate
static

Definition at line 95 of file lpc_phy_dp83848.c.