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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
/**
* @file IxEthMii.h
*
* @brief this file contains the public API of @ref IxEthMii component
*
* Design notes :
* The main intent of this API is to inplement MII high level fonctionalitoes
* to support the codelets provided with the IXP400 software releases. It
* superceedes previous interfaces provided with @ref IxEThAcc component.
*
* This API has been tested with the PHYs provided with the
* IXP400 development platforms. It may not work for specific Ethernet PHYs
* used on specific boards.
*
* This source code detects and interface the LXT972, LXT973 and KS6995
* Ethernet PHYs.
*
* This source code should be considered as an example which may need
* to be adapted for different hardware implementations.
*
* It is strongly recommended to use public domain and GPL utilities
* like libmii, mii-diag for MII interface support.
*
*
*
* @par
* IXP400 SW Release version 2.0
*
* -- Copyright Notice --
*
* @par
* Copyright 2001-2005, Intel Corporation.
* All rights reserved.
*
* @par
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* @par
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @par
* -- End of Copyright Notice --
*/
#ifndef IxEthMii_H
#define IxEthMii_H
#include <IxTypes.h>
/**
* @defgroup IxEthMii IXP400 Ethernet Phy Access (IxEthMii) API
*
* @brief ethMii is a library that does provides access to the
* Ethernet PHYs
*
*@{
*/
/**
* @ingroup IxEthMii
*
* @fn ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount)
*
* @brief Scan the MDIO bus for PHYs
* This function scans PHY addresses 0 through 31, and sets phyPresent[n] to
* true if a phy is discovered at address n.
*
* - Reentrant - no
* - ISR Callable - no
*
* @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
*
* @param phyPresent BOOL [in] - boolean array of IXP425_ETH_ACC_MII_MAX_ADDR entries
* @param maxPhyCount UINT32 [in] - number of PHYs to search for (the scan will stop when
* the indicated number of PHYs is found).
*
* @return IX_STATUS
* - IX_ETH_ACC_SUCCESS
* - IX_ETH_ACC_FAIL : invalid arguments.
*
* <hr>
*/
PUBLIC IX_STATUS ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount);
/**
* @ingroup IxEthMii
*
* @fn ixEthMiiPhyConfig(UINT32 phyAddr,
BOOL speed100,
BOOL fullDuplex,
BOOL autonegotiate)
*
*
* @brief Configure a PHY
* Configure a PHY's speed, duplex and autonegotiation status
*
* - Reentrant - no
* - ISR Callable - no
*
* @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
*
* @param phyAddr UINT32 [in]
* @param speed100 BOOL [in] - set to true for 100Mbit/s operation, false for 10Mbit/s
* @param fullDuplex BOOL [in] - set to true for Full Duplex, false for Half Duplex
* @param autonegotiate BOOL [in] - set to true to enable autonegotiation
*
* @return IX_STATUS
* - IX_SUCCESS
* - IX_FAIL : invalid arguments.
*
* <hr>
*/
PUBLIC IX_STATUS ixEthMiiPhyConfig(UINT32 phyAddr,
BOOL speed100,
BOOL fullDuplex,
BOOL autonegotiate);
/**
* @ingroup IxEthMii
*
* @fn ixEthMiiPhyLoopbackEnable(UINT32 phyAddr)
*
*
* @brief Enable PHY Loopback in a specific Eth MII port
*
* @note When PHY Loopback is enabled, frames sent out to the PHY from the
* IXP400 will be looped back to the IXP400. They will not be transmitted out
* on the wire.
*
* - Reentrant - no
* - ISR Callable - no
*
* @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
*
* @return IX_STATUS
* - IX_SUCCESS
* - IX_FAIL : invalid arguments.
* <hr>
*/
PUBLIC IX_STATUS
ixEthMiiPhyLoopbackEnable (UINT32 phyAddr);
/**
* @ingroup IxEthMii
*
* @fn ixEthMiiPhyLoopbackDisable(UINT32 phyAddr)
*
*
* @brief Disable PHY Loopback in a specific Eth MII port
*
* - Reentrant - no
* - ISR Callable - no
*
* @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
*
* @return IX_STATUS
* - IX_SUCCESS
* - IX_FAIL : invalid arguments.
* <hr>
*/
PUBLIC IX_STATUS
ixEthMiiPhyLoopbackDisable (UINT32 phyAddr);
/**
* @ingroup IxEthMii
*
* @fn ixEthMiiPhyReset(UINT32 phyAddr)
*
* @brief Reset a PHY
* Reset a PHY
*
* - Reentrant - no
* - ISR Callable - no
*
* @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
*
* @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
*
* @return IX_STATUS
* - IX_SUCCESS
* - IX_FAIL : invalid arguments.
*
* <hr>
*/
PUBLIC IX_STATUS ixEthMiiPhyReset(UINT32 phyAddr);
/**
* @ingroup IxEthMii
*
* @fn ixEthMiiLinkStatus(UINT32 phyAddr,
BOOL *linkUp,
BOOL *speed100,
BOOL *fullDuplex,
BOOL *autoneg)
*
* @brief Retrieve the current status of a PHY
* Retrieve the link, speed, duplex and autonegotiation status of a PHY
*
* - Reentrant - no
* - ISR Callable - no
*
* @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
*
* @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
* @param linkUp BOOL [out] - set to true if the link is up
* @param speed100 BOOL [out] - set to true indicates 100Mbit/s, false indicates 10Mbit/s
* @param fullDuplex BOOL [out] - set to true indicates Full Duplex, false indicates Half Duplex
* @param autoneg BOOL [out] - set to true indicates autonegotiation is enabled, false indicates autonegotiation is disabled
*
* @return IX_STATUS
* - IX_SUCCESS
* - IX_FAIL : invalid arguments.
*
* <hr>
*/
PUBLIC IX_STATUS ixEthMiiLinkStatus(UINT32 phyAddr,
BOOL *linkUp,
BOOL *speed100,
BOOL *fullDuplex,
BOOL *autoneg);
/**
* @ingroup IxEthMii
*
* @fn ixEthMiiPhyShow (UINT32 phyAddr)
*
*
* @brief Display information on a specified PHY
* Display link status, speed, duplex and Auto Negotiation status
*
* - Reentrant - no
* - ISR Callable - no
*
* @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
*
* @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
*
* @return IX_STATUS
* - IX_SUCCESS
* - IX_FAIL : invalid arguments.
*
* <hr>
*/
PUBLIC IX_STATUS ixEthMiiPhyShow (UINT32 phyAddr);
#endif /* ndef IxEthMii_H */
/**
*@}
*/
|