AM273x MCU+ SDK  08.06.00
enet_mod_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 
47 #ifndef ENET_MOD_MACPORT_H_
48 #define ENET_MOD_MACPORT_H_
49 
50 /* ========================================================================== */
51 /* Include Files */
52 /* ========================================================================== */
53 
54 #include <stdint.h>
55 #include <include/core/enet_mod.h>
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* ========================================================================== */
63 /* Macros */
64 /* ========================================================================== */
65 
67 #define ENET_MACPORT_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
68  ENET_IOCTL_MACPORT_BASE | \
69  ENET_IOCTL_MIN(x))
70 
72 #define ENET_MACPORT_PRIVATE_IOCTL(x) (ENET_IOCTL_TYPE_PRIVATE | \
73  ENET_IOCTL_MACPORT_BASE | \
74  ENET_IOCTL_MIN(x))
75 /* ========================================================================== */
76 /* Structures and Enums */
77 /* ========================================================================== */
78 
82 typedef enum EnetMacPort_Ioctl_e
83 {
92 
101 
119 
128 
137 
146 
155 
164 
173 
182 
191 
200 
209 
218 
227 
229 
233 typedef enum EnetMac_LayerType_e
234 {
237 
240 
244 
248 typedef enum EnetMac_SublayerType_e
249 {
252 
255 
258 
261 
265 
269 typedef enum EnetMac_VariantType_e
270 {
273 
277 
281 typedef enum EnetMac_SgmiiMode_e
282 {
285 
288 
291 
294 
297 
301 
305 typedef struct EnetMacPort_Interface_s
306 {
309 
312 
316 
320 typedef struct EnetMacPort_LinkCfg_s
321 {
324 
328 
332 typedef enum EnetMacPort_VlanType_e
333 {
336 
339 
343 
347 typedef struct EnetMacPort_GenericInArgs_s
348 {
352 
356 typedef struct EnetMacPort_SetIngressDscpPriorityMapInArgs_s
357 {
360 
364 
368 typedef struct EnetMacPort_SetPriorityRegenMapInArgs_s
369 {
372 
376 
380 typedef struct EnetMacPort_SetEgressPriorityMapInArgs_s
381 {
384 
388 
392 typedef struct EnetMacPort_EnableEgressTrafficShapingInArgs_s
393 {
396 
400 
404 typedef struct EnetMacPort_CreditBasedShaperInArgs_s
405 {
408 
412 
413 /* ========================================================================== */
414 /* Global Variables Declarations */
415 /* ========================================================================== */
416 
417 /* None */
418 
419 /* ========================================================================== */
420 /* Function Declarations */
421 /* ========================================================================== */
422 
430 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii);
431 
439 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii);
440 
448 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii);
449 
457 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii);
458 
466 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii);
467 
475 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii);
476 
484 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii);
485 
486 /* ========================================================================== */
487 /* Deprecated Function Declarations */
488 /* ========================================================================== */
489 
490 /* None */
491 
492 /* ========================================================================== */
493 /* Static Function Definitions */
494 /* ========================================================================== */
495 
496 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
497 {
498  return (mii->layerType == ENET_MAC_LAYER_MII) &&
500 }
501 
502 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
503 {
504  return (mii->layerType == ENET_MAC_LAYER_MII) &&
506 }
507 
508 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
509 {
510  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
512 }
513 
514 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
515 {
516  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
518 }
519 
520 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
521 {
522  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
524 }
525 
526 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)
527 {
528  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
531 }
532 
533 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii)
534 {
535  return (mii->layerType == ENET_MAC_LAYER_XGMII) &&
537 }
538 
539 #ifdef __cplusplus
540 }
541 #endif
542 
543 #endif /* ENET_MOD_MACPORT_H_ */
544 
EnetMacPort_SetIngressDscpPriorityMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:359
ENET_MACPORT_IOCTL_DISABLE_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_DISABLE_EGRESS_TRAFFIC_SHAPING
Disable egress traffic shaping configuration.
Definition: enet_mod_macport.h:181
EnetPort_PriorityMap
Priority map.
Definition: enet_mod_port.h:128
EnetMacPort_CreditBasedShaperInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:407
ENET_MACPORT_IOCTL_SET_CREDIT_BASED_SHAPING
@ ENET_MACPORT_IOCTL_SET_CREDIT_BASED_SHAPING
Set Idleslope for Credit Based Shaper on MAC Port.
Definition: enet_mod_macport.h:217
EnetMacPort_SetEgressPriorityMapInArgs::priorityMap
EnetPort_PriorityMap priorityMap
Definition: enet_mod_macport.h:386
ENET_MAC_SGMIIMODE_INVALID
@ ENET_MAC_SGMIIMODE_INVALID
Definition: enet_mod_macport.h:284
ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
@ ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
Definition: enet_mod_macport.h:341
ENET_MACPORT_IOCTL_GET_MAXLEN
@ ENET_MACPORT_IOCTL_GET_MAXLEN
Get MRU and MTU.
Definition: enet_mod_macport.h:199
ENET_MAC_SGMIIMODE_FIBER_WITH_PHY
@ ENET_MAC_SGMIIMODE_FIBER_WITH_PHY
Definition: enet_mod_macport.h:287
ENET_MAC_LAYER_GMII
@ ENET_MAC_LAYER_GMII
Definition: enet_mod_macport.h:239
ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
@ ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
Definition: enet_mod_macport.h:299
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
Definition: enet_mod_macport.h:296
EnetMacPort_Interface::variantType
EnetMac_VariantType variantType
Definition: enet_mod_macport.h:314
EnetMacPort_isMii
static bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
Check if interface is MII.
Definition: enet_mod_macport.h:496
ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP
@ ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP
Set VLAN priority regeneration map.
Definition: enet_mod_macport.h:136
ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING
Enable egress traffic shaping configuration.
Definition: enet_mod_macport.h:172
ENET_MACPORT_IOCTL_GET_EGRESS_QOS_PRI_MAP
@ ENET_MACPORT_IOCTL_GET_EGRESS_QOS_PRI_MAP
Get QoS egress priority map.
Definition: enet_mod_macport.h:163
Enet_Speed
Enet_Speed
MAC interface speed.
Definition: enet_types.h:343
EnetMacPort_LinkCfg
Link speed and duplexity configuration.
Definition: enet_mod_macport.h:321
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
Definition: enet_mod_macport.h:293
ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
@ ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
Definition: enet_mod_macport.h:290
ENET_MAC_SUBLAYER_SERIAL
@ ENET_MAC_SUBLAYER_SERIAL
Definition: enet_mod_macport.h:257
enet_mod_port.h
This file contains the type definitions and helper macros that are common for host and MAC ports.
ENET_MAC_SUBLAYER_QUAD_SERIAL_SUB
@ ENET_MAC_SUBLAYER_QUAD_SERIAL_SUB
Definition: enet_mod_macport.h:263
EnetMacPort_CreditBasedShaperInArgs::cbsCfg
EnetPort_CreditBasedShapingCfg cbsCfg
Definition: enet_mod_macport.h:410
EnetMacPort_EnableEgressTrafficShapingInArgs
Input args for ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING command.
Definition: enet_mod_macport.h:393
EnetMacPort_isGmii
static bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
Check if interface is GMII.
Definition: enet_mod_macport.h:508
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:409
EnetMacPort_LinkCfg::speed
Enet_Speed speed
Definition: enet_mod_macport.h:323
ENET_MACPORT_IOCTL_GET_INGRESS_DSCP_PRI_MAP
@ ENET_MACPORT_IOCTL_GET_INGRESS_DSCP_PRI_MAP
Get ingress DSCP priority (TOS) map.
Definition: enet_mod_macport.h:127
EnetMacPort_isQsgmii
static bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)
Check if interface is QSGMII.
Definition: enet_mod_macport.h:526
EnetMac_LayerType
EnetMac_LayerType
MAC interface layer type.
Definition: enet_mod_macport.h:234
ENET_MAC_LAYER_XGMII
@ ENET_MAC_LAYER_XGMII
Definition: enet_mod_macport.h:242
ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP
@ ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP
Set QoS egress priority map.
Definition: enet_mod_macport.h:154
ENET_MAC_SUBLAYER_STANDARD
@ ENET_MAC_SUBLAYER_STANDARD
Definition: enet_mod_macport.h:251
ENET_MAC_LAYER_MII
@ ENET_MAC_LAYER_MII
Definition: enet_mod_macport.h:236
EnetMacPort_GenericInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:350
ENET_MAC_VARIANT_FORCED
@ ENET_MAC_VARIANT_FORCED
Definition: enet_mod_macport.h:275
EnetPort_DscpPriorityMap
DSCP priority map.
Definition: enet_mod_port.h:138
EnetMacPort_GenericInArgs
Generic MAC port input args.
Definition: enet_mod_macport.h:348
ENET_MACPORT_IOCTL_GET_PRI_REGEN_MAP
@ ENET_MACPORT_IOCTL_GET_PRI_REGEN_MAP
Get VLAN priority regeneration map.
Definition: enet_mod_macport.h:145
ENET_MACPORT_VLAN_TYPE_NONE
@ ENET_MACPORT_VLAN_TYPE_NONE
Definition: enet_mod_macport.h:335
EnetMacPort_Interface::sublayerType
EnetMac_SublayerType sublayerType
Definition: enet_mod_macport.h:311
EnetMacPort_isRmii
static bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
Check if interface is RMII.
Definition: enet_mod_macport.h:502
EnetMacPort_VlanType
EnetMacPort_VlanType
VLAN usage type.
Definition: enet_mod_macport.h:333
EnetMacPort_EnableEgressTrafficShapingInArgs::trafficShapingCfg
EnetPort_TrafficShapingCfg trafficShapingCfg
Definition: enet_mod_macport.h:398
ENET_MACPORT_PUBLIC_IOCTL
#define ENET_MACPORT_PUBLIC_IOCTL(x)
Helper macro to create IOCTL commands for MAC port module.
Definition: enet_mod_macport.h:67
ENET_MACPORT_IOCTL_GET_LINK_CFG
@ ENET_MACPORT_IOCTL_GET_LINK_CFG
Get MAC port's speed and duplexity.
Definition: enet_mod_macport.h:208
EnetMacPort_Interface
MAC port interface.
Definition: enet_mod_macport.h:306
ENET_MAC_SUBLAYER_REDUCED
@ ENET_MAC_SUBLAYER_REDUCED
Definition: enet_mod_macport.h:254
Enet_Duplexity
Enet_Duplexity
MAC interface duplexity.
Definition: enet_types.h:361
EnetMacPort_SetPriorityRegenMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:371
EnetMac_VariantType
EnetMac_VariantType
MAC interface variant (only for specific interface types).
Definition: enet_mod_macport.h:270
ENET_MACPORT_IOCTL_GET_CREDIT_BASED_SHAPING
@ ENET_MACPORT_IOCTL_GET_CREDIT_BASED_SHAPING
Get Idleslope of Credit Based Shaper on MAC Port.
Definition: enet_mod_macport.h:226
EnetMacPort_EnableEgressTrafficShapingInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:395
ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
@ ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
Definition: enet_mod_macport.h:260
EnetMacPort_Interface::layerType
EnetMac_LayerType layerType
Definition: enet_mod_macport.h:308
EnetMacPort_Ioctl
EnetMacPort_Ioctl
MAC port IOCTL commands.
Definition: enet_mod_macport.h:83
EnetMacPort_SetEgressPriorityMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:383
EnetMacPort_SetPriorityRegenMapInArgs::priorityRegenMap
EnetPort_PriorityMap priorityRegenMap
Definition: enet_mod_macport.h:374
EnetPort_TrafficShapingCfg
Traffic shaping configuration for all priorities.
Definition: enet_mod_port.h:116
ENET_MACPORT_VLAN_TYPE_SINGLE_TAG
@ ENET_MACPORT_VLAN_TYPE_SINGLE_TAG
Definition: enet_mod_macport.h:338
ENET_MACPORT_IOCTL_PRINT_REGS
@ ENET_MACPORT_IOCTL_PRINT_REGS
Print MAC port registers.
Definition: enet_mod_macport.h:100
EnetMacPort_SetPriorityRegenMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP command.
Definition: enet_mod_macport.h:369
EnetMacPort_LinkCfg::duplexity
Enet_Duplexity duplexity
Definition: enet_mod_macport.h:326
EnetMacPort_SetIngressDscpPriorityMapInArgs::dscpPriorityMap
EnetPort_DscpPriorityMap dscpPriorityMap
Definition: enet_mod_macport.h:362
EnetMacPort_SetIngressDscpPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP command.
Definition: enet_mod_macport.h:357
enet_mod.h
This file contains the type definitions and helper macros for the Enet Module interface.
ENET_MACPORT_IOCTL_GET_VERSION
@ ENET_MACPORT_IOCTL_GET_VERSION
Get the hardware version of the MAC port module.
Definition: enet_mod_macport.h:91
EnetMacPort_isXfi
static bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii)
Check if interface is XFI.
Definition: enet_mod_macport.h:533
EnetMac_SublayerType
EnetMac_SublayerType
MAC interface sublayer type.
Definition: enet_mod_macport.h:249
EnetMacPort_SetEgressPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP command.
Definition: enet_mod_macport.h:381
ENET_MACPORT_IOCTL_GET_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_GET_EGRESS_TRAFFIC_SHAPING
Get egress traffic shaping configuration.
Definition: enet_mod_macport.h:190
EnetMacPort_CreditBasedShaperInArgs
Input args for ENET_MACPORT_IOCTL_SET_CREDIT_BASED_SHAPING command.
Definition: enet_mod_macport.h:405
EnetMacPort_isRgmii
static bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
Check if interface is RGMII.
Definition: enet_mod_macport.h:514
ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP
@ ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP
Set ingress DSCP priority (TOS) map.
Definition: enet_mod_macport.h:118
ENET_MAC_VARIANT_NONE
@ ENET_MAC_VARIANT_NONE
Definition: enet_mod_macport.h:272
EnetMacPort_isSgmii
static bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
Check if interface is SGMII.
Definition: enet_mod_macport.h:520
EnetMac_SgmiiMode
EnetMac_SgmiiMode
SGMII mode.
Definition: enet_mod_macport.h:282
EnetPort_CreditBasedShapingCfg
Credit Based shaping parameters (idleSlope).
Definition: enet_mod_port.h:107