HPM SDK
HPMicro Software Development Kit
hpm_jl1111.h File Reference

JL1111 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  jl1111_config_t
 JL1111 PHY configuration structure. More...
 

Macros

#define JL1111_ADDR   (2U)
 Default PHY address for JL1111. More...
 
#define JL1111_ID1   (0x937CU)
 JL1111 PHY ID register 1 value (OUI MSB) More...
 
#define JL1111_ID2   (0x10U)
 JL1111 PHY ID register 2 value (OUI LSB) More...
 

Enumerations

enum  jl1111_config_interface_t { jl1111_config_mii_itf = 0 , jl1111_config_rmii_itf }
 JL1111 interface configuration. More...
 
enum  jl1111_config_refclk_direction_t { jl1111_config_refclk_output = 0 , jl1111_config_refclk_input }
 JL1111 reference clock direction configuration. More...
 

Functions

bool jl1111_reset (ENET_Type *ptr, uint32_t phy_addr)
 Reset JL1111 PHY chip. More...
 
void jl1111_basic_mode_default_config (ENET_Type *ptr, jl1111_config_t *config)
 Set default configuration for JL1111 PHY basic mode. More...
 
bool jl1111_basic_mode_init (ENET_Type *ptr, uint32_t phy_addr, jl1111_config_t *config)
 Initialize JL1111 PHY chip in basic mode. More...
 
void jl1111_get_phy_status (ENET_Type *ptr, uint32_t phy_addr, enet_phy_status_t *status)
 Get JL1111 PHY status. More...
 
void jl1111_set_itf (ENET_Type *ptr, uint32_t phy_addr, uint8_t itf)
 Set interface mode for JL1111 PHY. More...
 
void jl1111_set_rmii_refclk_direction (ENET_Type *ptr, uint32_t phy_addr, uint8_t dir)
 Set RMII reference clock direction for JL1111 PHY. More...
 
void jl1111_set_rmii_skew (ENET_Type *ptr, uint32_t phy_addr, uint8_t tx_skew, uint8_t rx_skew)
 Set RMII skew timing for JL1111 PHY. More...
 
void jl1111_disable_broadcast_response (ENET_Type *ptr, uint32_t phy_addr)
 Disable broadcast response for JL1111 PHY. More...
 

Detailed Description

JL1111 Ethernet PHY driver header file.

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

Macro Definition Documentation

◆ JL1111_ADDR

#define JL1111_ADDR   (2U)

Default PHY address for JL1111.

◆ JL1111_ID1

#define JL1111_ID1   (0x937CU)

JL1111 PHY ID register 1 value (OUI MSB)

◆ JL1111_ID2

#define JL1111_ID2   (0x10U)

JL1111 PHY ID register 2 value (OUI LSB)

Enumeration Type Documentation

◆ jl1111_config_interface_t

JL1111 interface configuration.

Enumerator
jl1111_config_mii_itf 

MII interface mode

jl1111_config_rmii_itf 

RMII interface mode

◆ jl1111_config_refclk_direction_t

JL1111 reference clock direction configuration.

Enumerator
jl1111_config_refclk_output 

Reference clock output mode

jl1111_config_refclk_input 

Reference clock input mode

Function Documentation

◆ jl1111_basic_mode_default_config()

void jl1111_basic_mode_default_config ( ENET_Type ptr,
jl1111_config_t config 
)

Set default configuration for JL1111 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)

◆ jl1111_basic_mode_init()

bool jl1111_basic_mode_init ( ENET_Type ptr,
uint32_t  phy_addr,
jl1111_config_t config 
)

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

◆ jl1111_disable_broadcast_response()

void jl1111_disable_broadcast_response ( ENET_Type ptr,
uint32_t  phy_addr 
)

Disable broadcast response for JL1111 PHY.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address

This function disables the PHY's response to broadcast frames.

◆ jl1111_get_phy_status()

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

Get JL1111 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)

◆ jl1111_reset()

bool jl1111_reset ( ENET_Type ptr,
uint32_t  phy_addr 
)

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

◆ jl1111_set_itf()

void jl1111_set_itf ( ENET_Type ptr,
uint32_t  phy_addr,
uint8_t  itf 
)

Set interface mode for JL1111 PHY.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address
[in]itfInterface mode: jl1111_config_interface_t

This function configures the PHY interface mode (MII or RMII).

◆ jl1111_set_rmii_refclk_direction()

void jl1111_set_rmii_refclk_direction ( ENET_Type ptr,
uint32_t  phy_addr,
uint8_t  dir 
)

Set RMII reference clock direction for JL1111 PHY.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address
[in]dirReference clock direction: jl1111_config_refclk_direction_t

This function configures the RMII reference clock direction (input or output).

◆ jl1111_set_rmii_skew()

void jl1111_set_rmii_skew ( ENET_Type ptr,
uint32_t  phy_addr,
uint8_t  tx_skew,
uint8_t  rx_skew 
)

Set RMII skew timing for JL1111 PHY.

Parameters
[in]ptrPointer to the ENET peripheral base address
[in]phy_addrPHY address
[in]tx_skewTX skew value
[in]rx_skewRX skew value

This function configures the RMII TX and RX skew timing values for signal alignment.