AM263Px MCU+ SDK: CPSW MAC Port

| AM263Px MCU+ SDK 26.00.00 |

Data Structures | Functions | Enumerations | Macros
CPSW MAC Port
APIs for Networking modules » APIs for Enet LLD » Enet MAC Port

## Introduction

The CPSW MAC port module provides additional IOCTL commands than those supported by the generic Enet MAC Port API set.

CPSW MAC port clocks:

- CPSW_CPPI_CLK - CPSW main clock.

Features:

- CPSW_MACPORT_FEATURE_SGMII - Q/SGMII feature.
- CPSW_MACPORT_FEATURE_INTERVLAN - InterVLAN feature.

Compile-time configuration:

- ENET_CFG_CPSW_HOSTPORT_TRAFFIC_SHAPING - Traffic shaping (rate limit) support.
- ENET_CFG_CPSW_MACPORT_INTERVLAN - InterVLAN support.
- ENET_CFG_CPSW_MACPORT_SGMII - Q/SGMII support.

## Data Structures
struct | CpswMacPort_TxShortIpgCfg
| Configuration of transmit short inter packet gap feature. More...
struct | CpswMacPort_PortTxShortIpgCfg
| MAC port's short gap configuration. More...
struct | CpswMacPort_InterVlanRoutingCfg
| Port interVLAN configuration parameters. More...
struct | CpswMacPort_FifoStats
| FIFO related statistics of a MAC port. More...
struct | CpswMacPort_IpTsCfg
| Port IP configuration for time synchronization events. More...
struct | CpswMacPort_TsEventCfg
| Port configuration for time synchronization. More...
struct | CpswMacPort_EnableTsEventInArgs
| Input args for CPSW_MACPORT_IOCTL_ENABLE_CPTS_EVENT. More...
struct | CpswMacPort_EstTimestampCfg
| EST timestamping configuration parameters. More...
struct | CpswMacPort_Cfg
| MAC port module configuration parameters. More...

## Functions
void | CpswMacPort_initCfg (CpswMacPort_Cfg *macPortCfg)
| Initialize CPSW MAC port configuration parameters. More...

## Enumerations
enum | CpswMacPort_Ioctl { CPSW_MACPORT_IOCTL_GET_FIFO_STATS = CPSW_MACPORT_PUBLIC_IOCTL(0U), CPSW_MACPORT_IOCTL_ENABLE_CPTS_EVENT = CPSW_MACPORT_PUBLIC_IOCTL(1U), CPSW_MACPORT_IOCTL_DISABLE_CPTS_EVENT = CPSW_MACPORT_PUBLIC_IOCTL(2U), CPSW_MACPORT_IOCTL_EST_ENABLE_TIMESTAMP = CPSW_MACPORT_PUBLIC_IOCTL(3U), CPSW_MACPORT_IOCTL_EST_DISABLE_TIMESTAMP = CPSW_MACPORT_PUBLIC_IOCTL(4U) }
| CPSW MAC port IOCTL commands. More...
enum | CpswMacPort_InterVlanRouteId { CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST, CPSW_MACPORT_INTERVLAN_ROUTEID_1 = CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST, CPSW_MACPORT_INTERVLAN_ROUTEID_2, CPSW_MACPORT_INTERVLAN_ROUTEID_3, CPSW_MACPORT_INTERVLAN_ROUTEID_4, CPSW_MACPORT_INTERVLAN_ROUTEID_LAST = CPSW_MACPORT_INTERVLAN_ROUTEID_4 }
| MAC port interVLAN route identifier. More...
enum | CpswMacPort_EstTimestampMode { CPSW_MACPORT_EST_TIMESTAMP_ALL, CPSW_MACPORT_EST_TIMESTAMP_ONEPRI, CPSW_MACPORT_EST_TIMESTAMP_FIRST, CPSW_MACPORT_EST_TIMESTAMP_FIRST_ONEPRI }
| EST timestamping modes. More...

## Macros
#define | CPSW_MACPORT_PUBLIC_IOCTL(x)
| Helper macro to create IOCTL commands for CPSW MAC port module. More...
#define | CPSW_MACPORT_EST_TIME_INTERVAL_MIN (0x010U)
| EST non-zero minimum time interval, in wireside clocks. Needed to guarantee that next fetch value has time to be fetched before current fetch count is over. More...
#define | CPSW_MACPORT_EST_TIME_INTERVAL_MAX (0x3FFFU)
| EST maximum time interval (14-bit), in wireside clocks. More...
#define | CPSW_MACPORT_EST_TIME_STEP_1G (8U)
| Time interval step in nsecs for 1 Gbps link. More...
#define | CPSW_MACPORT_EST_TIME_STEP_100M (40U)
| Time interval step in nsecs for 100 Mbps link. More...
#define | CPSW_MACPORT_EST_TIME_STEP_10M (400U)
| Time interval step in nsecs for a 10 Mbps link. More...
#define | CPSW_MACPORT_EST_TIME_MIN(speed) (CPSW_MACPORT_EST_TIME_STEP_##speed * CPSW_MACPORT_EST_TIME_INTERVAL_MIN)
| Min time interval in nsecs for given link speed. More...
#define | CPSW_MACPORT_EST_TIME_MAX(speed) (CPSW_MACPORT_EST_TIME_STEP_##speed * CPSW_MACPORT_EST_TIME_INTERVAL_MAX)
| Max time interval in nsecs for given link speed. More...
#define | CPSW_MACPORT_EST_ALLOWCNT_FACTOR_1G (1U)
| EST allow count scaling factor for 1 Gbps link. More...
#define | CPSW_MACPORT_EST_ALLOWCNT_FACTOR_100M (2U)
| EST allow count scaling factor for 100 Mbps link. More...
#define | CPSW_MACPORT_EST_ALLOWCNT_FACTOR_10M (2U)
| EST allow count scaling factor for 10 Mbps link. More...
#define | CPSW_MACPORT_EST_GUARD_BAND(maxPktSize, speed)
| Guard band duration in nsecs for given link speed and maximum packet size in previous time interval. More...
#define | CPSW_MACPORT_GIGABIT_IET_VERIFY_TIMEOUT_NS (10*1000*1000)
| CPSW IET Verify timeout for 1 gig mode is 10ms. More...
#define | CPSW_MACPORT_RX_MAX_BLKS_IET (7U)
| CPSW Rx FIFO Blocks to enable IET. More...
#define | CPSW_MACPORT_TX_MAX_BLKS_IET (13U)
| CPSW Tx FIFO Blocks to enable IET. More...
#define | CPSW_MACPORT_RX_MAX_BLKS_DEFAULT (4U)
| CPSW default Rx FIFO Blocks for fifo_oneram. More...
#define | CPSW_MACPORT_TX_MAX_BLKS_DEFAULT (16U)
| CPSW default Tx FIFO Blocks for fifo_oneram. More...

## Macro Definition Documentation

## ◆ CPSW_MACPORT_PUBLIC_IOCTL

#define CPSW_MACPORT_PUBLIC_IOCTL | ( |  | x | ) |

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

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

## ◆ CPSW_MACPORT_EST_TIME_INTERVAL_MIN

#define CPSW_MACPORT_EST_TIME_INTERVAL_MIN (0x010U)

EST non-zero minimum time interval, in wireside clocks. Needed to guarantee that next fetch value has time to be fetched before current fetch count is over.

## ◆ CPSW_MACPORT_EST_TIME_INTERVAL_MAX

#define CPSW_MACPORT_EST_TIME_INTERVAL_MAX (0x3FFFU)

EST maximum time interval (14-bit), in wireside clocks.

## ◆ CPSW_MACPORT_EST_TIME_STEP_1G

#define CPSW_MACPORT_EST_TIME_STEP_1G (8U)

Time interval step in nsecs for 1 Gbps link.

## ◆ CPSW_MACPORT_EST_TIME_STEP_100M

#define CPSW_MACPORT_EST_TIME_STEP_100M (40U)

Time interval step in nsecs for 100 Mbps link.

## ◆ CPSW_MACPORT_EST_TIME_STEP_10M

#define CPSW_MACPORT_EST_TIME_STEP_10M (400U)

Time interval step in nsecs for a 10 Mbps link.

## ◆ CPSW_MACPORT_EST_TIME_MIN

#define CPSW_MACPORT_EST_TIME_MIN | ( |  | speed | ) | (CPSW_MACPORT_EST_TIME_STEP_##speed * CPSW_MACPORT_EST_TIME_INTERVAL_MIN)

Min time interval in nsecs for given link speed.

## ◆ CPSW_MACPORT_EST_TIME_MAX

#define CPSW_MACPORT_EST_TIME_MAX | ( |  | speed | ) | (CPSW_MACPORT_EST_TIME_STEP_##speed * CPSW_MACPORT_EST_TIME_INTERVAL_MAX)

Max time interval in nsecs for given link speed.

## ◆ CPSW_MACPORT_EST_ALLOWCNT_FACTOR_1G

#define CPSW_MACPORT_EST_ALLOWCNT_FACTOR_1G (1U)

EST allow count scaling factor for 1 Gbps link.

## ◆ CPSW_MACPORT_EST_ALLOWCNT_FACTOR_100M

#define CPSW_MACPORT_EST_ALLOWCNT_FACTOR_100M (2U)

EST allow count scaling factor for 100 Mbps link.

## ◆ CPSW_MACPORT_EST_ALLOWCNT_FACTOR_10M

#define CPSW_MACPORT_EST_ALLOWCNT_FACTOR_10M (2U)

EST allow count scaling factor for 10 Mbps link.

