PDK API Guide for J721E
|
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_Version * | Cpsw_GetVersionOutArgs |
Output args for CPSW_*_IOCTL_GET_VERSION commands. 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... | |
#define CPSW_IOCTL_SET_NO_ARGS | ( | prms | ) |
#define CPSW_IOCTL_SET_IN_ARGS | ( | prms, | |
in | |||
) |
#define CPSW_IOCTL_SET_OUT_ARGS | ( | prms, | |
out | |||
) |
#define CPSW_IOCTL_SET_INOUT_ARGS | ( | prms, | |
in, | |||
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, | |
n | |||
) | ((val & (1 << n)) >> n) |
Macro to get bit at given bit position
#define CPSW_IS_BIT_SET | ( | val, | |
n | |||
) | (((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 | |||
) |
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 |
10-Mbps, full and half-duplex capability mask
#define CPSW_LINK_CAP_100 |
100-Mbps, full and half-duplex capability mask
#define CPSW_LINK_CAP_1000 |
1-Gbps, full and half-duplex capability mask
#define CPSW_LINK_CAP_ALL |
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 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.
virtAddr | [IN] Virtual address |
chNum | [IN] Channel number passed during channel open |
appData | [IN] Callback pointer passed during channel open |
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.
phyAddr | [IN] Physical address |
chNum | [IN] Channel number passed during channel open |
appData | [IN] Callback pointer passed during channel open |
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.
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.
str | [OUT] Info string to print |
typedef uintptr_t(* CpswOsal_DisableAllIntrFxn) (void) |
CPSW OSAL intr disable function prototype.
typedef void(* CpswOsal_RestoreAllIntrFxn) (uintptr_t cookie) |
CPSW OSAL intr restore function prototype.
cookie | [IN] This is returned in disable interrupt function |
typedef void(* CpswOsal_RestoreIntrFxn) (uint32_t coreIntrNum) |
CPSW OSAL intr restore function prototype.
coreIntrNum | [IN] Interrupt to restore |
typedef void(* CpswOsal_DisableIntrFxn) (uint32_t coreIntrNum) |
CPSW OSAL intr disable function prototype.
coreIntrNum | [IN] Interrupt to disable |
typedef void*(* CpswOsal_MutexCreateFxn) (void) |
CPSW OSAL mutex create function prototype to protect critical section.
typedef void(* CpswOsal_MutexDeleteFxn) (void *mutexHandle) |
CPSW OSAL mutex delete function prototype.
mutexHandle | [IN] Pointer to mutex object returned during create |
typedef void(* CpswOsal_MutexLockFxn) (void *mutexHandle) |
CPSW OSAL mutex lock function prototype.
mutexHandle | [IN] Pointer to mutex object returned during create |
typedef void(* CpswOsal_MutexUnlockFxn) (void *mutexHandle) |
CPSW OSAL mutex lock function prototype.
mutexHandle | [IN] Pointer to mutex object returned during create |
typedef void(* CpswOsal_IsrFxn) (uintptr_t arg) |
CPSW OSAL ISR callback function prototype.
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.
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 |
typedef void(* CpswOsal_UnRegisterIntrFxn) (void *hwiHandle) |
CPSW OSAL ISR unregister function prototype.
hwiHandle | [IN] HWI handle |
CPSW OSAL cache invalidate function prototype.
addr | [IN] Start address of the cache line/s |
size | [IN] size (in bytes) of the memory to invalidate |
CPSW OSAL cache writeback function prototype.
addr | [IN] Start address of the cache line/s |
size | [IN] size (in bytes) of the memory to be written back |
CPSW OSAL cache writeback invalidate function prototype.
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.
typedef Cpsw_Version* Cpsw_GetVersionOutArgs |
Output args for CPSW_*_IOCTL_GET_VERSION commands.
enum Cpsw_Ioctl_e |
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:
|
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:
|
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:
|
enum Cpsw_IoctlType_e |
enum Cpsw_IoctlMajor_e |
IOCTL base number.
enum Cpsw_Type |
enum Cpsw_MacPort |
CPSW MAC port.
enum Cpsw_CrcType |
enum Cpsw_Speed |
enum Cpsw_Duplexity |
enum Cpsw_VlanSwitch |
enum Cpsw_RestartType |
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 |
void CpswOsal_initPrms | ( | CpswOsal_Prms * | osalPrms | ) |
CpswOsal_Prms structure init function.
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)
cachePrms | [IN] Pointer to CpswOsal_CachePrms structure. This parameter can't be NULL. |
void CpswOsal_initCachePrms | ( | CpswOsal_CachePrms * | cachePrms | ) |
CpswOsal_CachePrms structure init function.
cachePrms | [IN] Pointer to CpswOsal_CachePrms structure |
void Cpsw_initParams | ( | Cpsw_Config * | cfg | ) |
Initialize CPSW configuration parameters with default values.
cfg | [IN] CPSW configuration to be initialized |
void Cpsw_initMacPortParams | ( | CpswMacPort_Config * | cfg | ) |
Initialize MAC port configuration parameters with default values.
cfg | [IN] MAC port configuration to be initialized |
void Cpsw_initPhyParams | ( | CpswPhy_Config * | cfg | ) |
Initialize PHY configuration parameters.
Initializes PHY configuration to driver defaults.
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.
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
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.
cpswType | [IN] CPSW instance type |
pOsalPrms | [IN] OSAL parameters |
pUtilsPrms | [IN] Utils parameters |
void Cpsw_deinit | ( | Cpsw_Type | cpswType | ) |
De-initialize CPSW driver.
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.
level | [IN] Trace level |
CpswTrace_TraceLevel Cpsw_getTraceLevel | ( | void | ) |
Get runtime trace level.
Gets the driver's runtime 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
cpswType | [IN] CPSW instance type |
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().
cpswType | [IN] CPSW instance type |
cfg | [IN] CPSW configuration |
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().
cpswType | [IN] CPSW instance type |
void Cpsw_close | ( | Cpsw_Handle | hCpsw | ) |
Close CPSW peripheral.
Closes the CPSW peripheral.
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:
hCpsw | [IN] CPSW opaque handle |
coreId | [IN] Core Id |
cmd | [IN] IOCTL command Id |
prms | [IN] IOCTL parameters |
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.
hCpsw | [IN] CPSW opaque handle |
uint32_t Cpsw_getMacPortMax | ( | Cpsw_Type | cpswType | ) |
Get the number of MAC ports in the CPSW instance.
cpswType | [IN] CPSW instance type |