HPM SDK
HPMicro Software Development Kit
hpm_dp83867.h File Reference

DP83867 Ethernet PHY driver header file. More...

#include "hpm_enet_phy.h"
#include "hpm_common.h"
#include "hpm_enet_regs.h"

Go to the source code of this file.

Data Structures

struct  dp83867_config_t
 DP83867 PHY configuration structure. More...
 

Macros

#define DP83867_ADDR   (0U)
 Default PHY address for DP83867. More...
 
#define DP83867_ID1   (0x2000U)
 DP83867 PHY ID register 1 value (OUI MSB) More...
 
#define DP83867_ID2   (0x28U)
 DP83867 PHY ID register 2 value (OUI LSB) More...
 

Enumerations

enum  dp83867_rgmii_rx_delay_t {
  DP83867_RX_DELAY_0P25_NS = 0 , DP83867_RX_DELAY_0P50_NS , DP83867_RX_DELAY_0P75_NS , DP83867_RX_DELAY_1P00_NS ,
  DP83867_RX_DELAY_1P25_NS , DP83867_RX_DELAY_1P50_NS , DP83867_RX_DELAY_1P75_NS , DP83867_RX_DELAY_2P00_NS ,
  DP83867_RX_DELAY_2P25_NS , DP83867_RX_DELAY_2P50_NS , DP83867_RX_DELAY_2P75_NS , DP83867_RX_DELAY_3P00_NS ,
  DP83867_RX_DELAY_3P25_NS , DP83867_RX_DELAY_3P50_NS , DP83867_RX_DELAY_3P75_NS , DP83867_RX_DELAY_4P00_NS
}
 DP83867 RGMII RX delay configuration. More...
 

Functions

bool dp83867_reset (ENET_Type *ptr, uint32_t phy_addr)
 Reset DP83867 PHY chip. More...
 
void dp83867_basic_mode_default_config (ENET_Type *ptr, dp83867_config_t *config)
 Set default configuration for DP83867 PHY basic mode. More...
 
bool dp83867_basic_mode_init (ENET_Type *ptr, uint32_t phy_addr, dp83867_config_t *config)
 Initialize DP83867 PHY chip in basic mode. More...
 
void dp83867_get_phy_status (ENET_Type *ptr, uint32_t phy_addr, enet_phy_status_t *status)
 Get DP83867 PHY status. More...
 
void dp83867_set_mdi_crossover_mode (ENET_Type *ptr, uint32_t phy_addr, enet_phy_crossover_mode_t mode)
 Set MDI crossover mode for DP83867 PHY. More...
 

Detailed Description

DP83867 Ethernet PHY driver header file.

This file provides the API definitions for the DP83867 Ethernet PHY chip driver. The DP83867 is a single-port 10/100/1000-Mbps Ethernet physical layer transceiver.

Macro Definition Documentation

◆ DP83867_ADDR

#define DP83867_ADDR   (0U)

Default PHY address for DP83867.

◆ DP83867_ID1

#define DP83867_ID1   (0x2000U)

DP83867 PHY ID register 1 value (OUI MSB)

◆ DP83867_ID2

#define DP83867_ID2   (0x28U)

DP83867 PHY ID register 2 value (OUI LSB)

Enumeration Type Documentation

◆ dp83867_rgmii_rx_delay_t

DP83867 RGMII RX delay configuration.

This enumeration defines the available RX delay values for RGMII interface timing adjustment.

Enumerator
DP83867_RX_DELAY_0P25_NS 

RX delay: 0.25 ns

DP83867_RX_DELAY_0P50_NS 

RX delay: 0.50 ns

DP83867_RX_DELAY_0P75_NS 

RX delay: 0.75 ns

DP83867_RX_DELAY_1P00_NS 

RX delay: 1.00 ns

DP83867_RX_DELAY_1P25_NS 

RX delay: 1.25 ns

DP83867_RX_DELAY_1P50_NS 

RX delay: 1.50 ns

DP83867_RX_DELAY_1P75_NS 

RX delay: 1.75 ns

DP83867_RX_DELAY_2P00_NS 

RX delay: 2.00 ns

DP83867_RX_DELAY_2P25_NS 

RX delay: 2.25 ns

DP83867_RX_DELAY_2P50_NS 

RX delay: 2.50 ns

DP83867_RX_DELAY_2P75_NS 

RX delay: 2.75 ns

DP83867_RX_DELAY_3P00_NS 

RX delay: 3.00 ns

DP83867_RX_DELAY_3P25_NS 

RX delay: 3.25 ns

DP83867_RX_DELAY_3P50_NS 

RX delay: 3.50 ns

DP83867_RX_DELAY_3P75_NS 

RX delay: 3.75 ns

DP83867_RX_DELAY_4P00_NS 

RX delay: 4.00 ns

Function Documentation

◆ dp83867_basic_mode_default_config()

void dp83867_basic_mode_default_config ( ENET_Type ptr,
dp83867_config_t config 
)

Set default configuration for DP83867 PHY basic mode.

Parameters
[in]ptrPointer to the ENET peripheral base address
[out]configPointer to the configuration structure to be initialized

This function initializes the configuration structure with default values:

  • Loopback: disabled
  • Auto-negotiation: enabled (unless __DISABLE_AUTO_NEGO is defined)
  • Speed: 1000 Mbps (when auto-negotiation is disabled)
  • Duplex: full duplex (when auto-negotiation is disabled)

◆ dp83867_basic_mode_init()

bool dp83867_basic_mode_init ( ENET_Type ptr,
uint32_t  phy_addr,
dp83867_config_t config 
)

Initialize DP83867 PHY chip in basic mode.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address
[in]configPointer to the PHY configuration structure
Return values
trueInitialization completed successfully
falseInitialization failed (PHY ID check failed)

This function performs the following operations:

  • Verifies the PHY ID to ensure it's a DP83867 chip
  • Configures the PHY according to the provided configuration
  • Sets up loopback mode, auto-negotiation, speed, and duplex settings

◆ dp83867_get_phy_status()

void dp83867_get_phy_status ( ENET_Type ptr,
uint32_t  phy_addr,
enet_phy_status_t status 
)

Get DP83867 PHY status.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address
[out]statusPointer to the status structure to store PHY status

This function reads the PHY status register and extracts:

  • Link status (up/down)
  • Port speed (10 Mbps, 100 Mbps, or 1000 Mbps)
  • Duplex mode (half or full)

◆ dp83867_reset()

bool dp83867_reset ( ENET_Type ptr,
uint32_t  phy_addr 
)

Reset DP83867 PHY chip.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address
Return values
trueReset operation completed successfully
falseReset operation failed (timeout)

◆ dp83867_set_mdi_crossover_mode()

void dp83867_set_mdi_crossover_mode ( ENET_Type ptr,
uint32_t  phy_addr,
enet_phy_crossover_mode_t  mode 
)

Set MDI crossover mode for DP83867 PHY.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address
[in]modeCrossover mode: enet_phy_crossover_mode_t

This function configures the MDI/MDIX crossover mode for the PHY. The crossover mode determines how the PHY handles cable connections.