## ◆ CPSW_MACPORT_EST_GUARD_BAND

#define CPSW_MACPORT_EST_GUARD_BAND | ( |  | maxPktSize,
|  |  | speed
| ) |  |

Value:
(((((maxPktSize) + 4U) * \
CPSW_MACPORT_EST_ALLOWCNT_FACTOR_##speed) + 292U) * \
CPSW_MACPORT_EST_TIME_STEP_##speed)

Guard band duration in nsecs for given link speed and maximum packet size in previous time interval.

## ◆ CPSW_MACPORT_GIGABIT_IET_VERIFY_TIMEOUT_NS

#define CPSW_MACPORT_GIGABIT_IET_VERIFY_TIMEOUT_NS (10*1000*1000)

CPSW IET Verify timeout for 1 gig mode is 10ms.

## ◆ CPSW_MACPORT_RX_MAX_BLKS_IET

#define CPSW_MACPORT_RX_MAX_BLKS_IET (7U)

CPSW Rx FIFO Blocks to enable IET.

## ◆ CPSW_MACPORT_TX_MAX_BLKS_IET

#define CPSW_MACPORT_TX_MAX_BLKS_IET (13U)

CPSW Tx FIFO Blocks to enable IET.

## ◆ CPSW_MACPORT_RX_MAX_BLKS_DEFAULT

#define CPSW_MACPORT_RX_MAX_BLKS_DEFAULT (4U)

CPSW default Rx FIFO Blocks for fifo_oneram.

## ◆ CPSW_MACPORT_TX_MAX_BLKS_DEFAULT

#define CPSW_MACPORT_TX_MAX_BLKS_DEFAULT (16U)

CPSW default Tx FIFO Blocks for fifo_oneram.

## Enumeration Type Documentation

## ◆ CpswMacPort_Ioctl

enum CpswMacPort_Ioctl

CPSW MAC port IOCTL commands.

Enumerator
CPSW_MACPORT_IOCTL_GET_FIFO_STATS | Get MAC port FIFO statistics. IOCTL parameters: inArgs: EnetMacPort_GenericInArgs outArgs: CpswMacPort_FifoStats
CPSW_MACPORT_IOCTL_ENABLE_CPTS_EVENT | Enable Ethernet port CPTS event. IOCTL parameters: inArgs: CpswMacPort_EnableTsEventInArgs outArgs: None
CPSW_MACPORT_IOCTL_DISABLE_CPTS_EVENT | Disable Ethernet port CPTS event. IOCTL parameters: inArgs: EnetMacPort_GenericInArgs outArgs: None
CPSW_MACPORT_IOCTL_EST_ENABLE_TIMESTAMP | Enable EST packet timestamping functionality. Once enabled, timestamps can be retrieved using CPSW CPTS IOCTLs. IOCTL parameters: inArgs: CpswMacPort_EstTimestampCfg outArgs: None
CPSW_MACPORT_IOCTL_EST_DISABLE_TIMESTAMP | Disable EST packet timestamping functionality. IOCTL parameters: inArgs: EnetMacPort_GenericInArgs outArgs: None

## ◆ CpswMacPort_InterVlanRouteId

enum CpswMacPort_InterVlanRouteId

MAC port interVLAN route identifier.

Enumerator
CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST | First interVLAN route Id
CPSW_MACPORT_INTERVLAN_ROUTEID_1 | InterVLAN route Id 1
CPSW_MACPORT_INTERVLAN_ROUTEID_2 | InterVLAN route Id 2
CPSW_MACPORT_INTERVLAN_ROUTEID_3 | InterVLAN route Id 3
CPSW_MACPORT_INTERVLAN_ROUTEID_4 | InterVLAN route Id 4
CPSW_MACPORT_INTERVLAN_ROUTEID_LAST | Last interVLAN route Id

## ◆ CpswMacPort_EstTimestampMode

enum CpswMacPort_EstTimestampMode

EST timestamping modes.

Enumerator
CPSW_MACPORT_EST_TIMESTAMP_ALL | Timestamp all express packets on any priority.
CPSW_MACPORT_EST_TIMESTAMP_ONEPRI | Timestamp only express packets of a given priority.
CPSW_MACPORT_EST_TIMESTAMP_FIRST | Timestamp the first express packet in each time interval.
CPSW_MACPORT_EST_TIMESTAMP_FIRST_ONEPRI | Timestamp the first express packet of a given priority in the time interval.

## Function Documentation

## ◆ CpswMacPort_initCfg()

void CpswMacPort_initCfg | ( | CpswMacPort_Cfg * | macPortCfg | ) |

Initialize CPSW MAC port configuration parameters.

Parameters

  macPortCfg | Configuration parameters to be initialized

ENET_IOCTL_TYPE_PUBLIC
@ ENET_IOCTL_TYPE_PUBLIC
Definition: enet_ioctl.h:216