MSPM0G1X0X_G3X0X TI-Driver Library  2.01.00.03
DMAMSPM0.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023, 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  */
32 /*!****************************************************************************
33  * @file DMAMSPM0.h
34  *
35  * @brief DMA driver implementation for MSPM0.
36  *
37  * @defgroup DMA Direct Memory Access (DMA)
38  *
39  * The DMA header file should be included in an application as follows:
40  * @code
41  * #include <ti/drivers/dma/DMAMSPM0.h>
42  * @endcode
43  *
44  * @anchor ti_drivers_DMA_Overview
45  * # Overview
46  *
47  * This driver is intended for use only by drivers that use the DMA
48  * peripheral (e.g., SPI). This driver is mainly used for management of
49  * the control table base address of the DMA peripheral.
50  *
51  * The application should set up the DMAMSPM0_HWAttrs and DMAMSPM0_Config structures.
52  *
53  * The DMAMSPM0 header file should be included in an application as follows:
54  * @code
55  * #include <ti/drivers/dma/DMAMSPM0.h>
56  * @endcode
57  *
58  ******************************************************************************
59  */
63 /* clang-format off */
64 #ifndef ti_drivers_dma_DMAMSPM0__include
65 #define ti_drivers_dma_DMAMSPM0__include
66 
67 #include <stdbool.h>
68 #include <stdint.h>
69 
70 #include <ti/driverlib/dl_dma.h>
71 #include <ti/drivers/dpl/HwiP.h>
72 
73 #ifdef __cplusplus
74 extern "C" {
75 #endif
76 
84 #define NUM_DMA_CHANNELS (DMA_SYS_N_DMA_CHANNEL)
85 
89 typedef void (*DMAMSPM0_IsrFxn)(uintptr_t arg);
90 
124 typedef struct
125 {
127  uint8_t intPriority;
130 
131 
132 
141 typedef struct
142 {
143  uint8_t txTrigger;
144  uint8_t rxTrigger;
145  DL_DMA_TRIGGER_TYPE txTriggerType;
146  DL_DMA_TRIGGER_TYPE rxTriggerType;
147  DL_DMA_TRANSFER_MODE transferMode;
148  DL_DMA_EXTENDED_MODE extendedMode;
149  DL_DMA_WIDTH srcWidth;
150  DL_DMA_WIDTH destWidth;
151  DL_DMA_INCREMENT srcIncrement;
152  DL_DMA_INCREMENT destIncrement;
154  uint8_t dmaChannel;
157  uint32_t noOfData;
161 
167 typedef struct
168 {
181 typedef struct
182 {
183  void const *hwAttrs;
184  void *object;
185 } DMAMSPM0_Cfg;
186 
190 extern const DMAMSPM0_Cfg DMAMSPM0_Config[];
191 
195 extern const uint_least8_t DMA_Count;
196 
201 
217 extern void DMAMSPM0_close(DMA_Regs *handle, uint8_t channelNum);
228 extern bool DMAMSPM0_init(void);
229 
244 extern DMAMSPM0_Handle DMAMSPM0_open(uint_least8_t index, uint8_t channelNum);
245 
259 bool DMAMSPM0_setupTransfer(DMAMSPM0_Transfer *transfer, DL_DMA_Config* DMACfg);
276 DMAMSPM0_Handle DMA_Init(DMAMSPM0_Transfer* dmaParams, DL_DMA_Config* DMACfg, uint8_t noOfChs);
277 
291 void DMAMSPM0_disableChannel(DMAMSPM0_Handle handle, uint8_t dmaChannel);
292 
305 uint16_t DMAMSPM0_getCurrTransferSize(uint8_t dmaChannel);
306 
319 void DMA_Params_init(DMAMSPM0_Transfer *params);
320 
335 void DMAMSPM0_copyDMAParams(DMAMSPM0_Transfer* dmaParams, DL_DMA_Config* dmaConfig);
336 
337 #ifdef __cplusplus
338 }
339 #endif
340 
341 #endif /* ti_drivers_dma_DMAMSPM0__include */
342 /* clang-format on */
DMAMSPM0 channel based Transfer configuration.
Definition: DMAMSPM0.h:141
DMAMSPM0 Hardware attributes.
Definition: DMAMSPM0.h:124
uint8_t dmaChannel
Definition: DMAMSPM0.h:154
DMAMSPM0_IsrFxn dmaChIsrFxn
Definition: DMAMSPM0.h:158
DL_DMA_TRIGGER_TYPE txTriggerType
Definition: DMAMSPM0.h:145
void * dmaTransferSource
Definition: DMAMSPM0.h:155
uint16_t DMAMSPM0_getCurrTransferSize(uint8_t dmaChannel)
This function will return the DMA transfer size in bytes for given channel.
DMAMSPM0_Handle DMAMSPM0_open(uint_least8_t index, uint8_t channelNum)
Function to initialize the MSPM0 DMA peripheral and corresponding interrupt.
uint32_t noOfData
Definition: DMAMSPM0.h:157
DMAMSPM0 object.
Definition: DMAMSPM0.h:167
bool DMAMSPM0_init(void)
Function to initialize the MSPM0 DMA driver.
DMAMSPM0_Handle DMA_Init(DMAMSPM0_Transfer *dmaParams, DL_DMA_Config *DMACfg, uint8_t noOfChs)
One Function that initialize DMA by calling all needed functions in sequence. User may call this func...
DMAMSPM0 Global configuration.
Definition: DMAMSPM0.h:181
DL_DMA_WIDTH srcWidth
Definition: DMAMSPM0.h:149
void const * hwAttrs
Definition: DMAMSPM0.h:183
DL_DMA_TRANSFER_MODE transferMode
Definition: DMAMSPM0.h:147
bool enableDMAISR
Definition: DMAMSPM0.h:159
uint8_t rxTrigger
Definition: DMAMSPM0.h:144
uint8_t intPriority
Definition: DMAMSPM0.h:127
const DMAMSPM0_Cfg DMAMSPM0_Config[]
Instance of a DMA Config structure.
void * dmaTransferDestination
Definition: DMAMSPM0.h:156
void DMAMSPM0_copyDMAParams(DMAMSPM0_Transfer *dmaParams, DL_DMA_Config *dmaConfig)
This function will extract parameters from DMA Config struct to DMA Transfer struct.
void DMA_Params_init(DMAMSPM0_Transfer *params)
This function will initialize the default params.
void(* DMAMSPM0_IsrFxn)(uintptr_t arg)
DMA error function pointers.
Definition: DMAMSPM0.h:89
DL_DMA_TRIGGER_TYPE rxTriggerType
Definition: DMAMSPM0.h:146
const uint_least8_t DMA_Count
Number of DMA channels.
DL_DMA_WIDTH destWidth
Definition: DMAMSPM0.h:150
DL_DMA_INCREMENT srcIncrement
Definition: DMAMSPM0.h:151
uint8_t txTrigger
Definition: DMAMSPM0.h:143
bool DMAMSPM0_setupTransfer(DMAMSPM0_Transfer *transfer, DL_DMA_Config *DMACfg)
Function to set up a DMA channel for data transfer.
void DMAMSPM0_disableChannel(DMAMSPM0_Handle handle, uint8_t dmaChannel)
This function will disable the channel and related flags.
bool roundRobinPriority
Definition: DMAMSPM0.h:128
void * object
Definition: DMAMSPM0.h:184
DL_DMA_INCREMENT destIncrement
Definition: DMAMSPM0.h:152
void DMAMSPM0_close(DMA_Regs *handle, uint8_t channelNum)
Function to close the DMA channel.
DMAMSPM0_IsrFxn dmaIsrFxn
Definition: DMAMSPM0.h:126
DMAMSPM0_Transfer dmaTransfer
Definition: DMAMSPM0.h:170
DL_DMA_EXTENDED_MODE extendedMode
Definition: DMAMSPM0.h:148
DMAMSPM0_Cfg * DMAMSPM0_Handle
A handle that is returned from a DMAMSPM0_open() call.
Definition: DMAMSPM0.h:200
© Copyright 1995-2024, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale