PDK API Guide for J721E
enet_per.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 
40 #ifndef ENET_PER_H_
41 #define ENET_PER_H_
42 
43 /* ========================================================================== */
44 /* Include Files */
45 /* ========================================================================== */
46 
47 #include <stdint.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /* ========================================================================== */
58 /* Macros */
59 /* ========================================================================== */
60 
62 #define ENET_TO_PER(per) ((EnetPer_Handle)(per))
63 
65 #define ENET_PER_NAME(per) (ENET_TO_PER(per)->name)
66 
68 #define ENET_PER_PUBLIC_IOCTL(x) (ENET_IOCTL_TYPE_PUBLIC | \
69  ENET_IOCTL_PER_BASE | \
70  ENET_IOCTL_MIN(x))
71 
72 /* ========================================================================== */
73 /* Structures and Enums */
74 /* ========================================================================== */
75 
80 {
89 
98 
107 
116 
125 
134 
143 
152 
161 
173 
186 
198 
209 
220 };
221 
225 typedef struct Enet_DfltFlowInfo_s
226 {
228  uint32_t coreKey;
229 
231  uint32_t chIdx;
232 
234  uint32_t startIdx;
235 
237  uint32_t flowIdx;
239 
244 typedef struct Enet_MacDstFlowInfo_s
245 {
247  uint32_t coreKey;
248 
250  uint32_t startIdx;
251 
253  uint32_t flowIdx;
254 
256  uint8_t macAddress[ENET_MAC_ADDR_LEN];
258 
262 typedef struct EnetPer_PortLinkCfg_s
263 {
266 
268  void *macCfg;
269 
272 
275 
279 
283 typedef struct EnetPer_AttachCoreOutArgs_s
284 {
286  uint32_t coreKey;
287 
289  uint32_t rxMtu;
290 
292  uint32_t txMtu[ENET_PRI_NUM];
294 
300 typedef struct EnetPer_Obj_s *EnetPer_Handle;
301 
312 typedef void (*EnetPer_InitCfg)(EnetPer_Handle hPer,
313  Enet_Type enetType,
314  void *cfg,
315  uint32_t cfgSize);
316 
331 typedef int32_t (*EnetPer_Open)(EnetPer_Handle hPer,
332  Enet_Type enetType,
333  uint32_t instId,
334  const void *cfg,
335  uint32_t cfgSize);
336 
352 typedef int32_t (*EnetPer_Rejoin)(EnetPer_Handle hPer,
353  Enet_Type enetType,
354  uint32_t instId);
355 
367 typedef int32_t (*EnetPer_Ioctl)(EnetPer_Handle hPer,
368  uint32_t cmd,
369  Enet_IoctlPrms *prms);
370 
385 typedef void (*EnetPer_Poll)(EnetPer_Handle hPer,
386  Enet_Event evt,
387  const void *arg,
388  uint32_t argSize);
389 
406 typedef uint64_t (*EnetPer_ConvertTs)(EnetPer_Handle hPer,
407  uint64_t ts);
408 
416 typedef void (*EnetPer_PeriodicTick)(EnetPer_Handle hPer);
417 
432  Enet_Event evt,
433  uint32_t evtNum,
434  Enet_EventCallback evtCb,
435  void *evtCbArgs);
436 
447  Enet_Event evt,
448  uint32_t evtNum);
449 
457 typedef void (*EnetPer_Close)(EnetPer_Handle hPer);
458 
462 typedef struct EnetPer_Obj_s
463 {
465  const char *name;
466 
469 
471  uint32_t instId;
472 
475 
481  uint64_t physAddr;
482 
484  void *virtAddr;
485 
487  uint64_t physAddr2;
488 
490  void *virtAddr2;
491 
493  uint32_t features;
494 
496  uint32_t errata;
497 
500 
503 
506 
509 
512 
515 
518 
521 
524 
527 } EnetPer_Obj;
528 
529 /* ========================================================================== */
530 /* Global Variables Declarations */
531 /* ========================================================================== */
532 
533 /* None */
534 
535 /* ========================================================================== */
536 /* Function Declarations */
537 /* ========================================================================== */
538 
539 /* None */
540 
541 /* ========================================================================== */
542 /* Deprecated Function Declarations */
543 /* ========================================================================== */
544 
545 /* None */
546 
547 /* ========================================================================== */
548 /* Static Function Definitions */
549 /* ========================================================================== */
550 
551 /* None */
552 
553 #ifdef __cplusplus
554 }
555 #endif
556 
557 #endif /* ENET_PER_H_ */
Register destination MAC address to a specific rx flow.
Definition: enet_per.h:185
Disable VLAN aware mode.
Definition: enet_per.h:219
Enet_Magic
Enet driver magic value, used to indicate if driver is open or not.
Definition: enet_types.h:228
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:195
void(* EnetPer_Close)(EnetPer_Handle hPer)
Close the Enet Peripheral.
Definition: enet_per.h:457
EnetPer_Rejoin rejoin
Definition: enet_per.h:505
Enet_MacPort macPort
Definition: enet_per.h:265
EnetPhy_Cfg phyCfg
Definition: enet_per.h:271
Attach core to Ethernet peripheral.
Definition: enet_per.h:142
MAC port interface.
Definition: enet_mod_macport.h:273
int32_t(* EnetPer_Ioctl)(EnetPer_Handle hPer, uint32_t cmd, Enet_IoctlPrms *prms)
Issue an operation on the Enet Peripheral.
Definition: enet_per.h:367
#define ENET_PER_PUBLIC_IOCTL(x)
Helper macro to create IOCTL commands for peripherals.
Definition: enet_per.h:68
void(* EnetPer_Poll)(EnetPer_Handle hPer, Enet_Event evt, const void *arg, uint32_t argSize)
Poll for Ethernet events.
Definition: enet_per.h:385
Close port link (MAC port and PHY).
Definition: enet_per.h:115
uint64_t physAddr2
Definition: enet_per.h:487
PHY configuration parameters.
Definition: enetphy.h:335
EnetPer_ConvertTs convertTs
Definition: enet_per.h:514
This file contains the basic types using across the Enet driver.
Check if port link is up.
Definition: enet_per.h:124
Link speed and duplexity configuration.
Definition: enet_mod_macport.h:288
uint32_t coreKey
Definition: enet_per.h:286
EnetPer_InitCfg initCfg
Definition: enet_per.h:499
Output args for ENET_PER_IOCTL_ATTACH_CORE command.
Definition: enet_per.h:283
const char * name
Definition: enet_per.h:465
EnetPer_Ioctl ioctl
Definition: enet_per.h:508
EnetPer_Ioctl_e
Ethernet peripheral IOCTL commands.
Definition: enet_per.h:79
This file contains the type definitions and helper macros for the Enet MAC port module interface.
#define ENET_MAC_ADDR_LEN
MAC address length in bytes/octets.
Definition: enet_types.h:153
int32_t(* EnetPer_Rejoin)(EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)
Rejoin a running Enet Peripheral.
Definition: enet_per.h:352
uint64_t physAddr
Definition: enet_per.h:481
void * virtAddr
Definition: enet_per.h:484
Detach core from Ethernet peripheral using its core key.
Definition: enet_per.h:151
uint32_t flowIdx
Definition: enet_per.h:253
Enet_Magic magic
Definition: enet_per.h:474
Register default flow to a specific rx flow.
Definition: enet_per.h:160
Rx Default Flow Info used for default flow registration/unregistration.
Definition: enet_per.h:225
void * macCfg
Definition: enet_per.h:268
Enet_Type enetType
Definition: enet_per.h:468
Open port link (MAC port and PHY).
Definition: enet_per.h:106
Enable VLAN aware mode.
Definition: enet_per.h:208
This file contains the type definitions and helper macros for the Enet IOCTL interface.
uint32_t instId
Definition: enet_per.h:471
Unregister default flow.
Definition: enet_per.h:172
EnetPer_Open open
Definition: enet_per.h:502
uint32_t chIdx
Definition: enet_per.h:231
uint32_t startIdx
Definition: enet_per.h:250
Get the hardware version of the peripheral.
Definition: enet_per.h:88
EnetPer_UnregisterEventCb unregisterEventCb
Definition: enet_per.h:523
Input args for ENET_PER_IOCTL_OPEN_PORT_LINK command.
Definition: enet_per.h:262
Ethernet Peripheral object.
Definition: enet_per.h:462
uint32_t errata
Definition: enet_per.h:496
uint32_t coreKey
Definition: enet_per.h:247
uint32_t startIdx
Definition: enet_per.h:234
Enet IOCTL param.
Definition: enet_ioctl.h:232
EnetPer_PeriodicTick periodicTick
Definition: enet_per.h:517
uint32_t coreKey
Definition: enet_per.h:228
void(* EnetPer_InitCfg)(EnetPer_Handle hPer, Enet_Type enetType, void *cfg, uint32_t cfgSize)
Initialize peripheral's configuration parameters.
Definition: enet_per.h:312
Input args for ENET_IOCTL_REGISTER_DSTMAC_RX_FLOW and ENET_IOCTL_UNREGISTER_DSTMAC_RX_FLOW commands.
Definition: enet_per.h:244
#define ENET_PRI_NUM
Packet priority.
Definition: enet_types.h:165
EnetPer_Poll poll
Definition: enet_per.h:511
EnetMacPort_Interface mii
Definition: enet_per.h:274
EnetMacPort_LinkCfg linkCfg
Definition: enet_per.h:277
uint32_t flowIdx
Definition: enet_per.h:237
uint32_t rxMtu
Definition: enet_per.h:289
Enet_Event
Ethernet events.
Definition: enet_types.h:258
uint64_t(* EnetPer_ConvertTs)(EnetPer_Handle hPer, uint64_t ts)
Convert a timestamp to nanoseconds.
Definition: enet_per.h:406
Enet_MacPort
MAC port.
Definition: enet_types.h:402
Print registers of the peripheral and all its modules.
Definition: enet_per.h:97
void(* EnetPer_PeriodicTick)(EnetPer_Handle hPer)
Run periodic tick on the Ethernet peripheral.
Definition: enet_per.h:416
Get port link configuration (speed and duplexity).
Definition: enet_per.h:133
Unregister destination MAC address to a specific flow.
Definition: enet_per.h:197
void(* EnetPer_UnregisterEventCb)(EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum)
Unregister callback for an event.
Definition: enet_per.h:446
struct EnetPer_Obj_s * EnetPer_Handle
Ethernet Peripheral handle.
Definition: enet_per.h:300
void * virtAddr2
Definition: enet_per.h:490
void(* Enet_EventCallback)(Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2)
Event callback.
Definition: enet_types.h:445
int32_t(* EnetPer_Open)(EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initialize the Enet Peripheral.
Definition: enet_per.h:331
void(* EnetPer_RegisterEventCb)(EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum, Enet_EventCallback evtCb, void *evtCbArgs)
Register a callback for an event.
Definition: enet_per.h:431
This file contains the type definitions and helper macros for the Ethernet PHY interface.
EnetPer_RegisterEventCb registerEventCb
Definition: enet_per.h:520
uint32_t features
Definition: enet_per.h:493
EnetPer_Close close
Definition: enet_per.h:526