PDK API Guide for J721E
cpsw_macport_priv.h File Reference

Introduction

This file contains private type definitions and helper macros for the CPSW MAC port module which are meant for internal use in Enet Per drivers.

Go to the source code of this file.

Data Structures

struct  CpswMacPort_SetSpecificInterVlanRouteInArgs
 Input args for CPSW_MACPORT_IOCTL_SET_SPECIFIC_INTERVLAN_ROUTE command. More...
 
struct  CpswMacPort_InterVlanFreeRouteInfo
 Information on free interVLAN routes available for an egress port. More...
 
struct  CpswMacPort_ModCfg
 MAC port module configuration parameters. More...
 
struct  CpswMacPort_Obj
 CPSW MAC port object. More...
 

Macros

#define CPSW_MACPORT_PRIVATE_IOCTL(x)
 Helper macro to create private IOCTL commands for CPSW MAC port module. More...
 
#define CPSW_MACPORT_FEATURE_SGMII   (ENET_BIT(0U))
 SGMII feature mask. More...
 
#define CPSW_MACPORT_FEATURE_INTERVLAN   (ENET_BIT(1U))
 InterVLAN feature mask. More...
 
#define CPSW_MACPORT_INTERVLAN_ROUTEID_BASE   (1U)
 Base InterVLAN Route Id. More...
 
#define CPSW_MACPORT_INTERVLAN_ROUTE_MAX
 Maximum number of interVLAN routes available per egress port. More...
 
#define CPSW_MACPORT_INTERVLAN_ROUTE2PTR(routeId)
 Convert route id to pointer. More...
 

Typedefs

typedef CpswMacPort_ObjCpswMacPort_Handle
 MAC port module handle. More...
 

Enumerations

enum  CpswMacPort_PrivIoctls {
  CPSW_MACPORT_IOCTL_ENABLE = CPSW_MACPORT_PRIVATE_IOCTL(0U), CPSW_MACPORT_IOCTL_DISABLE = CPSW_MACPORT_PRIVATE_IOCTL(1U), CPSW_MACPORT_IOCTL_SET_INTERVLAN_ROUTE = CPSW_MACPORT_PRIVATE_IOCTL(2U), CPSW_MACPORT_IOCTL_SET_SPECIFIC_INTERVLAN_ROUTE = CPSW_MACPORT_PRIVATE_IOCTL(3U),
  CPSW_MACPORT_IOCTL_GET_INTERVLAN_ROUTE = CPSW_MACPORT_PRIVATE_IOCTL(4U), CPSW_MACPORT_IOCTL_DELETE_INTERVLAN_ROUTE = CPSW_MACPORT_PRIVATE_IOCTL(5U), CPSW_MACPORT_IOCTL_GET_INTERVLAN_FREEROUTES = CPSW_MACPORT_PRIVATE_IOCTL(6U), CPSW_MACPORT_IOCTL_FIND_INTERVLAN_ROUTE = CPSW_MACPORT_PRIVATE_IOCTL(7U),
  CPSW_MACPORT_IOCTL_IS_INTERVLAN_ROUTE_FREE = CPSW_MACPORT_PRIVATE_IOCTL(8U), CPSW_MACPORT_IOCTL_SET_SHORT_IPG = CPSW_MACPORT_PRIVATE_IOCTL(9U), CPSW_MACPORT_IOCTL_GET_SHORT_IPG = CPSW_MACPORT_PRIVATE_IOCTL(10U), CPSW_MACPORT_IOCTL_GET_SGMII_AUTONEG_LINK_STATUS = CPSW_MACPORT_PRIVATE_IOCTL(11U),
  CPSW_MACPORT_IOCTL_GET_SGMII_LINK_STATUS = CPSW_MACPORT_PRIVATE_IOCTL(12U)
}
 MAC port private IOCTL commands. More...
 

Functions

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. More...
 
int32_t CpswMacPort_rejoin (EnetMod_Handle hMod, Enet_Type enetType, uint32_t instId)
 Rejoin a running CPSW MAC port. More...
 
int32_t CpswMacPort_ioctl (EnetMod_Handle hMod, uint32_t cmd, Enet_IoctlPrms *prms)
 Run an IOCTL operation on CPSW MAC port. More...
 
void CpswMacPort_close (EnetMod_Handle hMod)
 Close CPSW MAC port. More...
 

Macro Definition Documentation

◆ CPSW_MACPORT_PRIVATE_IOCTL

#define CPSW_MACPORT_PRIVATE_IOCTL (   x)
Value:
ENET_IOCTL_MACPORT_BASE | \
ENET_IOCTL_PER_CPSW | \
ENET_IOCTL_MIN(x))
Definition: enet_ioctl.h:170

Helper macro to create private IOCTL commands for CPSW MAC port module.

◆ CPSW_MACPORT_FEATURE_SGMII

#define CPSW_MACPORT_FEATURE_SGMII   (ENET_BIT(0U))

SGMII feature mask.

◆ CPSW_MACPORT_FEATURE_INTERVLAN

#define CPSW_MACPORT_FEATURE_INTERVLAN   (ENET_BIT(1U))

InterVLAN feature mask.

◆ CPSW_MACPORT_INTERVLAN_ROUTEID_BASE

#define CPSW_MACPORT_INTERVLAN_ROUTEID_BASE   (1U)

