AM64x MCU+ SDK  10.00.00
udma_flow.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2021 Texas Instruments Incorporated
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 {
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 
256  Udma_FlowHandle flowHandle,
257  const Udma_FlowAllocMappedPrms *flowAllocMappedPrms);
258 
272 int32_t Udma_flowFree(Udma_FlowHandle flowHandle);
273 
304 int32_t Udma_flowAttach(Udma_DrvHandle drvHandle,
305  Udma_FlowHandle flowHandle,
306  uint32_t flowStart,
307  uint32_t flowCnt);
308 
339  Udma_FlowHandle flowHandle,
340  uint32_t mappepdFlowNum,
341  const Udma_FlowAllocMappedPrms *flowAllocMappedPrms);
342 
359 int32_t Udma_flowDetach(Udma_FlowHandle flowHandle);
360 
380 int32_t Udma_flowConfig(Udma_FlowHandle flowHandle,
381  uint32_t flowIdx,
382  const Udma_FlowPrms *flowPrms);
383 
395 uint32_t Udma_flowGetNum(Udma_FlowHandle flowHandle);
396 
410 uint32_t Udma_flowGetCount(Udma_FlowHandle flowHandle);
411 
412 /*
413  * Structure Init functions
414  */
422 void UdmaFlowPrms_init(Udma_FlowPrms *flowPrms, uint32_t chType);
423 
424 /* ========================================================================== */
425 /* Static Function Definitions */
426 /* ========================================================================== */
427 
428 /* None */
429 
430 /* ========================================================================== */
431 /* Internal/Private Structure Declarations */
432 /* ========================================================================== */
433 
437 typedef struct Udma_FlowObject_t
438 {
439  uintptr_t rsv[6U];
442 
443 #ifdef __cplusplus
444 }
445 #endif
446 
447 #endif /* #ifndef UDMA_FLOW_H_ */
448 
Udma_flowDetach
int32_t Udma_flowDetach(Udma_FlowHandle flowHandle)
UDMA flow detach API.
Udma_FlowPrms::rxChHandle
Udma_ChHandle rxChHandle
Definition: udma_flow.h:80
Udma_flowGetNum
uint32_t Udma_flowGetNum(Udma_FlowHandle flowHandle)
Returns the start flow number managed by this flow handle.
Udma_FlowAllocMappedPrms
UDMA RX channel mapped flow alloc parameters.
Definition: udma_flow.h:213
Udma_FlowPrms::einfoPresent
uint8_t einfoPresent
Definition: udma_flow.h:82
Udma_FlowAllocMappedPrms::mappedFlowGrp
uint32_t mappedFlowGrp
Definition: udma_flow.h:214
Udma_FlowPrms::sopOffset
uint16_t sopOffset
Definition: udma_flow.h:97
Udma_FlowPrms::descType
uint8_t descType
Definition: udma_flow.h:90
Udma_FlowHandle
void * Udma_FlowHandle
UDMA flow handle.
Definition: udma_types.h:73
Udma_FlowPrms::destTagLo
uint8_t destTagLo
Definition: udma_flow.h:122
Udma_FlowPrms::srcTagLoSel
uint8_t srcTagLoSel
Definition: udma_flow.h:114
Udma_ChHandle
void * Udma_ChHandle
UDMA channel handle.
Definition: udma_types.h:67
Udma_FlowPrms::destTagHiSel
uint8_t destTagHiSel
Definition: udma_flow.h:126
Udma_FlowPrms::destTagLoSel
uint8_t destTagLoSel
Definition: udma_flow.h:130
Udma_FlowPrms::psLocation
uint8_t psLocation
Definition: udma_flow.h:92
Udma_flowConfig
int32_t Udma_flowConfig(Udma_FlowHandle flowHandle, uint32_t flowIdx, const Udma_FlowPrms *flowPrms)
This API configures the flow configurations.
Udma_flowAttachMapped
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_FlowPrms::sizeThresh2
uint16_t sizeThresh2
Definition: udma_flow.h:179
Udma_FlowPrms::fdq1Qnum
uint16_t fdq1Qnum
Definition: udma_flow.h:150
Udma_FlowAllocMappedPrms::mappedChNum
uint32_t mappedChNum
Definition: udma_flow.h:221
Udma_flowAllocMapped
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....
Udma_FlowPrms::fdq0Sz0Qnum
uint16_t fdq0Sz0Qnum
Definition: udma_flow.h:143
Udma_FlowPrms::sizeThresh1
uint16_t sizeThresh1
Definition: udma_flow.h:175
Udma_FlowPrms::fdq3Qnum
uint16_t fdq3Qnum
Definition: udma_flow.h:164
UdmaFlowPrms_init
void UdmaFlowPrms_init(Udma_FlowPrms *flowPrms, uint32_t chType)
Udma_FlowPrms structure init function.
Udma_FlowObject
Opaque UDMA flow object.
Definition: udma_flow.h:438
Udma_flowAttach
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 ...
Udma_FlowPrms::defaultRxCQ
uint16_t defaultRxCQ
Definition: udma_flow.h:100
Udma_FlowPrms::errorHandling
uint8_t errorHandling
Definition: udma_flow.h:87
Udma_FlowPrms::sizeThreshEn
uint8_t sizeThreshEn
Definition: udma_flow.h:134
Udma_FlowPrms::fdq2Qnum
uint16_t fdq2Qnum
Definition: udma_flow.h:157
Udma_FlowPrms
UDMA RX channel flow parameters.
Definition: udma_flow.h:79
Udma_DrvHandle
void * Udma_DrvHandle
UDMA driver handle.
Definition: udma_types.h:65
Udma_FlowPrms::destTagHi
uint8_t destTagHi
Definition: udma_flow.h:118
Udma_FlowPrms::fdq0Sz1Qnum
uint16_t fdq0Sz1Qnum
Definition: udma_flow.h:183
Udma_FlowPrms::psInfoPresent
uint8_t psInfoPresent
Definition: udma_flow.h:84
Udma_FlowPrms::fdq0Sz3Qnum
uint16_t fdq0Sz3Qnum
Definition: udma_flow.h:199
Udma_FlowPrms::fdq0Sz2Qnum
uint16_t fdq0Sz2Qnum
Definition: udma_flow.h:191
Udma_flowFree
int32_t Udma_flowFree(Udma_FlowHandle flowHandle)
UDMA free flows.
Udma_FlowPrms::srcTagHiSel
uint8_t srcTagHiSel
Definition: udma_flow.h:110
Udma_flowGetCount
uint32_t Udma_flowGetCount(Udma_FlowHandle flowHandle)
Returns the number of flows managed by this flow handle.
Udma_FlowPrms::sizeThresh0
uint16_t sizeThresh0
Definition: udma_flow.h:171
Udma_FlowPrms::srcTagHi
uint8_t srcTagHi
Definition: udma_flow.h:102
Udma_FlowPrms::srcTagLo
uint8_t srcTagLo
Definition: udma_flow.h:106