PDK API Guide for J721E
CPSW Main API

Introduction

Data Structures

struct  Cpsw_GetVersionsOutArgs
 Output args for CPSW_IOCTL_GET_VERSION command. More...
 
struct  Cpsw_OpenPortLinkInArgs
 Input args for CPSW_IOCTL_OPEN_PORT_LINK command. More...
 
struct  Cpsw_GenericPortLinkInArgs
 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
 Input args for CPSW_IOCTL_SET_HOSTPORT_TRAFFIC_SHAPING command. More...
 
struct  Cpsw_InterVlanRouteIngressPktMatchCfg
 InterVLAN route ingress packet match criteria configuration. More...
 
struct  Cpsw_InterVlanEgressPortCfg
 InterVLAN egress port configuration. More...
 
struct  Cpsw_SetInterVlanRouteUniEgressInArgs
 Input args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_SetInterVlanRouteUniEgressOutArgs
 Output args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteUniEgressInArgs
 Input args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteUniEgressOutArgs
 Output args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command. More...
 
struct  Cpsw_SetInterVlanRouteMultiEgressInArgs
 Input args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_SetInterVlanRouteMultiEgressOutArgs
 Output args for CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteMultiEgressInArgs
 Input args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_ClearInterVlanRouteMultiEgressOutArgs
 Output args for CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
 
struct  Cpsw_AttachCoreOutArgs
 Output args for CPSW_IOCTL_ATTACH_CORE command. More...
 
struct  Cpsw_MdioLinkStateChangeInfo
 PHY link status change event information. More...
 
struct  Cpsw_DefaultFlowInfo
 Rx Default Flow Info used for default flow registration/unregistration. More...
 
struct  Cpsw_MacDstFlowInfo
 Output args for CPSW_IOCTL_ATTACH_CORE command. More...
 
struct  Cpsw_SetShortTxIPGConfigInArgs
 Short IPG configuration for CPSW IP. More...
 
struct  Cpsw_GetShortTxIPGConfigOutArgs
 Short IPG configuration for CPSW IP. More...
 
struct  Cpsw_VlanConfig
 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
 CPSW configuration. More...
 
struct  Cpsw_Version
 CPSW hardware version. More...
 
struct  Cpsw_IoctlPrms
 CPSW IOCTL param. 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...
 

Typedefs

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_Obj_s * Cpsw_Handle
 CPSW handle. More...
 
typedef uint64_t(* Cpsw_VirtToPhyFxn) (const void *virtAddr, void *appData)
 CPSW virtual-to-physical address translation callback function. More...
 
typedef void *(* Cpsw_PhyToVirtFxn) (uint64_t phyAddr, void *appData)
 CPSW physical-to-virtual address translation callback function. More...
 
typedef void(* Cpsw_PrintFxnCb) (const char *str,...)
 CPSW info/debug print function prototype. More...
 
typedef void(* Cpsw_TraceFxnCb) (const char *str,...)
 CPSW log trace function prototype. More...
 
typedef uintptr_t(* CpswOsal_DisableAllIntrFxn) (void)
 CPSW OSAL intr disable function prototype. More...
 
typedef void(* CpswOsal_RestoreAllIntrFxn) (uintptr_t cookie)
 CPSW OSAL intr restore function prototype. More...
 
typedef void(* CpswOsal_RestoreIntrFxn) (uint32_t coreIntrNum)
 CPSW OSAL intr restore function prototype. More...
 
typedef void(* CpswOsal_DisableIntrFxn) (uint32_t coreIntrNum)
 CPSW OSAL intr disable function prototype. More...
 
typedef void *(* CpswOsal_MutexCreateFxn) (void)
 CPSW OSAL mutex create function prototype to protect critical section. More...
 
typedef void(* CpswOsal_MutexDeleteFxn) (void *mutexHandle)
 CPSW OSAL mutex delete function prototype. More...
 
typedef void(* CpswOsal_MutexLockFxn) (void *mutexHandle)
 CPSW OSAL mutex lock function prototype. More...
 
typedef void(* CpswOsal_MutexUnlockFxn) (void *mutexHandle)
 CPSW OSAL mutex lock function prototype. More...
 
typedef void(* CpswOsal_IsrFxn) (uintptr_t arg)
 CPSW OSAL ISR callback function prototype. More...
 
typedef void *(* CpswOsal_RegisterIntrFxn) (CpswOsal_IsrFxn isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, void *arg)
 CPSW OSAL ISR register function prototype. More...
 
typedef void(* CpswOsal_UnRegisterIntrFxn) (void *hwiHandle)
 CPSW OSAL ISR unregister function prototype. More...
 
typedef void(* CpswOsal_CacheInv) (const void *addr, int32_t size)
 CPSW OSAL cache invalidate function prototype. More...
 
typedef void(* CpswOsal_CacheWb) (const void *addr, int32_t size)
 CPSW OSAL cache writeback function prototype. More...
 
typedef void(* CpswOsal_CacheWbInv) (const void *addr, int32_t size)
 CPSW OSAL cache writeback invalidate function prototype. More...
 
typedef uint32_t(* CpswOsal_TimerReadFxn) (void)
 CPSW OSAL timer read function prototype. More...
 
typedef Cpsw_VersionCpsw_GetVersionOutArgs
 Output args for CPSW_*_IOCTL_GET_VERSION commands. 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...
 
enum  Cpsw_IoctlType_e { CPSW_IOCTL_TYPE_PUBLIC = CPSW_IOCTL_TYPE(0U), CPSW_IOCTL_TYPE_PRIVATE = CPSW_IOCTL_TYPE(1U) }
 IOCTL types. More...
 
