| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
BOARD: PHY status and control driver for the SMSC 87x0
BOARD: Board specific PHY drivers

## Detailed Description

Various functions for controlling and monitoring the status of the SMSC 87x0 PHY.

## Macros
#define | LAN8_BCR_REG 0x0
#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
static Status | lpc_mii_write (uint8_t reg, uint16_t data)
static Status | lpc_mii_read (uint8_t reg, uint16_t *data)
static void | smsc_update_phy_sts (uint16_t linksts, uint16_t sdsts)
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

## Macro Definition Documentation

#define LAN8_100BASE_T4 (1 << 15)

T4 mode

Definition at line 60 of file lpc_phy_smsc87x0.c.

#define LAN8_100BASE_TX_FD (1 << 14)

100MBps full duplex

Definition at line 61 of file lpc_phy_smsc87x0.c.

#define LAN8_100BASE_TX_HD (1 << 13)

100MBps half duplex

Definition at line 62 of file lpc_phy_smsc87x0.c.

#define LAN8_10BASE_T_FD (1 << 12)

100Bps full duplex

Definition at line 63 of file lpc_phy_smsc87x0.c.

#define LAN8_10BASE_T_HD (1 << 11)

10MBps half duplex

Definition at line 64 of file lpc_phy_smsc87x0.c.

#define LAN8_AUTONEG (1 << 12)

1=Enable auto-negotiation

Definition at line 53 of file lpc_phy_smsc87x0.c.

#define LAN8_AUTONEG_ABILITY (1 << 3)

Auto-negotation supported

Definition at line 67 of file lpc_phy_smsc87x0.c.

#define LAN8_AUTONEG_COMP (1 << 5)

Auto-negotation complete

Definition at line 65 of file lpc_phy_smsc87x0.c.

#define LAN8_BCR_REG 0x0

Basic Control Register

Definition at line 43 of file lpc_phy_smsc87x0.c.

#define LAN8_BSR_REG 0x1

Basic Status Reg

Definition at line 44 of file lpc_phy_smsc87x0.c.

#define LAN8_DUPLEX_MODE (1 << 8)

1=Full duplex mode

Definition at line 57 of file lpc_phy_smsc87x0.c.

#define LAN8_EXTEND_CAPAB (1 << 0)

Supports extended capabilities

Definition at line 70 of file lpc_phy_smsc87x0.c.

#define LAN8_ISOLATE (1 << 10)

1=Isolate PHY

Definition at line 55 of file lpc_phy_smsc87x0.c.

#define LAN8_JABBER_DETECT (1 << 1)

Jabber detect

Definition at line 69 of file lpc_phy_smsc87x0.c.

#define LAN8_LINK_STATUS (1 << 2)

1=Link active

Definition at line 68 of file lpc_phy_smsc87x0.c.

#define LAN8_LOOPBACK (1 << 14)

1=loopback Enabled

Definition at line 51 of file lpc_phy_smsc87x0.c.

#define LAN8_PHYID1_OUI 0x0007

Expected PHY ID1

Definition at line 80 of file lpc_phy_smsc87x0.c.

#define LAN8_PHYID1_REG 0x2

PHY ID 1 Reg

Definition at line 45 of file lpc_phy_smsc87x0.c.

#define LAN8_PHYID2_OUI 0xC0F0

Expected PHY ID2, except last 4 bits

Definition at line 81 of file lpc_phy_smsc87x0.c.

#define LAN8_PHYID2_REG 0x3

PHY ID 2 Reg

Definition at line 46 of file lpc_phy_smsc87x0.c.

#define LAN8_PHYSPLCTL_REG 0x1F

PHY special control/status Reg

Definition at line 47 of file lpc_phy_smsc87x0.c.

#define LAN8_POWER_DOWN (1 << 11)

1=Power down PHY

Definition at line 54 of file lpc_phy_smsc87x0.c.

#define LAN8_RESET (1 << 15)

1= S/W Reset

Definition at line 50 of file lpc_phy_smsc87x0.c.

#define LAN8_RESTART_AUTONEG (1 << 9)

1=Restart auto-negoatiation

Definition at line 56 of file lpc_phy_smsc87x0.c.

#define LAN8_RMT_FAULT (1 << 4)

Fault

Definition at line 66 of file lpc_phy_smsc87x0.c.

#define LAN8_SPEED100F (6 << 2)

100BT full duplex

Definition at line 74 of file lpc_phy_smsc87x0.c.

#define LAN8_SPEED100H (2 << 2)

100BT half duplex

Definition at line 76 of file lpc_phy_smsc87x0.c.

#define LAN8_SPEED10F (5 << 2)

10BT full duplex

Definition at line 75 of file lpc_phy_smsc87x0.c.

#define LAN8_SPEED10H (1 << 2)

10BT half duplex

Definition at line 77 of file lpc_phy_smsc87x0.c.

#define LAN8_SPEED_SELECT (1 << 13)

1=Select 100MBps

Definition at line 52 of file lpc_phy_smsc87x0.c.

#define LAN8_SPEEDMASK (7 << 2)

Speed and duplex mask

Definition at line 73 of file lpc_phy_smsc87x0.c.

## Function Documentation

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

Definition at line 119 of file lpc_phy_smsc87x0.c.

static Status lpc_mii_write | ( | uint8_t | reg,
|  | uint16_t | data
| ) |  |
| static

Definition at line 94 of file lpc_phy_smsc87x0.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

Note
  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 186 of file lpc_phy_smsc87x0.c.

uint32_t lpcPHYStsPoll | ( | void |  | ) |

Phy status update state machine.

Returns
  An Or'ed value of PHY_LINK_* statuses

Note
  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 230 of file lpc_phy_smsc87x0.c.

static void smsc_update_phy_sts | ( | uint16_t | linksts,
|  | uint16_t | sdsts
| ) |  |
| static

Definition at line 144 of file lpc_phy_smsc87x0.c.

## Variable Documentation

uint32_t olddphysts
| static

Definition at line 84 of file lpc_phy_smsc87x0.c.

p_msDelay_func_t pDelayMs
| static

Definition at line 90 of file lpc_phy_smsc87x0.c.

uint32_t physts
| static

Definition at line 84 of file lpc_phy_smsc87x0.c.

int32_t phyustate
| static

Definition at line 87 of file lpc_phy_smsc87x0.c.