AM263x MCU+ SDK  08.02.01
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 
120 
131 
141 
145 typedef struct CpswMacPort_TxShortIpgCfg_s
146 {
151 
164 
168 typedef struct CpswMacPort_PortTxShortIpgCfg_s
169 {
172 
176 
180 typedef enum CpswMacPort_InterVlanRouteId_e
181 {
184 
187 
190 
193 
196 
200 
204 typedef struct CpswMacPort_InterVlanRoutingCfg_s
205 {
207  uint8_t dstAddr[ENET_MAC_ADDR_LEN];
208 
210  uint8_t srcAddr[ENET_MAC_ADDR_LEN];
211 
213  uint32_t vlanId;
214 
218 
222 
234 
238 typedef struct CpswMacPort_FifoStats_s
239 {
242 
245  uint32_t txStartWords;
246 
248  uint32_t txMaxBlocks;
249 
252  uint32_t rxMaxBlocks;
253 
255  uint32_t txBlockCount;
256 
259 
262 
264  bool txActiveFifo[ENET_PRI_NUM];
266 
272 typedef struct CpswMacPort_IpTsCfg_s
273 {
276 
278  bool unicastEn;
279 
281  bool tsIp129En;
282 
284  bool tsIp130En;
285 
287  bool tsIp131En;
288 
290  bool tsIp132En;
291 
293  bool tsIp107En;
294 
297 
301 
308 typedef struct CpswMacPort_TsEventCfg_s
309 {
312 
315 
318 
321 
324 
327 
330 
333 
336 
339  uint32_t vlanLType1;
340 
343  uint32_t vlanLType2;
344 
347 
349  uint32_t mcastType;
350 
352  uint32_t messageType;
353 
355  bool ltype2En;
356 
358  uint32_t seqIdOffset;
359 
361  uint32_t domainOffset;
363 
367 typedef struct CpswMacPort_EnableTsEventInArgs_s
368 {
371 
375 
379 typedef enum CpswMacPort_EstTimestampMode_e
380 {
383 
386 
389 
392 
394 
398 typedef struct CpswMacPort_EstTimestampCfg_s
399 {
402 
405 
409  uint8_t priority;
410 
413  uint8_t domain;
415 
419 typedef struct CpswMacPort_Cfg_s
420 {
423 
426 
429  uint32_t rxMtu;
430 
434 
437 
440 
444 
445 /* ========================================================================== */
446 /* Global Variables Declarations */
447 /* ========================================================================== */
448 
449 /* None */
450 
451 /* ========================================================================== */
452 /* Function Declarations */
453 /* ========================================================================== */
454 
461 
462 /* ========================================================================== */
463 /* Deprecated Function Declarations */
464 /* ========================================================================== */
465 
466 /* None */
467 
468 /* ========================================================================== */
469 /* Static Function Definitions */
470 /* ========================================================================== */
471 
472 /* None */
473 
474 #ifdef __cplusplus
475 }
476 #endif
477 
478 #endif /* CPSW_MACPORT_H_ */
479 
CpswMacPort_FifoStats::rxPreemptBlockCount
uint32_t rxPreemptBlockCount
Definition: cpsw_macport.h:261
CpswMacPort_Cfg::passPriorityTaggedUnchanged
bool passPriorityTaggedUnchanged
Definition: cpsw_macport.h:433
CpswMacPort_EstTimestampMode
CpswMacPort_EstTimestampMode
EST timestamping modes.
Definition: cpsw_macport.h:380
CpswMacPort_EnableTsEventInArgs::macPort
Enet_MacPort macPort
Definition: cpsw_macport.h:370
CpswMacPort_FifoStats::txStartWords
uint32_t txStartWords
Definition: cpsw_macport.h:245
CpswMacPort_FifoStats::rxMaxBlocks
uint32_t rxMaxBlocks
Definition: cpsw_macport.h:252
CPSW_MACPORT_INTERVLAN_ROUTEID_2
@ CPSW_MACPORT_INTERVLAN_ROUTEID_2
Definition: cpsw_macport.h:189
CpswMacPort_IpTsCfg::tsPort320En
bool tsPort320En
Definition: cpsw_macport.h:299
CpswMacPort_TxShortIpgCfg::txShortGapEn
bool txShortGapEn
Definition: cpsw_macport.h:150
CpswMacPort_IpTsCfg::tsIp132En
bool tsIp132En
Definition: cpsw_macport.h:290
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:323
CpswMacPort_TsEventCfg::txVlanType
EnetMacPort_VlanType txVlanType
Definition: cpsw_macport.h:332
CpswMacPort_InterVlanRoutingCfg::forceUntaggedEgress
bool forceUntaggedEgress
Definition: cpsw_macport.h:221
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:335
CpswMacPort_FifoStats::txBlockCount
uint32_t txBlockCount
Definition: cpsw_macport.h:255
CpswMacPort_IpTsCfg::tsPort319En
bool tsPort319En
Definition: cpsw_macport.h:296
CPSW_MACPORT_INTERVLAN_ROUTEID_1
@ CPSW_MACPORT_INTERVLAN_ROUTEID_1
Definition: cpsw_macport.h:186
CpswMacPort_IpTsCfg
Port IP configuration for time synchronization events.
Definition: cpsw_macport.h:273
CpswMacPort_TxShortIpgCfg::txShortGapLimitEn
bool txShortGapLimitEn
Definition: cpsw_macport.h:162
CPSW_MACPORT_EST_TIMESTAMP_FIRST_ONEPRI
@ CPSW_MACPORT_EST_TIMESTAMP_FIRST_ONEPRI
Definition: cpsw_macport.h:391
CpswMacPort_TsEventCfg::domainOffset
uint32_t domainOffset
Definition: cpsw_macport.h:361
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:406
CpswMacPort_PortTxShortIpgCfg
MAC port's short gap configuration.
Definition: cpsw_macport.h:169
CPSW_MACPORT_INTERVLAN_ROUTEID_3
@ CPSW_MACPORT_INTERVLAN_ROUTEID_3
Definition: cpsw_macport.h:192
CpswMacPort_IpTsCfg::tsIp130En
bool tsIp130En
Definition: cpsw_macport.h:284
CpswMacPort_InterVlanRoutingCfg::replaceDASA
bool replaceDASA
Definition: cpsw_macport.h:217
CpswMacPort_InterVlanRoutingCfg
Port interVLAN configuration parameters.
Definition: cpsw_macport.h:205
CpswMacPort_Cfg::crcType
Enet_CrcType crcType
Definition: cpsw_macport.h:425
CpswMacPort_TxShortIpgCfg
Configuration of transmit short inter packet gap feature.
Definition: cpsw_macport.h:146
CpswMacPort_Cfg::vlanCfg
EnetPort_VlanCfg vlanCfg
Definition: cpsw_macport.h:436
CpswMacPort_Cfg::loopbackEn
bool loopbackEn
Definition: cpsw_macport.h:422
CpswMacPort_PortTxShortIpgCfg::shortIpgCfg
CpswMacPort_TxShortIpgCfg shortIpgCfg
Definition: cpsw_macport.h:174
CPSW_MACPORT_EST_TIMESTAMP_FIRST
@ CPSW_MACPORT_EST_TIMESTAMP_FIRST
Definition: cpsw_macport.h:388
CpswMacPort_IpTsCfg::tsIp131En
bool tsIp131En
Definition: cpsw_macport.h:287
CpswMacPort_EstTimestampCfg::mode
CpswMacPort_EstTimestampMode mode
Definition: cpsw_macport.h:404
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:309
CPSW_MACPORT_INTERVLAN_ROUTEID_LAST
@ CPSW_MACPORT_INTERVLAN_ROUTEID_LAST
Definition: cpsw_macport.h:198
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:317
CpswMacPort_Cfg
MAC port module configuration parameters.
Definition: cpsw_macport.h:420
CpswMacPort_TsEventCfg::commonPortIpCfg
CpswMacPort_IpTsCfg commonPortIpCfg
Definition: cpsw_macport.h:346
CPSW_MACPORT_IOCTL_EST_ENABLE_TIMESTAMP
@ CPSW_MACPORT_IOCTL_EST_ENABLE_TIMESTAMP
Enable EST packet timestamping functionality.
Definition: cpsw_macport.h:130
CpswMacPort_IpTsCfg::tsIp107En
bool tsIp107En
Definition: cpsw_macport.h:293
CpswMacPort_IpTsCfg::tsIp129En
bool tsIp129En
Definition: cpsw_macport.h:281
CpswMacPort_EstTimestampCfg::domain
uint8_t domain
Definition: cpsw_macport.h:413
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:239
CpswMacPort_Cfg::sgmiiMode
EnetMac_SgmiiMode sgmiiMode
Definition: cpsw_macport.h:442
CpswMacPort_TsEventCfg::vlanLType2
uint32_t vlanLType2
Definition: cpsw_macport.h:343
CpswMacPort_FifoStats::rxExpressBlockCount
uint32_t rxExpressBlockCount
Definition: cpsw_macport.h:258
CpswMacPort_EnableTsEventInArgs
Input args for CPSW_MACPORT_IOCTL_ENABLE_CPTS_EVENT.
Definition: cpsw_macport.h:368
CpswMacPort_TsEventCfg::vlanLType1
uint32_t vlanLType1
Definition: cpsw_macport.h:339
CPSW_MACPORT_EST_TIMESTAMP_ONEPRI
@ CPSW_MACPORT_EST_TIMESTAMP_ONEPRI
Definition: cpsw_macport.h:385
CpswMacPort_FifoStats::txMaxBlocks
uint32_t txMaxBlocks
Definition: cpsw_macport.h:248
CpswMacPort_TsEventCfg::rxAnnexFEn
bool rxAnnexFEn
Definition: cpsw_macport.h:326
CpswMacPort_TsEventCfg::rxAnnexEEn
bool rxAnnexEEn
Definition: cpsw_macport.h:320
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:439
CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST
@ CPSW_MACPORT_INTERVLAN_ROUTEID_FIRST
Definition: cpsw_macport.h:183
CpswMacPort_TsEventCfg::ltype2En
bool ltype2En
Definition: cpsw_macport.h:355
CpswMacPort_InterVlanRoutingCfg::decrementTTL
bool decrementTTL
Definition: cpsw_macport.h:232
CpswMacPort_Cfg::rxMtu
uint32_t rxMtu
Definition: cpsw_macport.h:429
CpswMacPort_PortTxShortIpgCfg::macPort
Enet_MacPort macPort
Definition: cpsw_macport.h:171
CpswMacPort_TsEventCfg::rxAnnexDEn
bool rxAnnexDEn
Definition: cpsw_macport.h:314
CpswMacPort_TsEventCfg::seqIdOffset
uint32_t seqIdOffset
Definition: cpsw_macport.h:358
CpswMacPort_TsEventCfg::messageType
uint32_t messageType
Definition: cpsw_macport.h:352
CPSW_MACPORT_INTERVLAN_ROUTEID_4
@ CPSW_MACPORT_INTERVLAN_ROUTEID_4
Definition: cpsw_macport.h:195
CPSW_MACPORT_IOCTL_GET_FIFO_STATS
@ CPSW_MACPORT_IOCTL_GET_FIFO_STATS
Get MAC port FIFO statistics.
Definition: cpsw_macport.h:101
CPSW_MACPORT_EST_TIMESTAMP_ALL
@ CPSW_MACPORT_EST_TIMESTAMP_ALL
Definition: cpsw_macport.h:382
CpswMacPort_EnableTsEventInArgs::tsEventCfg
CpswMacPort_TsEventCfg tsEventCfg
Definition: cpsw_macport.h:373
CpswMacPort_TsEventCfg::txAnnexDEn
bool txAnnexDEn
Definition: cpsw_macport.h:311
CpswMacPort_InterVlanRouteId
CpswMacPort_InterVlanRouteId
MAC port interVLAN route identifier.
Definition: cpsw_macport.h:181
CPSW_MACPORT_IOCTL_EST_DISABLE_TIMESTAMP
@ CPSW_MACPORT_IOCTL_EST_DISABLE_TIMESTAMP
Disable EST packet timestamping functionality.
Definition: cpsw_macport.h:139
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:278
CpswMacPort_InterVlanRoutingCfg::vlanId
uint32_t vlanId
Definition: cpsw_macport.h:213
CpswMacPort_EstTimestampCfg::macPort
Enet_MacPort macPort
Definition: cpsw_macport.h:401
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:241
CpswMacPort_EstTimestampCfg::priority
uint8_t priority
Definition: cpsw_macport.h:409
CpswMacPort_TsEventCfg::mcastType
uint32_t mcastType
Definition: cpsw_macport.h:349
Enet_CrcType
Enet_CrcType
CRC type.
Definition: enet_types.h:244
CpswMacPort_EstTimestampCfg
EST timestamping configuration parameters.
Definition: cpsw_macport.h:399
CpswMacPort_TsEventCfg::txHostTsEn
bool txHostTsEn
Definition: cpsw_macport.h:329
CpswMacPort_IpTsCfg::ttlNonzeroEn
bool ttlNonzeroEn
Definition: cpsw_macport.h:275
EnetMac_SgmiiMode
EnetMac_SgmiiMode
SGMII mode.
Definition: enet_mod_macport.h:250