HPM SDK
HPMicro Software Development Kit
hpm_dp83848.h File Reference

DP83848 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  dp83848_config_t
 DP83848 PHY configuration structure. More...
 

Macros

#define DP83848_ADDR   (1U)
 Default PHY address for DP83848. More...
 
#define DP83848_ID1   (0x2000U)
 DP83848 PHY ID register 1 value (OUI MSB) More...
 
#define DP83848_ID2   (0x17U)
 DP83848 PHY ID register 2 value (OUI LSB) More...
 

Enumerations

enum  dp83848_config_refclk_direction_t { dp83848_config_refclk_input = 0 }
 DP83848 reference clock direction configuration. More...
 

Functions

bool dp83848_reset (ENET_Type *ptr, uint32_t phy_addr)
 Reset DP83848 PHY chip. More...
 
void dp83848_basic_mode_default_config (ENET_Type *ptr, dp83848_config_t *config)
 Set default configuration for DP83848 PHY basic mode. More...
 
bool dp83848_basic_mode_init (ENET_Type *ptr, uint32_t phy_addr, dp83848_config_t *config)
 Initialize DP83848 PHY chip in basic mode. More...
 
void dp83848_get_phy_status (ENET_Type *ptr, uint32_t phy_addr, enet_phy_status_t *status)
 Get DP83848 PHY status. More...
 

Detailed Description

DP83848 Ethernet PHY driver header file.

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

Macro Definition Documentation

◆ DP83848_ADDR

#define DP83848_ADDR   (1U)

Default PHY address for DP83848.

◆ DP83848_ID1

#define DP83848_ID1   (0x2000U)

DP83848 PHY ID register 1 value (OUI MSB)

◆ DP83848_ID2

#define DP83848_ID2   (0x17U)

DP83848 PHY ID register 2 value (OUI LSB)

Enumeration Type Documentation

◆ dp83848_config_refclk_direction_t

DP83848 reference clock direction configuration.

Enumerator
dp83848_config_refclk_input 

Reference clock input mode

Function Documentation

◆ dp83848_basic_mode_default_config()

void dp83848_basic_mode_default_config ( ENET_Type ptr,
dp83848_config_t config 
)

Set default configuration for DP83848 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: 100 Mbps (when auto-negotiation is disabled)
  • Duplex: full duplex (when auto-negotiation is disabled)

◆ dp83848_basic_mode_init()

bool dp83848_basic_mode_init ( ENET_Type ptr,
uint32_t  phy_addr,
dp83848_config_t config 
)

Initialize DP83848 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 DP83848 chip
  • Configures the PHY according to the provided configuration
  • Sets up loopback mode, auto-negotiation, speed, and duplex settings

◆ dp83848_get_phy_status()

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

Get DP83848 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 or 100 Mbps)
  • Duplex mode (half or full)

◆ dp83848_reset()

bool dp83848_reset ( ENET_Type ptr,
uint32_t  phy_addr 
)

Reset DP83848 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)