HPM SDK
HPMicro Software Development Kit
hpm_jl1111.c File Reference
#include "hpm_enet_drv.h"
#include "hpm_jl1111_regs.h"
#include "hpm_jl1111.h"

Functions

static bool jl1111_check_id (ENET_Type *ptr, uint32_t phy_addr)
 
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...
 

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_check_id()

static bool jl1111_check_id ( ENET_Type ptr,
uint32_t  phy_addr 
)
static

◆ 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.