• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef HPM_DP83867_H
9 #define HPM_DP83867_H
10 
11 /*---------------------------------------------------------------------
12  * Includes
13  *---------------------------------------------------------------------
14  */
15 #include "stdint.h"
16 
17 /*---------------------------------------------------------------------
18  *  Macro Const Definitions
19  *---------------------------------------------------------------------
20  */
21 #define PHY_ADDR (0U)
22 #define PHY_ID1  (0x2000U)
23 #define PHY_ID2  (0x28U)
24 
25 /*---------------------------------------------------------------------
26  *  Typedef Struct Declarations
27  *---------------------------------------------------------------------
28  */
29 typedef struct {
30     bool loopback;
31     uint8_t speed;
32     bool auto_negotiation;
33     uint8_t duplex_mode;
34 } dp83867_config_t;
35 
36 typedef enum {
37     DP83867_RX_DELAY_0P25_NS = 0,
38     DP83867_RX_DELAY_0P50_NS,
39     DP83867_RX_DELAY_0P75_NS,
40     DP83867_RX_DELAY_1P00_NS,
41     DP83867_RX_DELAY_1P25_NS,
42     DP83867_RX_DELAY_1P50_NS,
43     DP83867_RX_DELAY_1P75_NS,
44     DP83867_RX_DELAY_2P00_NS,
45     DP83867_RX_DELAY_2P25_NS,
46     DP83867_RX_DELAY_2P50_NS,
47     DP83867_RX_DELAY_2P75_NS,
48     DP83867_RX_DELAY_3P00_NS,
49     DP83867_RX_DELAY_3P25_NS,
50     DP83867_RX_DELAY_3P50_NS,
51     DP83867_RX_DELAY_3P75_NS,
52     DP83867_RX_DELAY_4P00_NS
53 } dp83867_rgmii_rx_delay_t;
54 
55 #if defined(__cplusplus)
56 extern "C" {
57 #endif /* __cplusplus */
58 /*---------------------------------------------------------------------
59  * Exported Functions
60  *---------------------------------------------------------------------
61  */
62 uint16_t dp83867_check(ENET_Type *ptr, uint32_t addr);
63 void dp83867_reset(ENET_Type *ptr);
64 void dp83867_basic_mode_default_config(ENET_Type *ptr, dp83867_config_t *config);
65 bool dp83867_basic_mode_init(ENET_Type *ptr, dp83867_config_t *config);
66 void dp83867_read_status(ENET_Type *ptr);
67 void dp83867_control_config(ENET_Type *ptr);
68 void dp83867_ctl_config(ENET_Type *ptr);
69 void dp83867_bist_config(ENET_Type *ptr);
70 uint16_t dp83867_get_phy_link_status(ENET_Type *ptr);
71 void dp83867_set_rx_clk_delay(ENET_Type *ptr);
72 void dp83867_enable_crc_check(ENET_Type *ptr);
73 void dp83867_set_rgmii_rx_delay(ENET_Type *ptr, uint32_t phy_addr, uint8_t delay);
74 uint16_t dp83867_get_rgmii_rx_delay(ENET_Type *ptr, uint32_t phy_addr);
75 void dp83867_enable_rmii_inf(ENET_Type *ptr);
76 
77 #if defined(__cplusplus)
78 }
79 #endif /* __cplusplus */
80 #endif /* HPM_DP83867_H */
81