PDK API Guide for AM64x
udma_flow.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2018
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 
48 #ifndef UDMA_FLOW_H_
49 #define UDMA_FLOW_H_
50 
51 /* ========================================================================== */
52 /* Include Files */
53 /* ========================================================================== */
54 
55 /* None */
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /* ========================================================================== */
62 /* Macros & Typedefs */
63 /* ========================================================================== */
64 
66 #define UDMA_DEFAULT_FLOW_ID (0x3FFFU)
67 
69 #define UDMA_FLOW_INVALID ((uint32_t) 0xFFFF0000U)
70 
71 /* ========================================================================== */
72 /* Structure Declarations */
73 /* ========================================================================== */
74 
78 typedef struct
79 {
80  Udma_ChHandle rxChHandle;
82  uint8_t einfoPresent;
84  uint8_t psInfoPresent;
87  uint8_t errorHandling;
90  uint8_t descType;
92  uint8_t psLocation;
97  uint16_t sopOffset;
100  uint16_t defaultRxCQ;
102  uint8_t srcTagHi;
106  uint8_t srcTagLo;
110  uint8_t srcTagHiSel;
114  uint8_t srcTagLoSel;
118  uint8_t destTagHi;
122  uint8_t destTagLo;
126  uint8_t destTagHiSel;
130  uint8_t destTagLoSel;
134  uint8_t sizeThreshEn;
143  uint16_t fdq0Sz0Qnum;
150  uint16_t fdq1Qnum;
157  uint16_t fdq2Qnum;
164  uint16_t fdq3Qnum;
171  uint16_t sizeThresh0;
175  uint16_t sizeThresh1;
179  uint16_t sizeThresh2;
183  uint16_t fdq0Sz1Qnum;
191  uint16_t fdq0Sz2Qnum;
199  uint16_t fdq0Sz3Qnum;
207 } Udma_FlowPrms;
208 
212 typedef struct
213 {
214  uint32_t mappedFlowGrp;
221  uint32_t mappedChNum;
230 
231 /* ========================================================================== */
232 /* Function Declarations */
233 /* ========================================================================== */
234 
250 int32_t Udma_flowAlloc(Udma_DrvHandle drvHandle,
251  Udma_FlowHandle flowHandle,
252  uint32_t flowCnt);
253 
274 int32_t Udma_flowAllocMapped(Udma_DrvHandle drvHandle,
275  Udma_FlowHandle flowHandle,
276  const Udma_FlowAllocMappedPrms *flowAllocMappedPrms);
277 
293 int32_t Udma_flowFree(Udma_FlowHandle flowHandle);
294 
327 int32_t Udma_flowAttach(Udma_DrvHandle drvHandle,
328  Udma_FlowHandle flowHandle,
329  uint32_t flowStart,
330  uint32_t flowCnt);
331 
361 int32_t Udma_flowAttachMapped(Udma_DrvHandle drvHandle,
362  Udma_FlowHandle flowHandle,
363  uint32_t mappepdFlowNum,
364  const Udma_FlowAllocMappedPrms *flowAllocMappedPrms);
365 
382 int32_t Udma_flowDetach(Udma_FlowHandle flowHandle);
383 
403 int32_t Udma_flowConfig(Udma_FlowHandle flowHandle,
404  uint32_t flowIdx,
405  const Udma_FlowPrms *flowPrms);
406 
420 uint32_t Udma_flowGetNum(Udma_FlowHandle flowHandle);
421 
435 uint32_t Udma_flowGetCount(Udma_FlowHandle flowHandle);
436 
437 /*
438  * Structure Init functions
439  */
447 void UdmaFlowPrms_init(Udma_FlowPrms *flowPrms, uint32_t chType);
448 
449 /* ========================================================================== */
450 /* Static Function Definitions */
451 /* ========================================================================== */
452 
453 /* None */
454 
455 /* ========================================================================== */
456 /* Internal/Private Structure Declarations */
457 /* ========================================================================== */
458 
466 {
467  Udma_DrvHandle drvHandle;
470  uint32_t flowStart;
477  uint32_t flowCnt;
484  uint32_t flowInitDone;
487  uint32_t mappedFlowGrp;
497  uint32_t mappedChNum;
505 };
506 
507 #ifdef __cplusplus
508 }
509 #endif
510 
511 #endif /* #ifndef UDMA_FLOW_H_ */
512 
513 /* @} */
Udma_DrvHandle drvHandle
Definition: udma_flow.h:467
uint8_t srcTagHiSel
Definition: udma_flow.h:110
uint8_t sizeThreshEn
Definition: udma_flow.h:134
uint16_t fdq0Sz1Qnum
Definition: udma_flow.h:183
uint32_t mappedFlowGrp
Definition: udma_flow.h:214
UDMA flow object.
Definition: udma_flow.h:465
uint32_t Udma_flowGetCount(Udma_FlowHandle flowHandle)
Returns the number of flows managed by this flow handle.
uint32_t Udma_flowGetNum(Udma_FlowHandle flowHandle)
Returns the start flow number managed by this flow handle.
uint32_t mappedChNum
Definition: udma_flow.h:497
uint16_t fdq3Qnum
Definition: udma_flow.h:164
uint16_t sizeThresh2
Definition: udma_flow.h:179
uint8_t einfoPresent
Definition: udma_flow.h:82
uint16_t defaultRxCQ
Definition: udma_flow.h:100
uint8_t psInfoPresent
Definition: udma_flow.h:84
int32_t Udma_flowConfig(Udma_FlowHandle flowHandle, uint32_t flowIdx, const Udma_FlowPrms *flowPrms)
This API configures the flow configurations.
uint16_t sizeThresh0
Definition: udma_flow.h:171
uint8_t srcTagLoSel
Definition: udma_flow.h:114
uint16_t fdq1Qnum
Definition: udma_flow.h:150
int32_t Udma_flowAllocMapped(Udma_DrvHandle drvHandle, Udma_FlowHandle flowHandle, const Udma_FlowAllocMappedPrms *flowAllocMappedPrms)
UDMA mapped flow allocation API. In devices like AM64x, flows are tied to channels....
int32_t Udma_flowAlloc(Udma_DrvHandle drvHandle, Udma_FlowHandle flowHandle, uint32_t flowCnt)
UDMA flow allocation API.
uint16_t fdq0Sz0Qnum
Definition: udma_flow.h:143
uint16_t sopOffset
Definition: udma_flow.h:97
uint32_t flowCnt
Definition: udma_flow.h:477
uint8_t destTagHiSel
Definition: udma_flow.h:126
uint16_t fdq2Qnum
Definition: udma_flow.h:157
uint16_t sizeThresh1
Definition: udma_flow.h:175
uint32_t mappedChNum
Definition: udma_flow.h:221
uint32_t flowStart
Definition: udma_flow.h:470
uint8_t srcTagLo
Definition: udma_flow.h:106
int32_t Udma_flowAttachMapped(Udma_DrvHandle drvHandle, Udma_FlowHandle flowHandle, uint32_t mappepdFlowNum, const Udma_FlowAllocMappedPrms *flowAllocMappedPrms)
UDMA mapped flow attach API. This API is used to attach to an already allocated mapped flow....
UDMA RX channel flow parameters.
Definition: udma_flow.h:78
UDMA RX channel mapped flow alloc parameters.
Definition: udma_flow.h:212
uint8_t descType
Definition: udma_flow.h:90
uint32_t mappedFlowGrp
Definition: udma_flow.h:487
uint8_t destTagLoSel
Definition: udma_flow.h:130
void UdmaFlowPrms_init(Udma_FlowPrms *flowPrms, uint32_t chType)
Udma_FlowPrms structure init function.
uint8_t psLocation
Definition: udma_flow.h:92
uint8_t destTagLo
Definition: udma_flow.h:122
uint8_t errorHandling
Definition: udma_flow.h:87
int32_t Udma_flowAttach(Udma_DrvHandle drvHandle, Udma_FlowHandle flowHandle, uint32_t flowStart, uint32_t flowCnt)
UDMA flow attach API. This API is used to attach to an already allocated flow. This API differs from ...
uint16_t fdq0Sz2Qnum
Definition: udma_flow.h:191
int32_t Udma_flowDetach(Udma_FlowHandle flowHandle)
UDMA flow detach API.
Udma_ChHandle rxChHandle
Definition: udma_flow.h:80
uint8_t destTagHi
Definition: udma_flow.h:118
uint32_t flowInitDone
Definition: udma_flow.h:484
uint16_t fdq0Sz3Qnum
Definition: udma_flow.h:199
uint8_t srcTagHi
Definition: udma_flow.h:102
int32_t Udma_flowFree(Udma_FlowHandle flowHandle)
UDMA free flows.