AM64x MCU+ SDK  08.02.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 
71 /* ========================================================================== */
72 /* Structures and Enums */
73 /* ========================================================================== */
74 
78 typedef enum EnetMacPort_Ioctl_e
79 {
88 
97 
106 
115 
124 
133 
142 
151 
160 
169 
178 
187 
197 
201 typedef enum EnetMac_LayerType_e
202 {
205 
208 
212 
216 typedef enum EnetMac_SublayerType_e
217 {
220 
223 
226 
229 
233 
237 typedef enum EnetMac_VariantType_e
238 {
241 
245 
249 typedef enum EnetMac_SgmiiMode_e
250 {
253 
256 
259 
262 
265 
269 
273 typedef struct EnetMacPort_Interface_s
274 {
277 
280 
284 
288 typedef struct EnetMacPort_LinkCfg_s
289 {
292 
296 
300 typedef enum EnetMacPort_VlanType_e
301 {
304 
307 
311 
315 typedef struct EnetMacPort_GenericInArgs_s
316 {
320 
324 typedef struct EnetMacPort_SetIngressDscpPriorityMapInArgs_s
325 {
328 
332 
336 typedef struct EnetMacPort_SetPriorityRegenMapInArgs_s
337 {
340 
344 
348 typedef struct EnetMacPort_SetEgressPriorityMapInArgs_s
349 {
352 
356 
360 typedef struct EnetMacPort_EnableEgressTrafficShapingInArgs_s
361 {
364 
368 
369 /* ========================================================================== */
370 /* Global Variables Declarations */
371 /* ========================================================================== */
372 
373 /* None */
374 
375 /* ========================================================================== */
376 /* Function Declarations */
377 /* ========================================================================== */
378 
386 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii);
387 
395 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii);
396 
404 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii);
405 
413 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii);
414 
422 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii);
423 
431 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii);
432 
440 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii);
441 
442 /* ========================================================================== */
443 /* Deprecated Function Declarations */
444 /* ========================================================================== */
445 
446 /* None */
447 
448 /* ========================================================================== */
449 /* Static Function Definitions */
450 /* ========================================================================== */
451 
452 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
453 {
454  return (mii->layerType == ENET_MAC_LAYER_MII) &&
456 }
457 
458 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
459 {
460  return (mii->layerType == ENET_MAC_LAYER_MII) &&
462 }
463 
464 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
465 {
466  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
468 }
469 
470 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
471 {
472  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
474 }
475 
476 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
477 {
478  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
480 }
481 
482 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)
483 {
484  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
487 }
488 
489 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii)
490 {
491  return (mii->layerType == ENET_MAC_LAYER_XGMII) &&
493 }
494 
495 #ifdef __cplusplus
496 }
497 #endif
498 
499 #endif /* ENET_MOD_MACPORT_H_ */
500 
EnetMacPort_SetIngressDscpPriorityMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:327
ENET_MACPORT_IOCTL_DISABLE_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_DISABLE_EGRESS_TRAFFIC_SHAPING
Disable egress traffic shaping configuration.
Definition: enet_mod_macport.h:168
EnetPort_PriorityMap
Priority map.
Definition: enet_mod_port.h:119
EnetMacPort_SetEgressPriorityMapInArgs::priorityMap
EnetPort_PriorityMap priorityMap
Definition: enet_mod_macport.h:354
ENET_MAC_SGMIIMODE_INVALID
@ ENET_MAC_SGMIIMODE_INVALID
Definition: enet_mod_macport.h:252
ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
@ ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
Definition: enet_mod_macport.h:309
ENET_MACPORT_IOCTL_GET_MAXLEN
@ ENET_MACPORT_IOCTL_GET_MAXLEN
Get MRU and MTU.
Definition: enet_mod_macport.h:186
ENET_MAC_SGMIIMODE_FIBER_WITH_PHY
@ ENET_MAC_SGMIIMODE_FIBER_WITH_PHY
Definition: enet_mod_macport.h:255
ENET_MAC_LAYER_GMII
@ ENET_MAC_LAYER_GMII
Definition: enet_mod_macport.h:207
ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
@ ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
Definition: enet_mod_macport.h:267
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
Definition: enet_mod_macport.h:264
EnetMacPort_Interface::variantType
EnetMac_VariantType variantType
Definition: enet_mod_macport.h:282
EnetMacPort_isMii
static bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
Check if interface is MII.
Definition: enet_mod_macport.h:452
ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP
@ ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP
Set VLAN priority regeneration map.
Definition: enet_mod_macport.h:123
ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING
Enable egress traffic shaping configuration.
Definition: enet_mod_macport.h:159
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:150
Enet_Speed
Enet_Speed
MAC interface speed.
Definition: enet_types.h:340
EnetMacPort_LinkCfg
Link speed and duplexity configuration.
Definition: enet_mod_macport.h:289
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
Definition: enet_mod_macport.h:261
ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
@ ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
Definition: enet_mod_macport.h:258
ENET_MAC_SUBLAYER_SERIAL
@ ENET_MAC_SUBLAYER_SERIAL
Definition: enet_mod_macport.h:225
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:231
EnetMacPort_EnableEgressTrafficShapingInArgs
Input args for ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING command.
Definition: enet_mod_macport.h:361
EnetMacPort_isGmii
static bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
Check if interface is GMII.
Definition: enet_mod_macport.h:464
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:406
EnetMacPort_LinkCfg::speed
Enet_Speed speed
Definition: enet_mod_macport.h:291
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:114
EnetMacPort_isQsgmii
static bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)
Check if interface is QSGMII.
Definition: enet_mod_macport.h:482
EnetMac_LayerType
EnetMac_LayerType
MAC interface layer type.
Definition: enet_mod_macport.h:202
ENET_MAC_LAYER_XGMII
@ ENET_MAC_LAYER_XGMII
Definition: enet_mod_macport.h:210
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:141
ENET_MAC_SUBLAYER_STANDARD
@ ENET_MAC_SUBLAYER_STANDARD
Definition: enet_mod_macport.h:219
ENET_MAC_LAYER_MII
@ ENET_MAC_LAYER_MII
Definition: enet_mod_macport.h:204
EnetMacPort_GenericInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:318
ENET_MAC_VARIANT_FORCED
@ ENET_MAC_VARIANT_FORCED
Definition: enet_mod_macport.h:243
EnetPort_DscpPriorityMap
DSCP priority map.
Definition: enet_mod_port.h:129
EnetMacPort_GenericInArgs
Generic MAC port input args.
Definition: enet_mod_macport.h:316
ENET_MACPORT_IOCTL_GET_PRI_REGEN_MAP
@ ENET_MACPORT_IOCTL_GET_PRI_REGEN_MAP
Get VLAN priority regeneration map.
Definition: enet_mod_macport.h:132
ENET_MACPORT_VLAN_TYPE_NONE
@ ENET_MACPORT_VLAN_TYPE_NONE
Definition: enet_mod_macport.h:303
EnetMacPort_Interface::sublayerType
EnetMac_SublayerType sublayerType
Definition: enet_mod_macport.h:279
EnetMacPort_isRmii
static bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
Check if interface is RMII.
Definition: enet_mod_macport.h:458
EnetMacPort_VlanType
EnetMacPort_VlanType
VLAN usage type.
Definition: enet_mod_macport.h:301
EnetMacPort_EnableEgressTrafficShapingInArgs::trafficShapingCfg
EnetPort_TrafficShapingCfg trafficShapingCfg
Definition: enet_mod_macport.h:366
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:195
EnetMacPort_Interface
MAC port interface.
Definition: enet_mod_macport.h:274
ENET_MAC_SUBLAYER_REDUCED
@ ENET_MAC_SUBLAYER_REDUCED
Definition: enet_mod_macport.h:222
Enet_Duplexity
Enet_Duplexity
MAC interface duplexity.
Definition: enet_types.h:358
EnetMacPort_SetPriorityRegenMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:339
EnetMac_VariantType
EnetMac_VariantType
MAC interface variant (only for specific interface types).
Definition: enet_mod_macport.h:238
EnetMacPort_EnableEgressTrafficShapingInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:363
ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
@ ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
Definition: enet_mod_macport.h:228
EnetMacPort_Interface::layerType
EnetMac_LayerType layerType
Definition: enet_mod_macport.h:276
EnetMacPort_Ioctl
EnetMacPort_Ioctl
MAC port IOCTL commands.
Definition: enet_mod_macport.h:79
EnetMacPort_SetEgressPriorityMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:351
EnetMacPort_SetPriorityRegenMapInArgs::priorityRegenMap
EnetPort_PriorityMap priorityRegenMap
Definition: enet_mod_macport.h:342
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:306
ENET_MACPORT_IOCTL_PRINT_REGS
@ ENET_MACPORT_IOCTL_PRINT_REGS
Print MAC port registers.
Definition: enet_mod_macport.h:96
EnetMacPort_SetPriorityRegenMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP command.
Definition: enet_mod_macport.h:337
EnetMacPort_LinkCfg::duplexity
Enet_Duplexity duplexity
Definition: enet_mod_macport.h:294
EnetMacPort_SetIngressDscpPriorityMapInArgs::dscpPriorityMap
EnetPort_DscpPriorityMap dscpPriorityMap
Definition: enet_mod_macport.h:330
EnetMacPort_SetIngressDscpPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP command.
Definition: enet_mod_macport.h:325
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:87
EnetMacPort_isXfi
static bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii)
Check if interface is XFI.
Definition: enet_mod_macport.h:489
EnetMac_SublayerType
EnetMac_SublayerType
MAC interface sublayer type.
Definition: enet_mod_macport.h:217
EnetMacPort_SetEgressPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP command.
Definition: enet_mod_macport.h:349
ENET_MACPORT_IOCTL_GET_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_GET_EGRESS_TRAFFIC_SHAPING
Get egress traffic shaping configuration.
Definition: enet_mod_macport.h:177
EnetMacPort_isRgmii
static bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
Check if interface is RGMII.
Definition: enet_mod_macport.h:470
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:105
ENET_MAC_VARIANT_NONE
@ ENET_MAC_VARIANT_NONE
Definition: enet_mod_macport.h:240
EnetMacPort_isSgmii
static bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
Check if interface is SGMII.
Definition: enet_mod_macport.h:476
EnetMac_SgmiiMode
EnetMac_SgmiiMode
SGMII mode.
Definition: enet_mod_macport.h:250