AM64x MCU+ SDK  11.02.00
udma_ch.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018-2024 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_CH_H_
49 #define UDMA_CH_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 
69 #define UDMA_DMA_CH_INVALID ((uint32_t) 0xFFFF0000U)
70 
74 #define UDMA_DMA_CH_ANY ((uint32_t) 0xFFFF0001U)
75 
79 #define UDMA_DMA_CH_NA ((uint32_t) 0xFFFF0002U)
80 
81 #define UDMA_MAPPED_GROUP_INVALID ((uint32_t) 0xFFFF0004U)
82 
84 #define UDMA_DMSC_EXTENDED_CH_TYPE_BCDMA_BLK_CPY ((uint8_t) 1U)
85 
87 #define UDMA_DMSC_EXTENDED_CH_TYPE_BCDMA_SPLIT_TR_TX ((uint8_t) 0U)
88 
89 
99 #define UDMA_CH_FLAG_TX ((uint32_t) 0x0001U)
100 
101 #define UDMA_CH_FLAG_RX ((uint32_t) 0x0002U)
102 
103 #define UDMA_CH_FLAG_BLK_COPY ((uint32_t) 0x0004U)
104 
105 #define UDMA_CH_FLAG_PDMA ((uint32_t) 0x0008U)
106 
107 #define UDMA_CH_FLAG_PSIL ((uint32_t) 0x0010U)
108 
109 #define UDMA_CH_FLAG_UTC ((uint32_t) 0x0020U)
110 
111 #define UDMA_CH_FLAG_HC ((uint32_t) 0x0040U)
112 
113 #define UDMA_CH_FLAG_UHC ((uint32_t) 0x0080U)
114 
115 #define UDMA_CH_FLAG_MAPPED ((uint32_t) 0x0100U)
116 
127 #define UDMA_CH_TYPE_TR_BLK_COPY (UDMA_CH_FLAG_BLK_COPY | \
128  UDMA_CH_FLAG_TX | \
129  UDMA_CH_FLAG_RX)
130 
131 #define UDMA_CH_TYPE_TR_BLK_COPY_HC (UDMA_CH_FLAG_BLK_COPY | \
132  UDMA_CH_FLAG_TX | \
133  UDMA_CH_FLAG_RX | \
134  UDMA_CH_FLAG_HC)
135 
136 #define UDMA_CH_TYPE_TR_BLK_COPY_UHC (UDMA_CH_FLAG_BLK_COPY | \
137  UDMA_CH_FLAG_TX | \
138  UDMA_CH_FLAG_RX | \
139  UDMA_CH_FLAG_UHC)
140 
141 #define UDMA_CH_TYPE_TX (UDMA_CH_FLAG_TX | UDMA_CH_FLAG_PSIL)
142 
143 #define UDMA_CH_TYPE_TX_HC (UDMA_CH_FLAG_TX | UDMA_CH_FLAG_PSIL | UDMA_CH_FLAG_HC)
144 
145 #define UDMA_CH_TYPE_TX_UHC (UDMA_CH_FLAG_TX | UDMA_CH_FLAG_PSIL | UDMA_CH_FLAG_UHC)
146 
148 #define UDMA_CH_TYPE_RX (UDMA_CH_FLAG_RX | UDMA_CH_FLAG_PSIL)
149 
150 #define UDMA_CH_TYPE_RX_HC (UDMA_CH_FLAG_RX | UDMA_CH_FLAG_PSIL | UDMA_CH_FLAG_HC)
151 
152 #define UDMA_CH_TYPE_RX_UHC (UDMA_CH_FLAG_RX | UDMA_CH_FLAG_PSIL | UDMA_CH_FLAG_UHC)
153 
155 #define UDMA_CH_TYPE_PDMA_TX (UDMA_CH_FLAG_TX | UDMA_CH_FLAG_PDMA)
156 
157 #define UDMA_CH_TYPE_PDMA_TX_HC (UDMA_CH_FLAG_TX | UDMA_CH_FLAG_PDMA | UDMA_CH_FLAG_HC)
158 
159 #define UDMA_CH_TYPE_PDMA_TX_UHC (UDMA_CH_FLAG_TX | UDMA_CH_FLAG_PDMA | UDMA_CH_FLAG_UHC)
160 
162 #define UDMA_CH_TYPE_PDMA_RX (UDMA_CH_FLAG_RX | UDMA_CH_FLAG_PDMA)
163 
164 #define UDMA_CH_TYPE_PDMA_RX_HC (UDMA_CH_FLAG_RX | UDMA_CH_FLAG_PDMA | UDMA_CH_FLAG_HC)
165 
166 #define UDMA_CH_TYPE_PDMA_RX_UHC (UDMA_CH_FLAG_RX | UDMA_CH_FLAG_PDMA | UDMA_CH_FLAG_UHC)
167 
173 #define UDMA_CH_TYPE_TX_MAPPED (UDMA_CH_FLAG_TX | UDMA_CH_FLAG_PSIL | UDMA_CH_FLAG_MAPPED)
174 
179 #define UDMA_CH_TYPE_RX_MAPPED (UDMA_CH_FLAG_RX | UDMA_CH_FLAG_PSIL | UDMA_CH_FLAG_MAPPED)
180 
186 #define UDMA_CH_TYPE_UTC (UDMA_CH_FLAG_UTC)
187 
195 #define UDMA_PDMA_ES_8BITS ((uint32_t) 0x00U)
196 #define UDMA_PDMA_ES_16BITS ((uint32_t) 0x01U)
197 #define UDMA_PDMA_ES_24BITS ((uint32_t) 0x02U)
198 #define UDMA_PDMA_ES_32BITS ((uint32_t) 0x03U)
199 #define UDMA_PDMA_ES_64BITS ((uint32_t) 0x04U)
200 
201 #define UDMA_PDMA_ES_DONTCARE ((uint32_t) 0x00U)
202 
204 /* ========================================================================== */
205 /* Structure Declarations */
206 /* ========================================================================== */
207 
208 
209 
210 /* ========================================================================== */
211 /* Function Declarations */
212 /* ========================================================================== */
213 
236 int32_t Udma_chOpen(Udma_DrvHandle drvHandle,
237  Udma_ChHandle chHandle,
238  uint32_t chType,
239  const Udma_ChPrms *chPrms);
240 
253 int32_t Udma_chClose(Udma_ChHandle chHandle);
254 
272 int32_t Udma_chConfigTx(Udma_ChHandle chHandle, const Udma_ChTxPrms *txPrms);
273 
293 int32_t Udma_chConfigRx(Udma_ChHandle chHandle, const Udma_ChRxPrms *rxPrms);
294 
311  const Udma_ChPdmaPrms *pdmaPrms);
312 
325 int32_t Udma_chEnable(Udma_ChHandle chHandle);
326 
348 int32_t Udma_chDisable(Udma_ChHandle chHandle, uint32_t timeout);
349 
363 int32_t Udma_chPause(Udma_ChHandle chHandle);
364 
378 int32_t Udma_chResume(Udma_ChHandle chHandle);
379 
392 uint32_t Udma_chGetNum(Udma_ChHandle chHandle);
393 
403 
413 
423 
434 
447 
457 
474 uint32_t Udma_chGetTriggerEvent(Udma_ChHandle chHandle, uint32_t trigger);
475 
496 
519 int32_t Udma_chSetSwTrigger(Udma_ChHandle chHandle, uint32_t trigger);
520 
543 int32_t Udma_chSetChaining(Udma_ChHandle triggerChHandle,
544  Udma_ChHandle chainedChHandle,
545  uint32_t trigger);
546 
559 int32_t Udma_chBreakChaining(Udma_ChHandle triggerChHandle,
560  Udma_ChHandle chainedChHandle);
561 
562 /*
563  * Structure Init functions
564  */
572 void UdmaChPrms_init(Udma_ChPrms *chPrms, uint32_t chType);
573 
581 void UdmaChTxPrms_init(Udma_ChTxPrms *txPrms, uint32_t chType);
582 
590 void UdmaChRxPrms_init(Udma_ChRxPrms *rxPrms, uint32_t chType);
591 
599 
612 int32_t Udma_chGetStats(Udma_ChHandle chHandle, Udma_ChStats *chStats);
613 
623 int32_t Udma_getPeerData(Udma_ChHandle chHandle, uint32_t *peerData);
624 
634 int32_t Udma_clearPeerData(Udma_ChHandle chHandle, uint32_t peerData);
635 
636 #if (UDMA_SOC_CFG_RA_NORMAL_PRESENT == 1)
637 
653 int32_t Udma_chDequeueTdResponse(Udma_ChHandle chHandle,
654  CSL_UdmapTdResponse *tdResponse);
655 #endif
656 /* ========================================================================== */
657 /* Static Function Definitions */
658 /* ========================================================================== */
659 
660 /* None */
661 
662 /* ========================================================================== */
663 /* Internal/Private Structure Declarations */
664 /* ========================================================================== */
665 
666 /* None */
667 
668 #ifdef __cplusplus
669 }
670 #endif
671 
672 #endif /* #ifndef UDMA_CH_H_ */
673 
Udma_chGetCqRingHandle
Udma_RingHandle Udma_chGetCqRingHandle(Udma_ChHandle chHandle)
Returns the default completion ring handle of the channel.
Udma_ChTxPrms
UDMA TX channel parameters.
Definition: udma_types.h:223
Udma_ChPrms
UDMA channel open parameters.
Definition: udma_types.h:163
Udma_chOpen
int32_t Udma_chOpen(Udma_DrvHandle drvHandle, Udma_ChHandle chHandle, uint32_t chType, const Udma_ChPrms *chPrms)
UDMA open channel.
Udma_chEnable
int32_t Udma_chEnable(Udma_ChHandle chHandle)
UDMA channel enable API.
Udma_DrvHandle
struct Udma_DrvObjectInt * Udma_DrvHandle
UDMA driver handle.
Definition: udma_types.h:84
Udma_ChRxPrms
UDMA RX channel parameters.
Definition: udma_types.h:296
Udma_chGetTdCqRingHandle
Udma_RingHandle Udma_chGetTdCqRingHandle(Udma_ChHandle chHandle)
Returns the teardown completion ring handle of the channel.
Udma_chDisable
int32_t Udma_chDisable(Udma_ChHandle chHandle, uint32_t timeout)
UDMA channel teardown and disable API.
Udma_ChPdmaPrms
UDMA PDMA channel Static TR parameters.
Definition: udma_types.h:374
UdmaChPdmaPrms_init
void UdmaChPdmaPrms_init(Udma_ChPdmaPrms *pdmaPrms)
Udma_ChPdmaPrms structure init function.
Udma_FlowHandle
struct Udma_FlowObjectInt * Udma_FlowHandle
UDMA flow handle.
Definition: udma_types.h:92
Udma_chGetStats
int32_t Udma_chGetStats(Udma_ChHandle chHandle, Udma_ChStats *chStats)
Get real-time channel statistics.
Udma_chGetNum
uint32_t Udma_chGetNum(Udma_ChHandle chHandle)
Returns the channel number offset with in a channel type - TX, RX and External (UTC) channel types.
Udma_chPause
int32_t Udma_chPause(Udma_ChHandle chHandle)
UDMA channel pause API.
Udma_chGetDefaultFlowHandle
Udma_FlowHandle Udma_chGetDefaultFlowHandle(Udma_ChHandle chHandle)
Returns the default flow handle of the RX channel.
Udma_chConfigTx
int32_t Udma_chConfigTx(Udma_ChHandle chHandle, const Udma_ChTxPrms *txPrms)
UDMA configure TX channel.
Udma_chSetSwTrigger
int32_t Udma_chSetSwTrigger(Udma_ChHandle chHandle, uint32_t trigger)
Sets the software trigger register based on the trigger mode provided.
Udma_getPeerData
int32_t Udma_getPeerData(Udma_ChHandle chHandle, uint32_t *peerData)
Get real-time peer data which contains number of bytes written.
Udma_chResume
int32_t Udma_chResume(Udma_ChHandle chHandle)
UDMA channel resume API.
Udma_chGetTriggerEvent
uint32_t Udma_chGetTriggerEvent(Udma_ChHandle chHandle, uint32_t trigger)
Returns the global trigger event for the channel.
Udma_chGetSwTriggerRegister
uint32_t * Udma_chGetSwTriggerRegister(Udma_ChHandle chHandle)
Returns the software trigger register address for the channel.
Udma_chGetCqRingNum
uint16_t Udma_chGetCqRingNum(Udma_ChHandle chHandle)
Returns the default completion ring number to be programmed in descriptor.
UdmaChPrms_init
void UdmaChPrms_init(Udma_ChPrms *chPrms, uint32_t chType)
Udma_ChPrms structure init function.
Udma_chSetChaining
int32_t Udma_chSetChaining(Udma_ChHandle triggerChHandle, Udma_ChHandle chainedChHandle, uint32_t trigger)
Chains the trigger channel with the chained channel.
UdmaChTxPrms_init
void UdmaChTxPrms_init(Udma_ChTxPrms *txPrms, uint32_t chType)
Udma_ChTxPrms structure init function.
UdmaChRxPrms_init
void UdmaChRxPrms_init(Udma_ChRxPrms *rxPrms, uint32_t chType)
Udma_ChRxPrms structure init function.
Udma_ChStats
UDMA channel statistics.
Definition: udma_types.h:426
Udma_clearPeerData
int32_t Udma_clearPeerData(Udma_ChHandle chHandle, uint32_t peerData)
Clear real-time peer data which contains number of bytes written.
Udma_ChHandle
struct Udma_ChObjectInt * Udma_ChHandle
UDMA channel handle.
Definition: udma_types.h:86
Udma_chClose
int32_t Udma_chClose(Udma_ChHandle chHandle)
UDMA close channel.
Udma_chGetFqRingHandle
Udma_RingHandle Udma_chGetFqRingHandle(Udma_ChHandle chHandle)
Returns the default free ring handle of the channel.
Udma_chConfigPdma
int32_t Udma_chConfigPdma(Udma_ChHandle chHandle, const Udma_ChPdmaPrms *pdmaPrms)
UDMA configure PDMA channel (peerChNum as part of Udma_ChPrms) paired with the UDMAP channel.
Udma_RingHandle
struct Udma_RingObjectInt * Udma_RingHandle
UDMA ring handle.
Definition: udma_types.h:90
Udma_chBreakChaining
int32_t Udma_chBreakChaining(Udma_ChHandle triggerChHandle, Udma_ChHandle chainedChHandle)
Breaks the chaining by resetting the trigger channel's OES.
Udma_chConfigRx
int32_t Udma_chConfigRx(Udma_ChHandle chHandle, const Udma_ChRxPrms *rxPrms)
UDMA configure RX channel.
Udma_chGetFqRingNum
uint16_t Udma_chGetFqRingNum(Udma_ChHandle chHandle)
Returns the default free ring number to be programmed in descriptor.