AM263x MCU+ SDK  08.03.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 
115 
124 
133 
142 
151 
160 
169 
178 
187 
196 
206 
210 typedef enum EnetMac_LayerType_e
211 {
214 
217 
221 
225 typedef enum EnetMac_SublayerType_e
226 {
229 
232 
235 
238 
242 
246 typedef enum EnetMac_VariantType_e
247 {
250 
254 
258 typedef enum EnetMac_SgmiiMode_e
259 {
262 
265 
268 
271 
274 
278 
282 typedef struct EnetMacPort_Interface_s
283 {
286 
289 
293 
297 typedef struct EnetMacPort_LinkCfg_s
298 {
301 
305 
309 typedef enum EnetMacPort_VlanType_e
310 {
313 
316 
320 
324 typedef struct EnetMacPort_GenericInArgs_s
325 {
329 
333 typedef struct EnetMacPort_SetIngressDscpPriorityMapInArgs_s
334 {
337 
341 
345 typedef struct EnetMacPort_SetPriorityRegenMapInArgs_s
346 {
349 
353 
357 typedef struct EnetMacPort_SetEgressPriorityMapInArgs_s
358 {
361 
365 
369 typedef struct EnetMacPort_EnableEgressTrafficShapingInArgs_s
370 {
373 
377 
378 /* ========================================================================== */
379 /* Global Variables Declarations */
380 /* ========================================================================== */
381 
382 /* None */
383 
384 /* ========================================================================== */
385 /* Function Declarations */
386 /* ========================================================================== */
387 
395 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii);
396 
404 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii);
405 
413 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii);
414 
422 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii);
423 
431 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii);
432 
440 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii);
441 
449 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii);
450 
451 /* ========================================================================== */
452 /* Deprecated Function Declarations */
453 /* ========================================================================== */
454 
455 /* None */
456 
457 /* ========================================================================== */
458 /* Static Function Definitions */
459 /* ========================================================================== */
460 
461 static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
462 {
463  return (mii->layerType == ENET_MAC_LAYER_MII) &&
465 }
466 
467 static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
468 {
469  return (mii->layerType == ENET_MAC_LAYER_MII) &&
471 }
472 
473 static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
474 {
475  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
477 }
478 
479 static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
480 {
481  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
483 }
484 
485 static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
486 {
487  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
489 }
490 
491 static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)
492 {
493  return (mii->layerType == ENET_MAC_LAYER_GMII) &&
496 }
497 
498 static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii)
499 {
500  return (mii->layerType == ENET_MAC_LAYER_XGMII) &&
502 }
503 
504 #ifdef __cplusplus
505 }
506 #endif
507 
508 #endif /* ENET_MOD_MACPORT_H_ */
509 
EnetMacPort_SetIngressDscpPriorityMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:336
ENET_MACPORT_IOCTL_DISABLE_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_DISABLE_EGRESS_TRAFFIC_SHAPING
Disable egress traffic shaping configuration.
Definition: enet_mod_macport.h:177
EnetPort_PriorityMap
Priority map.
Definition: enet_mod_port.h:119
EnetMacPort_SetEgressPriorityMapInArgs::priorityMap
EnetPort_PriorityMap priorityMap
Definition: enet_mod_macport.h:363
ENET_MAC_SGMIIMODE_INVALID
@ ENET_MAC_SGMIIMODE_INVALID
Definition: enet_mod_macport.h:261
ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
@ ENET_MACPORT_VLAN_TYPE_STACKED_TAGS
Definition: enet_mod_macport.h:318
ENET_MACPORT_IOCTL_GET_MAXLEN
@ ENET_MACPORT_IOCTL_GET_MAXLEN
Get MRU and MTU.
Definition: enet_mod_macport.h:195
ENET_MAC_SGMIIMODE_FIBER_WITH_PHY
@ ENET_MAC_SGMIIMODE_FIBER_WITH_PHY
Definition: enet_mod_macport.h:264
ENET_MAC_LAYER_GMII
@ ENET_MAC_LAYER_GMII
Definition: enet_mod_macport.h:216
ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
@ ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK
Definition: enet_mod_macport.h:276
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE
Definition: enet_mod_macport.h:273
EnetMacPort_Interface::variantType
EnetMac_VariantType variantType
Definition: enet_mod_macport.h:291
EnetMacPort_isMii
static bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)
Check if interface is MII.
Definition: enet_mod_macport.h:461
ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP
@ ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP
Set VLAN priority regeneration map.
Definition: enet_mod_macport.h:132
ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING
Enable egress traffic shaping configuration.
Definition: enet_mod_macport.h:168
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:159
Enet_Speed
Enet_Speed
MAC interface speed.
Definition: enet_types.h:340
EnetMacPort_LinkCfg
Link speed and duplexity configuration.
Definition: enet_mod_macport.h:298
ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
@ ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER
Definition: enet_mod_macport.h:270
ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
@ ENET_MAC_SGMIIMODE_SGMII_WITH_PHY
Definition: enet_mod_macport.h:267
ENET_MAC_SUBLAYER_SERIAL
@ ENET_MAC_SUBLAYER_SERIAL
Definition: enet_mod_macport.h:234
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:240
EnetMacPort_EnableEgressTrafficShapingInArgs
Input args for ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING command.
Definition: enet_mod_macport.h:370
EnetMacPort_isGmii
static bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)
Check if interface is GMII.
Definition: enet_mod_macport.h:473
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:406
EnetMacPort_LinkCfg::speed
Enet_Speed speed
Definition: enet_mod_macport.h:300
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:123
EnetMacPort_isQsgmii
static bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)
Check if interface is QSGMII.
Definition: enet_mod_macport.h:491
EnetMac_LayerType
EnetMac_LayerType
MAC interface layer type.
Definition: enet_mod_macport.h:211
ENET_MAC_LAYER_XGMII
@ ENET_MAC_LAYER_XGMII
Definition: enet_mod_macport.h:219
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:150
ENET_MAC_SUBLAYER_STANDARD
@ ENET_MAC_SUBLAYER_STANDARD
Definition: enet_mod_macport.h:228
ENET_MAC_LAYER_MII
@ ENET_MAC_LAYER_MII
Definition: enet_mod_macport.h:213
EnetMacPort_GenericInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:327
ENET_MAC_VARIANT_FORCED
@ ENET_MAC_VARIANT_FORCED
Definition: enet_mod_macport.h:252
EnetPort_DscpPriorityMap
DSCP priority map.
Definition: enet_mod_port.h:129
EnetMacPort_GenericInArgs
Generic MAC port input args.
Definition: enet_mod_macport.h:325
ENET_MACPORT_IOCTL_GET_PRI_REGEN_MAP
@ ENET_MACPORT_IOCTL_GET_PRI_REGEN_MAP
Get VLAN priority regeneration map.
Definition: enet_mod_macport.h:141
ENET_MACPORT_VLAN_TYPE_NONE
@ ENET_MACPORT_VLAN_TYPE_NONE
Definition: enet_mod_macport.h:312
EnetMacPort_Interface::sublayerType
EnetMac_SublayerType sublayerType
Definition: enet_mod_macport.h:288
EnetMacPort_isRmii
static bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)
Check if interface is RMII.
Definition: enet_mod_macport.h:467
EnetMacPort_VlanType
EnetMacPort_VlanType
VLAN usage type.
Definition: enet_mod_macport.h:310
EnetMacPort_EnableEgressTrafficShapingInArgs::trafficShapingCfg
EnetPort_TrafficShapingCfg trafficShapingCfg
Definition: enet_mod_macport.h:375
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:204
EnetMacPort_Interface
MAC port interface.
Definition: enet_mod_macport.h:283
ENET_MAC_SUBLAYER_REDUCED
@ ENET_MAC_SUBLAYER_REDUCED
Definition: enet_mod_macport.h:231
Enet_Duplexity
Enet_Duplexity
MAC interface duplexity.
Definition: enet_types.h:358
EnetMacPort_SetPriorityRegenMapInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:348
EnetMac_VariantType
EnetMac_VariantType
MAC interface variant (only for specific interface types).
Definition: enet_mod_macport.h:247
EnetMacPort_EnableEgressTrafficShapingInArgs::macPort
Enet_MacPort macPort
Definition: enet_mod_macport.h:372
ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
@ ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN
Definition: enet_mod_macport.h:237
EnetMacPort_Interface::layerType
EnetMac_LayerType layerType
Definition: enet_mod_macport.h:285
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:360
EnetMacPort_SetPriorityRegenMapInArgs::priorityRegenMap
EnetPort_PriorityMap priorityRegenMap
Definition: enet_mod_macport.h:351
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:315
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:346
EnetMacPort_LinkCfg::duplexity
Enet_Duplexity duplexity
Definition: enet_mod_macport.h:303
EnetMacPort_SetIngressDscpPriorityMapInArgs::dscpPriorityMap
EnetPort_DscpPriorityMap dscpPriorityMap
Definition: enet_mod_macport.h:339
EnetMacPort_SetIngressDscpPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP command.
Definition: enet_mod_macport.h:334
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:498
EnetMac_SublayerType
EnetMac_SublayerType
MAC interface sublayer type.
Definition: enet_mod_macport.h:226
EnetMacPort_SetEgressPriorityMapInArgs
Input args for ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP command.
Definition: enet_mod_macport.h:358
ENET_MACPORT_IOCTL_GET_EGRESS_TRAFFIC_SHAPING
@ ENET_MACPORT_IOCTL_GET_EGRESS_TRAFFIC_SHAPING
Get egress traffic shaping configuration.
Definition: enet_mod_macport.h:186
EnetMacPort_isRgmii
static bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)
Check if interface is RGMII.
Definition: enet_mod_macport.h:479
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:114
ENET_MAC_VARIANT_NONE
@ ENET_MAC_VARIANT_NONE
Definition: enet_mod_macport.h:249
EnetMacPort_isSgmii
static bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)
Check if interface is SGMII.
Definition: enet_mod_macport.h:485
EnetMac_SgmiiMode
EnetMac_SgmiiMode
SGMII mode.
Definition: enet_mod_macport.h:259