summaryrefslogtreecommitdiff
path: root/bsp/hpmicro/libraries/drivers/drv_enet_phy.h
blob: 77da6a4fdaa2dfdf3f3c84f40147d68cac873432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * Copyright (c) 2023-2024 HPMicro
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */

#ifndef DRV_ENET_PHY_H
#define DRV_ENET_PHY_H

#include "hpm_ioc_regs.h"
#include <rtdevice.h>

#if defined(BSP_USING_ENET_PHY_DP83867)
#include "hpm_dp83867.h"
#endif

#if defined(BSP_USING_ENET_PHY_RTL8211)
#include "hpm_rtl8211.h"
#endif

#if defined(BSP_USING_ENET_PHY_DP83848)
#include "hpm_dp83848.h"
#endif

#if defined(BSP_USING_ENET_PHY_RTL8201)
#include "hpm_rtl8201.h"
#endif

#if defined(BSP_USING_ENET_PHY_LAN8720)
#include "hpm_lan8720.h"
#endif

#ifndef PHY_AUTO_NEGO
#define PHY_AUTO_NEGO  (1U)
#endif

#ifndef PHY_MDIO_CSR_CLK_FREQ
#define PHY_MDIO_CSR_CLK_FREQ (200000000U)
#endif

enum phy_link_status
{
   PHY_LINK_DOWN = 0U,
   PHY_LINK_UP
};

typedef struct {
    rt_uint32_t phy_speed;
    rt_uint32_t phy_duplex;
} phy_info_t;

typedef struct {
    rt_uint32_t phy_link;
    rt_phy_t phy;
    phy_info_t phy_info;
} phy_device_t;

#endif /* DRV_ENET_PHY_H */