PDK API Guide for J721E
mdio_priv.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 MDIO_PRIV_H_
41 #define MDIO_PRIV_H_
42 
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
46 
47 #include <stdint.h>
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /* ========================================================================== */
55 /* Macros */
56 /* ========================================================================== */
57 
59 #define MDIO_PRIVATE_IOCTL(x) (ENET_IOCTL_TYPE_PRIVATE | \
60  ENET_IOCTL_MDIO_BASE | \
61  ENET_IOCTL_PER_CPSW | \
62  ENET_IOCTL_MIN(x))
63 
65 #define MDIO_FEATURE_CLAUSE45 (ENET_BIT(0U))
66 
67 /* ========================================================================== */
68 /* Structures and Enums */
69 /* ========================================================================== */
70 
74 typedef enum Mdio_PrivIoctls_e
75 {
86 
92 typedef struct Mdio_PhyStatus_s
93 {
95  uint32_t aliveMask;
96 
98  uint32_t linkedMask;
100 
112  Mdio_PhyStatus *phyStatus,
113  void *cbArgs);
114 
123  uint8_t phyAddr,
124  void *cbArgs);
125 
132 typedef struct Mdio_Callbacks_s
133 {
136 
139 
141  void *cbArgs;
143 
147 typedef struct Mdio_Obj_s
148 {
151 
155  bool isMaster;
156 
157 
161 } Mdio_Obj;
162 
167 
168 /* ========================================================================== */
169 /* Global Variables Declarations */
170 /* ========================================================================== */
171 
172 /* None */
173 
174 /* ========================================================================== */
175 /* Function Declarations */
176 /* ========================================================================== */
177 
189 int32_t Mdio_open(EnetMod_Handle hMod,
190  Enet_Type enetType,
191  uint32_t instId,
192  const void *cfg,
193  uint32_t cfgSize);
194 
204 int32_t Mdio_rejoin(EnetMod_Handle hMod,
205  Enet_Type enetType,
206  uint32_t instId);
207 
217 int32_t Mdio_ioctl(EnetMod_Handle hMod,
218  uint32_t cmd,
219  Enet_IoctlPrms *prms);
220 
231  uint32_t cmd,
232  Enet_IoctlPrms *prms);
233 
239 void Mdio_close(EnetMod_Handle hMod);
240 
241 /* ========================================================================== */
242 /* Deprecated Function Declarations */
243 /* ========================================================================== */
244 
245 /* None */
246 
247 /* ========================================================================== */
248 /* Static Function Definitions */
249 /* ========================================================================== */
250 
251 /* None */
252 
253 #ifdef __cplusplus
254 }
255 #endif
256 
257 #endif /* MDIO_PRIV_H_ */
uint32_t linkedMask
Definition: mdio_priv.h:98
Mdio_Obj * Mdio_Handle
MDIO module handle.
Definition: mdio_priv.h:166
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
int32_t Mdio_rejoin(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId)
Rejoin a running MDIO.
uint32_t mdc_halfPeriodInNsec
Definition: mdio_priv.h:160
This file contains the type definitions and helper macros for the Enet MDIO module.
EnetMod_Obj enetMod
Definition: mdio_priv.h:150
int32_t Mdio_ioctlManualMode(EnetMod_Handle hMod, uint32_t cmd, Enet_IoctlPrms *prms)
Run an IOCTL operation on MDIO when MDIO manual mode is enabled.
void(* Mdio_LinkStateCallback)(EnetMdio_Group group, Mdio_PhyStatus *phyStatus, void *cbArgs)
MDIO link state change callback function.
Definition: mdio_priv.h:111
Ethernet Module object.
Definition: enet_mod.h:136
int32_t Mdio_open(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize MDIO.
MDIO callback functions.
Definition: mdio_priv.h:132
bool isMaster
Definition: mdio_priv.h:155
void Mdio_close(EnetMod_Handle hMod)
Close MDIO.
Handle MDIO_INTR which combines MDIO_LINKINT and MDIO_USERINT events.
Definition: mdio_priv.h:84
#define MDIO_PRIVATE_IOCTL(x)
Helper macro to create private IOCTL commands for MDIO module.
Definition: mdio_priv.h:59
Mdio_UserAccessCallback userAccessCb
Definition: mdio_priv.h:138
Enet IOCTL param.
Definition: enet_ioctl.h:232
void(* Mdio_UserAccessCallback)(EnetMdio_Group group, uint8_t phyAddr, void *cbArgs)
MDIO user access completion callback function.
Definition: mdio_priv.h:122
Mdio_LinkStateCallback linkStateCb
Definition: mdio_priv.h:135
gptp_ipc_command_t cmd
Definition: gptpipc.h:140
void * cbArgs
Definition: mdio_priv.h:141
EnetMdio_Group
MDIO user group.
Definition: enet_mod_mdio.h:188
MDIO PHY status.
Definition: mdio_priv.h:92
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
int32_t Mdio_ioctl(EnetMod_Handle hMod, uint32_t cmd, Enet_IoctlPrms *prms)
Run an IOCTL operation on MDIO.
Mdio_PrivIoctls
MDIO private IOCTL commands.
Definition: mdio_priv.h:74
uint32_t aliveMask
Definition: mdio_priv.h:95
MDIO port object.
Definition: mdio_priv.h:147