AM64x MCU+ SDK  08.04.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 
211 
215 typedef enum EnetMac_LayerType_e
216 {
219 
222 
226 
230 typedef enum EnetMac_SublayerType_e
231 {
234 
237 
240 
243 
247 
251 typedef enum EnetMac_VariantType_e
252 {
255 
259 
263 typedef enum EnetMac_SgmiiMode_e
264 {
267 
270 
273 
276 
279 
283 
287 typedef struct EnetMacPort_Interface_s
288 {
291 
294 
298 
302 typedef struct EnetMacPort_LinkCfg_s
303 {
306 
310 
314 typedef enum EnetMacPort_VlanType_e
315 {
318 
321 
325 
329 typedef struct EnetMacPort_GenericInArgs_s
330 {
334 
338 typedef struct EnetMacPort_SetIngressDscpPriorityMapInArgs_s
339 {
342 
346 
350 typedef struct EnetMacPort_SetPriorityRegenMapInArgs_s
351 {
354 
358 
362 typedef struct EnetMacPort_SetEgressPriorityMapInArgs_s
363 {
366 
370 
374 typedef struct EnetMacPort_EnableEgressTrafficShapingInArgs_s
375 {
378 
382 
383 /* ========================================================================== */
384 /* Global Variables Declarations */
385 /* ========================================================================== */
386 
387 /* None */
388 
389 /* ========================================================================== */
390 /* Function Declarations */
391 /* ========================================================================== */
392 
400 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii);
401 
409 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii);
410 
418 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii);
419 
427 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii);
428 
436 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii);
437 
445 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii);
446 
454 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii);
455 
456 /* ========================================================================== */
457 /* Deprecated Function Declarations */
458 /* ========================================================================== */
459 
460 /* None */
461 
462 /* ========================================================================== */
463 /* Static Function Definitions */
464 /* ========================================================================== */
465 
466 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
467 {
468  return (mii->layerType == ENET_MAC_LAYER_MII) &&
470 }
471 
472 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
473 {
474  return (mii->layerType == ENET_MAC_LAYER_MII) &&
476 }
477 
478 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
479 {
480  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
482 }
483 
484 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
485 {
486  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
488 }
489 
490 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
491 {
492  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
494 }
495 
496 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)
497 {
498  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
501 }
502 
503 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii)
504 {
505  return (mii->layerType == ENET_MAC_LAYER_XGMII) &&
507 }
508 
509 #ifdef __cplusplus
510 }
511 #endif
512 
513 #endif /* ENET_MOD_MACPORT_H_ */
514 
EnetMacPort_SetIngressDscpPriorityMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:341
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:119
EnetMacPort_SetEgressPriorityMapInArgs::priorityMap
EnetPort_PriorityMap priorityMap
Definition: enet_mod_macport.h:368
ENET_MAC_SGMIIMODE_INVALID
@ ENET_MAC_SGMIIMODE_INVALID
Definition: enet_mod_macport.h:266
ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
@ ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
Definition: enet_mod_macport.h:323
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:269
ENET_MAC_LAYER_GMII
@ ENET_MAC_LAYER_GMII
Definition: enet_mod_macport.h:221
ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
@ ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
Definition: enet_mod_macport.h:281
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
Definition: enet_mod_macport.h:278
EnetMacPort_Interface::variantType
EnetMac_VariantType variantType
Definition: enet_mod_macport.h:296
EnetMacPort_isMii
static bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
Check if interface is MII.
Definition: enet_mod_macport.h:466
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:340
EnetMacPort_LinkCfg
Link speed and duplexity configuration.
Definition: enet_mod_macport.h:303
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
Definition: enet_mod_macport.h:275
ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
@ ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
Definition: enet_mod_macport.h:272
ENET_MAC_SUBLAYER_SERIAL
@ ENET_MAC_SUBLAYER_SERIAL
Definition: enet_mod_macport.h:239
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:245
EnetMacPort_EnableEgressTrafficShapingInArgs
Input args for ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING command.
Definition: enet_mod_macport.h:375
EnetMacPort_isGmii
static bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
Check if interface is GMII.
Definition: enet_mod_macport.h:478
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:406
EnetMacPort_LinkCfg::speed
Enet_Speed speed
Definition: enet_mod_macport.h:305
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:496
EnetMac_LayerType
EnetMac_LayerType
MAC interface layer type.
Definition: enet_mod_macport.h:216
ENET_MAC_LAYER_XGMII
@ ENET_MAC_LAYER_XGMII
Definition: enet_mod_macport.h:224
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:233
ENET_MAC_LAYER_MII
@ ENET_MAC_LAYER_MII
Definition: enet_mod_macport.h:218
EnetMacPort_GenericInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:332
ENET_MAC_VARIANT_FORCED
@ ENET_MAC_VARIANT_FORCED
Definition: enet_mod_macport.h:257
EnetPort_DscpPriorityMap
DSCP priority map.
Definition: enet_mod_port.h:129
EnetMacPort_GenericInArgs
Generic MAC port input args.
Definition: enet_mod_macport.h:330
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:317
EnetMacPort_Interface::sublayerType
EnetMac_SublayerType sublayerType
Definition: enet_mod_macport.h:293
EnetMacPort_isRmii
static bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
Check if interface is RMII.
Definition: enet_mod_macport.h:472
EnetMacPort_VlanType
EnetMacPort_VlanType
VLAN usage type.
Definition: enet_mod_macport.h:315
EnetMacPort_EnableEgressTrafficShapingInArgs::trafficShapingCfg
EnetPort_TrafficShapingCfg trafficShapingCfg
Definition: enet_mod_macport.h:380
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:288
ENET_MAC_SUBLAYER_REDUCED
@ ENET_MAC_SUBLAYER_REDUCED
Definition: enet_mod_macport.h:236
Enet_Duplexity
Enet_Duplexity
MAC interface duplexity.
Definition: enet_types.h:358
EnetMacPort_SetPriorityRegenMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:353
EnetMac_VariantType
EnetMac_VariantType
MAC interface variant (only for specific interface types).
Definition: enet_mod_macport.h:252
EnetMacPort_EnableEgressTrafficShapingInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:377
ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
@ ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
Definition: enet_mod_macport.h:242
EnetMacPort_Interface::layerType
EnetMac_LayerType layerType
Definition: enet_mod_macport.h:290
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:365
EnetMacPort_SetPriorityRegenMapInArgs::priorityRegenMap
EnetPort_PriorityMap priorityRegenMap
Definition: enet_mod_macport.h:356
EnetPort_TrafficShapingCfg
Traffic shaping configuration for all priorities.
Definition: enet_mod_port.h:107
ENET_MACPORT_VLAN_TYPE_SINGLE_TAG
@ ENET_MACPORT_VLAN_TYPE_SINGLE_TAG
Definition: enet_mod_macport.h:320
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:351
EnetMacPort_LinkCfg::duplexity
Enet_Duplexity duplexity
Definition: enet_mod_macport.h:308
EnetMacPort_SetIngressDscpPriorityMapInArgs::dscpPriorityMap
EnetPort_DscpPriorityMap dscpPriorityMap
Definition: enet_mod_macport.h:344
EnetMacPort_SetIngressDscpPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP command.
Definition: enet_mod_macport.h:339
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:503
EnetMac_SublayerType
EnetMac_SublayerType
MAC interface sublayer type.
Definition: enet_mod_macport.h:231
EnetMacPort_SetEgressPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP command.
Definition: enet_mod_macport.h:363
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_isRgmii
static bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
Check if interface is RGMII.
Definition: enet_mod_macport.h:484
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:254
EnetMacPort_isSgmii
static bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
Check if interface is SGMII.
Definition: enet_mod_macport.h:490
EnetMac_SgmiiMode
EnetMac_SgmiiMode
SGMII mode.
Definition: enet_mod_macport.h:264