PDK API Guide for AM65xx
cpsw.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2020
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
62 #ifndef CPSW_H_
63 #define CPSW_H_
64 
65 /* ========================================================================== */
66 /* Include Files */
67 /* ========================================================================== */
68 
69 #include <stdint.h>
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 /* ========================================================================== */
85 /* Macros */
86 /* ========================================================================== */
88 #define CPSW_PER_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
89  ENET_IOCTL_PER_BASE | \
90  ENET_IOCTL_PER_CPSW | \
91  ENET_IOCTL_MIN(x))
92 
94 #if defined(SOC_TPR12) || defined(SOC_AWR294X)
95 #define CPSW_MAC_PORT_NUM (1U)
96 #else
97 #define CPSW_MAC_PORT_NUM (8U)
98 #endif
99 
110 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_PORT (CPSW_ALE_POLICER_MATCH_PORT)
111 
113 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACSRC (CPSW_ALE_POLICER_MATCH_MACSRC)
114 
116 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_MACDST (CPSW_ALE_POLICER_MATCH_MACDST)
117 
119 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_ETHERTYPE (CPSW_ALE_POLICER_MATCH_ETHERTYPE)
120 
122 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPSRC (CPSW_ALE_POLICER_MATCH_IPSRC)
123 
125 #define CPSW_INTERVLAN_INGRESSPKT_MATCH_IPDST (CPSW_ALE_POLICER_MATCH_IPDST)
126 
130 #define CPSW_INTR_STATS_PEND0 (1U)
131 
133 #define CPSW_INTR_MDIO_PEND (2U)
134 
136 #define CPSW_INTR_EVNT_PEND (3U)
137 
138 /* ========================================================================== */
139 /* Structures and Enums */
140 /* ========================================================================== */
141 
145 typedef enum Cpsw_Ioctl_e
146 {
155 
164 
173 
182 
191 
201 } Cpsw_Ioctl;
202 
206 typedef struct Cpsw_InterVlanRouteIngressPktMatchCfg_s
207 {
211 
216 
221 
226 
231 
233  uint32_t vlanId;
234 
239 
244 
248  uint16_t etherType;
250 
254 typedef struct Cpsw_InterVlanEgressPortCfg_s
255 {
258 
264 
268 typedef struct Cpsw_SetInterVlanRouteUniEgressInArgs_s
269 {
274 
278 
282 typedef struct Cpsw_SetInterVlanRouteUniEgressOutArgs_s
283 {
286 
290 
294 typedef struct Cpsw_ClearInterVlanRouteUniEgressInArgs_s
295 {
300 
303 
307  uint32_t delAleEntryMask;
309 
313 typedef struct Cpsw_SetInterVlanRouteMultiEgressInArgs_s
314 {
316  uint32_t numEgressPorts;
317 
322 
328 
332 typedef struct Cpsw_SetInterVlanRouteMultiEgressOutArgs_s
333 {
336 
340 
344 typedef struct Cpsw_ClearInterVlanRouteMultiEgressInArgs_s
345 {
347  uint32_t numEgressPorts;
348 
353 
358 
362  uint32_t delAleEntryMask;
364 
368 typedef struct Cpsw_SetTxShortIpgCfgInArgs_s
369 {
374 
378 
380  uint32_t numMacPorts;
381 
386 
392 typedef struct Cpsw_TxShortIpgCfg_s
393 {
397 
399  uint32_t numMacPorts;
400 
405 
409 typedef struct Cpsw_VlanCfg_s
410 {
412  bool vlanAware;
413 
416 
418  uint16_t outerVlan;
419 
421  uint16_t innerVlan;
422 } Cpsw_VlanCfg;
423 
427 typedef struct Cpsw_MdioLinkStateChangeInfo_s
428 {
430  uint32_t phyAddr;
431 
435 
438  bool isAlive;
439 
442 
444  bool isLinked;
446 
454  void *appArg);
455 
464  bool isLinkUp,
465  void *appArg);
466 
472 typedef struct Cpsw_Cfg_s
473 {
476 
478  const void *dmaCfg;
479 
482 
486  uint32_t txMtu[ENET_PRI_NUM];
487 
488  // /*! Configuration of the CPSW DMA */
489  // EnetDma_Cfg dmaCfg;
490 
493 
496 
499 
502 
505 
507  uint32_t intrPriority;
508 
511 
514 
518 
521 
527 
530 } Cpsw_Cfg;
531 
532 /* ========================================================================== */
533 /* Global Variables Declarations */
534 /* ========================================================================== */
535 
536 /* None */
537 
538 /* ========================================================================== */
539 /* Function Declarations */
540 /* ========================================================================== */
541 
542 /* None */
543 
544 /* ========================================================================== */
545 /* Deprecated Function Declarations */
546 /* ========================================================================== */
547 
548 /* None */
549 
550 /* ========================================================================== */
551 /* Static Function Definitions */
552 /* ========================================================================== */
553 
554 /* None */
555 
556 #ifdef __cplusplus
557 }
558 #endif
559 
560 #endif /* CPSW_H_ */
561 
bool enableQsgmii1RDC
Definition: cpsw.h:529
Setup interVLAN route for a single egress port.
Definition: cpsw.h:154
#define CPSW_PER_PUBLIC_IOCTL(x)
Helper macro to create CPSW IOCTL commands.
Definition: cpsw.h:88
bool isAlive
Definition: cpsw.h:438
CpswAle_Cfg aleCfg
Definition: cpsw.h:495
void(* Cpsw_PortLinkStatusChangeCb)(Enet_MacPort macPort, bool isLinkUp, void *appArg)
CPSW port link status change callback function.
Definition: cpsw.h:463
ALE configuration.
Definition: cpsw_ale.h:2016
Clear interVLAN route for a multiple egress port route.
Definition: cpsw.h:181
This file contains the type definitions and helper macros for the CPSW Statistics module interface.
Enet_MacPort egressPort
Definition: cpsw.h:257
#define CPSW_ALE_NUM_MAC_PORTS
Number of external ports in the subsystem.
Definition: cpsw_ale.h:92
uint32_t vlanId
Definition: cpsw.h:233
bool isLinked
Definition: cpsw.h:444
uint32_t numEgressPorts
Definition: cpsw.h:316
Output args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command.
Definition: cpsw.h:282
CpswAle_IpAddrClassifierInfo srcIpInfo
Definition: cpsw.h:238
Input args for CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_UNI_EGRESS command.
Definition: cpsw.h:294
const void * dmaCfg
Definition: cpsw.h:478
uint32_t packetMatchEnMask
Definition: cpsw.h:210
Cpsw_VlanCfg vlanCfg
Definition: cpsw.h:481
Setup interVLAN route for a single egress port.
Definition: cpsw.h:163
bool linkChanged
Definition: cpsw.h:441
This file contains the type definitions and helper macros for the Enet Data Path (DMA) interface.
This file contains the type definitions and helper macros for the CPSW Address Lookup Engine (ALE) mo...
void * mdioLinkStateChangeCbArg
Definition: cpsw.h:513
This file contains the type definitions and helper macros for the Ethernet PHY interface.
Output args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command.
Definition: cpsw.h:332
Mdio_Cfg mdioCfg
Definition: cpsw.h:501
uint32_t intrPriority
Definition: cpsw.h:507
void * portLinkStatusChangeCbArg
Definition: cpsw.h:520
Short IPG configuration for CPSW IP.
Definition: cpsw.h:392
bool configureGapThresh
Definition: cpsw.h:373
uint16_t etherType
Definition: cpsw.h:248
uint32_t delAleEntryMask
Definition: cpsw.h:362
CpswMacPort_InterVlanRouteId egressPortRouteId
Definition: cpsw.h:285
Enet_MacPort ingressPort
Definition: cpsw.h:220
Port interVLAN configuration parameters.
Definition: cpsw_macport.h:184
CpswAle_PolicerEntryOutArgs ingressPacketClassifierInfo
Definition: cpsw.h:288
#define CPSW_MAC_PORT_NUM
Definition: cpsw.h:97
uint32_t ipgTriggerThreshBlkCnt
Definition: cpsw.h:377
uint32_t numEgressPorts
Definition: cpsw.h:347
void(* Cpsw_MdioLinkStateChangeCb)(Cpsw_MdioLinkStateChangeInfo *info, void *appArg)
CPSW PHY link state change callback function.
Definition: cpsw.h:453
Setup interVLAN route for a multiple egress port.
Definition: cpsw.h:172
ALE IP address classifier info.
Definition: cpsw_ale.h:1371
CpswAle_MacAddrClassifierInfo srcMacAddrInfo
Definition: cpsw.h:225
This file contains the type definitions and helper macros for the Enet Resource Manager module.
Enet_VlanTagType vlanSwitch
Definition: cpsw.h:415
uint32_t numMacPorts
Definition: cpsw.h:399
Resource manager configuration parameters.
Definition: enet_rm.h:336
Cpsw_Ioctl
CPSW peripheral IOCTL commands.
Definition: cpsw.h:145
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:299
CpswAle_MacAddrClassifierInfo dstMacAddrInfo
Definition: cpsw.h:230
Cpsw_PortLinkStatusChangeCb portLinkStatusChangeCb
Definition: cpsw.h:517
bool enableQsgmii0RDC
Definition: cpsw.h:526
This file contains the type definitions and helper macros for the CPSW host port module.
Cpsw_MdioLinkStateChangeCb mdioLinkStateChangeCb
Definition: cpsw.h:510
CPSW-level VLAN configuration.
Definition: cpsw.h:409
ALE classifier/policer match parameters for source or destination MAC address.
Definition: cpsw_ale.h:1171
CPTS configuration.
Definition: cpsw_cpts.h:531
Input args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_MULTI_EGRESS command.
Definition: cpsw.h:313
MAC port's short gap configuration.
Definition: cpsw_macport.h:148
uint32_t ipgTriggerThreshBlkCnt
Definition: cpsw.h:396
Input args for CPSW_PER_IOCTL_SET_INTERVLAN_ROUTE_UNI_EGRESS command.
Definition: cpsw.h:268
uint32_t phyAddr
Definition: cpsw.h:430
MDIO module configuration.
Definition: mdio.h:107
This file contains the type definitions and helper macros for the CPSW MAC port module interface.
PHY link status change event information.
Definition: cpsw.h:427
uint32_t escalatePriorityLoadVal
Definition: cpsw.h:475
InterVLAN route ingress packet match criteria configuration.
Definition: cpsw.h:206
Output args for CPSW_ALE_IOCTL_GET_POLICER, CPSW_ALE_IOCTL_SET_POLICER_THREADCFG, CPSW_ALE_IOCTL_BLOC...
Definition: cpsw_ale.h:1522
#define ENET_PRI_NUM
Packet priority.
Definition: enet_types.h:165
InterVLAN egress port configuration.
Definition: cpsw.h:254
uint32_t numMacPorts
Definition: cpsw.h:380
CpswMacPort_InterVlanRoutingCfg outPktModCfg
Definition: cpsw.h:262
Enet_MacPort
MAC port.
Definition: enet_types.h:402
CpswAle_IpAddrClassifierInfo dstIpInfo
Definition: cpsw.h:243
Get the current short inter-packet gap (IPG) configuration for all open MAC ports.
Definition: cpsw.h:200
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:273
Host port module configuration parameters.
Definition: cpsw_hostport.h:137
CpswHostPort_Cfg hostPortCfg
Definition: cpsw.h:492
CpswMacPort_InterVlanRouteId
MAC port interVLAN route identifier.
Definition: cpsw_macport.h:160
CpswCpts_Cfg cptsCfg
Definition: cpsw.h:498
Input args for CPSW_PER_IOCTL_SET_SHORT_IPG_CFG.
Definition: cpsw.h:368
CPSW configuration.
Definition: cpsw.h:472
bool vlanAware
Definition: cpsw.h:412
EnetRm_ResCfg resCfg
Definition: cpsw.h:504
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:326
Cpsw_InterVlanRouteIngressPktMatchCfg inPktMatchCfg
Definition: cpsw.h:357
Cpsw_InterVlanEgressPortCfg egressCfg
Definition: cpsw.h:276
CpswMacPort_InterVlanRouteId egressPortRouteId
Definition: cpsw.h:335
uint16_t outerVlan
Definition: cpsw.h:418
Enet_VlanTagType
Double tagging VLAN type.
Definition: enet_types.h:369
This file contains private type definitions and helper macros for the CPSW CPTS module.
bool ttlCheckEn
Definition: cpsw.h:215
uint32_t delAleEntryMask
Definition: cpsw.h:307
This file contains the type definitions and helper macros for the MDIO module interface.
bool aliveChanged
Definition: cpsw.h:434
Configure short inter-packet gap (IPG) for specific MAC ports.
Definition: cpsw.h:190
Input args for CPSW_PER_IOCTL_CLEAR_INTERVLAN_ROUTE_MULTI_EGRESS command.
Definition: cpsw.h:344
CpswAle_PolicerEntryOutArgs ingressPacketClassifierInfo
Definition: cpsw.h:338
Cpsw_InterVlanEgressPortCfg egressCfg
Definition: cpsw.h:302
uint16_t innerVlan
Definition: cpsw.h:421