AM263Px MCU+ SDK: dp83867.h Source File

| AM263Px MCU+ SDK 26.00.00 |

dp83867.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) Texas Instruments Incorporated 2020
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 DP83867_H_
50 #define DP83867_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 DP83867_LED_NUM (4U)
72
73 /* ========================================================================== */
74 /* Structures and Enums */
75 /* ========================================================================== */
76
80 typedef enum Dp83867_Gpio0Mode_e
81 {
83 DP83867_GPIO0_RXERR = 0x0U,
84
86 DP83867_GPIO0_1588TXSFD = 0x1U,
87
89 DP83867_GPIO0_1588RXSFD = 0x2U,
90
92 DP83867_GPIO0_WOL = 0x3U,
93
95 DP83867_GPIO0_ENERGYDET = 0x4U,
96
98 DP83867_GPIO0_LED3 = 0x6U,
99
101 DP83867_GPIO0_PRBSERR = 0x7U,
102
104 DP83867_GPIO0_CONSTANT0 = 0x8U,
105
107 DP83867_GPIO0_CONSTANT1 = 0x9U,
108 } Dp83867_Gpio0Mode;
109
113 typedef enum Dp83867_Gpio1Mode_e
114 {
116 DP83867_GPIO1_COL = 0x0U,
117
119 DP83867_GPIO1_1588TXSFD = 0x1U,
120
122 DP83867_GPIO1_1588RXSFD = 0x2U,
123
125 DP83867_GPIO1_WOL = 0x3U,
126
128 DP83867_GPIO1_ENERGYDET = 0x4U,
129
131 DP83867_GPIO1_LED3 = 0x6U,
132
134 DP83867_GPIO1_PRBSERR = 0x7U,
135
137 DP83867_GPIO1_CONSTANT0 = 0x8U,
138
140 DP83867_GPIO1_CONSTANT1 = 0x9U,
141 } Dp83867_Gpio1Mode;
142
146 typedef enum Dp83867_LedMode_e
147 {
149 DP83867_LED_LINKED = 0x0U,
150
152 DP83867_LED_RXTXACT = 0x1U,
153
155 DP83867_LED_TXACT = 0x2U,
156
158 DP83867_LED_RXACT = 0x3U,
159
161 DP83867_LED_COLLDET = 0x4U,
162
164 DP83867_LED_LINKED_1000BT = 0x5U,
165
167 DP83867_LED_LINKED_100BTX = 0x6U,
168
170 DP83867_LED_LINKED_10BT = 0x7U,
171
173 DP83867_LED_LINKED_10100BT = 0x8U,
174
176 DP83867_LED_LINKED_1001000BT = 0x9U,
177
179 DP83867_LED_FULLDUPLEX = 0xAU,
180
182 DP83867_LED_LINKED_BLINKACT = 0xBU,
183
185 DP83867_LED_RXTXERR = 0xDU,
186
188 DP83867_LED_RXERR = 0xEU,
189 } Dp83867_LedMode;
190
194 typedef struct Dp83867_Cfg_s
195 {
197 bool txClkShiftEn;
198
200 bool rxClkShiftEn;
201
203 uint32_t txDelayInPs;
204
206 uint32_t rxDelayInPs;
207
209 uint8_t txFifoDepth;
210
212 uint32_t idleCntThresh;
213
216 uint32_t impedanceInMilliOhms;
217
219 Dp83867_Gpio0Mode gpio0Mode;
220
222 Dp83867_Gpio1Mode gpio1Mode;
223
225 Dp83867_LedMode ledMode[DP83867_LED_NUM];
226 } Dp83867_Cfg;
227
228 /* ========================================================================== */
229 /* Global Variables Declarations */
230 /* ========================================================================== */
231
232 /* None */
233
234 /* ========================================================================== */
235 /* Function Declarations */
236 /* ========================================================================== */
237
245 void Dp83867_initCfg(Dp83867_Cfg *cfg);
246
247 void Dp83867_bind(EthPhyDrv_Handle* hPhy,
248 uint8_t phyAddr,
249 Phy_RegAccessCb_t* pRegAccessCb);
250
251 bool Dp83867_isPhyDevSupported(EthPhyDrv_Handle hPhy,
252 const void *pVersion);
253
254 bool Dp83867_isMacModeSupported(EthPhyDrv_Handle hPhy,
255 Phy_Mii mii);
256
257 int32_t Dp83867_config(EthPhyDrv_Handle hPhy,
258 const void *pExtCfg,
259 const uint32_t extCfgSize,
260 Phy_Mii mii,
261 bool loopbackEn);
262
263 void Dp83867_reset(EthPhyDrv_Handle hPhy);
264
265 bool Dp83867_isResetComplete(EthPhyDrv_Handle hPhy);
266
267 void Dp83867_printRegs(EthPhyDrv_Handle hPhy);
268
269 /* ========================================================================== */
270 /* Deprecated Function Declarations */
271 /* ========================================================================== */
272
273 /* None */
274
275 /* ========================================================================== */
276 /* Static Function Definitions */
277 /* ========================================================================== */
278
279 /* None */
280
281 #ifdef __cplusplus
282 }
283 #endif
284
285 #endif /* DP83867_H_ */
286
DP83867_GPIO1_LED3
@ DP83867_GPIO1_LED3
Definition: dp83867.h:131
Dp83867_Cfg::impedanceInMilliOhms
uint32_t impedanceInMilliOhms
Definition: dp83867.h:216
Dp83867_Cfg::idleCntThresh
uint32_t idleCntThresh
Definition: dp83867.h:212
DP83867_LED_LINKED_10BT
@ DP83867_LED_LINKED_10BT
Definition: dp83867.h:170
DP83867_GPIO0_1588RXSFD
@ DP83867_GPIO0_1588RXSFD
Definition: dp83867.h:89
DP83867_LED_FULLDUPLEX
@ DP83867_LED_FULLDUPLEX
Definition: dp83867.h:179
DP83867_GPIO0_1588TXSFD
@ DP83867_GPIO0_1588TXSFD
Definition: dp83867.h:86
Dp83867_Cfg::gpio1Mode
Dp83867_Gpio1Mode gpio1Mode
Definition: dp83867.h:222
Dp83867_LedMode
Dp83867_LedMode
LED modes (sources).
Definition: dp83867.h:147
Dp83867_initCfg
void Dp83867_initCfg(Dp83867_Cfg *cfg)
Initialize DP83867 PHY specific config params.
Dp83867_Cfg::gpio0Mode
Dp83867_Gpio0Mode gpio0Mode
Definition: dp83867.h:219
Phy_RegAccessCb_t
Definition: phy_common.h:283
DP83867_GPIO1_ENERGYDET
@ DP83867_GPIO1_ENERGYDET
Definition: dp83867.h:128
DP83867_LED_RXERR
@ DP83867_LED_RXERR
Definition: dp83867.h:188
DP83867_LED_LINKED
@ DP83867_LED_LINKED
Definition: dp83867.h:149
DP83867_LED_LINKED_BLINKACT
@ DP83867_LED_LINKED_BLINKACT
Definition: dp83867.h:182
DP83867_GPIO1_WOL
@ DP83867_GPIO1_WOL
Definition: dp83867.h:125
DP83867_GPIO0_PRBSERR
@ DP83867_GPIO0_PRBSERR
Definition: dp83867.h:101
EthPhyDrv_Handle
uint8_t EthPhyDrv_Handle[ETHPHYDRV_MAX_OBJ_SIZE]
Definition: phy_common.h:302
DP83867_GPIO0_RXERR
@ DP83867_GPIO0_RXERR
Definition: dp83867.h:83
DP83867_GPIO0_LED3
@ DP83867_GPIO0_LED3
Definition: dp83867.h:98
DP83867_LED_LINKED_1000BT
@ DP83867_LED_LINKED_1000BT
Definition: dp83867.h:164
Phy_Mii
Phy_Mii
Definition: phy_common.h:220
Dp83867_bind
void Dp83867_bind(EthPhyDrv_Handle *hPhy, uint8_t phyAddr, Phy_RegAccessCb_t *pRegAccessCb)
DP83867_LED_RXACT
@ DP83867_LED_RXACT
Definition: dp83867.h:158
DP83867_LED_COLLDET
@ DP83867_LED_COLLDET
Definition: dp83867.h:161
Dp83867_reset
void Dp83867_reset(EthPhyDrv_Handle hPhy)
Dp83867_Gpio1Mode
Dp83867_Gpio1Mode
GPIO_1 mux modes.
Definition: dp83867.h:114
DP83867_GPIO1_PRBSERR
@ DP83867_GPIO1_PRBSERR
Definition: dp83867.h:134
Dp83867_printRegs
void Dp83867_printRegs(EthPhyDrv_Handle hPhy)
Dp83867_Cfg::txClkShiftEn
bool txClkShiftEn
Definition: dp83867.h:197
DP83867_GPIO0_ENERGYDET
@ DP83867_GPIO0_ENERGYDET
Definition: dp83867.h:95
DP83867_LED_LINKED_100BTX
@ DP83867_LED_LINKED_100BTX
Definition: dp83867.h:167
Dp83867_Cfg::txFifoDepth
uint8_t txFifoDepth
Definition: dp83867.h:209
DP83867_GPIO1_COL
@ DP83867_GPIO1_COL
Definition: dp83867.h:116
Dp83867_Cfg::rxDelayInPs
uint32_t rxDelayInPs
Definition: dp83867.h:206
Dp83867_Gpio0Mode
Dp83867_Gpio0Mode
GPIO_0 mux modes.
Definition: dp83867.h:81
Dp83867_isPhyDevSupported
bool Dp83867_isPhyDevSupported(EthPhyDrv_Handle hPhy, const void *pVersion)
Dp83867_Cfg::rxClkShiftEn
bool rxClkShiftEn
Definition: dp83867.h:200
DP83867_GPIO0_WOL
@ DP83867_GPIO0_WOL
Definition: dp83867.h:92
DP83867_LED_RXTXACT
@ DP83867_LED_RXTXACT
Definition: dp83867.h:152
DP83867_GPIO1_1588RXSFD
@ DP83867_GPIO1_1588RXSFD
Definition: dp83867.h:122
DP83867_LED_RXTXERR
@ DP83867_LED_RXTXERR
Definition: dp83867.h:185
DP83867_LED_LINKED_10100BT
@ DP83867_LED_LINKED_10100BT
Definition: dp83867.h:173
DP83867_GPIO1_CONSTANT0
@ DP83867_GPIO1_CONSTANT0
Definition: dp83867.h:137
phy_common.h
DP83867_LED_NUM
#define DP83867_LED_NUM
Number of LEDs available in the PHY.
Definition: dp83867.h:71
Dp83867_isMacModeSupported
bool Dp83867_isMacModeSupported(EthPhyDrv_Handle hPhy, Phy_Mii mii)
DP83867_GPIO1_CONSTANT1
@ DP83867_GPIO1_CONSTANT1
Definition: dp83867.h:140
Dp83867_config
int32_t Dp83867_config(EthPhyDrv_Handle hPhy, const void *pExtCfg, const uint32_t extCfgSize, Phy_Mii mii, bool loopbackEn)
Dp83867_Cfg::txDelayInPs
uint32_t txDelayInPs
Definition: dp83867.h:203
DP83867_GPIO0_CONSTANT1
@ DP83867_GPIO0_CONSTANT1
Definition: dp83867.h:107
Dp83867_Cfg
DP83867 PHY configuration parameters.
Definition: dp83867.h:195
DP83867_GPIO1_1588TXSFD
@ DP83867_GPIO1_1588TXSFD
Definition: dp83867.h:119
DP83867_LED_TXACT
@ DP83867_LED_TXACT
Definition: dp83867.h:155
Dp83867_isResetComplete
bool Dp83867_isResetComplete(EthPhyDrv_Handle hPhy)
DP83867_LED_LINKED_1001000BT
@ DP83867_LED_LINKED_1001000BT
Definition: dp83867.h:176
DP83867_GPIO0_CONSTANT0
@ DP83867_GPIO0_CONSTANT0
Definition: dp83867.h:104