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 
48 #if ENET_CFG_IS_ON(CPSW_MACPORT_EST)
50 #endif
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 /* ========================================================================== */
59 /* Macros */
60 /* ========================================================================== */
61 
63 #define CPSW_MACPORT_PRIVATE_IOCTL(x) (ENET_IOCTL_TYPE_PRIVATE | \
64  ENET_IOCTL_MACPORT_BASE | \
65  ENET_IOCTL_PER_CPSW | \
66  ENET_IOCTL_MIN(x))
67 
69 #define CPSW_MACPORT_FEATURE_SGMII (ENET_BIT(0U))
70 
72 #define CPSW_MACPORT_FEATURE_INTERVLAN (ENET_BIT(1U))
73 
75 #define CPSW_MACPORT_FEATURE_EST (ENET_BIT(2U))
76 
78 #define CPSW_MACPORT_ERRATA_SOFTRESET (ENET_BIT(0U))
79 
81 #define CPSW_MACPORT_INTERVLAN_ROUTEID_BASE (1U)
82 
84 #define CPSW_MACPORT_INTERVLAN_ROUTE_MAX (CPSW_MACPORT_INTERVLAN_ROUTEID_LAST - \
85  CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST + 1U)
86 
88 #define CPSW_MACPORT_INTERVLAN_ROUTE2PTR(routeId) (CPSW_MACPORT_INTERVLAN_ROUTEID_BASE + \
89  (routeId) - CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST)
90 
91 /* ========================================================================== */
92 /* Structures and Enums */
93 /* ========================================================================== */
94 
98 typedef enum CpswMacPort_PrivIoctls_e
99 {
108 
117 
126 
135 
144 
153 
162 
172 
181 
190 
199 
208 
218 
222 typedef struct CpswMacPort_SetSpecificInterVlanRouteInArgs_s
223 {
226 
230 
234 typedef struct CpswMacPort_InterVlanFreeRouteInfo_s
235 {
237  uint32_t numFreeRoutes;
238 
242 
251 typedef struct CpswMacPort_ModCfg_s
252 {
255 
258 
262 
266 typedef struct CpswMacPort_Obj_s
267 {
270 
273 
276 
278  uint32_t instId;
279 
281  bool enabled;
282 
285 
286 #if ENET_CFG_IS_ON(CPSW_MACPORT_EST)
287 
289 
291  EnetTas_ControlList adminList;
292 
294  EnetTas_ControlList operList;
295 
297  bool estBufUpper;
298 
300  EnetTas_ConfigStatus configStatus;
301 #endif
303 
308 
309 /* ========================================================================== */
310 /* Global Variables Declarations */
311 /* ========================================================================== */
312 
313 /* None */
314 
315 /* ========================================================================== */
316 /* Function Declarations */
317 /* ========================================================================== */
318 
330 int32_t CpswMacPort_open(EnetMod_Handle hMod,
331  Enet_Type enetType,
332  uint32_t instId,
333  const void *cfg,
334  uint32_t cfgSize);
335 
346  Enet_Type enetType,
347  uint32_t instId);
348 
358 int32_t CpswMacPort_ioctl(EnetMod_Handle hMod,
359  uint32_t cmd,
360  Enet_IoctlPrms *prms);
361 
368 
369 /* ========================================================================== */
370 /* Deprecated Function Declarations */
371 /* ========================================================================== */
372 
373 /* None */
374 
375 /* ========================================================================== */
376 /* Static Function Definitions */
377 /* ========================================================================== */
378 
379 /* None */
380 
381 #ifdef __cplusplus
382 }
383 #endif
384 
385 #endif /* CPSW_MACPORT_PRIV_H_ */
Get SGMII auto-negotiate link status from the SGMII status register.
Definition: cpsw_macport_priv.h:207
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
Find interVLAN route id matching the given route params.
Definition: cpsw_macport_priv.h:171
MAC port interface.
Definition: enet_mod_macport.h:273
EnetTas_TasState
TAS state types.
Definition: enet_mod_tas.h:219
CpswMacPort_Cfg macCfg
Definition: cpsw_macport_priv.h:254
EnetMacPort_LinkCfg linkCfg
Definition: cpsw_macport_priv.h:260
Link speed and duplexity configuration.
Definition: enet_mod_macport.h:288
Check if given interVLAN route is free.
Definition: cpsw_macport_priv.h:180
Get interVLAN free routes available for the given egress port.
Definition: cpsw_macport_priv.h:161
#define CPSW_MACPORT_INTERVLAN_ROUTE_MAX
Maximum number of interVLAN routes available per egress port.
Definition: cpsw_macport_priv.h:84
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:134
Ethernet Module object.
Definition: enet_mod.h:136
Disable MAC port.
Definition: cpsw_macport_priv.h:116
CpswMacPort_Obj * CpswMacPort_Handle
MAC port module handle.
Definition: cpsw_macport_priv.h:307
Delete the specified interVlan route.
Definition: cpsw_macport_priv.h:152
MAC port module configuration parameters.
Definition: cpsw_macport_priv.h:251
Get SGMII link status from the SGMII status register.
Definition: cpsw_macport_priv.h:216
Port interVLAN configuration parameters.
Definition: cpsw_macport.h:213
Gate control list. See IEEE Std 802.1Q-2018 8.6.9.4 D3-1.
Definition: enet_mod_tas.h:254
Config state machine variables. See IEEE Std 802.1Q-2018 8.6.8.4.
Definition: enet_mod_tas.h:277
EnetMod_Obj enetMod
Definition: cpsw_macport_priv.h:269
Information on free interVLAN routes available for an egress port.
Definition: cpsw_macport_priv.h:234
EnetMacPort_Interface mii
Definition: cpsw_macport_priv.h:257
Enable MAC port.
Definition: cpsw_macport_priv.h:107
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:266
Set transmit short gap configuration for MAC port.
Definition: cpsw_macport_priv.h:189
Get interVLAN config for egress MAC port.
Definition: cpsw_macport_priv.h:143
uint8_t state
Definition: tisci_pm_clock.h:130
Enet IOCTL param.
Definition: enet_ioctl.h:232
uint32_t numFreeRoutes
Definition: cpsw_macport_priv.h:237
This file contains the type definitions and helper macros for the CPSW MAC port module interface.
gptp_ipc_command_t cmd
Definition: gptpipc.h:140
CpswMacPort_InterVlanRoutingCfg routeCfg
Definition: cpsw_macport_priv.h:228
void CpswMacPort_close(EnetMod_Handle hMod)
Close CPSW MAC port.
bool enabled
Definition: cpsw_macport_priv.h:281
This file contains the type definitions and helper macros for the Enet Time Aware Shaper (TAS) module...
#define CPSW_MACPORT_PRIVATE_IOCTL(x)
Helper macro to create private IOCTL commands for CPSW MAC port module.
Definition: cpsw_macport_priv.h:63
CpswMacPort_PrivIoctls
MAC port private IOCTL commands.
Definition: cpsw_macport_priv.h:98
Alloc free route and set interVLAN config for egress MAC port.
Definition: cpsw_macport_priv.h:125
Enet_MacPort
MAC port.
Definition: enet_types.h:405
Enet_MacPort macPort
Definition: cpsw_macport_priv.h:272
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:189
Get transmit short gap configuration for MAC port.
Definition: cpsw_macport_priv.h:198
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.
EnetMacPort_LinkCfg linkCfg
Definition: cpsw_macport_priv.h:284
CpswMacPort_InterVlanRouteId routeId
Definition: cpsw_macport_priv.h:225
Input args for CPSW_MACPORT_IOCTL_SET_SPECIFIC_INTERVLAN_ROUTE command.
Definition: cpsw_macport_priv.h:222
uint32_t instId
Definition: cpsw_macport_priv.h:278
MAC port module configuration parameters.
Definition: cpsw_macport.h:452
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:275