AM261x MCU+ SDK: CPSW Peripheral

| AM261x MCU+ SDK 26.00.00 |

Data Structures | Typedefs | Enumerations | Macros
CPSW Peripheral
APIs for Networking modules » APIs for Enet LLD » Enet Peripherals

## Introduction

CPSW peripheral supports CPSW_2G, CPSW_5G and CPSW_9G found in SoCs of the Jacinto 7 family.

Features:

- CPSW_FEATURE_INTERVLAN - InterVLAN feature.

Compile-time configuration:

- ENET_CFG_CPSW_SGMII - Q/SGMII support. It requires CPSW MAC port's ENET_CFG_CPSW_MACPORT_SGMII compile-time flag.
- ENET_CFG_CPSW_INTERVLAN - InterVLAN support. It requires CPSW MAC port's ENET_CFG_CPSW_MACPORT_INTERVLAN compile-time flag.

## Data Structures
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_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command. More...
struct | Cpsw_SetInterVlanRouteUniEgressOutArgs
| Output args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command. More...
struct | Cpsw_ClearInterVlanRouteUniEgressInArgs
| Input args for CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command. More...
struct | Cpsw_SetInterVlanRouteMultiEgressInArgs
| Input args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
struct | Cpsw_SetInterVlanRouteMultiEgressOutArgs
| Output args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
struct | Cpsw_ClearInterVlanRouteMultiEgressInArgs
| Input args for CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command. More...
struct | Cpsw_SetTxShortIpgCfgInArgs
| Input args for CPSW_PER_IOCTL_SET_SHORT_IPG_CFG. More...
struct | Cpsw_TxShortIpgCfg
| Short IPG configuration for CPSW IP. More...
struct | Cpsw_VlanCfg
| CPSW-level VLAN configuration. More...
struct | Cpsw_MdioLinkStateChangeInfo
| PHY link status change event information. More...
struct | Cpsw_Cfg
| CPSW configuration. More...

## Typedefs
typedef void(* | Cpsw_MdioLinkStateChangeCb) (Cpsw_MdioLinkStateChangeInfo *info, void *appArg)
| CPSW PHY link state change callback function. More...
typedef void(* | Cpsw_PortLinkStatusChangeCb) (Enet_MacPort macPort, bool isLinkUp, void *appArg)
| CPSW port link status change callback function. More...

## Enumerations
enum | Cpsw_Ioctl { CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS = CPSW_PER_PUBLIC_IOCTL(0U), CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS = CPSW_PER_PUBLIC_IOCTL(1U), CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS = CPSW_PER_PUBLIC_IOCTL(2U), CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS = CPSW_PER_PUBLIC_IOCTL(3U), CPSW_PER_IOCTL_SET_SHORT_IPG_CFG = CPSW_PER_PUBLIC_IOCTL(4U), CPSW_PER_IOCTL_GET_SHORT_IPG_CFG = CPSW_PER_PUBLIC_IOCTL(5U) }
| CPSW peripheral IOCTL commands. More...

## Macros
#define | CPSW_COMMON_TX_MTU_DEFAULT (2024U)
| Default common TX MTU. More...
#define | CPSW_ESC_PRI_LD_VAL (2U)
| Priority escalation value for switch scheduler. More...
#define | CPSW_PER_PUBLIC_IOCTL(x)
| Helper macro to create CPSW IOCTL commands. More...
#define | CPSW_MAC_PORT_NUM (8U)
#define | CPSW_INTR_STATS_PEND0 (1U)
| CPSW statistics interrupt id. More...
#define | CPSW_INTR_MDIO_PEND (2U)
| CPSW MDIO interrupt id. More...
#define | CPSW_INTR_EVNT_PEND (3U)
| CPSW event pending interrupt (CPTS) id. More...

## 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)
| Enable classifier match with PORT number. More...
#define | CPSW_INTERVLAN_INGRESSPKT_MATCH_MACSRC (CPSW_ALE_POLICER_MATCH_MACSRC)
| Enable classifier match with MAC source address entry. More...
#define | CPSW_INTERVLAN_INGRESSPKT_MATCH_MACDST (CPSW_ALE_POLICER_MATCH_MACDST)
| Enable classifier match with MAC destination address entry. More...
#define | CPSW_INTERVLAN_INGRESSPKT_MATCH_ETHERTYPE (CPSW_ALE_POLICER_MATCH_ETHERTYPE)
| Enable classifier match with MAC destination address entry. More...
#define | CPSW_INTERVLAN_INGRESSPKT_MATCH_IPSRC (CPSW_ALE_POLICER_MATCH_IPSRC)
| Enable classifier match with IPv4/IPv6 source address. More...
#define | CPSW_INTERVLAN_INGRESSPKT_MATCH_IPDST (CPSW_ALE_POLICER_MATCH_IPDST)
| Enable classifier match with IPv4/IPv6 destination address. More...

## Macro Definition Documentation