enum  Cpsw_IoctlMajor_e {
  CPSW_IOCTL_CPSW_BASE = CPSW_IOCTL_MAJ(1U), CPSW_IOCTL_ALE_BASE = CPSW_IOCTL_MAJ(2U), CPSW_IOCTL_CPTS_BASE = CPSW_IOCTL_MAJ(3U), CPSW_IOCTL_HOSTPORT_BASE = CPSW_IOCTL_MAJ(5U),
  CPSW_IOCTL_MACPORT_BASE = CPSW_IOCTL_MAJ(6U), CPSW_IOCTL_MDIO_BASE = CPSW_IOCTL_MAJ(7U), CPSW_IOCTL_SGMII_BASE = CPSW_IOCTL_MAJ(8U), CPSW_IOCTL_STATS_BASE = CPSW_IOCTL_MAJ(9U),
  CPSW_IOCTL_SS_BASE = CPSW_IOCTL_MAJ(10U), CPSW_IOCTL_PHY_BASE = CPSW_IOCTL_MAJ(11U), CPSW_IOCTL_RM_BASE = CPSW_IOCTL_MAJ(12U)
}
 IOCTL base number. More...
 
enum  Cpsw_Type { CPSW_2G, CPSW_9G, CPSW_TYPE_LAST = CPSW_9G }
 CPSW instance type. More...
 
enum  Cpsw_MacPort {
  CPSW_MAC_PORT_FIRST = 0U, CPSW_MAC_PORT_0 = CPSW_MAC_PORT_FIRST, CPSW_MAC_PORT_1 = 1U, CPSW_MAC_PORT_2 = 2U,
  CPSW_MAC_PORT_3 = 3U, CPSW_MAC_PORT_4 = 4U, CPSW_MAC_PORT_5 = 5U, CPSW_MAC_PORT_6 = 6U,
  CPSW_MAC_PORT_7 = 7U, CPSW_MAC_PORT_LAST = CPSW_MAC_PORT_7
}
 CPSW MAC port. More...
 
enum  Cpsw_CrcType { CPSW_CRC_ETHERNET = 0U, CPSW_CRC_CASTAGNOLI = 1U }
 CRC type. More...
 
enum  Cpsw_Speed {
  CPSW_SPEED_10MBIT = 0U, CPSW_SPEED_100MBIT = 1U, CPSW_SPEED_1GBIT = 2U, CPSW_SPEED_2p5GBIT = 3U,
  CPSW_SPEED_10GBIT = 4U, CPSW_SPEED_AUTO = 5U
}
 MAC interface speed. More...
 
enum  Cpsw_Duplexity { CPSW_DUPLEX_HALF = 0U, CPSW_DUPLEX_FULL = 1U, CPSW_DUPLEX_AUTO = 2U }
 MAC interface duplexity. More...
 
enum  Cpsw_VlanSwitch { CPSW_VLAN_SWITCH_CUSTOMER = 0U, CPSW_VLAN_SWITCH_SERVICE = 1U }
 Double VLAN switch. More...
 
enum  Cpsw_RestartType { CPSW_RESTART_DOMAINRESET = 0U, CPSW_RESTART_COREREBOOT = 1U }
 CPSW Restart type. 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. More...
 
#define CPSW_SOC_RGMII_MHZ_250_CLK_VAL   (250000000U)
 Frequency in HZ for RGMII 250MHz clock needed to operate in 1Gbps mode. More...
 
#define CPSW_SOC_RGMII_MHZ_50_CLK_VAL   (50000000U)
 Frequency in HZ for RGMII 50MHz clock needed to operate in 100Mbps mode. More...
 
#define CPSW_SOC_RGMII_MHZ_5_CLK_VAL   (5000000U)
 Frequency in HZ for RGMII 5MHz clock needed to operate in 10Mbps mode. More...
 
#define CPSW_SET_BIT(n)   (1U << (n))
 
#define CPSW_GET_BIT(val, n)   ((val & (1 << n)) >> n)
 
#define CPSW_IS_BIT_SET(val, n)   (((val) & (1U << (n))) != 0U)
 
#define CPSW_FEXT(reg, PER_REG_FIELD)   (((reg) & PER_REG_FIELD##_MASK) >> PER_REG_FIELD##_SHIFT)
 Field EXTract macro. We can't use CSL macro as it appends shift/mask with CSL_. More...
 
#define CPSW_FINS(reg, PER_REG_FIELD, val)
 Field INSert macro. We can't use CSL macro as it appends shift/mask with CSL_. More...
 
#define CPSW_IOCTL_TYPE_OFFSET   (24U)
 IOCTL major number bit offset. More...
 
#define CPSW_IOCTL_MAJOR_OFFSET   (16U)
 IOCTL major number bit offset. More...
 
#define CPSW_IOCTL_MINOR_OFFSET   (0U)
 IOCTL minor number bit offset. More...
 
#define CPSW_IOCTL_GET_TYPE(x)   ((x) & 0xFF000000U)
 Helper macro to get the IOCTL type (public/private) More...
 
#define CPSW_IOCTL_GET_MAJ(x)   ((x) & 0x00FF0000U)
 Helper macro to get the IOCTL major number. More...
 
#define CPSW_IOCTL_GET_MIN(x)   ((x) & 0x0000FFFFU)
 Helper macro to get the IOCTL major number. More...
 
#define CPSW_IOCTL_TYPE(x)   ((x) << CPSW_IOCTL_TYPE_OFFSET)
 Helper macro to set the IOCTL type. More...
 
#define CPSW_IOCTL_MAJ(x)   ((x) << CPSW_IOCTL_MAJOR_OFFSET)
 Helper macro to set the IOCTL major number. More...
 
#define CPSW_IOCTL_MIN(x)   ((x) << CPSW_IOCTL_MINOR_OFFSET)
 Helper macro to set the IOCTL minor number. More...
 
#define CPSW_MAC_ADDR_LEN   (6U)
 MAC address length (in bytes) More...
 
#define CPSW_PRIORITY_NUM   (8U)
 CPSW priority levels. More...
 
#define CPSW_TOS_PRIORITY_NUM   (64U)
 Type of Service (ToS) priority. More...
 
