1
1
/*
2
-
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
2
+
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
3
3
*
4
4
* SPDX-License-Identifier: Apache-2.0
5
5
*/
@@ -28,6 +28,144 @@ typedef struct {
28
28
int reset_gpio_num; /*!< Reset GPIO number, -1 means no hardware reset */
29
29
} phy_802_3_t;
30
30
31
+
/**
32
+
* @brief Set Ethernet mediator
33
+
*
34
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
35
+
* @param eth Ethernet mediator pointer
36
+
* @return
37
+
* - ESP_OK: Ethermet mediator set successfuly
38
+
* - ESP_ERR_INVALID_ARG: if @c eth is @c NULL
39
+
*/
40
+
esp_err_t esp_eth_phy_802_3_set_mediator(phy_802_3_t *phy_802_3, esp_eth_mediator_t *eth);
41
+
42
+
/**
43
+
* @brief Reset PHY
44
+
*
45
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
46
+
* @return
47
+
* - ESP_OK: Ethernet PHY reset successfuly
48
+
* - ESP_FAIL: reset Ethernet PHY failed because some error occured
49
+
*/
50
+
esp_err_t esp_eth_phy_802_3_reset(phy_802_3_t *phy_802_3);
51
+
52
+
/**
53
+
* @brief Control autonegotiation mode of Ethernet PHY
54
+
*
55
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
56
+
* @param cmd autonegotiation command enumeration
57
+
* @param[out] autonego_en_stat autonegotiation enabled flag
58
+
* @return
59
+
* - ESP_OK: Ethernet PHY autonegotiation configured successfuly
60
+
* - ESP_FAIL: Ethernet PHY autonegotiation configuration fail because some error occured
61
+
* - ESP_ERR_INVALID_ARG: invalid value of @c cmd
62
+
*/
63
+
esp_err_t esp_eth_phy_802_3_autonego_ctrl(phy_802_3_t *phy_802_3, eth_phy_autoneg_cmd_t cmd, bool *autonego_en_stat);
64
+
65
+
/**
66
+
* @brief Power control of Ethernet PHY
67
+
*
68
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
69
+
* @param enable set true to power ON Ethernet PHY; set false to power OFF Ethernet PHY
70
+
* @return
71
+
* - ESP_OK: Ethernet PHY power down mode set successfuly
72
+
* - ESP_FAIL: Ethernet PHY power up or power down failed because some error occured
73
+
*/
74
+
esp_err_t esp_eth_phy_802_3_pwrctl(phy_802_3_t *phy_802_3, bool enable);
75
+
76
+
/**
77
+
* @brief Set Ethernet PHY address
78
+
*
79
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
80
+
* @param addr new PHY address
81
+
* @return
82
+
* - ESP_OK: Ethernet PHY address set
83
+
*/
84
+
esp_err_t esp_eth_phy_802_3_set_addr(phy_802_3_t *phy_802_3, uint32_t addr);
85
+
86
+
/**
87
+
* @brief Get Ethernet PHY address
88
+
*
89
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
90
+
* @param[out] addr Ethernet PHY address
91
+
* @return
92
+
* - ESP_OK: Ethernet PHY address read successfuly
93
+
* - ESP_ERR_INVALID_ARG: @c addr pointer is @c NULL
94
+
*/
95
+
esp_err_t esp_eth_phy_802_3_get_addr(phy_802_3_t *phy_802_3, uint32_t *addr);
96
+
97
+
/**
98
+
* @brief Advertise pause function ability
99
+
*
100
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
101
+
* @param ability enable or disable pause ability
102
+
* @return
103
+
* - ESP_OK: pause ability set successfuly
104
+
* - ESP_FAIL: Advertise pause function ability failed because some error occured
105
+
*/
106
+
esp_err_t esp_eth_phy_802_3_advertise_pause_ability(phy_802_3_t *phy_802_3, uint32_t ability);
107
+
108
+
/**
109
+
* @brief Set Ethernet PHY loopback mode
110
+
*
111
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
112
+
* @param enable set true to enable loopback; set false to disable loopback
113
+
* @return
114
+
* - ESP_OK: Ethernet PHY loopback mode set successfuly
115
+
* - ESP_FAIL: Ethernet PHY loopback configuration failed because some error occured
116
+
*/
117
+
esp_err_t esp_eth_phy_802_3_loopback(phy_802_3_t *phy_802_3, bool enable);
118
+
119
+
/**
120
+
* @brief Set Ethernet PHY speed
121
+
*
122
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
123
+
* @param speed new speed of Ethernet PHY link
124
+
* @return
125
+
* - ESP_OK: Ethernet PHY speed set successfuly
126
+
* - ESP_FAIL: Set Ethernet PHY speed failed because some error occured
127
+
*/
128
+
esp_err_t esp_eth_phy_802_3_set_speed(phy_802_3_t *phy_802_3, eth_speed_t speed);
129
+
130
+
/**
131
+
* @brief Set Ethernet PHY duplex mode
132
+
*
133
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
134
+
* @param duplex new duplex mode for Ethernet PHY link
135
+
* @return
136
+
* - ESP_OK: Ethernet PHY duplex mode set successfuly
137
+
* - ESP_ERR_INVALID_STATE: unable to set duplex mode to Half if loopback is enabled
138
+
* - ESP_FAIL: Set Ethernet PHY duplex mode failed because some error occured
139
+
*/
140
+
esp_err_t esp_eth_phy_802_3_set_duplex(phy_802_3_t *phy_802_3, eth_duplex_t duplex);
141
+
142
+
/**
143
+
* @brief Initialize Ethernet PHY
144
+
*
145
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
146
+
* @return
147
+
* - ESP_OK: Ethernet PHY initialized successfuly
148
+
*/
149
+
esp_err_t esp_eth_phy_802_3_init(phy_802_3_t *phy_802_3);
150
+
151
+
/**
152
+
* @brief Power off Eternet PHY
153
+
*
154
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
155
+
* @return
156
+
* - ESP_OK: Ethernet PHY powered off successfuly
157
+
*/
158
+
esp_err_t esp_eth_phy_802_3_deinit(phy_802_3_t *phy_802_3);
159
+
160
+
/**
161
+
* @brief Delete Ethernet PHY infostructure
162
+
*
163
+
* @param phy_802_3 IEEE 802.3 PHY object infostructure
164
+
* @return
165
+
* - ESP_OK: Ethrnet PHY infostructure deleted
166
+
*/
167
+
esp_err_t esp_eth_phy_802_3_del(phy_802_3_t *phy_802_3);
168
+
31
169
/**
32
170
* @brief Performs hardware reset with specific reset pin assertion time
33
171
*
@@ -116,7 +254,10 @@ esp_err_t esp_eth_phy_802_3_read_manufac_info(phy_802_3_t *phy_802_3, uint8_t *m
116
254
* @return phy_802_3_t*
117
255
* - address to parent IEEE 802.3 PHY object infostructure
118
256
*/
119
-
phy_802_3_t *esp_eth_phy_into_phy_802_3(esp_eth_phy_t *phy);
257
+
inline __attribute__((always_inline)) phy_802_3_t *esp_eth_phy_into_phy_802_3(esp_eth_phy_t *phy)
258
+
{
259
+
return __containerof(phy, phy_802_3_t, parent);
260
+
}
120
261
121
262
/**
122
263
* @brief Initializes configuration of parent IEEE 802.3 PHY object infostructure
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4