AM64x MCU+ SDK  08.02.00
enet_mod_phy.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 
40 #ifndef ENET_MOD_PHY_H_
41 #define ENET_MOD_PHY_H_
42 
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
46 
47 #include <stdint.h>
48 #include <include/core/enet_mod.h>
49 #include <include/phy/enetphy.h>
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /* ========================================================================== */
56 /* Macros */
57 /* ========================================================================== */
58 
60 #define ENET_PHY_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
61  ENET_IOCTL_PHY_BASE | \
62  ENET_IOCTL_MIN(x))
63 
64 /* ========================================================================== */
65 /* Structures and Enums */
66 /* ========================================================================== */
67 
72 {
81 
90 
99 
108 
118 
128 
137 
146 
155 
164 
173 
182 
191 
200 };
201 
205 typedef struct EnetPhy_GenericInArgs_s
206 {
210 
214 typedef struct EnetPhy_ReadRegInArgs_s
215 {
218 
220  uint16_t reg;
222 
226 typedef struct EnetPhy_WriteRegInArgs_s
227 {
230 
232  uint16_t reg;
233 
235  uint16_t val;
237 
241 typedef struct EnetPhy_C45ReadRegInArgs_s
242 {
245 
247  uint8_t mmd;
248 
250  uint16_t reg;
252 
256 typedef struct EnetPhy_C45WriteRegInArgs_s
257 {
260 
262  uint8_t mmd;
263 
265  uint16_t reg;
266 
268  uint16_t val;
270 
271 /* ========================================================================== */
272 /* Global Variables Declarations */
273 /* ========================================================================== */
274 
275 /* None */
276 
277 /* ========================================================================== */
278 /* Function Declarations */
279 /* ========================================================================== */
280 
281 /* None */
282 
283 /* ========================================================================== */
284 /* Deprecated Function Declarations */
285 /* ========================================================================== */
286 
287 /* None */
288 
289 /* ========================================================================== */
290 /* Static Function Definitions */
291 /* ========================================================================== */
292 
293 /* None */
294 
295 #ifdef __cplusplus
296 }
297 #endif
298 
299 #endif /* ENET_MOD_PHY_H_ */
EnetPhy_GenericInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_phy.h:208
EnetPhy_Ioctl_e
EnetPhy_Ioctl_e
PHY IOCTL commands.
Definition: enet_mod_phy.h:72
EnetPhy_WriteRegInArgs::reg
uint16_t reg
Definition: enet_mod_phy.h:232
ENET_PHY_IOCTL_READ_REG
@ ENET_PHY_IOCTL_READ_REG
Read PHY register.
Definition: enet_mod_phy.h:145
ENET_PHY_IOCTL_GET_LINK_MODE
@ ENET_PHY_IOCTL_GET_LINK_MODE
Get the link speed and duplexity state after the state machine has reached the LINKED state.
Definition: enet_mod_phy.h:127
ENET_PHY_IOCTL_C45_WRITE_REG
@ ENET_PHY_IOCTL_C45_WRITE_REG
Write PHY register using Clause-45 frame.
Definition: enet_mod_phy.h:190
EnetPhy_C45WriteRegInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_phy.h:259
ENET_PHY_IOCTL_GET_ID
@ ENET_PHY_IOCTL_GET_ID
Get PHY identification.
Definition: enet_mod_phy.h:80
EnetPhy_WriteRegInArgs
Input args for ENET_PHY_IOCTL_WRITE_EXT_REG command.
Definition: enet_mod_phy.h:227
ENET_PHY_IOCTL_WRITE_REG
@ ENET_PHY_IOCTL_WRITE_REG
Write PHY register.
Definition: enet_mod_phy.h:154
EnetPhy_C45ReadRegInArgs::reg
uint16_t reg
Definition: enet_mod_phy.h:250
ENET_PHY_IOCTL_RESET
@ ENET_PHY_IOCTL_RESET
Reset PHY.
Definition: enet_mod_phy.h:136
ENET_PHY_IOCTL_READ_EXT_REG
@ ENET_PHY_IOCTL_READ_EXT_REG
Read PHY extended register.
Definition: enet_mod_phy.h:163
EnetPhy_C45WriteRegInArgs::val
uint16_t val
Definition: enet_mod_phy.h:268
ENET_PHY_IOCTL_GET_SUPPORTED_MODES
@ ENET_PHY_IOCTL_GET_SUPPORTED_MODES
Get PHY supported modes by local PHY device.
Definition: enet_mod_phy.h:89
EnetPhy_GenericInArgs
Generic input args.
Definition: enet_mod_phy.h:206
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:406
EnetPhy_WriteRegInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_phy.h:229
EnetPhy_ReadRegInArgs::reg
uint16_t reg
Definition: enet_mod_phy.h:220
EnetPhy_C45ReadRegInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_phy.h:244
EnetPhy_C45WriteRegInArgs
Input args for ENET_PHY_IOCTL_C45_WRITE_REG command.
Definition: enet_mod_phy.h:257
EnetPhy_C45ReadRegInArgs
Input args for ENET_PHY_IOCTL_C45_READ_REG command.
Definition: enet_mod_phy.h:242
enetphy.h
This file contains the type definitions and helper macros for the Ethernet PHY interface.
ENET_PHY_IOCTL_WRITE_EXT_REG
@ ENET_PHY_IOCTL_WRITE_EXT_REG
Write PHY extended register.
Definition: enet_mod_phy.h:172
EnetPhy_C45WriteRegInArgs::mmd
uint8_t mmd
Definition: enet_mod_phy.h:262
ENET_PHY_IOCTL_IS_ALIVE
@ ENET_PHY_IOCTL_IS_ALIVE
Check PHY alive status.
Definition: enet_mod_phy.h:107
ENET_PHY_IOCTL_IS_LINKED
@ ENET_PHY_IOCTL_IS_LINKED
Check state-machine link state, that is, whether the state machine has reached the LINKED state.
Definition: enet_mod_phy.h:117
EnetPhy_WriteRegInArgs::val
uint16_t val
Definition: enet_mod_phy.h:235
EnetPhy_ReadRegInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_phy.h:217
ENET_PHY_IOCTL_PRINT_REGS
@ ENET_PHY_IOCTL_PRINT_REGS
Print PHY registers.
Definition: enet_mod_phy.h:199
EnetPhy_C45ReadRegInArgs::mmd
uint8_t mmd
Definition: enet_mod_phy.h:247
EnetPhy_ReadRegInArgs
Input args for ENET_PHY_IOCTL_READ_EXT_REG command.
Definition: enet_mod_phy.h:215
enet_mod.h
This file contains the type definitions and helper macros for the Enet Module interface.
ENET_PHY_PUBLIC_IOCTL
#define ENET_PHY_PUBLIC_IOCTL(x)
Helper macro to create PHY IOCTL commands.
Definition: enet_mod_phy.h:60
ENET_PHY_IOCTL_C45_READ_REG
@ ENET_PHY_IOCTL_C45_READ_REG
Read PHY register using Clause-45 frame.
Definition: enet_mod_phy.h:181
EnetPhy_C45WriteRegInArgs::reg
uint16_t reg
Definition: enet_mod_phy.h:265
ENET_PHY_IOCTL_GET_LOOPBACK_STATE
@ ENET_PHY_IOCTL_GET_LOOPBACK_STATE
Check if PHY is in loopback or not.
Definition: enet_mod_phy.h:98