#define CPSW_VLAN_ID_MAX   (4095U)
 Maximum value for VLAN ID. More...
 
#define CPSW_LINK_CAP_HD10   CPSW_SET_BIT(1)
 10-Mbps, half-duplex capability mask More...
 
#define CPSW_LINK_CAP_FD10   CPSW_SET_BIT(2)
 10-Mbps, full-duplex capability mask More...
 
#define CPSW_LINK_CAP_HD100   CPSW_SET_BIT(3)
 100-Mbps, half-duplex capability mask More...
 
#define CPSW_LINK_CAP_FD100   CPSW_SET_BIT(4)
 100-Mbps, full-duplex capability mask More...
 
#define CPSW_LINK_CAP_HD1000   CPSW_SET_BIT(5)
 1-Gbps, half-duplex capability mask More...
 
#define CPSW_LINK_CAP_FD1000   CPSW_SET_BIT(6)
 1-Gbps, full-duplex capability mask More...
 
#define CPSW_LINK_CAP_10
 10-Mbps, full and half-duplex capability mask More...
 
#define CPSW_LINK_CAP_100
 100-Mbps, full and half-duplex capability mask More...
 
#define CPSW_LINK_CAP_1000
 1-Gbps, full and half-duplex capability mask More...
 
#define CPSW_LINK_CAP_ALL
 Auto-negotiation mask with all duplexity and speed values set. More...
 
#define CPSW_ETHERTYPE_PTP   (0x88F7U)
 Ethertype value for PTP over Ethernet Annex F (IEEE 802.3) More...
 
#define CPSW_REMOTE_CLIENT_CORES_MAX   (6U)
 Maximum number of client core that the CPSW driver can serve. More...
 
#define CPSW_COUNT   (CPSW_TYPE_LAST + 1U)
 Number of supported CPSW types. More...
 
#define CPSW_MAC_PORT_NUM   (CPSW_MAC_PORT_LAST + 1U)
 
#define CPSW_NORMALIZE_MACPORT(macPort)   ((macPort) - CPSW_MAC_PORT_FIRST)
 
#define CPSW_DENORMALIZE_MACPORT(macPort)   ((macPort) + CPSW_MAC_PORT_FIRST)
 
#define CPSW_MAC_PORT_INV   ((Cpsw_MacPort)0xFFFFU)
 

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)
 

CPSW Error Codes

Error codes returned by the CPSW driver APIs

#define CPSW_SOK   (UDMA_SOK)
 Success. More...
 
#define CPSW_EFAIL   (UDMA_EFAIL)
 Generic failure error condition (typically caused by hardware) More...
 
#define CPSW_EBADARGS   (UDMA_EBADARGS)
 Bad arguments (i.e. NULL pointer) More...
 
#define CPSW_EINVALID_PARAMS   (UDMA_EINVALID_PARAMS)
 Invalid parameters (i.e. value out-of-range) More...
 
#define CPSW_ETIMEOUT   (UDMA_ETIMEOUT)
 Time out while waiting for a given condition to happen. More...
 
#define CPSW_EALLOC   (UDMA_EALLOC)
 Allocation failure. More...
 
#define CPSW_EUNEXPECTED   (UDMA_EALLOC - 1)
 Unexpected condition occurred (sometimes unrecoverable) More...
 
#define CPSW_EBUSY   (UDMA_EALLOC - 2)
 The resource is currently busy performing an operation. More...
 
#define CPSW_EMALFORMED_IOCTL   (UDMA_EALLOC - 3)
 Malformed IOCTL (args pointer or size not as expected) More...
 
#define CPSW_EALREADY_OPEN   (UDMA_EALLOC - 4)
 Already open error. More...
 
#define CPSW_EPERM   (UDMA_EALLOC - 5)
 Operation not permitted. More...
 
#define CPSW_ENOTSUPPORTED   (UDMA_EALLOC - 6)
 Operation not supported. More...
 
#define CPSW_EUNKNOWN_IOCTL   (UDMA_EALLOC - 7)
 Unknown IOCTL. More...
 
#define CPSW_EALE_TABLE_FULL   (UDMA_EALLOC - 8)
 ALE Table full. More...
 
#define CPSW_EALE_VLAN_UNAWARE_MODE   (UDMA_EALLOC - 9)
 ALE is in VLAN Unaware mode. More...
 
#define CPSW_EALE_ADDRESS_NOT_FOUND   (UDMA_EALLOC - 10)
 Address not found in ALE entries. More...
 
#define CPSW_EALE_VLAN_NOT_FOUND   (UDMA_EALLOC - 11)
 VLAN Entry not found. More...
 
#define CPSW_EALE_VLANMASK_NOT_FOUND   (UDMA_EALLOC - 12)
 VLAN Mask Mux Entry not found. More...
 
#define CPSW_EALE_POLICER_TABLE_FULL   (UDMA_EALLOC - 13)
 Policer entry table is full. More...
 
#define CPSW_ENOTFOUND   (UDMA_EALLOC - 14)
 Resource not found. More...
 

Macro Definition Documentation

#define CPSW_IOCTL_SET_NO_ARGS (   prms)
Value:
{ \
(prms)->inArgs = NULL; \
(prms)->inArgsSize = 0U; \
(prms)->outArgs = NULL; \
(prms)->outArgsSize = 0U; \
}
#define NULL
Define NULL if not defined.
Definition: csl_types.h:107

Set null args for an IOCTL command that takes no arguments.

#define CPSW_IOCTL_SET_IN_ARGS (   prms,
  in 
)
Value:
{ \
(prms)->inArgs = (in); \
(prms)->inArgsSize = sizeof(*(in)); \
(prms)->outArgs = NULL; \
(prms)->outArgsSize = 0U; \
}
#define NULL
Define NULL if not defined.
Definition: csl_types.h:107

Set the input args for an IOCTL command.

