AM263Px MCU+ SDK: dp83869.h Source File

| AM263Px MCU+ SDK 26.00.00 |

dp83869.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) Texas Instruments Incorporated 2021
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
15 *
16 * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
49 #ifndef DP83869_H_
50 #define DP83869_H_
51
52 /* ========================================================================== */
53 /* Include Files */
54 /* ========================================================================== */
55
56 #include <stdint.h>
57 #include <stdbool.h>
58
59 #include "phy_common.h"
60 #include "port.h"
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 /* ========================================================================== */
67 /* Macros */
68 /* ========================================================================== */
69
71 #define DP83869_LED_NUM (4U)
72
73 /* ========================================================================== */
74 /* Structures and Enums */
75 /* ========================================================================== */
76
80 typedef enum Dp83869_Gpio0Mode_e
81 {
83 DP83869_GPIO0_CLK_OUT = 0x0U,
84
86 DP83869_GPIO0_INT = 0x2U,
87
89 DP83869_GPIO0_LINK_STATUS = 0x3U,
90
92 DP83869_GPIO0_TX_SFD = 0x5U,
93
95 DP83869_GPIO0_RX_SFD = 0x6U,
96
98 DP83869_GPIO0_WOL = 0x7U,
99
100 /* Energy Detect (100/1000M)*/
101 DP83869_GPIO0_ED = 0x8U,
102
104 DP83869_GPIO0_PRBS_ERR = 0x9U,
105
107 DP83869_GPIO0_LED_2 = 0xAU,
108
110 DP83869_GPIO0_LED_GPIO_3 = 0xBU,
111
113 DP83869_GPIO0_CRS = 0xCU,
114
116 DP83869_GPIO0_COL = 0xDU,
117
119 DP83869_GPIO0_CONSTANT0 = 0xEU,
120
122 DP83869_GPIO0_CONSTANT1 = 0xFU,
123
124 } Dp83869_Gpio0Mode;
125
129 typedef enum Dp83869_Gpio1Mode_e
130 {
132 DP83869_GPIO1_CLK_OUT = 0x0U,
133
135 DP83869_GPIO1_INT = 0x2U,
136
138 DP83869_GPIO1_LINK_STATUS = 0x3U,
139
141 DP83869_GPIO1_TX_SFD = 0x5U,
142
144 DP83869_GPIO1_RX_SFD = 0x6U,
145
147 DP83869_GPIO1_WOL = 0x7U,
148
149 /* Energy Detect (100/1000M)*/
150 DP83869_GPIO1_ED = 0x8U,
151
153 DP83869_GPIO1_PRBS_ERR = 0x9U,
154
156 DP83869_GPIO1_LED_2 = 0xAU,
157
159 DP83869_GPIO1_LED_GPIO_3 = 0xBU,
160
162 DP83869_GPIO1_CRS = 0xCU,
163
165 DP83869_GPIO1_COL = 0xDU,
166
168 DP83869_GPIO1_CONSTANT0 = 0xEU,
169
171 DP83869_GPIO1_CONSTANT1 = 0xFU,
172 } Dp83869_Gpio1Mode;
173
177 typedef enum Dp83869_LedMode_e
178 {
180 DP83869_LED_LINKED = 0x0U,
181
183 DP83869_LED_RXTXACT = 0x1U,
184
186 DP83869_LED_TXACT = 0x2U,
187
189 DP83869_LED_RXACT = 0x3U,
190
192 DP83869_LED_COLLDET = 0x4U,
193
195 DP83869_LED_LINKED_1000BT = 0x5U,
196
198 DP83869_LED_LINKED_100BTX = 0x6U,
199
201 DP83869_LED_LINKED_10BT = 0x7U,
202
204 DP83869_LED_LINKED_10100BT = 0x8U,
205
207 DP83869_LED_LINKED_1001000BT = 0x9U,
208
210 DP83869_LED_FULLDUPLEX = 0xAU,
211
213 DP83869_LED_LINKED_BLINKACT = 0xBU,
214
216 DP83869_LED_RXTXERR = 0xDU,
217
219 DP83869_LED_RXERR = 0xEU,
220 } Dp83869_LedMode;
221
225 typedef struct Dp83869_Cfg_s
226 {
228 bool txClkShiftEn;
229
231 bool rxClkShiftEn;
232
234 uint32_t txDelayInPs;
235
237 uint32_t rxDelayInPs;
238
240 uint8_t txFifoDepth;
241
243 uint32_t idleCntThresh;
244
247 uint32_t impedanceInMilliOhms;
248
250 Dp83869_Gpio0Mode gpio0Mode;
251
253 Dp83869_Gpio1Mode gpio1Mode;
254
256 Dp83869_LedMode ledMode[DP83869_LED_NUM];
257 } Dp83869_Cfg;
258
259 /* ========================================================================== */
260 /* Global Variables Declarations */
261 /* ========================================================================== */
262
263 /* None */
264
265 /* ========================================================================== */
266 /* Function Declarations */
267 /* ========================================================================== */
268
276 void Dp83869_initCfg(Dp83869_Cfg *cfg);
277
278 void Dp83869_bind(EthPhyDrv_Handle* hPhy,
279 uint8_t phyAddr,
280 Phy_RegAccessCb_t* pRegAccessCb);
281
282 bool Dp83869_isPhyDevSupported(EthPhyDrv_Handle hPhy,
283 const void *pVersion);
284
285 bool Dp83869_isMacModeSupported(EthPhyDrv_Handle hPhy,
286 Phy_Mii mii);
287
288 int32_t Dp83869_config(EthPhyDrv_Handle hPhy,
289 const void *pExtCfg,
290 const uint32_t extCfgSize,
291 Phy_Mii mii,
292 bool loopbackEn);
293
294 void Dp83869_reset(EthPhyDrv_Handle hPhy);
295
296 bool Dp83869_isResetComplete(EthPhyDrv_Handle hPhy);
297
298 void Dp83869_printRegs(EthPhyDrv_Handle hPhy);
299
300 /* ========================================================================== */
301 /* Deprecated Function Declarations */
302 /* ========================================================================== */
303
304 /* None */
305
306 /* ========================================================================== */
307 /* Static Function Definitions */
308 /* ========================================================================== */
309
310 /* None */
311
312 #ifdef __cplusplus
313 }
314 #endif
315
316 #endif /* DP83869_H_ */
317
Dp83869_Cfg::txFifoDepth
uint8_t txFifoDepth
Definition: dp83869.h:240
Dp83869_initCfg
void Dp83869_initCfg(Dp83869_Cfg *cfg)
Initialize DP83869 PHY specific config params.
DP83869_LED_LINKED
@ DP83869_LED_LINKED
Definition: dp83869.h:180
DP83869_LED_TXACT
@ DP83869_LED_TXACT
Definition: dp83869.h:186
DP83869_GPIO1_ED
@ DP83869_GPIO1_ED
Definition: dp83869.h:150
Dp83869_Cfg::impedanceInMilliOhms
uint32_t impedanceInMilliOhms
Definition: dp83869.h:247
DP83869_GPIO1_COL
@ DP83869_GPIO1_COL
Definition: dp83869.h:165
Dp83869_LedMode
Dp83869_LedMode
LED modes (sources).
Definition: dp83869.h:178
DP83869_GPIO0_PRBS_ERR
@ DP83869_GPIO0_PRBS_ERR
Definition: dp83869.h:104
Phy_RegAccessCb_t
Definition: phy_common.h:283
DP83869_GPIO1_LINK_STATUS
@ DP83869_GPIO1_LINK_STATUS
Definition: dp83869.h:138
DP83869_GPIO1_PRBS_ERR
@ DP83869_GPIO1_PRBS_ERR
Definition: dp83869.h:153
Dp83869_reset
void Dp83869_reset(EthPhyDrv_Handle hPhy)
Dp83869_Cfg::txDelayInPs
uint32_t txDelayInPs
Definition: dp83869.h:234
DP83869_GPIO0_LED_GPIO_3
@ DP83869_GPIO0_LED_GPIO_3
Definition: dp83869.h:110
DP83869_LED_LINKED_100BTX
@ DP83869_LED_LINKED_100BTX
Definition: dp83869.h:198
EthPhyDrv_Handle
uint8_t EthPhyDrv_Handle[ETHPHYDRV_MAX_OBJ_SIZE]
Definition: phy_common.h:302
DP83869_GPIO1_LED_GPIO_3
@ DP83869_GPIO1_LED_GPIO_3
Definition: dp83869.h:159
DP83869_LED_RXACT
@ DP83869_LED_RXACT
Definition: dp83869.h:189
Dp83869_isMacModeSupported
bool Dp83869_isMacModeSupported(EthPhyDrv_Handle hPhy, Phy_Mii mii)
Dp83869_Gpio0Mode
Dp83869_Gpio0Mode
GPIO_0 mux modes.
Definition: dp83869.h:81
Phy_Mii
Phy_Mii
Definition: phy_common.h:220
DP83869_LED_RXTXERR
@ DP83869_LED_RXTXERR
Definition: dp83869.h:216
Dp83869_Cfg::rxDelayInPs
uint32_t rxDelayInPs
Definition: dp83869.h:237
Dp83869_printRegs
void Dp83869_printRegs(EthPhyDrv_Handle hPhy)
DP83869_GPIO1_CONSTANT0
@ DP83869_GPIO1_CONSTANT0
Definition: dp83869.h:168
DP83869_GPIO1_CONSTANT1
@ DP83869_GPIO1_CONSTANT1
Definition: dp83869.h:171
DP83869_GPIO0_ED
@ DP83869_GPIO0_ED
Definition: dp83869.h:101
DP83869_GPIO1_CRS
@ DP83869_GPIO1_CRS
Definition: dp83869.h:162
DP83869_LED_RXERR
@ DP83869_LED_RXERR
Definition: dp83869.h:219
DP83869_GPIO1_RX_SFD
@ DP83869_GPIO1_RX_SFD
Definition: dp83869.h:144
DP83869_LED_LINKED_1000BT
@ DP83869_LED_LINKED_1000BT
Definition: dp83869.h:195
Dp83869_Cfg
DP83869 PHY configuration parameters.
Definition: dp83869.h:226
DP83869_LED_RXTXACT
@ DP83869_LED_RXTXACT
Definition: dp83869.h:183
Dp83869_Cfg::idleCntThresh
uint32_t idleCntThresh
Definition: dp83869.h:243
DP83869_GPIO0_CONSTANT1
@ DP83869_GPIO0_CONSTANT1
Definition: dp83869.h:122
DP83869_GPIO0_RX_SFD
@ DP83869_GPIO0_RX_SFD
Definition: dp83869.h:95
DP83869_GPIO0_LED_2
@ DP83869_GPIO0_LED_2
Definition: dp83869.h:107
DP83869_GPIO0_TX_SFD
@ DP83869_GPIO0_TX_SFD
Definition: dp83869.h:92
DP83869_GPIO1_TX_SFD
@ DP83869_GPIO1_TX_SFD
Definition: dp83869.h:141
Dp83869_Cfg::txClkShiftEn
bool txClkShiftEn
Definition: dp83869.h:228
Dp83869_Gpio1Mode
Dp83869_Gpio1Mode
GPIO_1 mux modes.
Definition: dp83869.h:130
DP83869_GPIO1_CLK_OUT
@ DP83869_GPIO1_CLK_OUT
Definition: dp83869.h:132
DP83869_GPIO1_LED_2
@ DP83869_GPIO1_LED_2
Definition: dp83869.h:156
DP83869_GPIO0_WOL
@ DP83869_GPIO0_WOL
Definition: dp83869.h:98
DP83869_GPIO0_INT
@ DP83869_GPIO0_INT
Definition: dp83869.h:86
DP83869_LED_NUM
#define DP83869_LED_NUM
Number of LEDs available in the PHY.
Definition: dp83869.h:71
DP83869_LED_LINKED_1001000BT
@ DP83869_LED_LINKED_1001000BT
Definition: dp83869.h:207
DP83869_GPIO0_CLK_OUT
@ DP83869_GPIO0_CLK_OUT
Definition: dp83869.h:83
DP83869_LED_LINKED_10BT
@ DP83869_LED_LINKED_10BT
Definition: dp83869.h:201
phy_common.h
DP83869_GPIO1_WOL
@ DP83869_GPIO1_WOL
Definition: dp83869.h:147
DP83869_LED_COLLDET
@ DP83869_LED_COLLDET
Definition: dp83869.h:192
DP83869_GPIO1_INT
@ DP83869_GPIO1_INT
Definition: dp83869.h:135
Dp83869_config
int32_t Dp83869_config(EthPhyDrv_Handle hPhy, const void *pExtCfg, const uint32_t extCfgSize, Phy_Mii mii, bool loopbackEn)
Dp83869_Cfg::rxClkShiftEn
bool rxClkShiftEn
Definition: dp83869.h:231
Dp83869_bind
void Dp83869_bind(EthPhyDrv_Handle *hPhy, uint8_t phyAddr, Phy_RegAccessCb_t *pRegAccessCb)
DP83869_GPIO0_CRS
@ DP83869_GPIO0_CRS
Definition: dp83869.h:113
DP83869_LED_LINKED_10100BT
@ DP83869_LED_LINKED_10100BT
Definition: dp83869.h:204
DP83869_GPIO0_LINK_STATUS
@ DP83869_GPIO0_LINK_STATUS
Definition: dp83869.h:89
Dp83869_Cfg::gpio0Mode
Dp83869_Gpio0Mode gpio0Mode
Definition: dp83869.h:250
DP83869_GPIO0_COL
@ DP83869_GPIO0_COL
Definition: dp83869.h:116
DP83869_LED_FULLDUPLEX
@ DP83869_LED_FULLDUPLEX
Definition: dp83869.h:210
Dp83869_Cfg::gpio1Mode
Dp83869_Gpio1Mode gpio1Mode
Definition: dp83869.h:253
DP83869_LED_LINKED_BLINKACT
@ DP83869_LED_LINKED_BLINKACT
Definition: dp83869.h:213
Dp83869_isPhyDevSupported
bool Dp83869_isPhyDevSupported(EthPhyDrv_Handle hPhy, const void *pVersion)
DP83869_GPIO0_CONSTANT0
@ DP83869_GPIO0_CONSTANT0
Definition: dp83869.h:119
Dp83869_isResetComplete
bool Dp83869_isResetComplete(EthPhyDrv_Handle hPhy)