AM261x MCU+ SDK: enet.h Source File

| AM261x MCU+ SDK 26.00.00 |

enet.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
62 #ifndef ENET_H_
63 #define ENET_H_
64
65 /* ========================================================================== */
66 /* Include Files */
67 /* ========================================================================== */
68
69 #include <stdint.h>
70 #include <stdbool.h>
71 #include <enet_cfg.h>
72 #include <include/core/enet_types.h>
73 #include <include/core/enet_base.h>
74 #include <include/core/enet_osal.h>
75 #include <include/core/enet_utils.h>
76 #include <include/core/enet_ioctl.h>
77 #include <include/core/enet_trace.h>
78 #include <include/core/enet_queue.h>
79 #include <include/core/enet_soc.h>
80 #include <include/core/enet_mod_fdb.h>
81 #include <include/core/enet_mod_port.h>
82 #include <include/core/enet_mod_timesync.h>
83 #include <include/core/enet_mod_tas.h>
84 #include <include/core/enet_mod_phy.h>
85 #include <include/core/enet_dma.h>
86
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90
91 /* ========================================================================== */
92 /* Macros */
93 /* ========================================================================== */
94
95 /* None */
96
97 /* ========================================================================== */
98 /* Structures and Enums */
99 /* ========================================================================== */
100
101 /* ========================================================================== */
102 /* Global Variables Declarations */
103 /* ========================================================================== */
104
105 /* None */
106
107 /* ========================================================================== */
108 /* Function Declarations */
109 /* ========================================================================== */
110
119 uint32_t Enet_getCoreId(void);
120
134 EnetTrace_TraceLevel Enet_setTraceLevel(EnetTrace_TraceLevel level);
135
143 EnetTrace_TraceLevel Enet_getTraceLevel(void);
144
158 void Enet_initUtilsCfg(EnetUtils_Cfg *utilsCfg);
159
168 void Enet_init(const EnetUtils_Cfg *utilsCfg);
169
179 void Enet_deinit(void);
180
193 Enet_Handle Enet_getHandle(Enet_Type enetType,
194 uint32_t instId);
195
207 uint32_t Enet_getMacPortMax(Enet_Type enetType,
208 uint32_t instId);
209
225 void Enet_initCfg(Enet_Type enetType,
226 uint32_t instId,
227 void *cfg,
228 uint32_t cfgSize);
229
249 Enet_Handle Enet_open(Enet_Type enetType,
250 uint32_t instId,
251 const void *cfg,
252 uint32_t cfgSize);
253
266 Enet_Handle Enet_rejoin(Enet_Type enetType,
267 uint32_t instId);
268
282 EnetDma_Handle Enet_getDmaHandle(Enet_Handle hEnet);
283
284
298 void Enet_registerEventCb(Enet_Handle hEnet,
299 Enet_Event evt,
300 uint32_t evtNum,
301 Enet_EventCallback evtCb,
302 void *evtCbArgs);
303
313 void Enet_unregisterEventCb(Enet_Handle hEnet,
314 Enet_Event evt,
315 uint32_t evtNum);
316
333 void Enet_poll(Enet_Handle hEnet,
334 Enet_Event evt,
335 const void *arg,
336 uint32_t argSize);
337
345 void Enet_periodicTick(Enet_Handle hEnet);
346
358 uint32_t Enet_getMacPortCnt(Enet_Handle hEnet);
359
367 void Enet_close(Enet_Handle hEnet);
368
378 int32_t Enet_saveCtxt(Enet_Handle hEnet);
379
390 int32_t Enet_restoreCtxt(Enet_Type enetType,
391 uint32_t instId);
392
403 int32_t Enet_hardResetCpsw(Enet_Handle hEnet,
404 Enet_Type enetType,
405 uint32_t instId,
406 Enet_notify_t *pCpswTriggerResetCb);
416 int32_t Enet_getHandleInfo(Enet_Handle hEnet,
417 Enet_Type *enetType,
418 uint32_t *instId);
419 /* ========================================================================== */
420 /* Deprecated Function Declarations */
421 /* ========================================================================== */
422
423 /* None */
424
425 #ifdef __cplusplus
426 }
427 #endif
428
429 #endif /* ENET_H_ */
430
Enet_setTraceLevel
EnetTrace_TraceLevel Enet_setTraceLevel(EnetTrace_TraceLevel level)
Set global trace level.
Enet_getCoreId
uint32_t Enet_getCoreId(void)
Enet_hardResetCpsw
int32_t Enet_hardResetCpsw(Enet_Handle hEnet, Enet_Type enetType, uint32_t instId, Enet_notify_t *pCpswTriggerResetCb)
Hard reset CPSW peripheral.
enet_dma.h
This file contains the type definitions and helper macros for the Enet Data Path (DMA) interface.
enet_soc.h
This file contains the type definitions and helper macros for the Enet SoC interface.
enet_trace.h
This file contains the type definitions and helper macros for the Enet Trace interface.
Enet_open
Enet_Handle Enet_open(Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
Open and initializes the Enet driver for a peripheral.
Enet_getMacPortMax
uint32_t Enet_getMacPortMax(Enet_Type enetType, uint32_t instId)
Get number of MAC ports available in the Ethernet peripheral.
EnetTrace_TraceLevel
EnetTrace_TraceLevel
Enumerates the types of trace level.
Definition: enet_trace.h:109
enet_mod_port.h
This file contains the type definitions and helper macros that are common for host and MAC ports.
enet_osal.h
This file contains the OSAL API of the Enet driver.
enet_types.h
This file contains the basic types using across the Enet driver.
Enet_poll
void Enet_poll(Enet_Handle hEnet, Enet_Event evt, const void *arg, uint32_t argSize)
Poll for Ethernet events.
Enet_Event
Enet_Event
Ethernet events.
Definition: enet_types.h:268
Enet_notify_t
Definition: enet_types.h:463
Enet_getHandle
Enet_Handle Enet_getHandle(Enet_Type enetType, uint32_t instId)
Get the Enet handle of a peripheral.
enet_ioctl.h
This file contains the type definitions and helper macros for the Enet IOCTL interface.
Enet_registerEventCb
void Enet_registerEventCb(Enet_Handle hEnet, Enet_Event evt, uint32_t evtNum, Enet_EventCallback evtCb, void *evtCbArgs)
Register a callback for an event.
enet_mod_phy.h
This file contains the type definitions and helper macros for the Ethernet PHY interface.
enet_queue.h
This file contains the type definitions and helper macros for the Enet software queue.
Enet_getTraceLevel
EnetTrace_TraceLevel Enet_getTraceLevel(void)
Get current trace level.
Enet_unregisterEventCb
void Enet_unregisterEventCb(Enet_Handle hEnet, Enet_Event evt, uint32_t evtNum)
Unregister callback for an event.
Enet_close
void Enet_close(Enet_Handle hEnet)
Close the Enet peripheral.
Enet_initUtilsCfg
void Enet_initUtilsCfg(EnetUtils_Cfg *utilsCfg)
Initialize utils configuration.
EnetUtils_Cfg
Enet utils parameters.
Definition: enet_utils.h:200
Enet_periodicTick
void Enet_periodicTick(Enet_Handle hEnet)
Run periodic tick on the Ethernet peripheral.
enet_mod_fdb.h
This file contains the type definitions and helper macros for the Enet Forwarding Database (FDB) modu...
Enet_getDmaHandle
EnetDma_Handle Enet_getDmaHandle(Enet_Handle hEnet)
Get the handle to the DMA used for packet transmit/receive.
enet_mod_tas.h
This file contains the type definitions and helper macros for the Enet Time Aware Shaper (TAS) module...
Enet_initCfg
void Enet_initCfg(Enet_Type enetType, uint32_t instId, void *cfg, uint32_t cfgSize)
Initialize the peripheral configuration parameters.
Enet_Type
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:202
EnetDma_Handle
struct EnetCpdma_DrvObj_s * EnetDma_Handle
Opaque handle for Enet CPDMA driver object.
Definition: enet_cpdma_types.h:86
enet_mod_timesync.h
This file contains the type definitions and helper macros for the Enet Time Synchronization module in...
Enet_deinit
void Enet_deinit(void)
De-initialize Enet LLD.
Enet_saveCtxt
int32_t Enet_saveCtxt(Enet_Handle hEnet)
Save and closes the context of the Enet peripheral.
enet_base.h
This file contains the type definitions and helper macros for the Enet Peripheral interface.
Enet_EventCallback
void(* Enet_EventCallback)(Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2)
Event callback.
Definition: enet_types.h:454
Enet_getMacPortCnt
uint32_t Enet_getMacPortCnt(Enet_Handle hEnet)
Get number of MAC ports available in the Ethernet peripheral.
enet_cfg.h
This file contains the Enet configuration parameters.
Enet_init
void Enet_init(const EnetUtils_Cfg *utilsCfg)
Enet_rejoin
Enet_Handle Enet_rejoin(Enet_Type enetType, uint32_t instId)
Rejoin a running Ethernet peripheral.
Enet_Handle
struct Enet_Obj_s * Enet_Handle
Ethernet driver handle.
Definition: enet_base.h:106
Enet_getHandleInfo
int32_t Enet_getHandleInfo(Enet_Handle hEnet, Enet_Type *enetType, uint32_t *instId)
Get enetType and instId info from the enet handle.
Enet_restoreCtxt
int32_t Enet_restoreCtxt(Enet_Type enetType, uint32_t instId)
Restore and open the context of the Enet peripheral.
enet_utils.h
This file contains the type definitions and function prototypes of the Enet Utils functionality.