PDK API Guide for AM65xx
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 } Mdio_Obj;
157 
162 
163 /* ========================================================================== */
164 /* Global Variables Declarations */
165 /* ========================================================================== */
166 
167 /* None */
168 
169 /* ========================================================================== */
170 /* Function Declarations */
171 /* ========================================================================== */
172 
184 int32_t Mdio_open(EnetMod_Handle hMod,
185  Enet_Type enetType,
186  uint32_t instId,
187  const void *cfg,
188  uint32_t cfgSize);
189 
199 int32_t Mdio_rejoin(EnetMod_Handle hMod,
200  Enet_Type enetType,
201  uint32_t instId);
202 
212 int32_t Mdio_ioctl(EnetMod_Handle hMod,
213  uint32_t cmd,
214  Enet_IoctlPrms *prms);
215 
221 void Mdio_close(EnetMod_Handle hMod);
222 
223 /* ========================================================================== */
224 /* Deprecated Function Declarations */
225 /* ========================================================================== */
226 
227 /* None */
228 
229 /* ========================================================================== */
230 /* Static Function Definitions */
231 /* ========================================================================== */
232 
233 /* None */
234 
235 #ifdef __cplusplus
236 }
237 #endif
238 
239 #endif /* MDIO_PRIV_H_ */
uint32_t linkedMask
Definition: mdio_priv.h:98
Mdio_Obj * Mdio_Handle
MDIO module handle.
Definition: mdio_priv.h:161
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.
This file contains the type definitions and helper macros for the Enet MDIO module.
EnetMod_Obj enetMod
Definition: mdio_priv.h:150
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:229
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
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