AM64x MCU+ SDK  08.02.00
cpsw_macport.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_MACPORT_H_
63 #define CPSW_MACPORT_H_
64 
65 /* ========================================================================== */
66 /* Include Files */
67 /* ========================================================================== */
68 
70 
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 
75 /* ========================================================================== */
76 /* Macros */
77 /* ========================================================================== */
78 
80 #define CPSW_MACPORT_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
81  ENET_IOCTL_MACPORT_BASE | \
82  ENET_IOCTL_PER_CPSW | \
83  ENET_IOCTL_MIN(x))
84 
85 /* ========================================================================== */
86 /* Structures and Enums */
87 /* ========================================================================== */
88 
92 typedef enum CpswMacPort_Ioctl_s
93 {
102 
111 
121 
125 typedef struct CpswMacPort_TxShortIpgCfg_s
126 {
131 
144 
148 typedef struct CpswMacPort_PortTxShortIpgCfg_s
149 {
152 
156 
160 typedef enum CpswMacPort_InterVlanRouteId_e
161 {
164 
167 
170 
173 
176 
180 
184 typedef struct CpswMacPort_InterVlanRoutingCfg_s
185 {
187  uint8_t dstAddr[ENET_MAC_ADDR_LEN];
188 
190  uint8_t srcAddr[ENET_MAC_ADDR_LEN];
191 
193  uint32_t vlanId;
194 
198 
202 
214 
218 typedef struct CpswMacPort_FifoStats_s
219 {
222 
225  uint32_t txStartWords;
226 
228  uint32_t txMaxBlocks;
229 
232  uint32_t rxMaxBlocks;
233 
235  uint32_t txBlockCount;
236 
239 
242 
244  bool txActiveFifo[ENET_PRI_NUM];
246 
252 typedef struct CpswMacPort_IpTsCfg_s
253 {
256 
258  bool unicastEn;
259 
261  bool tsIp129En;
262 
264  bool tsIp130En;
265 
267  bool tsIp131En;
268 
270  bool tsIp132En;
271 
273  bool tsIp107En;
274 
277 
281 
288 typedef struct CpswMacPort_TsEventCfg_s
289 {
292 
295 
298 
301 
304 
307 
310 
313 
316 
319  uint32_t vlanLType1;
320 
323  uint32_t vlanLType2;
324 
327 
329  uint32_t mcastType;
330 
332  uint32_t messageType;
333 
335  bool ltype2En;
336 
338  uint32_t seqIdOffset;
339 
341  uint32_t domainOffset;
343 
347 typedef struct CpswMacPort_EnableTsEventInArgs_s
348 {
351 
355 
359 typedef struct CpswMacPort_Cfg_s
360 {
363 
366 
369  uint32_t rxMtu;
370 
374 
377 
380 
384 
385 /* ========================================================================== */
386 /* Global Variables Declarations */
387 /* ========================================================================== */
388 
389 /* None */
390 
391 /* ========================================================================== */
392 /* Function Declarations */
393 /* ========================================================================== */
394 
401 
402 /* ========================================================================== */
403 /* Deprecated Function Declarations */
404 /* ========================================================================== */
405 
406 /* None */
407 
408 /* ========================================================================== */
409 /* Static Function Definitions */
410 /* ========================================================================== */
411 
412 /* None */
413 
414 #ifdef __cplusplus
415 }
416 #endif
417 
418 #endif /* CPSW_MACPORT_H_ */
419 
CpswMacPort_FifoStats::rxPreemptBlockCount
uint32_t rxPreemptBlockCount
Definition: cpsw_macport.h:241
CpswMacPort_Cfg::passPriorityTaggedUnchanged
bool passPriorityTaggedUnchanged
Definition: cpsw_macport.h:373
CpswMacPort_EnableTsEventInArgs::macPort
Enet_MacPort macPort
Definition: cpsw_macport.h:350
CpswMacPort_FifoStats::txStartWords
uint32_t txStartWords
Definition: cpsw_macport.h:225
CpswMacPort_FifoStats::rxMaxBlocks
uint32_t rxMaxBlocks
Definition: cpsw_macport.h:232
CPSW_MACPORT_INTERVLAN_ROUTEID_2
@ CPSW_MACPORT_INTERVLAN_ROUTEID_2
Definition: cpsw_macport.h:169
CpswMacPort_IpTsCfg::tsPort320En
bool tsPort320En
Definition: cpsw_macport.h:279
CpswMacPort_TxShortIpgCfg::txShortGapEn
bool txShortGapEn
Definition: cpsw_macport.h:130
CpswMacPort_IpTsCfg::tsIp132En
bool tsIp132En
Definition: cpsw_macport.h:270
enet_mod_macport.h
This file contains the type definitions and helper macros for the Enet MAC port module interface.
CpswMacPort_TsEventCfg::txAnnexFEn
bool txAnnexFEn
Definition: cpsw_macport.h:303
CpswMacPort_TsEventCfg::txVlanType
EnetMacPort_VlanType txVlanType
Definition: cpsw_macport.h:312
CpswMacPort_InterVlanRoutingCfg::forceUntaggedEgress
bool forceUntaggedEgress
Definition: cpsw_macport.h:201
CpswMacPort_Ioctl
CpswMacPort_Ioctl
CPSW MAC port IOCTL commands.
Definition: cpsw_macport.h:93
EnetPort_VlanCfg
VLAN configuration parameters.
Definition: enet_mod_port.h:68
CpswMacPort_TsEventCfg::rxVlanType
EnetMacPort_VlanType rxVlanType
Definition: cpsw_macport.h:315
CpswMacPort_FifoStats::txBlockCount
uint32_t txBlockCount
Definition: cpsw_macport.h:235
CpswMacPort_IpTsCfg::tsPort319En
bool tsPort319En
Definition: cpsw_macport.h:276
CPSW_MACPORT_INTERVLAN_ROUTEID_1
@ CPSW_MACPORT_INTERVLAN_ROUTEID_1
Definition: cpsw_macport.h:166
CpswMacPort_IpTsCfg
Port IP configuration for time synchronization events.
Definition: cpsw_macport.h:253
CpswMacPort_TxShortIpgCfg::txShortGapLimitEn
bool txShortGapLimitEn
Definition: cpsw_macport.h:142
CpswMacPort_TsEventCfg::domainOffset
uint32_t domainOffset
Definition: cpsw_macport.h:341
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:406
CpswMacPort_PortTxShortIpgCfg
MAC port's short gap configuration.
Definition: cpsw_macport.h:149
CPSW_MACPORT_INTERVLAN_ROUTEID_3
@ CPSW_MACPORT_INTERVLAN_ROUTEID_3
Definition: cpsw_macport.h:172
CpswMacPort_IpTsCfg::tsIp130En
bool tsIp130En
Definition: cpsw_macport.h:264
CpswMacPort_InterVlanRoutingCfg::replaceDASA
bool replaceDASA
Definition: cpsw_macport.h:197
CpswMacPort_InterVlanRoutingCfg
Port interVLAN configuration parameters.
Definition: cpsw_macport.h:185
CpswMacPort_Cfg::crcType
Enet_CrcType crcType
Definition: cpsw_macport.h:365
CpswMacPort_TxShortIpgCfg
Configuration of transmit short inter packet gap feature.
Definition: cpsw_macport.h:126
CpswMacPort_Cfg::vlanCfg
EnetPort_VlanCfg vlanCfg
Definition: cpsw_macport.h:376
CpswMacPort_Cfg::loopbackEn
bool loopbackEn
Definition: cpsw_macport.h:362
CpswMacPort_PortTxShortIpgCfg::shortIpgCfg
CpswMacPort_TxShortIpgCfg shortIpgCfg
Definition: cpsw_macport.h:154
CpswMacPort_IpTsCfg::tsIp131En
bool tsIp131En
Definition: cpsw_macport.h:267
CpswMacPort_initCfg
void CpswMacPort_initCfg(CpswMacPort_Cfg *macPortCfg)
Initialize CPSW MAC port configuration parameters.
CpswMacPort_TsEventCfg
Port configuration for time synchronization.
Definition: cpsw_macport.h:289
CPSW_MACPORT_INTERVLAN_ROUTEID_LAST
@ CPSW_MACPORT_INTERVLAN_ROUTEID_LAST
Definition: cpsw_macport.h:178
EnetMacPort_VlanType
EnetMacPort_VlanType
VLAN usage type.
Definition: enet_mod_macport.h:301
CPSW_MACPORT_IOCTL_ENABLE_CPTS_EVENT
@ CPSW_MACPORT_IOCTL_ENABLE_CPTS_EVENT
Enable Ethernet port CPTS event.
Definition: cpsw_macport.h:110
ENET_PRI_NUM
#define ENET_PRI_NUM
Packet priority.
Definition: enet_types.h:165
CpswMacPort_TsEventCfg::txAnnexEEn
bool txAnnexEEn
Definition: cpsw_macport.h:297
CpswMacPort_Cfg
MAC port module configuration parameters.
Definition: cpsw_macport.h:360
CpswMacPort_TsEventCfg::commonPortIpCfg
CpswMacPort_IpTsCfg commonPortIpCfg
Definition: cpsw_macport.h:326
CpswMacPort_IpTsCfg::tsIp107En
bool tsIp107En
Definition: cpsw_macport.h:273
CpswMacPort_IpTsCfg::tsIp129En
bool tsIp129En
Definition: cpsw_macport.h:261
EnetPort_EgressPriorityType
EnetPort_EgressPriorityType
Egress priority type.
Definition: enet_mod_port.h:83
CpswMacPort_FifoStats
FIFO related statistics of a MAC port.
Definition: cpsw_macport.h:219
CpswMacPort_Cfg::sgmiiMode
EnetMac_SgmiiMode sgmiiMode
Definition: cpsw_macport.h:382
CpswMacPort_TsEventCfg::vlanLType2
uint32_t vlanLType2
Definition: cpsw_macport.h:323
CpswMacPort_FifoStats::rxExpressBlockCount
uint32_t rxExpressBlockCount
Definition: cpsw_macport.h:238
CpswMacPort_EnableTsEventInArgs
Input args for CPSW_MACPORT_IOCTL_ENABLE_CPTS_EVENT.
Definition: cpsw_macport.h:348
CpswMacPort_TsEventCfg::vlanLType1
uint32_t vlanLType1
Definition: cpsw_macport.h:319
CpswMacPort_FifoStats::txMaxBlocks
uint32_t txMaxBlocks
Definition: cpsw_macport.h:228
CpswMacPort_TsEventCfg::rxAnnexFEn
bool rxAnnexFEn
Definition: cpsw_macport.h:306
CpswMacPort_TsEventCfg::rxAnnexEEn
bool rxAnnexEEn
Definition: cpsw_macport.h:300
CPSW_MACPORT_IOCTL_DISABLE_CPTS_EVENT
@ CPSW_MACPORT_IOCTL_DISABLE_CPTS_EVENT
Disable Ethernet port CPTS event.
Definition: cpsw_macport.h:119
CpswMacPort_Cfg::txPriorityType
EnetPort_EgressPriorityType txPriorityType
Definition: cpsw_macport.h:379
CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST
@ CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST
Definition: cpsw_macport.h:163
CpswMacPort_TsEventCfg::ltype2En
bool ltype2En
Definition: cpsw_macport.h:335
CpswMacPort_InterVlanRoutingCfg::decrementTTL
bool decrementTTL
Definition: cpsw_macport.h:212
CpswMacPort_Cfg::rxMtu
uint32_t rxMtu
Definition: cpsw_macport.h:369
CpswMacPort_PortTxShortIpgCfg::macPort
Enet_MacPort macPort
Definition: cpsw_macport.h:151
CpswMacPort_TsEventCfg::rxAnnexDEn
bool rxAnnexDEn
Definition: cpsw_macport.h:294
CpswMacPort_TsEventCfg::seqIdOffset
uint32_t seqIdOffset
Definition: cpsw_macport.h:338
CpswMacPort_TsEventCfg::messageType
uint32_t messageType
Definition: cpsw_macport.h:332
CPSW_MACPORT_INTERVLAN_ROUTEID_4
@ CPSW_MACPORT_INTERVLAN_ROUTEID_4
Definition: cpsw_macport.h:175
CPSW_MACPORT_IOCTL_GET_FIFO_STATS
@ CPSW_MACPORT_IOCTL_GET_FIFO_STATS
Get MAC port FIFO statistics.
Definition: cpsw_macport.h:101
CpswMacPort_EnableTsEventInArgs::tsEventCfg
CpswMacPort_TsEventCfg tsEventCfg
Definition: cpsw_macport.h:353
CpswMacPort_TsEventCfg::txAnnexDEn
bool txAnnexDEn
Definition: cpsw_macport.h:291
CpswMacPort_InterVlanRouteId
CpswMacPort_InterVlanRouteId
MAC port interVLAN route identifier.
Definition: cpsw_macport.h:161
CPSW_MACPORT_PUBLIC_IOCTL
#define CPSW_MACPORT_PUBLIC_IOCTL(x)
Helper macro to create IOCTL commands for CPSW MAC port module.
Definition: cpsw_macport.h:80
CpswMacPort_IpTsCfg::unicastEn
bool unicastEn
Definition: cpsw_macport.h:258
CpswMacPort_InterVlanRoutingCfg::vlanId
uint32_t vlanId
Definition: cpsw_macport.h:193
ENET_MAC_ADDR_LEN
#define ENET_MAC_ADDR_LEN
MAC address length in bytes/octets.
Definition: enet_types.h:153
CpswMacPort_FifoStats::rxThroughputRate
uint32_t rxThroughputRate
Definition: cpsw_macport.h:221
CpswMacPort_TsEventCfg::mcastType
uint32_t mcastType
Definition: cpsw_macport.h:329
Enet_CrcType
Enet_CrcType
CRC type.
Definition: enet_types.h:244
CpswMacPort_TsEventCfg::txHostTsEn
bool txHostTsEn
Definition: cpsw_macport.h:309
CpswMacPort_IpTsCfg::ttlNonzeroEn
bool ttlNonzeroEn
Definition: cpsw_macport.h:255
EnetMac_SgmiiMode
EnetMac_SgmiiMode
SGMII mode.
Definition: enet_mod_macport.h:250