#define CPSW_IOCTL_SET_OUT_ARGS (   prms,
  out 
)
Value:
{ \
(prms)->inArgs = NULL; \
(prms)->inArgsSize = 0U; \
(prms)->outArgs = (out); \
(prms)->outArgsSize = sizeof(*(out)); \
}
#define NULL
Define NULL if not defined.
Definition: csl_types.h:107

Set the output args for an IOCTL command.

#define CPSW_IOCTL_SET_INOUT_ARGS (   prms,
  in,
  out 
)
Value:
{ \
(prms)->inArgs = (in); \
(prms)->inArgsSize = sizeof(*(in)); \
(prms)->outArgs = (out); \
(prms)->outArgsSize = sizeof(*(out)); \
}

Set the input and output args for an IOCTL command.

#define CPSW_PUBLIC_IOCTL (   x)    (CPSW_IOCTL_CPSW_BASE | CPSW_IOCTL_MIN(x))

Helper macro for CPSW public IOCTL command ids

#define CPSW_DMA_TX_CH_NUM (   chNum)    (chNum)

Set the input and output args for an IOCTL command.

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_PORT   (CPSW_ALE_POLICER_MATCH_PORT)

Enable classifier match with PORT number

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACSRC   (CPSW_ALE_POLICER_MATCH_MACSRC)

Enable classifier match with MAC source address entry

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACDST   (CPSW_ALE_POLICER_MATCH_MACDST)

Enable classifier match with MAC destination address entry

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_ETHERTYPE   (CPSW_ALE_POLICER_MATCH_ETHERTYPE)

Enable classifier match with MAC destination address entry

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPSRC   (CPSW_ALE_POLICER_MATCH_IPSRC)

Enable classifier match with IPv4/IPv6 source address

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPDST   (CPSW_ALE_POLICER_MATCH_IPDST)

Enable classifier match with IPv4/IPv6 destination address

#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_MACSRC   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACSRC)

Delete MAC source address ALE table entry

#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_MACDST   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_MACDST)

Delete MAC destination address ALE table entry

#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_ETHERTYPE   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_ETHERTYPE)

Delete EtherType classifier associated ALE table entry

#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_IPSRC   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPSRC)

Delete IPv4/IPv6 source address classifier associated ALE table entry

#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_IPDST   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_IPDST)

Delete IPv4/IPv6 destination address classifier associated ALE table entry

#define CPSW_INTERVLAN_PKTCLASSIFIER_DELETE_VLAN   (CPSW_ALE_POLICER_TABLEENTRY_DELETE_IVLAN)

Delete InnerVLAN classifier associated ALE table entry

#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.

#define CPSW_SET_BIT (   n)    (1U << (n))

Macro to set bit at given bit position

#define CPSW_GET_BIT (   val,
 
)    ((val & (1 << n)) >> n)

Macro to get bit at given bit position

#define CPSW_IS_BIT_SET (   val,
 
)    (((val) & (1U << (n))) != 0U)

Macro to check if bit at given bit position is set