Base InterVLAN Route Id.

◆ CPSW_MACPORT_INTERVLAN_ROUTE_MAX

#define CPSW_MACPORT_INTERVLAN_ROUTE_MAX
Value:
CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST + 1U)
Definition: cpsw_macport.h:178

Maximum number of interVLAN routes available per egress port.

◆ CPSW_MACPORT_INTERVLAN_ROUTE2PTR

#define CPSW_MACPORT_INTERVLAN_ROUTE2PTR (   routeId)
Value:
Definition: cpsw_macport.h:163
#define CPSW_MACPORT_INTERVLAN_ROUTEID_BASE
Base InterVLAN Route Id.
Definition: cpsw_macport_priv.h:72

Convert route id to pointer.

Typedef Documentation

◆ CpswMacPort_Handle

MAC port module handle.

Enumeration Type Documentation

◆ CpswMacPort_PrivIoctls

MAC port private IOCTL commands.

Enumerator
CPSW_MACPORT_IOCTL_ENABLE 

Enable MAC port.

IOCTL parameters: inArgs: EnetMacPort_LinkCfg outArgs: None

CPSW_MACPORT_IOCTL_DISABLE 

Disable MAC port.

IOCTL parameters: inArgs: None outArgs: None

CPSW_MACPORT_IOCTL_SET_INTERVLAN_ROUTE 

Alloc free route and set interVLAN config for egress MAC port.

IOCTL parameters: inArgs: CpswMacPort_InterVlanRoutingCfg outArgs: CpswMacPort_InterVlanRouteId

CPSW_MACPORT_IOCTL_SET_SPECIFIC_INTERVLAN_ROUTE 

Set interVLAN config for egress MAC port at given route index.

IOCTL parameters: inArgs: CpswMacPort_SetSpecificInterVlanRouteInArgs outArgs: None

CPSW_MACPORT_IOCTL_GET_INTERVLAN_ROUTE 

Get interVLAN config for egress MAC port.

IOCTL parameters: inArgs: CpswMacPort_InterVlanRouteId outArgs: CpswMacPort_InterVlanRoutingCfg

CPSW_MACPORT_IOCTL_DELETE_INTERVLAN_ROUTE 

Delete the specified interVlan route.

IOCTL parameters: inArgs: CpswMacPort_InterVlanRoutingCfg outArgs: CpswMacPort_InterVlanRouteId

CPSW_MACPORT_IOCTL_GET_INTERVLAN_FREEROUTES 

Get interVLAN free routes available for the given egress port.

IOCTL parameters: inArgs: None outArgs: CpswMacPort_InterVlanFreeRouteInfo

CPSW_MACPORT_IOCTL_FIND_INTERVLAN_ROUTE 

Find interVLAN route id matching the given route params.

If unable to find the route returns CPSW_MACPORT_EROUTENOTFOUND IOCTL parameters: inArgs: CpswMacPort_InterVlanRoutingCfg outArgs: CpswMacPort_InterVlanRouteId

CPSW_MACPORT_IOCTL_IS_INTERVLAN_ROUTE_FREE 

Check if given interVLAN route is free.

IOCTL parameters: inArgs: CpswMacPort_InterVlanRouteId outArgs: bool

CPSW_MACPORT_IOCTL_SET_SHORT_IPG 

Set transmit short gap configuration for MAC port.

IOCTL parameters: inArgs: CpswMacPort_PortTxShortIpgCfg outArgs: None

CPSW_MACPORT_IOCTL_GET_SHORT_IPG 

Get transmit short gap configuration for MAC port.

IOCTL parameters: inArgs: EnetMacPort_GenericInArgs outArgs: CpswMacPort_TxShortIpgCfg

CPSW_MACPORT_IOCTL_GET_SGMII_AUTONEG_LINK_STATUS 

Get SGMII auto-negotiate link status from the SGMII status register.

IOCTL parameters: inArgs: EnetMacPort_GenericInArgs outArgs: bool

CPSW_MACPORT_IOCTL_GET_SGMII_LINK_STATUS 

Get SGMII link status from the SGMII status register.

IOCTL parameters: inArgs: EnetMacPort_GenericInArgs outArgs: bool

Function Documentation

◆ CpswMacPort_open()

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.

Parameters
hModEnet Module handle
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
cfgConfiguration parameters
cfgSizeSize of the configuration parameters
Returns
Enet_ErrorCodes

◆ CpswMacPort_rejoin()

int32_t CpswMacPort_rejoin ( EnetMod_Handle  hMod,
Enet_Type  enetType,
uint32_t  instId 
)

Rejoin a running CPSW MAC port.

Parameters
hModEnet Module handle
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
Returns
Enet_ErrorCodes

◆ CpswMacPort_ioctl()

int32_t CpswMacPort_ioctl ( EnetMod_Handle  hMod,
uint32_t  cmd,
Enet_IoctlPrms prms 
)

Run an IOCTL operation on CPSW MAC port.

Parameters
hModEnet Module handle
cmdIOCTL command Id
prmsIOCTL parameters
Returns
Enet_ErrorCodes

◆ CpswMacPort_close()

void CpswMacPort_close ( EnetMod_Handle  hMod)

Close CPSW MAC port.

Parameters
hModEnet Module handle