PDK API Guide for J721E
lwipif2enet_appif.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Texas Instruments Incorporated - http://www.ti.com/
3  *
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the 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 "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
49 #ifndef LWIPIF2ENET_APPIF_H_
50 #define LWIPIF2ENET_APPIF_H_
51 
52 /* ========================================================================== */
53 /* Include Files */
54 /* ========================================================================== */
55 
56 #include <stdint.h>
57 #include <assert.h>
58 #include <ti/drv/enet/enet.h>
59 #include <lwip/netif.h>
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* ========================================================================== */
66 /* Macros */
67 /* ========================================================================== */
68 
70 #define LWIP2ENET_RX_NUM (2U)
71 
72 /* ========================================================================== */
73 /* Structures and Enums */
74 /* ========================================================================== */
75 
86 typedef void (*LwipifEnetAppIf_FreePktCbFxn)(void *cbArg,
87  EnetDma_PktQ *fqPktInfoQ,
88  EnetDma_PktQ *cqPktInfoQ);
89 
101 typedef bool (*LwipifEnetAppIf_IsPhyLinkedCbFxn)(struct netif *netif,
102  Enet_Handle hEnet);
103 
122 typedef bool (*LwipifEnetAppIf_HandleRxPktFxn)(struct netif *netif,
123  struct pbuf *pbuf);
124 
128 typedef struct LwipifEnetAppIf_RxConfig_s
129 {
134 
136  void *cbArg;
137 
140  uint32_t numPackets;
142 
146 typedef struct LwipifEnetAppIf_TxConfig_s
147 {
152 
154  void *cbArg;
155 
158  uint32_t numPackets;
160 
165 typedef struct LwipifEnetAppIf_GetHandleInArgs_s
166 {
168  struct netif *netif;
169 
172 
176 
180 typedef struct Lwip2EnetAppIf_FreePktInfo_s
181 {
184 
186  void *cbArg;
188 
193 typedef struct LwipifEnetAppIf_RxHandleInfo_s
194 {
197 
199  uint32_t rxFlowStartIdx;
200 
202  uint32_t rxFlowIdx;
203 
205  uint8_t macAddr[ENET_MAC_ADDR_LEN];
206 
210 
215 
220 typedef struct LwipifEnetAppIf_TxHandleInfo_s
221 {
224 
226  uint32_t txChNum;
227 
231 
235 
240 typedef struct LwipifEnetAppIf_GetHandleOutArgs_s
241 {
244 
245 #if defined (ENET_SOC_HOSTPORT_DMA_TYPE_UDMA)
246 
247  Udma_DrvHandle hUdmaDrv;
248 #endif
249 
251  uint32_t coreId;
252 
254  uint32_t coreKey;
255 
258 
260  uint32_t txMtu[ENET_PRI_NUM];
261 
263  uint32_t hostPortRxMtu;
264 
267 
271 
275 
277  uint32_t timerPeriodUs;
278 
281 
285 
289 typedef struct LwipifEnetAppIf_ReleaseHandleInfo_s
290 {
292  struct netif *netif;
293 
296 
297 #if defined (ENET_SOC_HOSTPORT_DMA_TYPE_UDMA)
298 
299  Udma_DrvHandle hUdmaDrv;
300 #endif
301 
303  uint32_t coreId;
304 
306  uint32_t coreKey;
307 
310 
313 
316 
320 
321 /* ========================================================================== */
322 /* Global Variables Declarations */
323 /* ========================================================================== */
324 
325 /* None */
326 
327 /* ========================================================================== */
328 /* Function Declarations */
329 /* ========================================================================== */
330 
346 
359 
360 /* ========================================================================== */
361 /* Deprecated Function Declarations */
362 /* ========================================================================== */
363 
364 /* None */
365 
366 /* ========================================================================== */
367 /* Static Function Definitions */
368 /* ========================================================================== */
369 
370 /* None */
371 
372 #ifdef __cplusplus
373 }
374 #endif
375 
376 #endif /* LWIPIF2ENET_APPIF_H_ */
377 
bool disableEvent
Definition: lwipif2enet_appif.h:209
struct Enet_Obj_s * Enet_Handle
Ethernet driver handle.
Definition: enet_base.h:105
uint32_t coreId
Definition: lwipif2enet_appif.h:251
struct EnetUdma_TxChObj_s * EnetDma_TxChHandle
Opaque handle that holds software state for Enet TX DMA channel.
Definition: enet_udma_types.h:100
void LwipifEnetAppCb_getHandle(LwipifEnetAppIf_GetHandleInArgs *inArgs, LwipifEnetAppIf_GetHandleOutArgs *outArgs)
Callback function used by Enet's netif to delegate TX/RX channel open to the application.
struct netif * netif
Definition: lwipif2enet_appif.h:168
EnetDma_PktNotifyCb notifyCb
Definition: lwipif2enet_appif.h:133
EnetDma_RxChHandle hRxFlow
Definition: lwipif2enet_appif.h:196
#define LWIP2ENET_RX_NUM
Number of RX channels.
Definition: lwipif2enet_appif.h:70
uint32_t hostPortRxMtu
Definition: lwipif2enet_appif.h:263
struct netif * netif
Definition: lwipif2enet_appif.h:292
Enet_Handle hEnet
Definition: lwipif2enet_appif.h:295
struct EnetUdma_RxFlowObj_s * EnetDma_RxChHandle
Opaque handle that holds software state for Enet RX DMA flow.
Definition: enet_udma_types.h:95
uint32_t rxFlowIdx
Definition: lwipif2enet_appif.h:202
void(* Enet_Print)(const char *fmt,...)
Info/debug print function prototype.
Definition: enet_utils.h:165
uint32_t txChNum
Definition: lwipif2enet_appif.h:226
Generic queue.
Definition: enet_queue.h:82
#define ENET_MAC_ADDR_LEN
MAC address length in bytes/octets.
Definition: enet_types.h:153
bool txCsumOffloadEn
Definition: lwipif2enet_appif.h:280
TX-related parameters required by Enet's netif. They are populated by application.
Definition: lwipif2enet_appif.h:220
LwipifEnetAppIf_HandleRxPktFxn handlePktFxn
Definition: lwipif2enet_appif.h:213
Container structure of packet free callback info.
Definition: lwipif2enet_appif.h:180
RX-related parameters required by Enet's netif. They are populated by application.
Definition: lwipif2enet_appif.h:193
void(* LwipifEnetAppIf_FreePktCbFxn)(void *cbArg, EnetDma_PktQ *fqPktInfoQ, EnetDma_PktQ *cqPktInfoQ)
Callback function used to free packets.
Definition: lwipif2enet_appif.h:86
LwipifEnetAppIf_TxHandleInfo txInfo
Definition: lwipif2enet_appif.h:270
Arguments passed to application by Enet's netif during deinitialization.
Definition: lwipif2enet_appif.h:289
Enet_Print print
Definition: lwipif2enet_appif.h:257
void * cbArg
Definition: lwipif2enet_appif.h:186
uint32_t rxFlowStartIdx
Definition: lwipif2enet_appif.h:199
void * cbArg
Definition: lwipif2enet_appif.h:154
LwipifEnetAppIf_FreePktCbFxn cb
Definition: lwipif2enet_appif.h:183
LwipifEnetAppIf_TxHandleInfo txInfo
Definition: lwipif2enet_appif.h:309
EnetDma_TxChHandle hTxChannel
Definition: lwipif2enet_appif.h:223
uint32_t coreId
Definition: lwipif2enet_appif.h:303
bool rxCsumOffloadEn
Definition: lwipif2enet_appif.h:283
bool(* LwipifEnetAppIf_HandleRxPktFxn)(struct netif *netif, struct pbuf *pbuf)
Callback function used to pass packets to application for processing.
Definition: lwipif2enet_appif.h:122
void * cbArg
Definition: lwipif2enet_appif.h:136
Enet_MacPort txPortNum
Definition: lwipif2enet_appif.h:233
bool disableEvent
Definition: lwipif2enet_appif.h:230
Enet_Handle hEnet
Definition: lwipif2enet_appif.h:243
uint32_t coreKey
Definition: lwipif2enet_appif.h:254
void LwipifEnetAppCb_releaseHandle(LwipifEnetAppIf_ReleaseHandleInfo *releaseInfo)
Callback function used by Enet's netif to delegate TX/RX channel close to the application.
bool(* LwipifEnetAppIf_IsPhyLinkedCbFxn)(struct netif *netif, Enet_Handle hEnet)
Callback function used to check PHY link status.
Definition: lwipif2enet_appif.h:101
#define ENET_PRI_NUM
Packet priority.
Definition: enet_types.h:165
uint32_t numPackets
Definition: lwipif2enet_appif.h:140
uint32_t coreKey
Definition: lwipif2enet_appif.h:306
uint32_t timerPeriodUs
Definition: lwipif2enet_appif.h:277
This file contains the top-level API of the Enet driver.
Enet_MacPort
MAC port.
Definition: enet_types.h:405
LwipifEnetAppIf_IsPhyLinkedCbFxn isPortLinkedFxn
Definition: lwipif2enet_appif.h:266
Input arguments passed to the application via LwipifEnetAppCb_getHandle() when Enet's netif is initia...
Definition: lwipif2enet_appif.h:165
Definition: lwipif2enet_appif.h:146
void(* EnetDma_PktNotifyCb)(void *cbArg)
Function pointer type for packet notify call back.
Definition: enet_udma.h:172
EnetDma_PktNotifyCb notifyCb
Definition: lwipif2enet_appif.h:151
Definition: lwipif2enet_appif.h:128
uint32_t numPackets
Definition: lwipif2enet_appif.h:158
LwipifEnetAppIf_TxConfig txCfg
Definition: lwipif2enet_appif.h:171
Output arguments to be populated by application via LwipifEnetAppCb_getHandle() when Enet's netif is ...
Definition: lwipif2enet_appif.h:240
Lwip2EnetAppIf_FreePktInfo txFreePkt
Definition: lwipif2enet_appif.h:315