PDK API Guide for J721E
cpsw_macport_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 
41 #ifndef CPSW_MACPORT_PRIV_H_
42 #define CPSW_MACPORT_PRIV_H_
43 
44 /* ========================================================================== */
45 /* Include Files */
46 /* ========================================================================== */
47 
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 /* ========================================================================== */
56 /* Macros */
57 /* ========================================================================== */
58 
60 #define CPSW_MACPORT_PRIVATE_IOCTL(x) (ENET_IOCTL_TYPE_PRIVATE | \
61  ENET_IOCTL_MACPORT_BASE | \
62  ENET_IOCTL_PER_CPSW | \
63  ENET_IOCTL_MIN(x))
64 
66 #define CPSW_MACPORT_FEATURE_SGMII (ENET_BIT(0U))
67 
69 #define CPSW_MACPORT_FEATURE_INTERVLAN (ENET_BIT(1U))
70 
72 #define CPSW_MACPORT_INTERVLAN_ROUTEID_BASE (1U)
73 
75 #define CPSW_MACPORT_INTERVLAN_ROUTE_MAX (CPSW_MACPORT_INTERVLAN_ROUTEID_LAST - \
76  CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST + 1U)
77 
79 #define CPSW_MACPORT_INTERVLAN_ROUTE2PTR(routeId) (CPSW_MACPORT_INTERVLAN_ROUTEID_BASE + \
80  (routeId) - CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST)
81 
82 /* ========================================================================== */
83 /* Structures and Enums */
84 /* ========================================================================== */
85 
89 typedef enum CpswMacPort_PrivIoctls_e
90 {
99 
108 
117 
126 
135 
144 
153 
163 
172 
181 
190 
199 
209 
213 typedef struct CpswMacPort_SetSpecificInterVlanRouteInArgs_s
214 {
217 
221 
225 typedef struct CpswMacPort_InterVlanFreeRouteInfo_s
226 {
228  uint32_t numFreeRoutes;
229 
233 
242 typedef struct CpswMacPort_ModCfg_s
243 {
246 
249 
253 
257 typedef struct CpswMacPort_Obj_s
258 {
261 
264 
267 
269  uint32_t instId;
271 
276 
277 /* ========================================================================== */
278 /* Global Variables Declarations */
279 /* ========================================================================== */
280 
281 /* None */
282 
283 /* ========================================================================== */
284 /* Function Declarations */
285 /* ========================================================================== */
286 
298 int32_t CpswMacPort_open(EnetMod_Handle hMod,
299  Enet_Type enetType,
300  uint32_t instId,
301  const void *cfg,
302  uint32_t cfgSize);
303 
314  Enet_Type enetType,
315  uint32_t instId);
316 
326 int32_t CpswMacPort_ioctl(EnetMod_Handle hMod,
327  uint32_t cmd,
328  Enet_IoctlPrms *prms);
329 
336 
337 /* ========================================================================== */
338 /* Deprecated Function Declarations */
339 /* ========================================================================== */
340 
341 /* None */
342 
343 /* ========================================================================== */
344 /* Static Function Definitions */
345 /* ========================================================================== */
346 
347 /* None */
348 
349 #ifdef __cplusplus
350 }
351 #endif
352 
353 #endif /* CPSW_MACPORT_PRIV_H_ */
Get SGMII auto-negotiate link status from the SGMII status register.
Definition: cpsw_macport_priv.h:198
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
Find interVLAN route id matching the given route params.
Definition: cpsw_macport_priv.h:162
MAC port interface.
Definition: enet_mod_macport.h:273
CpswMacPort_Cfg macCfg
Definition: cpsw_macport_priv.h:245
EnetMacPort_LinkCfg linkCfg
Definition: cpsw_macport_priv.h:251
Link speed and duplexity configuration.
Definition: enet_mod_macport.h:288
Check if given interVLAN route is free.
Definition: cpsw_macport_priv.h:171
Get interVLAN free routes available for the given egress port.
Definition: cpsw_macport_priv.h:152
#define CPSW_MACPORT_INTERVLAN_ROUTE_MAX
Maximum number of interVLAN routes available per egress port.
Definition: cpsw_macport_priv.h:75
This file contains the type definitions and helper macros for the Enet MAC port module interface.
Set interVLAN config for egress MAC port at given route index.
Definition: cpsw_macport_priv.h:125
Ethernet Module object.
Definition: enet_mod.h:136
Disable MAC port.
Definition: cpsw_macport_priv.h:107
CpswMacPort_Obj * CpswMacPort_Handle
MAC port module handle.
Definition: cpsw_macport_priv.h:275
Delete the specified interVlan route.
Definition: cpsw_macport_priv.h:143
MAC port module configuration parameters.
Definition: cpsw_macport_priv.h:242
Get SGMII link status from the SGMII status register.
Definition: cpsw_macport_priv.h:207
Port interVLAN configuration parameters.
Definition: cpsw_macport.h:184
EnetMod_Obj enetMod
Definition: cpsw_macport_priv.h:260
Information on free interVLAN routes available for an egress port.
Definition: cpsw_macport_priv.h:225
EnetMacPort_Interface mii
Definition: cpsw_macport_priv.h:248
Enable MAC port.
Definition: cpsw_macport_priv.h:98
int32_t CpswMacPort_ioctl(EnetMod_Handle hMod, uint32_t cmd, Enet_IoctlPrms *prms)
Run an IOCTL operation on CPSW MAC port.
CPSW MAC port object.
Definition: cpsw_macport_priv.h:257
Set transmit short gap configuration for MAC port.
Definition: cpsw_macport_priv.h:180
Get interVLAN config for egress MAC port.
Definition: cpsw_macport_priv.h:134
Enet IOCTL param.
Definition: enet_ioctl.h:232
uint32_t numFreeRoutes
Definition: cpsw_macport_priv.h:228
This file contains the type definitions and helper macros for the CPSW MAC port module interface.
CpswMacPort_InterVlanRoutingCfg routeCfg
Definition: cpsw_macport_priv.h:219
void CpswMacPort_close(EnetMod_Handle hMod)
Close CPSW MAC port.
#define CPSW_MACPORT_PRIVATE_IOCTL(x)
Helper macro to create private IOCTL commands for CPSW MAC port module.
Definition: cpsw_macport_priv.h:60
CpswMacPort_PrivIoctls
MAC port private IOCTL commands.
Definition: cpsw_macport_priv.h:89
Alloc free route and set interVLAN config for egress MAC port.
Definition: cpsw_macport_priv.h:116
Enet_MacPort
MAC port.
Definition: enet_types.h:402
Enet_MacPort macPort
Definition: cpsw_macport_priv.h:263
struct EnetMod_Obj_s * EnetMod_Handle
Ethernet Module handle.
Definition: enet_mod.h:71
CpswMacPort_InterVlanRouteId
MAC port interVLAN route identifier.
Definition: cpsw_macport.h:160
Get transmit short gap configuration for MAC port.
Definition: cpsw_macport_priv.h:189
int32_t CpswMacPort_open(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize CPSW MAC port.
CpswMacPort_InterVlanRouteId routeId
Definition: cpsw_macport_priv.h:216
Input args for CPSW_MACPORT_IOCTL_SET_SPECIFIC_INTERVLAN_ROUTE command.
Definition: cpsw_macport_priv.h:213
uint32_t instId
Definition: cpsw_macport_priv.h:269
MAC port module configuration parameters.
Definition: cpsw_macport.h:359
int32_t CpswMacPort_rejoin(EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId)
Rejoin a running CPSW MAC port.
Enet_Type enetType
Definition: cpsw_macport_priv.h:266