AM64x MCU+ SDK  08.01.00
enet_cpdma.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_CPDMA_H_
48 #define ENET_CPDMA_H_
49 
50 /* ========================================================================== */
51 /* Include Files */
52 /* ========================================================================== */
53 
54 #include <stdint.h>
56 #include <include/core/enet_base.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /* ========================================================================== */
65 /* Macros */
66 /* ========================================================================== */
67 
77 #define ENET_CPDMA_CPSW_MAX_TX_CH (8U)
78 
80 #define ENET_CPDMA_CPSW_MAX_RX_CH (8U)
81 
96 typedef struct EnetCpdma_Cfg_s EnetDma_Cfg;
97 
98 /* TODO: may be deleted */
105 typedef void (*EnetDma_PktNotifyCb)(void *cbArg);
106 
109 /* ========================================================================== */
110 /* Structures and Enums */
111 /* ========================================================================== */
112 
123 /*
124  * TODO: CPDMA does not support timestamp within packet
125  * Stub to share the application code?
126  */
127 
133 typedef struct EnetCpdma_PktTsInfo_s
134 {
137 
139  uint32_t txPktSeqId;
140 
142  uint8_t txPktMsgType;
143 
145  uint8_t txPktDomain;
146 
148  uint64_t rxPktTs;
150 
157 typedef struct EnetCpdma_PktInfo_s
158 {
163 
165  uint8_t *bufPtr;
166 
168  uint32_t orgBufLen;
169 
171  uint32_t userBufLen;
172 
174  void *appPriv;
175 
181  uint32_t pktState;
182 
192  uint32_t chkSumInfo;
193 
204 
215 
221 
240 typedef struct EnetCpdma_OpenTxChPrms_s
241 {
244 
246  uint32_t chNum;
247 
251 
254  uint32_t numTxPkts;
255 
258  void *cbArg;
259 
261 
267 typedef struct EnetCpdma_OpenRxChPrms_s
268 {
271 
273  uint32_t chNum;
274 
278 
281  uint32_t numRxPkts;
282 
285  void *cbArg;
286 
288 
294 
301 typedef struct EnetCpdma_RxChInitPrms_s
302 {
305  /* TODO: It may not be required anymore */
306  uint8_t dmaPriority;
307 
309  uint32_t rxBufferOffset;
311 
318 typedef struct EnetCpdma_Cfg_s
319 {
322 
325 
328 } EnetCpdma_Cfg;
329 
335 typedef struct EnetDma_initCfg_s
336 {
337 }
341 /* ========================================================================== */
342 /* Global Variables Declarations */
343 /* ========================================================================== */
344 
345 /* None */
346 
347 /* ========================================================================== */
348 /* Function Declarations */
349 /* ========================================================================== */
364 
378 int32_t EnetCpdma_rxIsr(EnetDma_Handle hEnetDma);
379 
393 int32_t EnetCpdma_txIsr(EnetDma_Handle hEnetDma);
394 
409 int32_t EnetCpdma_miscIsr(EnetDma_Handle hEnetDma, uint32_t *pStatusMask);
410 
422 void EnetCpdma_initParams(Enet_Type enetType, EnetDma_Cfg *pDmaConfig);
423 
424 /* ========================================================================== */
425 /* Deprecated Function Declarations */
426 /* ========================================================================== */
427 
428 /* None */
429 
430 /* ========================================================================== */
431 /* Static Function Definitions */
432 /* ========================================================================== */
433 
434 /* None */
435 
436 #ifdef __cplusplus
437 }
438 #endif
439 
440 #endif /* ENET_CPDMA_H_ */
441 
EnetCpdma_txIsr
int32_t EnetCpdma_txIsr(EnetDma_Handle hEnetDma)
ENET CPDMA Tx interrupt service routine.
EnetDma_Cfg
struct EnetUdma_Cfg_s EnetDma_Cfg
Opaque handle that holds config Info for Enet DMA channel.
Definition: enet_udma.h:118
EnetCpdma_RxChInitPrms
Global Param struct for the Rx channel open.
Definition: enet_cpdma.h:302
EnetDma_PktNotifyCb
void(* EnetDma_PktNotifyCb)(void *cbArg)
Function pointer type for packet notify call back.
Definition: enet_cpdma.h:105
EnetCpdma_PktTsInfo::txPktDomain
uint8_t txPktDomain
Definition: enet_cpdma.h:145
EnetCpdma_PktInfo::txPortNum
Enet_MacPort txPortNum
Definition: enet_cpdma.h:214
EnetCpdma_PktInfo::node
EnetQ_Node node
Definition: enet_cpdma.h:162
EnetCpdma_OpenRxChPrms::chNum
uint32_t chNum
Definition: enet_cpdma.h:273
enet_types.h
This file contains the basic types using across the Enet driver.
EnetCpdma_OpenRxChPrms::hEnet
Enet_Handle hEnet
Definition: enet_cpdma.h:270
enet_cpdma_types.h
This file contains the base DMA definitions.
EnetCpdma_PktTsInfo::txPktSeqId
uint32_t txPktSeqId
Definition: enet_cpdma.h:139
Enet_MacPort
Enet_MacPort
MAC port.
Definition: enet_types.h:406
EnetCpdma_Cfg::rxInterruptPerMSec
uint32_t rxInterruptPerMSec
Definition: enet_cpdma.h:324
EnetCpdma_initParams
void EnetCpdma_initParams(Enet_Type enetType, EnetDma_Cfg *pDmaConfig)
Initialize CPDMA config params.
EnetCpdma_PktInfo
Packet data structure.
Definition: enet_cpdma.h:158
EnetCpdma_PktInfo::chkSumInfo
uint32_t chkSumInfo
Definition: enet_cpdma.h:192
enet_queue.h
This file contains the type definitions and helper macros for the Enet software queue.
EnetCpdma_OpenTxChPrms::hEnet
Enet_Handle hEnet
Definition: enet_cpdma.h:243
EnetCpdma_RxChInitPrms::dmaPriority
uint8_t dmaPriority
Definition: enet_cpdma.h:306
EnetCpdma_Cfg
Config structure for Enet CPDMA.
Definition: enet_cpdma.h:319
EnetCpdma_OpenTxChPrms::notifyCb
EnetDma_PktNotifyCb notifyCb
Definition: enet_cpdma.h:250
EnetCpdma_OpenTxChPrms::chNum
uint32_t chNum
Definition: enet_cpdma.h:246
EnetQ_Node
A generic node structure for a single link list.
Definition: enet_queue.h:74
EnetCpdma_OpenTxChPrms::numTxPkts
uint32_t numTxPkts
Definition: enet_cpdma.h:254
EnetCpdma_PktInfo::orgBufLen
uint32_t orgBufLen
Definition: enet_cpdma.h:168
EnetCpdma_OpenRxChPrms::numRxPkts
uint32_t numRxPkts
Definition: enet_cpdma.h:281
EnetCpdma_PktTsInfo
CPPI buffer timestamp info.
Definition: enet_cpdma.h:134
EnetDma_OpenRxChPrms
EnetCpdma_OpenRxChPrms EnetDma_OpenRxChPrms
Param struct for the RX channel open function. We include this typedef as top level DMA APIs use Enet...
Definition: enet_cpdma.h:293
EnetCpdma_OpenRxChPrms::notifyCb
EnetDma_PktNotifyCb notifyCb
Definition: enet_cpdma.h:277
EnetCpdma_rxThreshIsr
int32_t EnetCpdma_rxThreshIsr(EnetDma_Handle hEnetDma)
ENET CPDMA Rx Threshold interrupt service routine.
EnetCpdma_OpenTxChPrms::cbArg
void * cbArg
Definition: enet_cpdma.h:258
EnetCpdma_PktInfo::rxPortNum
Enet_MacPort rxPortNum
Definition: enet_cpdma.h:219
Enet_Type
Enet_Type
Ethernet peripheral type.
Definition: enet_types.h:196
EnetCpdma_PktTsInfo::txPktMsgType
uint8_t txPktMsgType
Definition: enet_cpdma.h:142
EnetCpdma_Cfg::isCacheable
bool isCacheable
Definition: enet_cpdma.h:321
enet_base.h
This file contains the type definitions and helper macros for the Enet Peripheral interface.
EnetCpdma_PktInfo::bufPtr
uint8_t * bufPtr
Definition: enet_cpdma.h:165
EnetCpdma_PktInfo::pktState
uint32_t pktState
Definition: enet_cpdma.h:181
EnetDma_initCfg
Config structure for Enet UDMA Data Path initialization.
Definition: enet_udma.h:750
EnetCpdma_miscIsr
int32_t EnetCpdma_miscIsr(EnetDma_Handle hEnetDma, uint32_t *pStatusMask)
ENET CPDMA Miscellaneous interrupt service routine.
EnetCpdma_RxChInitPrms::rxBufferOffset
uint32_t rxBufferOffset
Definition: enet_cpdma.h:309
EnetCpdma_OpenRxChPrms::cbArg
void * cbArg
Definition: enet_cpdma.h:285
EnetCpdma_PktInfo::appPriv
void * appPriv
Definition: enet_cpdma.h:174
EnetCpdma_Cfg::rxChInitPrms
EnetCpdma_RxChInitPrms rxChInitPrms
Definition: enet_cpdma.h:327
EnetCpdma_OpenRxChPrms
Param struct for the RX channel open function.
Definition: enet_cpdma.h:268
EnetCpdma_PktInfo::tsInfo
EnetCpdma_PktTsInfo tsInfo
Definition: enet_cpdma.h:203
EnetCpdma_PktTsInfo::enableHostTxTs
bool enableHostTxTs
Definition: enet_cpdma.h:136
EnetCpdma_PktTsInfo::rxPktTs
uint64_t rxPktTs
Definition: enet_cpdma.h:148
Enet_Handle
struct Enet_Obj_s * Enet_Handle
Ethernet driver handle.
Definition: enet_base.h:105
EnetDma_Handle
struct EnetUdma_DrvObj_s * EnetDma_Handle
Opaque handle for Enet UDMA driver object.
Definition: enet_udma_types.h:86
EnetCpdma_OpenTxChPrms
Param struct for the TX channel open function.
Definition: enet_cpdma.h:241
EnetCpdma_PktInfo::userBufLen
uint32_t userBufLen
Definition: enet_cpdma.h:171
EnetCpdma_rxIsr
int32_t EnetCpdma_rxIsr(EnetDma_Handle hEnetDma)
ENET CPDMA Rx interrupt service routine.