UDMALPF3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2024, Texas Instruments Incorporated
3  * All rights reserved.
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  */
101 #ifndef ti_drivers_UDMALPF3__include
102 #define ti_drivers_UDMALPF3__include
103 
104 #include <stdint.h>
105 #include <stdbool.h>
106 
107 #include <ti/drivers/Power.h>
108 
109 #include <ti/devices/DeviceFamily.h>
110 #include DeviceFamily_constructPath(inc/hw_types.h)
111 #include DeviceFamily_constructPath(driverlib/udma.h)
112 
113 #ifdef __cplusplus
114 extern "C" {
115 #endif
116 
118 #if !defined(UDMALPF3_CONFIG_BASE)
119  #if TFM_ENABLED
120  #define UDMALPF3_CONFIG_BASE 0x3000C400
121  #else
122  #define UDMALPF3_CONFIG_BASE 0x20000400
123  #endif
124 #endif
125 
127 #if (UDMALPF3_CONFIG_BASE & 0x3FF)
128  #error "Base address for DMA control table 'UDMALPF3_CONFIG_BASE' must be 1024 bytes aligned."
129 #endif
130 
132 #if defined(__IAR_SYSTEMS_ICC__)
133  #define ALLOCATE_CONTROL_TABLE_ENTRY(ENTRY_NAME, CHANNEL_INDEX) \
134  __no_init __root static volatile uDMAControlTableEntry ENTRY_NAME @UDMALPF3_CONFIG_BASE + \
135  (CHANNEL_INDEX) * sizeof(uDMAControlTableEntry)
136 #elif defined(__TI_COMPILER_VERSION__) || defined(__clang__)
137  #define ALLOCATE_CONTROL_TABLE_ENTRY(ENTRY_NAME, CHANNEL_INDEX) \
138  static volatile uDMAControlTableEntry ENTRY_NAME \
139  __attribute__((retain, \
140  location((UDMALPF3_CONFIG_BASE) + (CHANNEL_INDEX) * sizeof(uDMAControlTableEntry))))
141 #elif defined(__GNUC__)
142  #define ALLOCATE_CONTROL_TABLE_ENTRY(ENTRY_NAME, CHANNEL_INDEX) \
143  extern int UDMALPF3_##ENTRY_NAME##_is_placed; \
144  __attribute__((section("." #ENTRY_NAME), used)) static volatile uDMAControlTableEntry ENTRY_NAME = { \
145  &UDMALPF3_##ENTRY_NAME##_is_placed}
146 #else
147  #error "don't know how to define ALLOCATE_CONTROL_TABLE_ENTRY for this toolchain"
148 #endif
149 
151 #define UDMALPF3_SET_TRANSFER_SIZE(SIZE) (((SIZE - 1) << UDMA_XFER_SIZE_S) & UDMA_XFER_SIZE_M)
152 
153 #define UDMALPF3_GET_TRANSFER_SIZE(CONTROL) (((CONTROL & UDMA_XFER_SIZE_M) >> UDMA_XFER_SIZE_S) + 1)
154 
158 typedef struct
159 {
160  uint32_t CtrlBaseAddr;
162 
163 /* Externs from ti_drivers_config.c */
164 extern const UDMALPF3_Config UDMALPF3_config;
165 
182 extern void UDMALPF3_init(void);
183 
195 __STATIC_INLINE void UDMALPF3_channelEnable(uint32_t channelBitMask)
196 {
197  /* Enable DMA channel */
198  uDMAEnableChannel(channelBitMask);
199 }
200 
217 __STATIC_INLINE bool UDMALPF3_channelDone(uint32_t channelBitMask)
218 {
219  /* Check if REQDONE is set for the specified channels */
220  return (uDMAIntStatus() & channelBitMask) ? true : false;
221 }
222 
235 __STATIC_INLINE void UDMALPF3_clearInterrupt(uint32_t channelBitMask)
236 {
237  /* Clear UDMA done interrupt */
238  uDMAClearInt(channelBitMask);
239 }
240 
255 __STATIC_INLINE void UDMALPF3_channelDisable(uint32_t channelBitMask)
256 {
257  /* Disable provided channels(s) */
258  uDMADisableChannel(channelBitMask);
259 }
260 
278 __STATIC_INLINE void UDMALPF3_disableAttribute(uint32_t channelBitMask, uint32_t attr)
279 {
280  /* disable provided attribute for the given channel */
281  uDMADisableChannelAttribute(channelBitMask, attr);
282 }
283 
284 #ifdef __cplusplus
285 }
286 #endif
287 
288 #endif /* ti_drivers_UDMALPF3__include */
const UDMALPF3_Config UDMALPF3_config
__STATIC_INLINE bool UDMALPF3_channelDone(uint32_t channelBitMask)
Definition: UDMALPF3.h:217
__STATIC_INLINE void UDMALPF3_channelDisable(uint32_t channelBitMask)
Definition: UDMALPF3.h:255
Power Manager.
__STATIC_INLINE void UDMALPF3_channelEnable(uint32_t channelBitMask)
Definition: UDMALPF3.h:195
UDMALPF3 Global configuration.
Definition: UDMALPF3.h:158
__STATIC_INLINE void UDMALPF3_disableAttribute(uint32_t channelBitMask, uint32_t attr)
Definition: UDMALPF3.h:278
uint32_t CtrlBaseAddr
Definition: UDMALPF3.h:160
void UDMALPF3_init(void)
Function to initialize the LPF3 DMA driver and peripheral.
__STATIC_INLINE void UDMALPF3_clearInterrupt(uint32_t channelBitMask)
Definition: UDMALPF3.h:235
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale