Data Structures | Macros | Typedefs | Enumerations | Functions
cpsw.h File Reference

This file contains the main structure definitions and function prototypes of the CPSW driver. More...

#include <ti/drv/cpsw/include/cpsw_types.h>
#include <ti/drv/cpsw/soc/cpsw_soc.h>
#include <ti/drv/cpsw/include/cpsw_ale.h>
#include <ti/drv/cpsw/include/cpsw_cpts.h>
#include <ti/drv/cpsw/include/cpsw_dma.h>
#include <ti/drv/cpsw/include/cpsw_hostport.h>
#include <ti/drv/cpsw/include/cpsw_macport.h>
#include <ti/drv/cpsw/include/cpsw_mdio.h>
#include <ti/drv/cpsw/include/cpsw_stats.h>
#include <ti/drv/cpsw/include/cpsw_phy.h>
#include <ti/drv/cpsw/include/cpsw_trace.h>
#include <ti/drv/cpsw/include/cpsw_utils.h>
#include <ti/drv/cpsw/include/cpsw_rm.h>

Data Structures

struct  Cpsw_GetVersionsOutArgs_s
 Output args for CPSW_IOCTL_GET_VERSION command. More...
 
struct  Cpsw_OpenPortLinkInArgs_s
 Input args for CPSW_IOCTL_OPEN_PORT_LINK command. More...
 
struct  Cpsw_GenericPortLinkInArgs_s
 Input args for CPSW_IOCTL_CLOSE_PORT_LINK, CPSW_IOCTL_IS_PORT_LINK_UP and CPSW_IOCTL_GET_PORT_LINK_CONFIG command. More...
 
struct  Cpsw_SetHostPortTrafficShapingInArgs_s
 Input args for CPSW_IOCTL_SET_HOSTPORT_TRAFFIC_SHAPING command. More...
 
struct  Cpsw_InterVlanRouteIngressPktMatchCfg_s
 InterVLAN route ingress packet match criteria configuration. More...
 
struct  Cpsw_InterVlanEgressPortCfg_s
 InterVLAN egress port configuration. More...
 
struct  Cpsw_SetInterVlanRouteUniEgressInArgs_s
 Input args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_SetInterVlanRouteUniEgressOutArgs_s
 Output args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteUniEgressInArgs_s
 Input args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteUniEgressOutArgs_s
 Output args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_SetInterVlanRouteMultiEgressInArgs_s
 Input args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_SetInterVlanRouteMultiEgressOutArgs_s
 Output args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteMultiEgressInArgs_s
 Input args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteMultiEgressOutArgs_s
 Output args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_AttachCoreOutArgs_s
 Output args for CPSW_IOCTL_ATTACH_CORE command. More...
 
struct  Cpsw_MdioLinkStateChangeInfo_s
 PHY link status change event information. More...
 
struct  Cpsw_DefaultFlowInfo_s
 Rx Default Flow Info used for default flow registration/unregistration. More...
 
struct  Cpsw_MacDstFlowInfo_s
 Output args for CPSW_IOCTL_ATTACH_CORE command. More...
 
struct  Cpsw_SetShortTxIPGConfigInArgs_s
 Short IPG configuration for CPSW IP. More...
 
struct  Cpsw_GetShortTxIPGConfigOutArgs_s
 Short IPG configuration for CPSW IP. More...
 
struct  Cpsw_VlanConfig_s
 CPSW-level VLAN configuration. More...
 
struct  CpswOsal_Prms
 CPSW driver OSAL function pointers. More...
 
struct  CpswOsal_CachePrms
 CPSW driver OSAL cache function pointers. More...
 
struct  Cpsw_Config_s
 CPSW configuration. More...
 

Macros

#define CPSW_IOCTL_SET_NO_ARGS(prms)
 Set null args for an IOCTL command that takes no arguments. More...
 
#define CPSW_IOCTL_SET_IN_ARGS(prms, in)
 Set the input args for an IOCTL command. More...
 
#define CPSW_IOCTL_SET_OUT_ARGS(prms, out)
 Set the output args for an IOCTL command. More...
 
#define CPSW_IOCTL_SET_INOUT_ARGS(prms, in, out)
 Set the input and output args for an IOCTL command. More...
 
#define CPSW_PUBLIC_IOCTL(x)   (CPSW_IOCTL_CPSW_BASE | CPSW_IOCTL_MIN(x))
 
#define CPSW_DMA_TX_CH_NUM(chNum)   (chNum)
 Set the input and output args for an IOCTL command.
 
#define CPSW_SOC_RGMII_MHZ_250_CLK_VAL   (250000000U)
 Frequency in HZ for RGMII 250MHz clock needed to operate in 1Gbps mode.
 
#define CPSW_SOC_RGMII_MHZ_50_CLK_VAL   (50000000U)
 Frequency in HZ for RGMII 50MHz clock needed to operate in 100Mbps mode.
 
#define CPSW_SOC_RGMII_MHZ_5_CLK_VAL   (5000000U)
 Frequency in HZ for RGMII 5MHz clock needed to operate in 10Mbps mode.
 
CPSW Intervlan ingress packet match types

Ingress packet match criteria for interVLAN routing. Each packet match criteria is represented by a bit To enable multiple match criteria create bitmask ORing required ingress packet match criteria defines

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_PORT   (CPSW_ALE_POLICER_MATCH_PORT)
 
#define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACSRC   (CPSW_ALE_POLICER_MATCH_MACSRC)
 
#define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACDST   (CPSW_ALE_POLICER_MATCH_MACDST)
 
#define CPSW_INTERVLAN_INGRESSPKT_MATCH_ETHERTYPE   (CPSW_ALE_POLICER_MATCH_ETHERTYPE)
 
#define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPSRC   (CPSW_ALE_POLICER_MATCH_IPSRC)
 
#define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPDST   (CPSW_ALE_POLICER_MATCH_IPDST)
 
InterVLAN ingress packet match aleEntry delete bitmask

Associated with some classifier types are ALE table entries. When deleting the classifier entry application needs to specify by means of below bitmask if the ALE entry associated with the classifier should also be deleted.If not set the ALE entry will remain.

#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_MACSRC   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACSRC)
 
#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_MACDST   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACDST)
 
#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_ETHERTYPE   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_ETHERTYPE)
 
#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_IPSRC   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPSRC)
 
#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_IPDST   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPDST)
 
#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_VLAN   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_IVLAN)
 

Typedefs

typedef struct
Cpsw_GetVersionsOutArgs_s 
Cpsw_GetVersionsOutArgs
 Output args for CPSW_IOCTL_GET_VERSION command.
 
typedef struct
Cpsw_OpenPortLinkInArgs_s 
Cpsw_OpenPortLinkInArgs
 Input args for CPSW_IOCTL_OPEN_PORT_LINK command.
 
typedef struct
Cpsw_GenericPortLinkInArgs_s 
Cpsw_GenericPortLinkInArgs
 Input args for CPSW_IOCTL_CLOSE_PORT_LINK, CPSW_IOCTL_IS_PORT_LINK_UP and CPSW_IOCTL_GET_PORT_LINK_CONFIG command.
 
typedef struct
Cpsw_SetHostPortTrafficShapingInArgs_s 
Cpsw_SetHostPortTrafficShapingInArgs
 Input args for CPSW_IOCTL_SET_HOSTPORT_TRAFFIC_SHAPING command.
 
typedef struct
Cpsw_InterVlanRouteIngressPktMatchCfg_s 
Cpsw_InterVlanRouteIngressPktMatchCfg
 InterVLAN route ingress packet match criteria configuration.
 
typedef struct
Cpsw_InterVlanEgressPortCfg_s 
Cpsw_InterVlanEgressPortCfg
 InterVLAN egress port configuration.
 
typedef struct
Cpsw_SetInterVlanRouteUniEgressInArgs_s 
Cpsw_SetInterVlanRouteUniEgressInArgs
 Input args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command.
 
typedef struct
Cpsw_SetInterVlanRouteUniEgressOutArgs_s 
Cpsw_SetInterVlanRouteUniEgressOutArgs
 Output args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command.
 
typedef struct
Cpsw_ClearInterVlanRouteUniEgressInArgs_s 
Cpsw_ClearInterVlanRouteUniEgressInArgs
 Input args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command.
 
typedef struct
Cpsw_ClearInterVlanRouteUniEgressOutArgs_s 
Cpsw_ClearInterVlanRouteUniEgressOutArgs
 Output args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command.
 
typedef struct
Cpsw_SetInterVlanRouteMultiEgressInArgs_s 
Cpsw_SetInterVlanRouteMultiEgressInArgs
 Input args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command.
 
typedef struct
Cpsw_SetInterVlanRouteMultiEgressOutArgs_s 
Cpsw_SetInterVlanRouteMultiEgressOutArgs
 Output args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command.
 
typedef struct
Cpsw_ClearInterVlanRouteMultiEgressInArgs_s 
Cpsw_ClearInterVlanRouteMultiEgressInArgs
 Input args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command.
 
typedef struct
Cpsw_ClearInterVlanRouteMultiEgressOutArgs_s 
Cpsw_ClearInterVlanRouteMultiEgressOutArgs
 Output args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command.
 
typedef struct
Cpsw_AttachCoreOutArgs_s 
Cpsw_AttachCoreOutArgs
 Output args for CPSW_IOCTL_ATTACH_CORE command.
 
typedef struct
Cpsw_MdioLinkStateChangeInfo_s 
Cpsw_MdioLinkStateChangeInfo
 PHY link status change event information.
 
typedef struct
Cpsw_DefaultFlowInfo_s 
Cpsw_DefaultFlowInfo
 Rx Default Flow Info used for default flow registration/unregistration.
 
typedef struct
Cpsw_MacDstFlowInfo_s 
Cpsw_MacDstFlowInfo
 Output args for CPSW_IOCTL_ATTACH_CORE command.
 
typedef void(* Cpsw_MdioLinkStateChangeCb )(Cpsw_MdioLinkStateChangeInfo *info, void *appArg)
 CPSW PHY link state change callback function. More...
 
typedef void(* Cpsw_PortLinkStatusChangeCb )(Cpsw_MacPort portNum, bool isLinkUp, void *appArg)
 CPSW port link status change callback function. More...
 
typedef struct
Cpsw_SetShortTxIPGConfigInArgs_s 
Cpsw_SetShortTxIPGConfigInArgs
 Short IPG configuration for CPSW IP.
 
typedef struct
Cpsw_GetShortTxIPGConfigOutArgs_s 
Cpsw_GetShortTxIPGConfigOutArgs
 Short IPG configuration for CPSW IP.
 
typedef struct Cpsw_VlanConfig_s Cpsw_VlanConfig
 CPSW-level VLAN configuration.
 
typedef struct Cpsw_Config_s Cpsw_Config
 CPSW configuration. More...
 
typedef struct Cpsw_Obj_s * Cpsw_Handle
 CPSW handle. More...
 

Enumerations

enum  Cpsw_Ioctl_e {
  CPSW_IOCTL_GET_VERSION = CPSW_PUBLIC_IOCTL(0U), CPSW_IOCTL_OPEN_PORT_LINK = CPSW_PUBLIC_IOCTL(1U), CPSW_IOCTL_CLOSE_PORT_LINK = CPSW_PUBLIC_IOCTL(2U), CPSW_IOCTL_IS_PORT_LINK_UP = CPSW_PUBLIC_IOCTL(3U),
  CPSW_IOCTL_GET_PORT_LINK_CONFIG = CPSW_PUBLIC_IOCTL(4U), CPSW_IOCTL_SET_HOSTPORT_TRAFFIC_SHAPING = CPSW_PUBLIC_IOCTL(5U), CPSW_IOCTL_PRINT_REGISTERS = CPSW_PUBLIC_IOCTL(6U), CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS = CPSW_PUBLIC_IOCTL(7U),
  CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS = CPSW_PUBLIC_IOCTL(8U), CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS = CPSW_PUBLIC_IOCTL(9U), CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS = CPSW_PUBLIC_IOCTL(10U), CPSW_IOCTL_SET_SHORT_IPG_CONFIG = CPSW_PUBLIC_IOCTL(11U),
  CPSW_IOCTL_GET_SHORT_IPG_CONFIG = CPSW_PUBLIC_IOCTL(12U), CPSW_IOCTL_ATTACH_CORE = CPSW_PUBLIC_IOCTL(13U), CPSW_IOCTL_DETACH_CORE = CPSW_PUBLIC_IOCTL(14U), CPSW_IOCTL_REGISTER_RX_DEFAULT_FLOW = CPSW_PUBLIC_IOCTL(15U),
  CPSW_IOCTL_UNREGISTER_RX_DEFAULT_FLOW = CPSW_PUBLIC_IOCTL(16U), CPSW_IOCTL_REGISTER_DSTMAC_RX_FLOW = CPSW_PUBLIC_IOCTL(17U), CPSW_IOCTL_UNREGISTER_DSTMAC_RX_FLOW = CPSW_PUBLIC_IOCTL(18U)
}
 CPSW module IOCTL commands. More...
 

Functions

void CpswOsal_initPrms (CpswOsal_Prms *osalPrms)
 CpswOsal_Prms structure init function. More...
 
int32_t CpswOsal_setCachePrms (const CpswOsal_CachePrms *cachePrms)
 Set the OSAL cache paramaters in case user needs to override the default cache API. More...
 
void CpswOsal_initCachePrms (CpswOsal_CachePrms *cachePrms)
 CpswOsal_CachePrms structure init function. More...
 
void Cpsw_initParams (Cpsw_Config *cfg)
 Initialize CPSW configuration parameters with default values. More...
 
void Cpsw_initMacPortParams (CpswMacPort_Config *cfg)
 Initialize MAC port configuration parameters with default values. More...
 
void Cpsw_initPhyParams (CpswPhy_Config *cfg)
 Initialize PHY configuration parameters. More...
 
void Cpsw_setPhyExtendedParams (CpswPhy_Config *cfg, const void *extendedCfg, uint32_t extendedCfgSize)
 Set PHY extended parameters. More...
 
void Cpsw_initOsalPrms (CpswOsal_Prms *pOsalPrms)
 Initialize OSAL parameters with default values. More...
 
void Cpsw_init (Cpsw_Type cpswType, const CpswOsal_Prms *pOsalPrms, CpswUtils_Prms *pUtilsPrms)
 Initialize CPSW driver. More...
 
void Cpsw_deinit (Cpsw_Type cpswType)
 De-initialize CPSW driver. More...
 
CpswTrace_TraceLevel Cpsw_setTraceLevel (CpswTrace_TraceLevel level)
 Set runtime trace level. More...
 
CpswTrace_TraceLevel Cpsw_getTraceLevel (void)
 Get runtime trace level. More...
 
Cpsw_Handle Cpsw_getHandle (Cpsw_Type cpswType)
 Get the CPSW opaque handle. More...
 
Cpsw_Handle Cpsw_open (Cpsw_Type cpswType, const Cpsw_Config *cfg)
 Open and initialize CPSW peripheral. More...
 
Cpsw_Handle Cpsw_reopen (Cpsw_Type cpswType)
 Re-open CPSW peripheral. More...
 
void Cpsw_close (Cpsw_Handle hCpsw)
 Close CPSW peripheral. More...
 
int32_t Cpsw_ioctl (Cpsw_Handle hCpsw, uint32_t coreId, uint32_t cmd, Cpsw_IoctlPrms *prms)
 Issue an operation on the CPSW peripheral/driver. More...
 
void Cpsw_periodicTick (Cpsw_Handle hCpsw)
 Run PHY-related periodic tick. More...
 
uint32_t Cpsw_getMacPortMax (Cpsw_Type cpswType)
 Get the number of MAC ports in the CPSW instance. More...
 

Detailed Description

This file contains the main structure definitions and function prototypes of the CPSW driver.


Copyright 2020, Texas Instruments Incorporated