HPM SDK
HPMicro Software Development Kit
hpm_rtl8201.h
Go to the documentation of this file.
1 
8 /*
9  * Copyright (c) 2021-2025 HPMicro
10  *
11  * SPDX-License-Identifier: BSD-3-Clause
12  *
13  */
14 
15 #ifndef HPM_RTL8201_H
16 #define HPM_RTL8201_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 RTL8201_ADDR
33 #define RTL8201_ADDR (2U)
34 #endif
35 
39 #define RTL8201_ID1 (0x001CU)
43 #define RTL8201_ID2 (0x32U)
44 
45 /*---------------------------------------------------------------------
46  * Typedef Enum Declarations
47  *---------------------------------------------------------------------
48  */
52 typedef enum {
56 
57 /*---------------------------------------------------------------------
58  * Typedef Struct Declarations
59  *---------------------------------------------------------------------
60  */
64 typedef struct {
65  bool loopback;
66  uint8_t speed;
68  uint8_t duplex;
69  uint8_t rmii_refclk_dir;
71 
72 #if defined(__cplusplus)
73 extern "C" {
74 #endif /* __cplusplus */
75 /*---------------------------------------------------------------------
76  * Exported Functions
77  *---------------------------------------------------------------------
78  */
86 bool rtl8201_reset(ENET_Type *ptr, uint32_t phy_addr);
87 
99 
112 bool rtl8201_basic_mode_init(ENET_Type *ptr, uint32_t phy_addr, rtl8201_config_t *config);
113 
124 void rtl8201_get_phy_status(ENET_Type *ptr, uint32_t phy_addr, enet_phy_status_t *status);
125 
134 void rtl8201_set_rmii_refclk_direction(ENET_Type *ptr, uint32_t phy_addr, uint8_t dir);
135 
136 #if defined(__cplusplus)
137 }
138 #endif /* __cplusplus */
139 #endif /* HPM_RTL8201_H */
void rtl8201_get_phy_status(ENET_Type *ptr, uint32_t phy_addr, enet_phy_status_t *status)
Get RTL8201 PHY status.
Definition: hpm_rtl8201.c:103
rtl8201_config_refclk_direction_t
RTL8201 reference clock direction configuration.
Definition: hpm_rtl8201.h:52
@ rtl8201_config_refclk_output
Definition: hpm_rtl8201.h:53
@ rtl8201_config_refclk_input
Definition: hpm_rtl8201.h:54
void rtl8201_set_rmii_refclk_direction(ENET_Type *ptr, uint32_t phy_addr, uint8_t dir)
Set RMII reference clock direction for RTL8201 PHY.
Definition: hpm_rtl8201.c:115
void rtl8201_basic_mode_default_config(ENET_Type *ptr, rtl8201_config_t *config)
Set default configuration for RTL8201 PHY basic mode.
Definition: hpm_rtl8201.c:54
bool rtl8201_basic_mode_init(ENET_Type *ptr, uint32_t phy_addr, rtl8201_config_t *config)
Initialize RTL8201 PHY chip in basic mode.
Definition: hpm_rtl8201.c:68
bool rtl8201_reset(ENET_Type *ptr, uint32_t phy_addr)
Reset RTL8201 PHY chip.
Definition: hpm_rtl8201.c:38
Definition: hpm_enet_regs.h:12
Definition: hpm_enet_phy.h:43
RTL8201 PHY configuration structure.
Definition: hpm_rtl8201.h:64
uint8_t speed
Definition: hpm_rtl8201.h:66
bool loopback
Definition: hpm_rtl8201.h:65
uint8_t duplex
Definition: hpm_rtl8201.h:68
bool auto_negotiation
Definition: hpm_rtl8201.h:67
uint8_t rmii_refclk_dir
Definition: hpm_rtl8201.h:69