## ◆ CPSW_COMMON_TX_MTU_DEFAULT

#define CPSW_COMMON_TX_MTU_DEFAULT (2024U)

Default common TX MTU.

## ◆ CPSW_ESC_PRI_LD_VAL

#define CPSW_ESC_PRI_LD_VAL (2U)

Priority escalation value for switch scheduler.

When a port is in escalate priority, this is the number of higher priority packets sent before the next lower priority is allowed to send a packet. Escalate priority allows lower priority packets to be sent at a fixed rate relative to the next higher priority. The min value of esc_pri_ld_val = 2

## ◆ CPSW_PER_PUBLIC_IOCTL

#define CPSW_PER_PUBLIC_IOCTL | ( |  | x | ) |

Value:
(ENET_IOCTL_TYPE_PUBLIC | \
ENET_IOCTL_PER_BASE | \
ENET_IOCTL_PER_CPSW | \
ENET_IOCTL_MIN(x))

Helper macro to create CPSW IOCTL commands.

## ◆ CPSW_MAC_PORT_NUM

#define CPSW_MAC_PORT_NUM (8U)

Maximum number of MAC ports supported by this driver.

## ◆ CPSW_INTERVLAN_INGRESSPKT_MATCH_PORT

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_PORT (CPSW_ALE_POLICER_MATCH_PORT)

Enable classifier match with PORT number.

## ◆ CPSW_INTERVLAN_INGRESSPKT_MATCH_MACSRC

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACSRC (CPSW_ALE_POLICER_MATCH_MACSRC)

Enable classifier match with MAC source address entry.

## ◆ CPSW_INTERVLAN_INGRESSPKT_MATCH_MACDST

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACDST (CPSW_ALE_POLICER_MATCH_MACDST)

Enable classifier match with MAC destination address entry.

## ◆ CPSW_INTERVLAN_INGRESSPKT_MATCH_ETHERTYPE

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_ETHERTYPE (CPSW_ALE_POLICER_MATCH_ETHERTYPE)

Enable classifier match with MAC destination address entry.

## ◆ CPSW_INTERVLAN_INGRESSPKT_MATCH_IPSRC

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPSRC (CPSW_ALE_POLICER_MATCH_IPSRC)

Enable classifier match with IPv4/IPv6 source address.

## ◆ CPSW_INTERVLAN_INGRESSPKT_MATCH_IPDST

#define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPDST (CPSW_ALE_POLICER_MATCH_IPDST)

Enable classifier match with IPv4/IPv6 destination address.

## ◆ CPSW_INTR_STATS_PEND0

#define CPSW_INTR_STATS_PEND0 (1U)

CPSW statistics interrupt id.

## ◆ CPSW_INTR_MDIO_PEND

#define CPSW_INTR_MDIO_PEND (2U)

CPSW MDIO interrupt id.

## ◆ CPSW_INTR_EVNT_PEND

#define CPSW_INTR_EVNT_PEND (3U)

CPSW event pending interrupt (CPTS) id.

## Typedef Documentation

## ◆ Cpsw_MdioLinkStateChangeCb

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.

## ◆ Cpsw_PortLinkStatusChangeCb

typedef void(* Cpsw_PortLinkStatusChangeCb) (Enet_MacPort macPort, 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).

## Enumeration Type Documentation

## ◆ Cpsw_Ioctl

enum Cpsw_Ioctl

CPSW peripheral IOCTL commands.

Enumerator
CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS | Setup interVLAN route for a single egress port. IOCTL parameters: inArgs: Cpsw_SetInterVlanRouteUniEgressInArgs outArgs: Cpsw_SetInterVlanRouteUniEgressOutArgs
CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS | Setup interVLAN route for a single egress port. IOCTL parameters: inArgs: Cpsw_ClearInterVlanRouteUniEgressInArgs outArgs: CpswMacPort_InterVlanRouteId
CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS | Setup interVLAN route for a multiple egress port. IOCTL parameters: inArgs: Cpsw_SetInterVlanRouteMultiEgressInArgs outArgs: Cpsw_SetInterVlanRouteMultiEgressOutArgs
CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS | Clear interVLAN route for a multiple egress port route. IOCTL parameters: inArgs: Cpsw_ClearInterVlanRouteMultiEgressInArgs outArgs: CpswMacPort_InterVlanRouteId
CPSW_PER_IOCTL_SET_SHORT_IPG_CFG | Configure short inter-packet gap (IPG) for specific MAC ports. IOCTL parameters: inArgs: Cpsw_SetTxShortIpgCfgInArgs outArgs: None
CPSW_PER_IOCTL_GET_SHORT_IPG_CFG | Get the current short inter-packet gap (IPG) configuration for all open MAC ports. IOCTL parameters: inArgs: None outArgs: Cpsw_TxShortIpgCfg

ENET_IOCTL_TYPE_PUBLIC
@ ENET_IOCTL_TYPE_PUBLIC
Definition: enet_ioctl.h:216