#define CPSW_FEXT (   reg,
  PER_REG_FIELD 
)    (((reg) & PER_REG_FIELD##_MASK) >> PER_REG_FIELD##_SHIFT)

Field EXTract macro. We can't use CSL macro as it appends shift/mask with CSL_.

#define CPSW_FINS (   reg,
  PER_REG_FIELD,
  val 
)
Value:
((reg) = ((reg) & ~PER_REG_FIELD##_MASK) \
| (((val) << PER_REG_FIELD##_SHIFT) & PER_REG_FIELD##_MASK))

Field INSert macro. We can't use CSL macro as it appends shift/mask with CSL_.

#define CPSW_SOK   (UDMA_SOK)

Success.

#define CPSW_EFAIL   (UDMA_EFAIL)

Generic failure error condition (typically caused by hardware)

#define CPSW_EBADARGS   (UDMA_EBADARGS)

Bad arguments (i.e. NULL pointer)

#define CPSW_EINVALID_PARAMS   (UDMA_EINVALID_PARAMS)

Invalid parameters (i.e. value out-of-range)

#define CPSW_ETIMEOUT   (UDMA_ETIMEOUT)

Time out while waiting for a given condition to happen.

#define CPSW_EALLOC   (UDMA_EALLOC)

Allocation failure.

#define CPSW_EUNEXPECTED   (UDMA_EALLOC - 1)

Unexpected condition occurred (sometimes unrecoverable)

#define CPSW_EBUSY   (UDMA_EALLOC - 2)

The resource is currently busy performing an operation.

#define CPSW_EMALFORMED_IOCTL   (UDMA_EALLOC - 3)

Malformed IOCTL (args pointer or size not as expected)

#define CPSW_EALREADY_OPEN   (UDMA_EALLOC - 4)

Already open error.

#define CPSW_EPERM   (UDMA_EALLOC - 5)

Operation not permitted.

#define CPSW_ENOTSUPPORTED   (UDMA_EALLOC - 6)

Operation not supported.

#define CPSW_EUNKNOWN_IOCTL   (UDMA_EALLOC - 7)

Unknown IOCTL.

#define CPSW_EALE_TABLE_FULL   (UDMA_EALLOC - 8)

ALE Table full.

#define CPSW_EALE_VLAN_UNAWARE_MODE   (UDMA_EALLOC - 9)

ALE is in VLAN Unaware mode.

#define CPSW_EALE_ADDRESS_NOT_FOUND   (UDMA_EALLOC - 10)

Address not found in ALE entries.

#define CPSW_EALE_VLAN_NOT_FOUND   (UDMA_EALLOC - 11)

VLAN Entry not found.

#define CPSW_EALE_VLANMASK_NOT_FOUND   (UDMA_EALLOC - 12)

VLAN Mask Mux Entry not found.

#define CPSW_EALE_POLICER_TABLE_FULL   (UDMA_EALLOC - 13)

Policer entry table is full.

#define CPSW_ENOTFOUND   (UDMA_EALLOC - 14)

Resource not found.

#define CPSW_IOCTL_TYPE_OFFSET   (24U)

IOCTL major number bit offset.

#define CPSW_IOCTL_MAJOR_OFFSET   (16U)

IOCTL major number bit offset.

#define CPSW_IOCTL_MINOR_OFFSET   (0U)

IOCTL minor number bit offset.

#define CPSW_IOCTL_GET_TYPE (   x)    ((x) & 0xFF000000U)

Helper macro to get the IOCTL type (public/private)

#define CPSW_IOCTL_GET_MAJ (   x)    ((x) & 0x00FF0000U)

Helper macro to get the IOCTL major number.

#define CPSW_IOCTL_GET_MIN (   x)    ((x) & 0x0000FFFFU)

Helper macro to get the IOCTL major number.

#define CPSW_IOCTL_TYPE (   x)    ((x) << CPSW_IOCTL_TYPE_OFFSET)

Helper macro to set the IOCTL type.

#define CPSW_IOCTL_MAJ (   x)    ((x) << CPSW_IOCTL_MAJOR_OFFSET)

Helper macro to set the IOCTL major number.

#define CPSW_IOCTL_MIN (   x)    ((x) << CPSW_IOCTL_MINOR_OFFSET)

Helper macro to set the IOCTL minor number.

#define CPSW_MAC_ADDR_LEN   (6U)

MAC address length (in bytes)

#define CPSW_PRIORITY_NUM   (8U)

CPSW priority levels.

#define CPSW_TOS_PRIORITY_NUM   (64U)

Type of Service (ToS) priority.

#define CPSW_VLAN_ID_MAX   (4095U)

Maximum value for VLAN ID.

#define CPSW_LINK_CAP_HD10   CPSW_SET_BIT(1)

10-Mbps, half-duplex capability mask

#define CPSW_LINK_CAP_FD10   CPSW_SET_BIT(2)

10-Mbps, full-duplex capability mask

#define CPSW_LINK_CAP_HD100   CPSW_SET_BIT(3)

100-Mbps, half-duplex capability mask

#define CPSW_LINK_CAP_FD100   CPSW_SET_BIT(4)

100-Mbps, full-duplex capability mask

#define CPSW_LINK_CAP_HD1000   CPSW_SET_BIT(5)

1-Gbps, half-duplex capability mask

#define CPSW_LINK_CAP_FD1000   CPSW_SET_BIT(6)

1-Gbps, full-duplex capability mask

#define CPSW_LINK_CAP_10
Value:
#define CPSW_LINK_CAP_FD10
10-Mbps, full-duplex capability mask
Definition: cpsw_types.h:197
#define CPSW_LINK_CAP_HD10
10-Mbps, half-duplex capability mask
Definition: cpsw_types.h:194

10-Mbps, full and half-duplex capability mask

#define CPSW_LINK_CAP_100
Value:
#define CPSW_LINK_CAP_FD100
100-Mbps, full-duplex capability mask
Definition: cpsw_types.h:203
#define CPSW_LINK_CAP_HD100
100-Mbps, half-duplex capability mask
Definition: cpsw_types.h:200

100-Mbps, full and half-duplex capability mask

#define CPSW_LINK_CAP_1000
Value:
#define CPSW_LINK_CAP_FD1000
1-Gbps, full-duplex capability mask
Definition: cpsw_types.h:209
#define CPSW_LINK_CAP_HD1000
1-Gbps, half-duplex capability mask
Definition: cpsw_types.h:206

1-Gbps, full and half-duplex capability mask

#define CPSW_LINK_CAP_ALL
Value:
#define CPSW_LINK_CAP_FD1000
1-Gbps, full-duplex capability mask
Definition: cpsw_types.h:209
#define CPSW_LINK_CAP_FD100
100-Mbps, full-duplex capability mask
Definition: cpsw_types.h:203
#define CPSW_LINK_CAP_HD100
100-Mbps, half-duplex capability mask
Definition: cpsw_types.h:200
#define CPSW_LINK_CAP_FD10
10-Mbps, full-duplex capability mask
Definition: cpsw_types.h:197
#define CPSW_LINK_CAP_HD10
10-Mbps, half-duplex capability mask
Definition: cpsw_types.h:194
#define CPSW_LINK_CAP_HD1000
1-Gbps, half-duplex capability mask
Definition: cpsw_types.h:206

Auto-negotiation mask with all duplexity and speed values set.

#define CPSW_ETHERTYPE_PTP   (0x88F7U)

Ethertype value for PTP over Ethernet Annex F (IEEE 802.3)

#define CPSW_REMOTE_CLIENT_CORES_MAX   (6U)

Maximum number of client core that the CPSW driver can serve.

#define CPSW_COUNT   (CPSW_TYPE_LAST + 1U)

Number of supported CPSW types.

#define CPSW_MAC_PORT_NUM   (CPSW_MAC_PORT_LAST + 1U)

Number of MAC ports

#define CPSW_NORMALIZE_MACPORT (   macPort)    ((macPort) - CPSW_MAC_PORT_FIRST)

Macro to normalize Cpsw_MacPort. It takes a Cpsw_MacPort enum and converts it to a zero-based index

#define CPSW_DENORMALIZE_MACPORT (   macPort)    ((macPort) + CPSW_MAC_PORT_FIRST)

Macro to denormalize MAC port number. It takes a zero-based port number and converts it to a Cpsw_MacPort enum

#define CPSW_MAC_PORT_INV   ((Cpsw_MacPort)0xFFFFU)

MAC invalid port number. Used for error checks

Typedef Documentation

typedef void(* Cpsw_MdioLinkStateChangeCb) (Cpsw_MdioLinkStateChangeInfo *info, void *appArg)

CPSW PHY link state change callback function.

Callback for PHY link state change interrupt (MDIO_LINKINT). This callback is invoked from interrupt context.

typedef void(* Cpsw_PortLinkStatusChangeCb) (Cpsw_MacPort portNum, bool isLinkUp, void *appArg)

CPSW port link status change callback function.

Callback for port link state change event. This callback is invoked when port link is fully functional (PHY linked, ALE ports enabled, etc) or when port link is fully shutdown (ALE ports disabled).

typedef struct Cpsw_Obj_s* Cpsw_Handle

CPSW handle.

CPSW opaque handle.

typedef uint64_t(* Cpsw_VirtToPhyFxn) (const void *virtAddr, void *appData)

CPSW virtual-to-physical address translation callback function.

This function is used by the driver to convert virtual address to physical address.

Parameters
virtAddr[IN] Virtual address
chNum[IN] Channel number passed during channel open
appData[IN] Callback pointer passed during channel open
Returns
Corresponding physical address
typedef void*(* Cpsw_PhyToVirtFxn) (uint64_t phyAddr, void *appData)

CPSW physical-to-virtual address translation callback function.

This function is used by the driver to convert physical address to virtual address.

Parameters
phyAddr[IN] Physical address
chNum[IN] Channel number passed during channel open
appData[IN] Callback pointer passed during channel open
Returns
Corresponding virtual address
typedef void(* Cpsw_PrintFxnCb) (const char *str,...)

CPSW info/debug print function prototype.

This function is used by the driver to print info/debug messages.

Parameters
str[OUT] Info string to print
typedef void(* Cpsw_TraceFxnCb) (const char *str,...)

CPSW log trace function prototype.

This function is used by the driver to trace log messages.

Parameters
str[OUT] Info string to print
typedef uintptr_t(* CpswOsal_DisableAllIntrFxn) (void)

CPSW OSAL intr disable function prototype.

Returns
Cookie to be passed back to enable interrupt function
typedef void(* CpswOsal_RestoreAllIntrFxn) (uintptr_t cookie)

CPSW OSAL intr restore function prototype.

Parameters
cookie[IN] This is returned in disable interrupt function
typedef void(* CpswOsal_RestoreIntrFxn) (uint32_t coreIntrNum)

CPSW OSAL intr restore function prototype.

Parameters
coreIntrNum[IN] Interrupt to restore
typedef void(* CpswOsal_DisableIntrFxn) (uint32_t coreIntrNum)

CPSW OSAL intr disable function prototype.

Parameters
coreIntrNum[IN] Interrupt to disable
typedef void*(* CpswOsal_MutexCreateFxn) (void)

CPSW OSAL mutex create function prototype to protect critical section.

Returns
Pointer to mutex object
typedef void(* CpswOsal_MutexDeleteFxn) (void *mutexHandle)

CPSW OSAL mutex delete function prototype.

Parameters
mutexHandle[IN] Pointer to mutex object returned during create
typedef void(* CpswOsal_MutexLockFxn) (void *mutexHandle)

CPSW OSAL mutex lock function prototype.

Parameters
mutexHandle[IN] Pointer to mutex object returned during create
typedef void(* CpswOsal_MutexUnlockFxn) (void *mutexHandle)

CPSW OSAL mutex lock function prototype.

Parameters
mutexHandle[IN] Pointer to mutex object returned during create
typedef void(* CpswOsal_IsrFxn) (uintptr_t arg)

CPSW OSAL ISR callback function prototype.

Parameters
arg[IN] App data
typedef void*(* CpswOsal_RegisterIntrFxn) (CpswOsal_IsrFxn isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, void *arg)

CPSW OSAL ISR register function prototype.

Parameters
isrFxn[IN] ISR callback fxn pointer
coreIntrNum[IN] Core interrupt number to register
intrPriority[IN] Priority
arg[IN] Arg that will be passed back in the ISR
Returns
Created HWI handle
typedef void(* CpswOsal_UnRegisterIntrFxn) (void *hwiHandle)

CPSW OSAL ISR unregister function prototype.

Parameters
hwiHandle[IN] HWI handle
typedef void(* CpswOsal_CacheInv) (const void *addr, int32_t size)

CPSW OSAL cache invalidate function prototype.

Parameters
addr[IN] Start address of the cache line/s
size[IN] size (in bytes) of the memory to invalidate
typedef void(* CpswOsal_CacheWb) (const void *addr, int32_t size)

CPSW OSAL cache writeback function prototype.

Parameters
addr[IN] Start address of the cache line/s
size[IN] size (in bytes) of the memory to be written back
typedef void(* CpswOsal_CacheWbInv) (const void *addr, int32_t size)

CPSW OSAL cache writeback invalidate function prototype.

Parameters
addr[IN] Start address of the cache line/s
size[IN] size (in bytes) of the memory to be written back
typedef uint32_t(* CpswOsal_TimerReadFxn) (void)

CPSW OSAL timer read function prototype.

Returns
Timer's read value

Output args for CPSW_*_IOCTL_GET_VERSION commands.

Enumeration Type Documentation

CPSW module IOCTL commands.

Enumerator
CPSW_IOCTL_GET_VERSION 

Get the version of CPSW.

IOCTL parameters:

CPSW_IOCTL_OPEN_PORT_LINK 

Open port link (MAC port and PHY)

IOCTL parameters:

CPSW_IOCTL_CLOSE_PORT_LINK 

Close port link (MAC port and PHY)

IOCTL parameters:

CPSW_IOCTL_IS_PORT_LINK_UP 

Check if port link is up.

IOCTL parameters:

CPSW_IOCTL_GET_PORT_LINK_CONFIG 

Get port link configuration (speed, duplexity)

IOCTL parameters:

CPSW_IOCTL_SET_HOSTPORT_TRAFFIC_SHAPING 

Set host port traffic shaping configuration.

Sets the traffic shaping configuration which not only depends on the host port parameters but also on the number of free TX FIFO blocks of the MAC ports.

IOCTL parameters:

CPSW_IOCTL_PRINT_REGISTERS 

Print CPSW and all submodule registers.

IOCTL parameters:

  • inArgs: None
  • outArgs: None
CPSW_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS 

Setup interVLAN route for a single egress port.

IOCTL parameters:

CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS 

Setup interVLAN route for a single egress port.

IOCTL parameters:

CPSW_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS 

Setup interVLAN route for a multiple egress port.

IOCTL parameters:

CPSW_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS 

Clear interVLAN route for a multiple egress port route.

IOCTL parameters:

CPSW_IOCTL_SET_SHORT_IPG_CONFIG 

Configure the short interpacket gap feature.

IOCTL parameters:

CPSW_IOCTL_GET_SHORT_IPG_CONFIG 

Get the current short interpacket gap configuration.

IOCTL parameters:

CPSW_IOCTL_ATTACH_CORE 

Attach Core with CPSW.

IOCTL parameters:

CPSW_IOCTL_DETACH_CORE 

Detach core from CPSW.

IOCTL parameters:

  • inArgs: uint32_t coreKey
  • outArgs: None
CPSW_IOCTL_REGISTER_RX_DEFAULT_FLOW 

Register default flow to a specific rx flow.

IOCTL parameters:

CPSW_IOCTL_UNREGISTER_RX_DEFAULT_FLOW 

Unregister default flow.

After unregistering default flow, default flow traffic will be directed to CPSW internal reserved flow where they will be dropped.

IOCTL parameters:

CPSW_IOCTL_REGISTER_DSTMAC_RX_FLOW 

Register destination MAC address to a specific rx flow.

Note that CPSW supports associating multiple L2/L3 header fields to a specific rx flow. Refer ALE API CPSW_ALE_IOCTL_SET_POLICER for details on how to associate fields other than DST MAC to a specific flow.

IOCTL parameters:

CPSW_IOCTL_UNREGISTER_DSTMAC_RX_FLOW 

Unregister destination MAC address to a specific flow.

After unregistering dstmac, traffic with associated MAC address will be directed to default flow.

IOCTL parameters:

IOCTL types.

Enumerator
CPSW_IOCTL_TYPE_PUBLIC 

Public IOCTL type (default type if omitted)

CPSW_IOCTL_TYPE_PRIVATE 

Private IOCTL type

IOCTL base number.

Enumerator
CPSW_IOCTL_CPSW_BASE 

CPSW IOCTL base

CPSW_IOCTL_ALE_BASE 

ALE submodule IOCTL base

CPSW_IOCTL_CPTS_BASE 

CPTS submodule IOCTL base

CPSW_IOCTL_HOSTPORT_BASE 

Host port submodule IOCTL base

CPSW_IOCTL_MACPORT_BASE 

MAC port submodule IOCTL base

CPSW_IOCTL_MDIO_BASE 

MDIO submodule IOCTL base

CPSW_IOCTL_SGMII_BASE 

SGMII submodule IOCTL base

CPSW_IOCTL_STATS_BASE 

Statistics submodule IOCTL base

CPSW_IOCTL_SS_BASE 

CPSW subsystem IOCTL base

CPSW_IOCTL_PHY_BASE 

PHY IOCTL base

CPSW_IOCTL_RM_BASE 
enum Cpsw_Type

CPSW instance type.

Type of CPSW instance.

Enumerator
CPSW_2G 

CPSW 2G: 1 host port, 1 MAC port

CPSW_9G 

CPSW 9G: 1 host port, 8 MAC ports

CPSW_TYPE_LAST 

CPSW last type - used for count of total number of types

CPSW MAC port.

Enumerator
CPSW_MAC_PORT_FIRST 

MAC port 0

CPSW_MAC_PORT_0 

MAC port 0

CPSW_MAC_PORT_1 

MAC port 1

CPSW_MAC_PORT_2 

MAC port 2

CPSW_MAC_PORT_3 

MAC port 3

CPSW_MAC_PORT_4 

MAC port 4

CPSW_MAC_PORT_5 

MAC port 5

CPSW_MAC_PORT_6 

MAC port 6

CPSW_MAC_PORT_7 

MAC port 7

CPSW_MAC_PORT_LAST 

MAC last port - used for count of total number of ports.

CRC type.

Enumerator
CPSW_CRC_ETHERNET 

Ethernet CRC type

CPSW_CRC_CASTAGNOLI 

Castagnoli CRC type

enum Cpsw_Speed

MAC interface speed.

Enumerator
CPSW_SPEED_10MBIT 

10 Mbps

CPSW_SPEED_100MBIT 

100 Mbps

CPSW_SPEED_1GBIT 

1 Gbps

CPSW_SPEED_2p5GBIT 

2.5 Gbps

CPSW_SPEED_10GBIT 

10 Gbps

CPSW_SPEED_AUTO 

Speed determined automatically

MAC interface duplexity.

Enumerator
CPSW_DUPLEX_HALF 

Half duplex

CPSW_DUPLEX_FULL 

Full duplex

CPSW_DUPLEX_AUTO 

Duplexity determined automatically

Double VLAN switch.

Enumerator
CPSW_VLAN_SWITCH_CUSTOMER 

Customer switch

CPSW_VLAN_SWITCH_SERVICE 

Service switch

CPSW Restart type.

CPSW supports reset isolation and full availability even when a core goes down. This requires speacial handling in driver when restarting from such scenarios. Based on type of restart different handling is required. Enumerator identifies type of restart

Enumerator
CPSW_RESTART_DOMAINRESET 

Restart after main domain reset

CPSW_RESTART_COREREBOOT 

Restart after core reboot due to watchdog expiry or software initiated reboot

Function Documentation

void CpswOsal_initPrms ( CpswOsal_Prms osalPrms)

CpswOsal_Prms structure init function.

Parameters
osalPrms[IN] Pointer to CpswOsal_Prms structure.
int32_t CpswOsal_setCachePrms ( const CpswOsal_CachePrms cachePrms)

Set the OSAL cache paramaters in case user needs to override the default cache API.

Caution: This is common across all handles and should be set perferably once for a given core before calling Cpsw_open.

Note: All the function pointer needs to be set.

Requirement: DOX_REQ_TAG(PDK-2984)

Parameters
cachePrms[IN] Pointer to CpswOsal_CachePrms structure. This parameter can't be NULL.
Returns
Cpsw_ErrorCodes
void CpswOsal_initCachePrms ( CpswOsal_CachePrms cachePrms)

CpswOsal_CachePrms structure init function.

Parameters
cachePrms[IN] Pointer to CpswOsal_CachePrms structure
void Cpsw_initParams ( Cpsw_Config cfg)

Initialize CPSW configuration parameters with default values.

Parameters
cfg[IN] CPSW configuration to be initialized
void Cpsw_initMacPortParams ( CpswMacPort_Config cfg)

Initialize MAC port configuration parameters with default values.

Parameters
cfg[IN] MAC port configuration to be initialized
void Cpsw_initPhyParams ( CpswPhy_Config cfg)

Initialize PHY configuration parameters.

Initializes PHY configuration to driver defaults.

Parameters
cfg[IN] Pointer to the PHY config structure
void Cpsw_setPhyExtendedParams ( CpswPhy_Config cfg,
const void *  extendedCfg,
uint32_t  extendedCfgSize 
)

Set PHY extended parameters.

Sets the PHY-specific extended parameters to the PHY config structure.

Parameters
cfg[IN] Pointer to the PHY config
extendedCfg[IN] Pointer to the PHY extended config
extendedCfgSize[IN] Size of the PHY extended config
void Cpsw_initOsalPrms ( CpswOsal_Prms pOsalPrms)

Initialize OSAL parameters with default values.

Initializes CPSW OSAL parameters structure with default values

Parameters
pOsalPrms[IN] OSAL parameters to be initialized
void Cpsw_init ( Cpsw_Type  cpswType,
const CpswOsal_Prms pOsalPrms,
CpswUtils_Prms pUtilsPrms 
)

Initialize CPSW driver.

Initializes the CPSW driver with OSAL and utils provided by the caller.

Parameters
cpswType[IN] CPSW instance type
pOsalPrms[IN] OSAL parameters
pUtilsPrms[IN] Utils parameters
void Cpsw_deinit ( Cpsw_Type  cpswType)

De-initialize CPSW driver.

Parameters
cpswType[IN] CPSW instance type
CpswTrace_TraceLevel Cpsw_setTraceLevel ( CpswTrace_TraceLevel  level)

Set runtime trace level.

Sets the driver's runtime trace level. The previous trace level is returned by this function should the application want to restore previous level at a later point in time.

Parameters
level[IN] Trace level
Returns
Previous trace level
CpswTrace_TraceLevel Cpsw_getTraceLevel ( void  )

Get runtime trace level.

Gets the driver's runtime trace level.

Returns
Current trace level
Cpsw_Handle Cpsw_getHandle ( Cpsw_Type  cpswType)

Get the CPSW opaque handle.

Gets the CPSW opaque handle corresponding to the given CPSW instance type

Parameters
cpswType[IN] CPSW instance type
Returns
CPSW opaque handle
Cpsw_Handle Cpsw_open ( Cpsw_Type  cpswType,
const Cpsw_Config cfg 
)

Open and initialize CPSW peripheral.

Opens and initializes the CPSW peripheral with the configuration parameters provided by the caller.

It must be called only after CPSW driver has been initialized via Cpsw_init().

Parameters
cpswType[IN] CPSW instance type
cfg[IN] CPSW configuration
Returns
CPSW opaque handle
Cpsw_Handle Cpsw_reopen ( Cpsw_Type  cpswType)

Re-open CPSW peripheral.

Re-opens the CPSW peripheral, but doesn't perform any hardware initialization. This function is expected to be called when application desires to attach to a running CPSW switch.

It must be called only after CPSW driver has been initialized via Cpsw_init().

Parameters
cpswType[IN] CPSW instance type
Returns
CPSW opaque handle
void Cpsw_close ( Cpsw_Handle  hCpsw)

Close CPSW peripheral.

Closes the CPSW peripheral.

Parameters
hCpsw[IN] CPSW opaque handle
int32_t Cpsw_ioctl ( Cpsw_Handle  hCpsw,
uint32_t  coreId,
uint32_t  cmd,
Cpsw_IoctlPrms prms 
)

Issue an operation on the CPSW peripheral/driver.

Issues a control operation on the CPSW peripheral and/or driver. The IOCTL commands fall in the following categories: CPSW, ALE, CPTS, HOSTPORT, MACPORT, MDIO, SGMII, STATS, SS, PHY and RM.

The IOCTL parameters should be built using the helper macros provided by the driver:

Parameters
hCpsw[IN] CPSW opaque handle
coreId[IN] Core Id
cmd[IN] IOCTL command Id
prms[IN] IOCTL parameters
Returns
Cpsw_ErrorCodes
void Cpsw_periodicTick ( Cpsw_Handle  hCpsw)

Run PHY-related periodic tick.

Runs the PHY-related periodic tick operation which executes one step in the PHY state machine and also handles link up or down events.

The registered Cpsw_Config::portLinkStatusChangeCb callback is executed in the caller's context when link up or down events occur.

Note: This must be called from only task context. Calling in interrupt context can cause deadlock with other CPSW driver APIs as both share the same mutex.

Parameters
hCpsw[IN] CPSW opaque handle
uint32_t Cpsw_getMacPortMax ( Cpsw_Type  cpswType)

Get the number of MAC ports in the CPSW instance.

Parameters
cpswType[IN] CPSW instance type
Returns
Number of supported MAC ports