HPM SDK
HPMicro Software Development Kit
hpm_lan8720.h
Go to the documentation of this file.
1 
8 /*
9  * Copyright (c) 2024-2025 HPMicro
10  *
11  * SPDX-License-Identifier: BSD-3-Clause
12  *
13  */
14 
15 #ifndef HPM_LAN8720_H
16 #define HPM_LAN8720_H
17 
18 /*---------------------------------------------------------------------
19  * Includes
20  *---------------------------------------------------------------------
21  */
22 #include "hpm_enet_phy.h"
23 #include "hpm_common.h"
24 #include "hpm_enet_regs.h"
25 /*---------------------------------------------------------------------
26  * Macro Const Definitions
27  *---------------------------------------------------------------------
28  */
29 #ifndef LAN8720_ADDR
33 #define LAN8720_ADDR (0U)
34 #endif
35 
39 #define LAN8720_ID1 (0x0007U)
43 #define LAN8720_ID2 (0x30U)
44 
45 /*---------------------------------------------------------------------
46  * Typedef Enum Declarations
47  *---------------------------------------------------------------------
48  */
52 typedef enum {
56 /*---------------------------------------------------------------------
57  * Typedef Struct Declarations
58  *---------------------------------------------------------------------
59  */
63 typedef struct {
64  bool loopback;
65  uint8_t speed;
67  uint8_t duplex;
69 
70 #if defined(__cplusplus)
71 extern "C" {
72 #endif /* __cplusplus */
73 /*---------------------------------------------------------------------
74  * Exported Functions
75  *---------------------------------------------------------------------
76  */
84 bool lan8720_reset(ENET_Type *ptr, uint32_t phy_addr);
85 
97 
110 bool lan8720_basic_mode_init(ENET_Type *ptr, uint32_t phy_addr, lan8720_config_t *config);
111 
122 void lan8720_get_phy_status(ENET_Type *ptr, uint32_t phy_addr, enet_phy_status_t *status);
123 
124 #if defined(__cplusplus)
125 }
126 #endif /* __cplusplus */
127 #endif /* HPM_LAN8720_H */
void lan8720_basic_mode_default_config(ENET_Type *ptr, lan8720_config_t *config)
Set default configuration for LAN8720 PHY basic mode.
Definition: hpm_lan8720.c:54
bool lan8720_reset(ENET_Type *ptr, uint32_t phy_addr)
Reset LAN8720 PHY chip.
Definition: hpm_lan8720.c:38
lan8720_config_refclk_direction_t
LAN8720 reference clock direction configuration.
Definition: hpm_lan8720.h:52
@ lan8720_config_refclk_input
Definition: hpm_lan8720.h:54
@ lan8720_config_refclk_output
Definition: hpm_lan8720.h:53
void lan8720_get_phy_status(ENET_Type *ptr, uint32_t phy_addr, enet_phy_status_t *status)
Get LAN8720 PHY status.
Definition: hpm_lan8720.c:92
bool lan8720_basic_mode_init(ENET_Type *ptr, uint32_t phy_addr, lan8720_config_t *config)
Initialize LAN8720 PHY chip in basic mode.
Definition: hpm_lan8720.c:66
Definition: hpm_enet_regs.h:12
Definition: hpm_enet_phy.h:43
LAN8720 PHY configuration structure.
Definition: hpm_lan8720.h:63
uint8_t speed
Definition: hpm_lan8720.h:65
bool loopback
Definition: hpm_lan8720.h:64
uint8_t duplex
Definition: hpm_lan8720.h:67
bool auto_negotiation
Definition: hpm_lan8720.h:66