1*5fd0122aSMatthias Ringwald /* --COPYRIGHT--,BSD 2*5fd0122aSMatthias Ringwald * Copyright (c) 2017, Texas Instruments Incorporated 3*5fd0122aSMatthias Ringwald * All rights reserved. 4*5fd0122aSMatthias Ringwald * 5*5fd0122aSMatthias Ringwald * Redistribution and use in source and binary forms, with or without 6*5fd0122aSMatthias Ringwald * modification, are permitted provided that the following conditions 7*5fd0122aSMatthias Ringwald * are met: 8*5fd0122aSMatthias Ringwald * 9*5fd0122aSMatthias Ringwald * * Redistributions of source code must retain the above copyright 10*5fd0122aSMatthias Ringwald * notice, this list of conditions and the following disclaimer. 11*5fd0122aSMatthias Ringwald * 12*5fd0122aSMatthias Ringwald * * Redistributions in binary form must reproduce the above copyright 13*5fd0122aSMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 14*5fd0122aSMatthias Ringwald * documentation and/or other materials provided with the distribution. 15*5fd0122aSMatthias Ringwald * 16*5fd0122aSMatthias Ringwald * * Neither the name of Texas Instruments Incorporated nor the names of 17*5fd0122aSMatthias Ringwald * its contributors may be used to endorse or promote products derived 18*5fd0122aSMatthias Ringwald * from this software without specific prior written permission. 19*5fd0122aSMatthias Ringwald * 20*5fd0122aSMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21*5fd0122aSMatthias Ringwald * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22*5fd0122aSMatthias Ringwald * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23*5fd0122aSMatthias Ringwald * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 24*5fd0122aSMatthias Ringwald * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25*5fd0122aSMatthias Ringwald * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26*5fd0122aSMatthias Ringwald * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 27*5fd0122aSMatthias Ringwald * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28*5fd0122aSMatthias Ringwald * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 29*5fd0122aSMatthias Ringwald * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 30*5fd0122aSMatthias Ringwald * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*5fd0122aSMatthias Ringwald * --/COPYRIGHT--*/ 32*5fd0122aSMatthias Ringwald #ifndef __DMA_H__ 33*5fd0122aSMatthias Ringwald #define __DMA_H__ 34*5fd0122aSMatthias Ringwald 35*5fd0122aSMatthias Ringwald //***************************************************************************** 36*5fd0122aSMatthias Ringwald // 37*5fd0122aSMatthias Ringwald //! \addtogroup dma_api 38*5fd0122aSMatthias Ringwald //! @{ 39*5fd0122aSMatthias Ringwald // 40*5fd0122aSMatthias Ringwald //***************************************************************************** 41*5fd0122aSMatthias Ringwald 42*5fd0122aSMatthias Ringwald //***************************************************************************** 43*5fd0122aSMatthias Ringwald // 44*5fd0122aSMatthias Ringwald // If building with a C++ compiler, make all of the definitions in this header 45*5fd0122aSMatthias Ringwald // have a C binding. 46*5fd0122aSMatthias Ringwald // 47*5fd0122aSMatthias Ringwald //***************************************************************************** 48*5fd0122aSMatthias Ringwald #ifdef __cplusplus 49*5fd0122aSMatthias Ringwald extern "C" 50*5fd0122aSMatthias Ringwald { 51*5fd0122aSMatthias Ringwald #endif 52*5fd0122aSMatthias Ringwald 53*5fd0122aSMatthias Ringwald #include <stdbool.h> 54*5fd0122aSMatthias Ringwald #include <ti/devices/msp432p4xx/inc/msp.h> 55*5fd0122aSMatthias Ringwald #include <ti/devices/msp432p4xx/driverlib/interrupt.h> 56*5fd0122aSMatthias Ringwald 57*5fd0122aSMatthias Ringwald //***************************************************************************** 58*5fd0122aSMatthias Ringwald // 59*5fd0122aSMatthias Ringwald // A structure that defines an entry in the channel control table. These 60*5fd0122aSMatthias Ringwald // fields are used by the DMA controller and normally it is not necessary for 61*5fd0122aSMatthias Ringwald // software to directly read or write fields in the table. 62*5fd0122aSMatthias Ringwald // 63*5fd0122aSMatthias Ringwald //***************************************************************************** 64*5fd0122aSMatthias Ringwald typedef struct _DMA_ControlTable 65*5fd0122aSMatthias Ringwald { 66*5fd0122aSMatthias Ringwald // 67*5fd0122aSMatthias Ringwald // The ending source address of the data transfer. 68*5fd0122aSMatthias Ringwald // 69*5fd0122aSMatthias Ringwald volatile void *srcEndAddr; 70*5fd0122aSMatthias Ringwald 71*5fd0122aSMatthias Ringwald // 72*5fd0122aSMatthias Ringwald // The ending destination address of the data transfer. 73*5fd0122aSMatthias Ringwald // 74*5fd0122aSMatthias Ringwald volatile void *dstEndAddr; 75*5fd0122aSMatthias Ringwald 76*5fd0122aSMatthias Ringwald // 77*5fd0122aSMatthias Ringwald // The channel control mode. 78*5fd0122aSMatthias Ringwald // 79*5fd0122aSMatthias Ringwald volatile uint32_t control; 80*5fd0122aSMatthias Ringwald 81*5fd0122aSMatthias Ringwald // 82*5fd0122aSMatthias Ringwald // An unused location. 83*5fd0122aSMatthias Ringwald // 84*5fd0122aSMatthias Ringwald volatile uint32_t spare; 85*5fd0122aSMatthias Ringwald } DMA_ControlTable; 86*5fd0122aSMatthias Ringwald 87*5fd0122aSMatthias Ringwald //***************************************************************************** 88*5fd0122aSMatthias Ringwald // 89*5fd0122aSMatthias Ringwald //! A helper macro for building scatter-gather task table entries. 90*5fd0122aSMatthias Ringwald //! 91*5fd0122aSMatthias Ringwald //! This macro is intended to be used to help populate a table of DMA tasks 92*5fd0122aSMatthias Ringwald //! for a scatter-gather transfer. This macro will calculate the values for 93*5fd0122aSMatthias Ringwald //! the fields of a task structure entry based on the input parameters. 94*5fd0122aSMatthias Ringwald //! 95*5fd0122aSMatthias Ringwald //! There are specific requirements for the values of each parameter. No 96*5fd0122aSMatthias Ringwald //! checking is done so it is up to the caller to ensure that correct values 97*5fd0122aSMatthias Ringwald //! are used for the parameters. 98*5fd0122aSMatthias Ringwald //! 99*5fd0122aSMatthias Ringwald //! The \b transferCount parameter is the number of items that will be 100*5fd0122aSMatthias Ringwald //! transferred by this task. It must be in the range 1-1024. 101*5fd0122aSMatthias Ringwald //! 102*5fd0122aSMatthias Ringwald //! The \b itemSize parameter is the bit size of the transfer data. It must 103*5fd0122aSMatthias Ringwald //! be one of \b UDMA_SIZE_8, \b UDMA_SIZE_16, or \b UDMA_SIZE_32. 104*5fd0122aSMatthias Ringwald //! 105*5fd0122aSMatthias Ringwald //! The \e srcIncrement parameter is the increment size for the source data. 106*5fd0122aSMatthias Ringwald //! It must be one of \b UDMA_SRC_INC_8, \b UDMA_SRC_INC_16, 107*5fd0122aSMatthias Ringwald //! \b UDMA_SRC_INC_32, or \b UDMA_SRC_INC_NONE. 108*5fd0122aSMatthias Ringwald //! 109*5fd0122aSMatthias Ringwald //! The \b srcAddr parameter is a void pointer to the beginning of the source 110*5fd0122aSMatthias Ringwald //! data. 111*5fd0122aSMatthias Ringwald //! 112*5fd0122aSMatthias Ringwald //! The \b dstIncrement parameter is the increment size for the destination 113*5fd0122aSMatthias Ringwald //! data. It must be one of \b UDMA_DST_INC_8, \b UDMA_DST_INC_16, 114*5fd0122aSMatthias Ringwald //! \b UDMA_DST_INC_32, or \b UDMA_DST_INC_NONE. 115*5fd0122aSMatthias Ringwald //! 116*5fd0122aSMatthias Ringwald //! The \b dstAddr parameter is a void pointer to the beginning of the 117*5fd0122aSMatthias Ringwald //! location where the data will be transferred. 118*5fd0122aSMatthias Ringwald //! 119*5fd0122aSMatthias Ringwald //! The \b arbSize parameter is the arbitration size for the transfer, and 120*5fd0122aSMatthias Ringwald //! must be one of \b UDMA_ARB_1, \b UDMA_ARB_2, \b UDMA_ARB_4, and so on 121*5fd0122aSMatthias Ringwald //! up to \b UDMA_ARB_1024. This is used to select the arbitration size in 122*5fd0122aSMatthias Ringwald //! powers of 2, from 1 to 1024. 123*5fd0122aSMatthias Ringwald //! 124*5fd0122aSMatthias Ringwald //! The \e mode parameter is the mode to use for this transfer task. It 125*5fd0122aSMatthias Ringwald //! must be one of \b UDMA_MODE_BASIC, \b UDMA_MODE_AUTO, 126*5fd0122aSMatthias Ringwald //! \b UDMA_MODE_MEM_SCATTER_GATHER, or \b UDMA_MODE_PER_SCATTER_GATHER. Note 127*5fd0122aSMatthias Ringwald //! that normally all tasks will be one of the scatter-gather modes while the 128*5fd0122aSMatthias Ringwald //! last task is a task list will be AUTO or BASIC. 129*5fd0122aSMatthias Ringwald //! 130*5fd0122aSMatthias Ringwald //! This macro is intended to be used to initialize individual entries of 131*5fd0122aSMatthias Ringwald //! a structure of DMA_ControlTable type, like this: 132*5fd0122aSMatthias Ringwald //! 133*5fd0122aSMatthias Ringwald //! \code{.c} 134*5fd0122aSMatthias Ringwald //! DMA_ControlTable MyTaskList[] = 135*5fd0122aSMatthias Ringwald //! { 136*5fd0122aSMatthias Ringwald //! DMA_TaskStructEntry(Task1Count, UDMA_SIZE_8, 137*5fd0122aSMatthias Ringwald //! UDMA_SRC_INC_8, MySourceBuf, 138*5fd0122aSMatthias Ringwald //! UDMA_DST_INC_8, MyDestBuf, 139*5fd0122aSMatthias Ringwald //! UDMA_ARB_8, UDMA_MODE_MEM_SCATTER_GATHER), 140*5fd0122aSMatthias Ringwald //! DMA_TaskStructEntry(Task2Count, ... ), 141*5fd0122aSMatthias Ringwald //! } 142*5fd0122aSMatthias Ringwald //! \endcode 143*5fd0122aSMatthias Ringwald //! 144*5fd0122aSMatthias Ringwald //! \param transferCount is the count of items to transfer for this task. 145*5fd0122aSMatthias Ringwald //! \param itemSize is the bit size of the items to transfer for this task. 146*5fd0122aSMatthias Ringwald //! \param srcIncrement is the bit size increment for source data. 147*5fd0122aSMatthias Ringwald //! \param srcAddr is the starting address of the data to transfer. 148*5fd0122aSMatthias Ringwald //! \param dstIncrement is the bit size increment for destination data. 149*5fd0122aSMatthias Ringwald //! \param dstAddr is the starting address of the destination data. 150*5fd0122aSMatthias Ringwald //! \param arbSize is the arbitration size to use for the transfer task. 151*5fd0122aSMatthias Ringwald //! \param mode is the transfer mode for this task. 152*5fd0122aSMatthias Ringwald //! 153*5fd0122aSMatthias Ringwald //! \return Nothing; this is not a function. 154*5fd0122aSMatthias Ringwald // 155*5fd0122aSMatthias Ringwald //***************************************************************************** 156*5fd0122aSMatthias Ringwald #define DMA_TaskStructEntry(transferCount, \ 157*5fd0122aSMatthias Ringwald itemSize, \ 158*5fd0122aSMatthias Ringwald srcIncrement, \ 159*5fd0122aSMatthias Ringwald srcAddr, \ 160*5fd0122aSMatthias Ringwald dstIncrement, \ 161*5fd0122aSMatthias Ringwald dstAddr, \ 162*5fd0122aSMatthias Ringwald arbSize, \ 163*5fd0122aSMatthias Ringwald mode) \ 164*5fd0122aSMatthias Ringwald { \ 165*5fd0122aSMatthias Ringwald (((srcIncrement) == UDMA_SRC_INC_NONE) ? (void *)(srcAddr) : \ 166*5fd0122aSMatthias Ringwald ((void *)(&((uint8_t *)(srcAddr))[((transferCount - 1) << \ 167*5fd0122aSMatthias Ringwald ((srcIncrement) >> 26))]))), \ 168*5fd0122aSMatthias Ringwald (((dstIncrement) == UDMA_DST_INC_NONE) ? (void *)(dstAddr) : \ 169*5fd0122aSMatthias Ringwald ((void *)(&((uint8_t *)(dstAddr))[((transferCount - 1) << \ 170*5fd0122aSMatthias Ringwald ((dstIncrement) >> 30))]))), \ 171*5fd0122aSMatthias Ringwald (srcIncrement) | (dstIncrement) | (itemSize) | (arbSize) | \ 172*5fd0122aSMatthias Ringwald (((transferCount) - 1) << 4) | \ 173*5fd0122aSMatthias Ringwald ((((mode) == UDMA_MODE_MEM_SCATTER_GATHER) || \ 174*5fd0122aSMatthias Ringwald ((mode) == UDMA_MODE_PER_SCATTER_GATHER)) ? \ 175*5fd0122aSMatthias Ringwald (mode) | UDMA_MODE_ALT_SELECT : (mode)), 0 \ 176*5fd0122aSMatthias Ringwald } 177*5fd0122aSMatthias Ringwald 178*5fd0122aSMatthias Ringwald //***************************************************************************** 179*5fd0122aSMatthias Ringwald // 180*5fd0122aSMatthias Ringwald // Flags that can be passed to DMA_enableChannelAttribute(), 181*5fd0122aSMatthias Ringwald // DMA_disableChannelAttribute(), and returned from DMA_getChannelAttribute(). 182*5fd0122aSMatthias Ringwald // 183*5fd0122aSMatthias Ringwald //***************************************************************************** 184*5fd0122aSMatthias Ringwald #define UDMA_ATTR_USEBURST 0x00000001 185*5fd0122aSMatthias Ringwald #define UDMA_ATTR_ALTSELECT 0x00000002 186*5fd0122aSMatthias Ringwald #define UDMA_ATTR_HIGH_PRIORITY 0x00000004 187*5fd0122aSMatthias Ringwald #define UDMA_ATTR_REQMASK 0x00000008 188*5fd0122aSMatthias Ringwald #define UDMA_ATTR_ALL 0x0000000F 189*5fd0122aSMatthias Ringwald 190*5fd0122aSMatthias Ringwald //***************************************************************************** 191*5fd0122aSMatthias Ringwald // 192*5fd0122aSMatthias Ringwald // DMA control modes that can be passed to DMAModeSet() and returned 193*5fd0122aSMatthias Ringwald // DMAModeGet(). 194*5fd0122aSMatthias Ringwald // 195*5fd0122aSMatthias Ringwald //***************************************************************************** 196*5fd0122aSMatthias Ringwald #define UDMA_MODE_STOP 0x00000000 197*5fd0122aSMatthias Ringwald #define UDMA_MODE_BASIC 0x00000001 198*5fd0122aSMatthias Ringwald #define UDMA_MODE_AUTO 0x00000002 199*5fd0122aSMatthias Ringwald #define UDMA_MODE_PINGPONG 0x00000003 200*5fd0122aSMatthias Ringwald #define UDMA_MODE_MEM_SCATTER_GATHER \ 201*5fd0122aSMatthias Ringwald 0x00000004 202*5fd0122aSMatthias Ringwald #define UDMA_MODE_PER_SCATTER_GATHER \ 203*5fd0122aSMatthias Ringwald 0x00000006 204*5fd0122aSMatthias Ringwald #define UDMA_MODE_ALT_SELECT 0x00000001 205*5fd0122aSMatthias Ringwald 206*5fd0122aSMatthias Ringwald //***************************************************************************** 207*5fd0122aSMatthias Ringwald // 208*5fd0122aSMatthias Ringwald // Channel configuration values that can be passed to DMAControlSet(). 209*5fd0122aSMatthias Ringwald // 210*5fd0122aSMatthias Ringwald //***************************************************************************** 211*5fd0122aSMatthias Ringwald #define UDMA_DST_INC_8 0x00000000 212*5fd0122aSMatthias Ringwald #define UDMA_DST_INC_16 0x40000000 213*5fd0122aSMatthias Ringwald #define UDMA_DST_INC_32 0x80000000 214*5fd0122aSMatthias Ringwald #define UDMA_DST_INC_NONE 0xc0000000 215*5fd0122aSMatthias Ringwald #define UDMA_SRC_INC_8 0x00000000 216*5fd0122aSMatthias Ringwald #define UDMA_SRC_INC_16 0x04000000 217*5fd0122aSMatthias Ringwald #define UDMA_SRC_INC_32 0x08000000 218*5fd0122aSMatthias Ringwald #define UDMA_SRC_INC_NONE 0x0c000000 219*5fd0122aSMatthias Ringwald #define UDMA_SIZE_8 0x00000000 220*5fd0122aSMatthias Ringwald #define UDMA_SIZE_16 0x11000000 221*5fd0122aSMatthias Ringwald #define UDMA_SIZE_32 0x22000000 222*5fd0122aSMatthias Ringwald #define UDMA_DST_PROT_PRIV 0x00200000 223*5fd0122aSMatthias Ringwald #define UDMA_SRC_PROT_PRIV 0x00040000 224*5fd0122aSMatthias Ringwald #define UDMA_ARB_1 0x00000000 225*5fd0122aSMatthias Ringwald #define UDMA_ARB_2 0x00004000 226*5fd0122aSMatthias Ringwald #define UDMA_ARB_4 0x00008000 227*5fd0122aSMatthias Ringwald #define UDMA_ARB_8 0x0000c000 228*5fd0122aSMatthias Ringwald #define UDMA_ARB_16 0x00010000 229*5fd0122aSMatthias Ringwald #define UDMA_ARB_32 0x00014000 230*5fd0122aSMatthias Ringwald #define UDMA_ARB_64 0x00018000 231*5fd0122aSMatthias Ringwald #define UDMA_ARB_128 0x0001c000 232*5fd0122aSMatthias Ringwald #define UDMA_ARB_256 0x00020000 233*5fd0122aSMatthias Ringwald #define UDMA_ARB_512 0x00024000 234*5fd0122aSMatthias Ringwald #define UDMA_ARB_1024 0x00028000 235*5fd0122aSMatthias Ringwald #define UDMA_NEXT_USEBURST 0x00000008 236*5fd0122aSMatthias Ringwald 237*5fd0122aSMatthias Ringwald //***************************************************************************** 238*5fd0122aSMatthias Ringwald // 239*5fd0122aSMatthias Ringwald // Flags to be OR'd with the channel ID to indicate if the primary or alternate 240*5fd0122aSMatthias Ringwald // control structure should be used. 241*5fd0122aSMatthias Ringwald // 242*5fd0122aSMatthias Ringwald //***************************************************************************** 243*5fd0122aSMatthias Ringwald #define UDMA_PRI_SELECT 0x00000000 244*5fd0122aSMatthias Ringwald #define UDMA_ALT_SELECT 0x00000008 245*5fd0122aSMatthias Ringwald 246*5fd0122aSMatthias Ringwald //***************************************************************************** 247*5fd0122aSMatthias Ringwald // 248*5fd0122aSMatthias Ringwald // Values that can be passed to DMA_assignChannel() to select peripheral 249*5fd0122aSMatthias Ringwald // mapping for each channel. The channels named RESERVED may be assigned 250*5fd0122aSMatthias Ringwald // to a peripheral in future parts. 251*5fd0122aSMatthias Ringwald // 252*5fd0122aSMatthias Ringwald //***************************************************************************** 253*5fd0122aSMatthias Ringwald // 254*5fd0122aSMatthias Ringwald // Channel 0 255*5fd0122aSMatthias Ringwald // 256*5fd0122aSMatthias Ringwald #define DMA_CH0_RESERVED0 0x00000000 257*5fd0122aSMatthias Ringwald #define DMA_CH0_EUSCIA0TX 0x01000000 258*5fd0122aSMatthias Ringwald #define DMA_CH0_EUSCIB0TX0 0x02000000 259*5fd0122aSMatthias Ringwald #define DMA_CH0_EUSCIB3TX1 0x03000000 260*5fd0122aSMatthias Ringwald #define DMA_CH0_EUSCIB2TX2 0x04000000 261*5fd0122aSMatthias Ringwald #define DMA_CH0_EUSCIB1TX3 0x05000000 262*5fd0122aSMatthias Ringwald #define DMA_CH0_TIMERA0CCR0 0x06000000 263*5fd0122aSMatthias Ringwald #define DMA_CH0_AESTRIGGER0 0x07000000 264*5fd0122aSMatthias Ringwald 265*5fd0122aSMatthias Ringwald // 266*5fd0122aSMatthias Ringwald // Channel 1 267*5fd0122aSMatthias Ringwald // 268*5fd0122aSMatthias Ringwald #define DMA_CH1_RESERVED0 0x00000001 269*5fd0122aSMatthias Ringwald #define DMA_CH1_EUSCIA0RX 0x01000001 270*5fd0122aSMatthias Ringwald #define DMA_CH1_EUSCIB0RX0 0x02000001 271*5fd0122aSMatthias Ringwald #define DMA_CH1_EUSCIB3RX1 0x03000001 272*5fd0122aSMatthias Ringwald #define DMA_CH1_EUSCIB2RX2 0x04000001 273*5fd0122aSMatthias Ringwald #define DMA_CH1_EUSCIB1RX3 0x05000001 274*5fd0122aSMatthias Ringwald #define DMA_CH1_TIMERA0CCR2 0x06000001 275*5fd0122aSMatthias Ringwald #define DMA_CH1_AESTRIGGER1 0x07000001 276*5fd0122aSMatthias Ringwald 277*5fd0122aSMatthias Ringwald // 278*5fd0122aSMatthias Ringwald // Channel 2 279*5fd0122aSMatthias Ringwald // 280*5fd0122aSMatthias Ringwald #define DMA_CH2_RESERVED0 0x00000002 281*5fd0122aSMatthias Ringwald #define DMA_CH2_EUSCIA1TX 0x01000002 282*5fd0122aSMatthias Ringwald #define DMA_CH2_EUSCIB1TX0 0x02000002 283*5fd0122aSMatthias Ringwald #define DMA_CH2_EUSCIB0TX1 0x03000002 284*5fd0122aSMatthias Ringwald #define DMA_CH2_EUSCIB3TX2 0x04000002 285*5fd0122aSMatthias Ringwald #define DMA_CH2_EUSCIB2TX3 0x05000002 286*5fd0122aSMatthias Ringwald #define DMA_CH2_TIMERA1CCR0 0x06000002 287*5fd0122aSMatthias Ringwald #define DMA_CH2_AESTRIGGER2 0x07000002 288*5fd0122aSMatthias Ringwald 289*5fd0122aSMatthias Ringwald // 290*5fd0122aSMatthias Ringwald // Channel 3 291*5fd0122aSMatthias Ringwald // 292*5fd0122aSMatthias Ringwald #define DMA_CH3_RESERVED0 0x00000003 293*5fd0122aSMatthias Ringwald #define DMA_CH3_EUSCIA1RX 0x01000003 294*5fd0122aSMatthias Ringwald #define DMA_CH3_EUSCIB1RX0 0x02000003 295*5fd0122aSMatthias Ringwald #define DMA_CH3_EUSCIB0RX1 0x03000003 296*5fd0122aSMatthias Ringwald #define DMA_CH3_EUSCIB3RX2 0x04000003 297*5fd0122aSMatthias Ringwald #define DMA_CH3_EUSCIB2RX3 0x05000003 298*5fd0122aSMatthias Ringwald #define DMA_CH3_TIMERA1CCR2 0x06000003 299*5fd0122aSMatthias Ringwald #define DMA_CH3_RESERVED1 0x07000003 300*5fd0122aSMatthias Ringwald 301*5fd0122aSMatthias Ringwald // 302*5fd0122aSMatthias Ringwald // Channel 4 303*5fd0122aSMatthias Ringwald // 304*5fd0122aSMatthias Ringwald #define DMA_CH4_RESERVED0 0x00000004 305*5fd0122aSMatthias Ringwald #define DMA_CH4_EUSCIA2TX 0x01000004 306*5fd0122aSMatthias Ringwald #define DMA_CH4_EUSCIB2TX0 0x02000004 307*5fd0122aSMatthias Ringwald #define DMA_CH4_EUSCIB1TX1 0x03000004 308*5fd0122aSMatthias Ringwald #define DMA_CH4_EUSCIB0TX2 0x04000004 309*5fd0122aSMatthias Ringwald #define DMA_CH4_EUSCIB3TX3 0x05000004 310*5fd0122aSMatthias Ringwald #define DMA_CH4_TIMERA2CCR0 0x06000004 311*5fd0122aSMatthias Ringwald #define DMA_CH4_RESERVED1 0x07000004 312*5fd0122aSMatthias Ringwald 313*5fd0122aSMatthias Ringwald // 314*5fd0122aSMatthias Ringwald // Channel 5 315*5fd0122aSMatthias Ringwald // 316*5fd0122aSMatthias Ringwald #define DMA_CH5_RESERVED0 0x00000005 317*5fd0122aSMatthias Ringwald #define DMA_CH5_EUSCIA2RX 0x01000005 318*5fd0122aSMatthias Ringwald #define DMA_CH5_EUSCIB2RX0 0x02000005 319*5fd0122aSMatthias Ringwald #define DMA_CH5_EUSCIB1RX1 0x03000005 320*5fd0122aSMatthias Ringwald #define DMA_CH5_EUSCIB0RX2 0x04000005 321*5fd0122aSMatthias Ringwald #define DMA_CH5_EUSCIB3RX3 0x05000005 322*5fd0122aSMatthias Ringwald #define DMA_CH5_TIMERA2CCR2 0x06000005 323*5fd0122aSMatthias Ringwald #define DMA_CH5_RESERVED1 0x07000005 324*5fd0122aSMatthias Ringwald 325*5fd0122aSMatthias Ringwald // 326*5fd0122aSMatthias Ringwald // Channel 6 327*5fd0122aSMatthias Ringwald // 328*5fd0122aSMatthias Ringwald #define DMA_CH6_RESERVED0 0x00000006 329*5fd0122aSMatthias Ringwald #define DMA_CH6_EUSCIA3TX 0x01000006 330*5fd0122aSMatthias Ringwald #define DMA_CH6_EUSCIB3TX0 0x02000006 331*5fd0122aSMatthias Ringwald #define DMA_CH6_EUSCIB2TX1 0x03000006 332*5fd0122aSMatthias Ringwald #define DMA_CH6_EUSCIB1TX2 0x04000006 333*5fd0122aSMatthias Ringwald #define DMA_CH6_EUSCIB0TX3 0x05000006 334*5fd0122aSMatthias Ringwald #define DMA_CH6_TIMERA3CCR0 0x06000006 335*5fd0122aSMatthias Ringwald #define DMA_CH6_EXTERNALPIN 0x07000006 336*5fd0122aSMatthias Ringwald 337*5fd0122aSMatthias Ringwald // 338*5fd0122aSMatthias Ringwald // Channel 7 339*5fd0122aSMatthias Ringwald // 340*5fd0122aSMatthias Ringwald #define DMA_CH7_RESERVED0 0x00000007 341*5fd0122aSMatthias Ringwald #define DMA_CH7_EUSCIA3RX 0x01000007 342*5fd0122aSMatthias Ringwald #define DMA_CH7_EUSCIB3RX0 0x02000007 343*5fd0122aSMatthias Ringwald #define DMA_CH7_EUSCIB2RX1 0x03000007 344*5fd0122aSMatthias Ringwald #define DMA_CH7_EUSCIB1RX2 0x04000007 345*5fd0122aSMatthias Ringwald #define DMA_CH7_EUSCIB0RX3 0x05000007 346*5fd0122aSMatthias Ringwald #define DMA_CH7_TIMERA3CCR2 0x06000007 347*5fd0122aSMatthias Ringwald #define DMA_CH7_ADC14 0x07000007 348*5fd0122aSMatthias Ringwald 349*5fd0122aSMatthias Ringwald // 350*5fd0122aSMatthias Ringwald // Different interrupt handlers to pass into DMA_registerInterrupt and 351*5fd0122aSMatthias Ringwald // DMA_unregisterInterrupt and other Int functions 352*5fd0122aSMatthias Ringwald // 353*5fd0122aSMatthias Ringwald #define DMA_INT0 INT_DMA_INT0 354*5fd0122aSMatthias Ringwald #define DMA_INT1 INT_DMA_INT1 355*5fd0122aSMatthias Ringwald #define DMA_INT2 INT_DMA_INT2 356*5fd0122aSMatthias Ringwald #define DMA_INT3 INT_DMA_INT3 357*5fd0122aSMatthias Ringwald #define DMA_INTERR INT_DMA_ERR 358*5fd0122aSMatthias Ringwald 359*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_0 0 360*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_1 1 361*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_2 2 362*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_3 3 363*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_4 4 364*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_5 5 365*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_6 6 366*5fd0122aSMatthias Ringwald #define DMA_CHANNEL_7 7 367*5fd0122aSMatthias Ringwald 368*5fd0122aSMatthias Ringwald //***************************************************************************** 369*5fd0122aSMatthias Ringwald // 370*5fd0122aSMatthias Ringwald // API Function prototypes 371*5fd0122aSMatthias Ringwald // 372*5fd0122aSMatthias Ringwald //***************************************************************************** 373*5fd0122aSMatthias Ringwald 374*5fd0122aSMatthias Ringwald //***************************************************************************** 375*5fd0122aSMatthias Ringwald // 376*5fd0122aSMatthias Ringwald //! Enables the DMA controller for use. 377*5fd0122aSMatthias Ringwald //! 378*5fd0122aSMatthias Ringwald //! This function enables the DMA controller. The DMA controller must be 379*5fd0122aSMatthias Ringwald //! enabled before it can be configured and used. 380*5fd0122aSMatthias Ringwald //! 381*5fd0122aSMatthias Ringwald //! \return None. 382*5fd0122aSMatthias Ringwald // 383*5fd0122aSMatthias Ringwald //***************************************************************************** 384*5fd0122aSMatthias Ringwald extern void DMA_enableModule(void); 385*5fd0122aSMatthias Ringwald 386*5fd0122aSMatthias Ringwald //***************************************************************************** 387*5fd0122aSMatthias Ringwald // 388*5fd0122aSMatthias Ringwald //! Disables the DMA controller for use. 389*5fd0122aSMatthias Ringwald //! 390*5fd0122aSMatthias Ringwald //! This function disables the DMA controller. Once disabled, the DMA 391*5fd0122aSMatthias Ringwald //! controller cannot operate until re-enabled with DMA_enableModule(). 392*5fd0122aSMatthias Ringwald //! 393*5fd0122aSMatthias Ringwald //! \return None. 394*5fd0122aSMatthias Ringwald // 395*5fd0122aSMatthias Ringwald //***************************************************************************** 396*5fd0122aSMatthias Ringwald extern void DMA_disableModule(void); 397*5fd0122aSMatthias Ringwald 398*5fd0122aSMatthias Ringwald //***************************************************************************** 399*5fd0122aSMatthias Ringwald // 400*5fd0122aSMatthias Ringwald //! Gets the DMA error status. 401*5fd0122aSMatthias Ringwald //! 402*5fd0122aSMatthias Ringwald //! This function returns the DMA error status. It should be called from 403*5fd0122aSMatthias Ringwald //! within the DMA error interrupt handler to determine if a DMA error 404*5fd0122aSMatthias Ringwald //! occurred. 405*5fd0122aSMatthias Ringwald //! 406*5fd0122aSMatthias Ringwald //! \return Returns non-zero if a DMA error is pending. 407*5fd0122aSMatthias Ringwald // 408*5fd0122aSMatthias Ringwald //***************************************************************************** 409*5fd0122aSMatthias Ringwald extern uint32_t DMA_getErrorStatus(void); 410*5fd0122aSMatthias Ringwald 411*5fd0122aSMatthias Ringwald //***************************************************************************** 412*5fd0122aSMatthias Ringwald // 413*5fd0122aSMatthias Ringwald //! Clears the DMA error interrupt. 414*5fd0122aSMatthias Ringwald //! 415*5fd0122aSMatthias Ringwald //! This function clears a pending DMA error interrupt. This function should 416*5fd0122aSMatthias Ringwald //! be called from within the DMA error interrupt handler to clear the 417*5fd0122aSMatthias Ringwald //! interrupt. 418*5fd0122aSMatthias Ringwald //! 419*5fd0122aSMatthias Ringwald //! \return None. 420*5fd0122aSMatthias Ringwald // 421*5fd0122aSMatthias Ringwald //***************************************************************************** 422*5fd0122aSMatthias Ringwald extern void DMA_clearErrorStatus(void); 423*5fd0122aSMatthias Ringwald 424*5fd0122aSMatthias Ringwald //***************************************************************************** 425*5fd0122aSMatthias Ringwald // 426*5fd0122aSMatthias Ringwald //! Enables a DMA channel for operation. 427*5fd0122aSMatthias Ringwald //! 428*5fd0122aSMatthias Ringwald //! \param channelNum is the channel number to enable. 429*5fd0122aSMatthias Ringwald //! 430*5fd0122aSMatthias Ringwald //! When a DMA transfer is completed, the channel is automatically disabled by 431*5fd0122aSMatthias Ringwald //! the DMA controller. Therefore, this function should be called prior to 432*5fd0122aSMatthias Ringwald //! starting up any new transfer. 433*5fd0122aSMatthias Ringwald //! 434*5fd0122aSMatthias Ringwald //! \return None. 435*5fd0122aSMatthias Ringwald // 436*5fd0122aSMatthias Ringwald //***************************************************************************** 437*5fd0122aSMatthias Ringwald extern void DMA_enableChannel(uint32_t channelNum); 438*5fd0122aSMatthias Ringwald 439*5fd0122aSMatthias Ringwald //***************************************************************************** 440*5fd0122aSMatthias Ringwald // 441*5fd0122aSMatthias Ringwald //! Disables a DMA channel for operation. 442*5fd0122aSMatthias Ringwald //! 443*5fd0122aSMatthias Ringwald //! \param channelNum is the channel number to disable. 444*5fd0122aSMatthias Ringwald //! 445*5fd0122aSMatthias Ringwald //! This function disables a specific DMA channel. Once disabled, a channel 446*5fd0122aSMatthias Ringwald //! cannot respond to DMA transfer requests until re-enabled via 447*5fd0122aSMatthias Ringwald //! DMA_enableChannel(). 448*5fd0122aSMatthias Ringwald //! 449*5fd0122aSMatthias Ringwald //! \return None. 450*5fd0122aSMatthias Ringwald // 451*5fd0122aSMatthias Ringwald //***************************************************************************** 452*5fd0122aSMatthias Ringwald extern void DMA_disableChannel(uint32_t channelNum); 453*5fd0122aSMatthias Ringwald 454*5fd0122aSMatthias Ringwald //***************************************************************************** 455*5fd0122aSMatthias Ringwald // 456*5fd0122aSMatthias Ringwald //! Checks if a DMA channel is enabled for operation. 457*5fd0122aSMatthias Ringwald //! 458*5fd0122aSMatthias Ringwald //! \param channelNum is the channel number to check. 459*5fd0122aSMatthias Ringwald //! 460*5fd0122aSMatthias Ringwald //! This function checks to see if a specific DMA channel is enabled. This 461*5fd0122aSMatthias Ringwald //! function can be used to check the status of a transfer, as the channel is 462*5fd0122aSMatthias Ringwald //! automatically disabled at the end of a transfer. 463*5fd0122aSMatthias Ringwald //! 464*5fd0122aSMatthias Ringwald //! \return Returns \b true if the channel is enabled, \b false if disabled. 465*5fd0122aSMatthias Ringwald // 466*5fd0122aSMatthias Ringwald //***************************************************************************** 467*5fd0122aSMatthias Ringwald extern bool DMA_isChannelEnabled(uint32_t channelNum); 468*5fd0122aSMatthias Ringwald 469*5fd0122aSMatthias Ringwald //***************************************************************************** 470*5fd0122aSMatthias Ringwald // 471*5fd0122aSMatthias Ringwald //! Sets the base address for the channel control table. 472*5fd0122aSMatthias Ringwald //! 473*5fd0122aSMatthias Ringwald //! \param controlTable is a pointer to the 1024-byte-aligned base address 474*5fd0122aSMatthias Ringwald //! of the DMA channel control table. 475*5fd0122aSMatthias Ringwald //! 476*5fd0122aSMatthias Ringwald //! This function configures the base address of the channel control table. 477*5fd0122aSMatthias Ringwald //! This table resides in system memory and holds control information for each 478*5fd0122aSMatthias Ringwald //! DMA channel. The table must be aligned on a 1024-byte boundary. The base 479*5fd0122aSMatthias Ringwald //! address must be configured before any of the channel functions can be used. 480*5fd0122aSMatthias Ringwald //! 481*5fd0122aSMatthias Ringwald //! The size of the channel control table depends on the number of DMA 482*5fd0122aSMatthias Ringwald //! channels and the transfer modes that are used. Refer to the introductory 483*5fd0122aSMatthias Ringwald //! text and the microcontroller datasheet for more information about the 484*5fd0122aSMatthias Ringwald //! channel control table. 485*5fd0122aSMatthias Ringwald //! 486*5fd0122aSMatthias Ringwald //! \return None. 487*5fd0122aSMatthias Ringwald // 488*5fd0122aSMatthias Ringwald //***************************************************************************** 489*5fd0122aSMatthias Ringwald extern void DMA_setControlBase(void *controlTable); 490*5fd0122aSMatthias Ringwald 491*5fd0122aSMatthias Ringwald //***************************************************************************** 492*5fd0122aSMatthias Ringwald // 493*5fd0122aSMatthias Ringwald //! Gets the base address for the channel control table. 494*5fd0122aSMatthias Ringwald //! 495*5fd0122aSMatthias Ringwald //! This function gets the base address of the channel control table. This 496*5fd0122aSMatthias Ringwald //! table resides in system memory and holds control information for each DMA 497*5fd0122aSMatthias Ringwald //! channel. 498*5fd0122aSMatthias Ringwald //! 499*5fd0122aSMatthias Ringwald //! \return Returns a pointer to the base address of the channel control table. 500*5fd0122aSMatthias Ringwald // 501*5fd0122aSMatthias Ringwald //***************************************************************************** 502*5fd0122aSMatthias Ringwald extern void* DMA_getControlBase(void); 503*5fd0122aSMatthias Ringwald 504*5fd0122aSMatthias Ringwald //***************************************************************************** 505*5fd0122aSMatthias Ringwald // 506*5fd0122aSMatthias Ringwald //! Gets the base address for the channel control table alternate structures. 507*5fd0122aSMatthias Ringwald //! 508*5fd0122aSMatthias Ringwald //! This function gets the base address of the second half of the channel 509*5fd0122aSMatthias Ringwald //! control table that holds the alternate control structures for each channel. 510*5fd0122aSMatthias Ringwald //! 511*5fd0122aSMatthias Ringwald //! \return Returns a pointer to the base address of the second half of the 512*5fd0122aSMatthias Ringwald //! channel control table. 513*5fd0122aSMatthias Ringwald // 514*5fd0122aSMatthias Ringwald //***************************************************************************** 515*5fd0122aSMatthias Ringwald extern void* DMA_getControlAlternateBase(void); 516*5fd0122aSMatthias Ringwald 517*5fd0122aSMatthias Ringwald //***************************************************************************** 518*5fd0122aSMatthias Ringwald // 519*5fd0122aSMatthias Ringwald //! Requests a DMA channel to start a transfer. 520*5fd0122aSMatthias Ringwald //! 521*5fd0122aSMatthias Ringwald //! \param channelNum is the channel number on which to request a DMA 522*5fd0122aSMatthias Ringwald //! transfer. 523*5fd0122aSMatthias Ringwald //! 524*5fd0122aSMatthias Ringwald //! This function allows software to request a DMA channel to begin a 525*5fd0122aSMatthias Ringwald //! transfer. This function could be used for performing a memory-to-memory 526*5fd0122aSMatthias Ringwald //! transfer, or if for some reason a transfer needs to be initiated by 527*5fd0122aSMatthias Ringwald //! software instead of the peripheral associated with that channel. 528*5fd0122aSMatthias Ringwald //! 529*5fd0122aSMatthias Ringwald //! \return None. 530*5fd0122aSMatthias Ringwald // 531*5fd0122aSMatthias Ringwald //***************************************************************************** 532*5fd0122aSMatthias Ringwald extern void DMA_requestChannel(uint32_t channelNum); 533*5fd0122aSMatthias Ringwald 534*5fd0122aSMatthias Ringwald //***************************************************************************** 535*5fd0122aSMatthias Ringwald // 536*5fd0122aSMatthias Ringwald //! Enables attributes of a DMA channel. 537*5fd0122aSMatthias Ringwald //! 538*5fd0122aSMatthias Ringwald //! \param channelNum is the channel to configure. 539*5fd0122aSMatthias Ringwald //! \param attr is a combination of attributes for the channel. 540*5fd0122aSMatthias Ringwald //! 541*5fd0122aSMatthias Ringwald //! This function is used to enable attributes of a DMA channel. 542*5fd0122aSMatthias Ringwald //! 543*5fd0122aSMatthias Ringwald //! The \e attr parameter is the logical OR of any of the following: 544*5fd0122aSMatthias Ringwald //! 545*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_USEBURST is used to restrict transfers to use only burst 546*5fd0122aSMatthias Ringwald //! mode. 547*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_ALTSELECT is used to select the alternate control structure 548*5fd0122aSMatthias Ringwald //! for this channel (it is very unlikely that this flag should be used). 549*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_HIGH_PRIORITY is used to set this channel to high priority. 550*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_REQMASK is used to mask the hardware request signal from the 551*5fd0122aSMatthias Ringwald //! peripheral for this channel. 552*5fd0122aSMatthias Ringwald //! 553*5fd0122aSMatthias Ringwald //! \return None. 554*5fd0122aSMatthias Ringwald // 555*5fd0122aSMatthias Ringwald //***************************************************************************** 556*5fd0122aSMatthias Ringwald extern void DMA_enableChannelAttribute(uint32_t channelNum, uint32_t attr); 557*5fd0122aSMatthias Ringwald 558*5fd0122aSMatthias Ringwald //***************************************************************************** 559*5fd0122aSMatthias Ringwald // 560*5fd0122aSMatthias Ringwald //! Disables attributes of a DMA channel. 561*5fd0122aSMatthias Ringwald //! 562*5fd0122aSMatthias Ringwald //! \param channelNum is the channel to configure. 563*5fd0122aSMatthias Ringwald //! \param attr is a combination of attributes for the channel. 564*5fd0122aSMatthias Ringwald //! 565*5fd0122aSMatthias Ringwald //! This function is used to disable attributes of a DMA channel. 566*5fd0122aSMatthias Ringwald //! 567*5fd0122aSMatthias Ringwald //! The \e attr parameter is the logical OR of any of the following: 568*5fd0122aSMatthias Ringwald //! 569*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_USEBURST is used to restrict transfers to use only burst 570*5fd0122aSMatthias Ringwald //! mode. 571*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_ALTSELECT is used to select the alternate control structure 572*5fd0122aSMatthias Ringwald //! for this channel. 573*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_HIGH_PRIORITY is used to set this channel to high priority. 574*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_REQMASK is used to mask the hardware request signal from the 575*5fd0122aSMatthias Ringwald //! peripheral for this channel. 576*5fd0122aSMatthias Ringwald //! 577*5fd0122aSMatthias Ringwald //! \return None. 578*5fd0122aSMatthias Ringwald // 579*5fd0122aSMatthias Ringwald //***************************************************************************** 580*5fd0122aSMatthias Ringwald extern void DMA_disableChannelAttribute(uint32_t channelNum, uint32_t attr); 581*5fd0122aSMatthias Ringwald 582*5fd0122aSMatthias Ringwald //***************************************************************************** 583*5fd0122aSMatthias Ringwald // 584*5fd0122aSMatthias Ringwald //! Gets the enabled attributes of a DMA channel. 585*5fd0122aSMatthias Ringwald //! 586*5fd0122aSMatthias Ringwald //! \param channelNum is the channel to configure. 587*5fd0122aSMatthias Ringwald //! 588*5fd0122aSMatthias Ringwald //! This function returns a combination of flags representing the attributes of 589*5fd0122aSMatthias Ringwald //! the DMA channel. 590*5fd0122aSMatthias Ringwald //! 591*5fd0122aSMatthias Ringwald //! \return Returns the logical OR of the attributes of the DMA channel, which 592*5fd0122aSMatthias Ringwald //! can be any of the following: 593*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_USEBURST is used to restrict transfers to use only burst 594*5fd0122aSMatthias Ringwald //! mode. 595*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_ALTSELECT is used to select the alternate control structure 596*5fd0122aSMatthias Ringwald //! for this channel. 597*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_HIGH_PRIORITY is used to set this channel to high priority. 598*5fd0122aSMatthias Ringwald //! - \b UDMA_ATTR_REQMASK is used to mask the hardware request signal from the 599*5fd0122aSMatthias Ringwald //! peripheral for this channel. 600*5fd0122aSMatthias Ringwald // 601*5fd0122aSMatthias Ringwald //***************************************************************************** 602*5fd0122aSMatthias Ringwald extern uint32_t DMA_getChannelAttribute(uint32_t channelNum); 603*5fd0122aSMatthias Ringwald 604*5fd0122aSMatthias Ringwald //***************************************************************************** 605*5fd0122aSMatthias Ringwald // 606*5fd0122aSMatthias Ringwald //! Sets the control parameters for a DMA channel control structure. 607*5fd0122aSMatthias Ringwald //! 608*5fd0122aSMatthias Ringwald //! \param channelStructIndex is the logical OR of the DMA channel number 609*5fd0122aSMatthias Ringwald //! with \b UDMA_PRI_SELECT or \b UDMA_ALT_SELECT. 610*5fd0122aSMatthias Ringwald //! \param control is logical OR of several control values to set the control 611*5fd0122aSMatthias Ringwald //! parameters for the channel. 612*5fd0122aSMatthias Ringwald //! 613*5fd0122aSMatthias Ringwald //! This function is used to set control parameters for a DMA transfer. These 614*5fd0122aSMatthias Ringwald //! parameters are typically not changed often. 615*5fd0122aSMatthias Ringwald //! 616*5fd0122aSMatthias Ringwald //! The \e channelStructIndex parameter should be the logical OR of the 617*5fd0122aSMatthias Ringwald //! channel number with one of \b UDMA_PRI_SELECT or \b UDMA_ALT_SELECT to 618*5fd0122aSMatthias Ringwald //! choose whether the primary or alternate data structure is used. 619*5fd0122aSMatthias Ringwald //! 620*5fd0122aSMatthias Ringwald //! The \e control parameter is the logical OR of five values: the data size, 621*5fd0122aSMatthias Ringwald //! the source address increment, the destination address increment, the 622*5fd0122aSMatthias Ringwald //! arbitration size, and the use burst flag. The choices available for each 623*5fd0122aSMatthias Ringwald //! of these values is described below. 624*5fd0122aSMatthias Ringwald //! 625*5fd0122aSMatthias Ringwald //! Choose the data size from one of \b UDMA_SIZE_8, \b UDMA_SIZE_16, or 626*5fd0122aSMatthias Ringwald //! \b UDMA_SIZE_32 to select a data size of 8, 16, or 32 bits. 627*5fd0122aSMatthias Ringwald //! 628*5fd0122aSMatthias Ringwald //! Choose the source address increment from one of \b UDMA_SRC_INC_8, 629*5fd0122aSMatthias Ringwald //! \b UDMA_SRC_INC_16, \b UDMA_SRC_INC_32, or \b UDMA_SRC_INC_NONE to select 630*5fd0122aSMatthias Ringwald //! an address increment of 8-bit bytes, 16-bit half-words, 32-bit words, or 631*5fd0122aSMatthias Ringwald //! to select non-incrementing. 632*5fd0122aSMatthias Ringwald //! 633*5fd0122aSMatthias Ringwald //! Choose the destination address increment from one of \b UDMA_DST_INC_8, 634*5fd0122aSMatthias Ringwald //! \b UDMA_DST_INC_16, \b UDMA_DST_INC_32, or \b UDMA_SRC_INC_8 to select 635*5fd0122aSMatthias Ringwald //! an address increment of 8-bit bytes, 16-bit half-words, 32-bit words, or 636*5fd0122aSMatthias Ringwald //! to select non-incrementing. 637*5fd0122aSMatthias Ringwald //! 638*5fd0122aSMatthias Ringwald //! The arbitration size determines how many items are transferred before 639*5fd0122aSMatthias Ringwald //! the DMA controller re-arbitrates for the bus. Choose the arbitration size 640*5fd0122aSMatthias Ringwald //! from one of \b UDMA_ARB_1, \b UDMA_ARB_2, \b UDMA_ARB_4, \b UDMA_ARB_8, 641*5fd0122aSMatthias Ringwald //! through \b UDMA_ARB_1024 to select the arbitration size from 1 to 1024 642*5fd0122aSMatthias Ringwald //! items, in powers of 2. 643*5fd0122aSMatthias Ringwald //! 644*5fd0122aSMatthias Ringwald //! The value \b UDMA_NEXT_USEBURST is used to force the channel to only 645*5fd0122aSMatthias Ringwald //! respond to burst requests at the tail end of a scatter-gather transfer. 646*5fd0122aSMatthias Ringwald //! 647*5fd0122aSMatthias Ringwald //! \note The address increment cannot be smaller than the data size. 648*5fd0122aSMatthias Ringwald //! 649*5fd0122aSMatthias Ringwald //! \return None. 650*5fd0122aSMatthias Ringwald // 651*5fd0122aSMatthias Ringwald //***************************************************************************** 652*5fd0122aSMatthias Ringwald extern void DMA_setChannelControl(uint32_t channelStructIndex, 653*5fd0122aSMatthias Ringwald uint32_t control); 654*5fd0122aSMatthias Ringwald 655*5fd0122aSMatthias Ringwald //***************************************************************************** 656*5fd0122aSMatthias Ringwald // 657*5fd0122aSMatthias Ringwald //! Sets the transfer parameters for a DMA channel control structure. 658*5fd0122aSMatthias Ringwald //! 659*5fd0122aSMatthias Ringwald //! \param channelStructIndex is the logical OR of the DMA channel number 660*5fd0122aSMatthias Ringwald //! with either \b UDMA_PRI_SELECT or \b UDMA_ALT_SELECT. 661*5fd0122aSMatthias Ringwald //! \param mode is the type of DMA transfer. 662*5fd0122aSMatthias Ringwald //! \param srcAddr is the source address for the transfer. 663*5fd0122aSMatthias Ringwald //! \param dstAddr is the destination address for the transfer. 664*5fd0122aSMatthias Ringwald //! \param transferSize is the number of data items to transfer. 665*5fd0122aSMatthias Ringwald //! 666*5fd0122aSMatthias Ringwald //! This function is used to configure the parameters for a DMA transfer. 667*5fd0122aSMatthias Ringwald //! These parameters are typically changed often. The function 668*5fd0122aSMatthias Ringwald //! DMA_setChannelControl() MUST be called at least once for this channel prior 669*5fd0122aSMatthias Ringwald //! to calling this function. 670*5fd0122aSMatthias Ringwald //! 671*5fd0122aSMatthias Ringwald //! The \e channelStructIndex parameter should be the logical OR of the 672*5fd0122aSMatthias Ringwald //! channel number with one of \b UDMA_PRI_SELECT or \b UDMA_ALT_SELECT to 673*5fd0122aSMatthias Ringwald //! choose whether the primary or alternate data structure is used. 674*5fd0122aSMatthias Ringwald //! 675*5fd0122aSMatthias Ringwald //! The \e mode parameter should be one of the following values: 676*5fd0122aSMatthias Ringwald //! 677*5fd0122aSMatthias Ringwald //! - \b UDMA_MODE_STOP stops the DMA transfer. The controller sets the mode 678*5fd0122aSMatthias Ringwald //! to this value at the end of a transfer. 679*5fd0122aSMatthias Ringwald //! - \b UDMA_MODE_BASIC to perform a basic transfer based on request. 680*5fd0122aSMatthias Ringwald //! - \b UDMA_MODE_AUTO to perform a transfer that always completes once 681*5fd0122aSMatthias Ringwald //! started even if the request is removed. 682*5fd0122aSMatthias Ringwald //! - \b UDMA_MODE_PINGPONG to set up a transfer that switches between the 683*5fd0122aSMatthias Ringwald //! primary and alternate control structures for the channel. This mode 684*5fd0122aSMatthias Ringwald //! allows use of ping-pong buffering for DMA transfers. 685*5fd0122aSMatthias Ringwald //! - \b UDMA_MODE_MEM_SCATTER_GATHER to set up a memory scatter-gather 686*5fd0122aSMatthias Ringwald //! transfer. 687*5fd0122aSMatthias Ringwald //! - \b UDMA_MODE_PER_SCATTER_GATHER to set up a peripheral scatter-gather 688*5fd0122aSMatthias Ringwald //! transfer. 689*5fd0122aSMatthias Ringwald //! 690*5fd0122aSMatthias Ringwald //! The \e srcAddr and \e dstAddr parameters are pointers to the first 691*5fd0122aSMatthias Ringwald //! location of the data to be transferred. These addresses should be aligned 692*5fd0122aSMatthias Ringwald //! according to the item size. The compiler takes care of this alignment if 693*5fd0122aSMatthias Ringwald //! the pointers are pointing to storage of the appropriate data type. 694*5fd0122aSMatthias Ringwald //! 695*5fd0122aSMatthias Ringwald //! The \e transferSize parameter is the number of data items, not the number 696*5fd0122aSMatthias Ringwald //! of bytes. 697*5fd0122aSMatthias Ringwald //! 698*5fd0122aSMatthias Ringwald //! The two scatter-gather modes, memory and peripheral, are actually different 699*5fd0122aSMatthias Ringwald //! depending on whether the primary or alternate control structure is 700*5fd0122aSMatthias Ringwald //! selected. This function looks for the \b UDMA_PRI_SELECT and 701*5fd0122aSMatthias Ringwald //! \b UDMA_ALT_SELECT flag along with the channel number and sets the 702*5fd0122aSMatthias Ringwald //! scatter-gather mode as appropriate for the primary or alternate control 703*5fd0122aSMatthias Ringwald //! structure. 704*5fd0122aSMatthias Ringwald //! 705*5fd0122aSMatthias Ringwald //! The channel must also be enabled using DMA_enableChannel() after calling 706*5fd0122aSMatthias Ringwald //! this function. The transfer does not begin until the channel has been 707*5fd0122aSMatthias Ringwald //! configured and enabled. Note that the channel is automatically disabled 708*5fd0122aSMatthias Ringwald //! after the transfer is completed, meaning that DMA_enableChannel() must be 709*5fd0122aSMatthias Ringwald //! called again after setting up the next transfer. 710*5fd0122aSMatthias Ringwald //! 711*5fd0122aSMatthias Ringwald //! \note Great care must be taken to not modify a channel control structure 712*5fd0122aSMatthias Ringwald //! that is in use or else the results are unpredictable, including the 713*5fd0122aSMatthias Ringwald //! possibility of undesired data transfers to or from memory or peripherals. 714*5fd0122aSMatthias Ringwald //! For BASIC and AUTO modes, it is safe to make changes when the channel is 715*5fd0122aSMatthias Ringwald //! disabled, or the DMA_getChannelMode() returns \b UDMA_MODE_STOP. For 716*5fd0122aSMatthias Ringwald //! PINGPONG or one of the SCATTER_GATHER modes, it is safe to modify the 717*5fd0122aSMatthias Ringwald //! primary or alternate control structure only when the other is being used. 718*5fd0122aSMatthias Ringwald //! The DMA_getChannelMode() function returns \b UDMA_MODE_STOP when a 719*5fd0122aSMatthias Ringwald //! channel control structure is inactive and safe to modify. 720*5fd0122aSMatthias Ringwald //! 721*5fd0122aSMatthias Ringwald //! \return None. 722*5fd0122aSMatthias Ringwald // 723*5fd0122aSMatthias Ringwald //***************************************************************************** 724*5fd0122aSMatthias Ringwald extern void DMA_setChannelTransfer(uint32_t channelStructIndex, uint32_t mode, 725*5fd0122aSMatthias Ringwald void *srcAddr, void *dstAddr, uint32_t transferSize); 726*5fd0122aSMatthias Ringwald 727*5fd0122aSMatthias Ringwald //***************************************************************************** 728*5fd0122aSMatthias Ringwald // 729*5fd0122aSMatthias Ringwald //! Configures a DMA channel for scatter-gather mode. 730*5fd0122aSMatthias Ringwald //! 731*5fd0122aSMatthias Ringwald //! \param channelNum is the DMA channel number. 732*5fd0122aSMatthias Ringwald //! \param taskCount is the number of scatter-gather tasks to execute. 733*5fd0122aSMatthias Ringwald //! \param taskList is a pointer to the beginning of the scatter-gather 734*5fd0122aSMatthias Ringwald //! task list. 735*5fd0122aSMatthias Ringwald //! \param isPeriphSG is a flag to indicate it is a peripheral scatter-gather 736*5fd0122aSMatthias Ringwald //! transfer (else it is memory scatter-gather transfer) 737*5fd0122aSMatthias Ringwald //! 738*5fd0122aSMatthias Ringwald //! This function is used to configure a channel for scatter-gather mode. 739*5fd0122aSMatthias Ringwald //! The caller must have already set up a task list and must pass a pointer to 740*5fd0122aSMatthias Ringwald //! the start of the task list as the \e taskList parameter. The 741*5fd0122aSMatthias Ringwald //! \e taskCount parameter is the count of tasks in the task list, not the 742*5fd0122aSMatthias Ringwald //! size of the task list. The flag \e bIsPeriphSG should be used to indicate 743*5fd0122aSMatthias Ringwald //! if scatter-gather should be configured for peripheral or memory 744*5fd0122aSMatthias Ringwald //! operation. 745*5fd0122aSMatthias Ringwald //! 746*5fd0122aSMatthias Ringwald //! \sa DMA_TaskStructEntry 747*5fd0122aSMatthias Ringwald //! 748*5fd0122aSMatthias Ringwald //! \return None. 749*5fd0122aSMatthias Ringwald // 750*5fd0122aSMatthias Ringwald //***************************************************************************** 751*5fd0122aSMatthias Ringwald extern void DMA_setChannelScatterGather(uint32_t channelNum, uint32_t taskCount, 752*5fd0122aSMatthias Ringwald void *taskList, uint32_t isPeriphSG); 753*5fd0122aSMatthias Ringwald 754*5fd0122aSMatthias Ringwald //***************************************************************************** 755*5fd0122aSMatthias Ringwald // 756*5fd0122aSMatthias Ringwald //! Gets the current transfer size for a DMA channel control structure. 757*5fd0122aSMatthias Ringwald //! 758*5fd0122aSMatthias Ringwald //! \param channelStructIndex is the logical OR of the DMA channel number 759*5fd0122aSMatthias Ringwald //! with either \b UDMA_PRI_SELECT or \b UDMA_ALT_SELECT. 760*5fd0122aSMatthias Ringwald //! 761*5fd0122aSMatthias Ringwald //! This function is used to get the DMA transfer size for a channel. The 762*5fd0122aSMatthias Ringwald //! transfer size is the number of items to transfer, where the size of an item 763*5fd0122aSMatthias Ringwald //! might be 8, 16, or 32 bits. If a partial transfer has already occurred, 764*5fd0122aSMatthias Ringwald //! then the number of remaining items is returned. If the transfer is 765*5fd0122aSMatthias Ringwald //! complete, then 0 is returned. 766*5fd0122aSMatthias Ringwald //! 767*5fd0122aSMatthias Ringwald //! \return Returns the number of items remaining to transfer. 768*5fd0122aSMatthias Ringwald // 769*5fd0122aSMatthias Ringwald //***************************************************************************** 770*5fd0122aSMatthias Ringwald extern uint32_t DMA_getChannelSize(uint32_t channelStructIndex); 771*5fd0122aSMatthias Ringwald 772*5fd0122aSMatthias Ringwald //***************************************************************************** 773*5fd0122aSMatthias Ringwald // 774*5fd0122aSMatthias Ringwald //! Gets the transfer mode for a DMA channel control structure. 775*5fd0122aSMatthias Ringwald //! 776*5fd0122aSMatthias Ringwald //! \param channelStructIndex is the logical OR of the DMA channel number 777*5fd0122aSMatthias Ringwald //! with either \b UDMA_PRI_SELECT or \b UDMA_ALT_SELECT. 778*5fd0122aSMatthias Ringwald //! 779*5fd0122aSMatthias Ringwald //! This function is used to get the transfer mode for the DMA channel and 780*5fd0122aSMatthias Ringwald //! to query the status of a transfer on a channel. When the transfer is 781*5fd0122aSMatthias Ringwald //! complete the mode is \b UDMA_MODE_STOP. 782*5fd0122aSMatthias Ringwald //! 783*5fd0122aSMatthias Ringwald //! \return Returns the transfer mode of the specified channel and control 784*5fd0122aSMatthias Ringwald //! structure, which is one of the following values: \b UDMA_MODE_STOP, 785*5fd0122aSMatthias Ringwald //! \b UDMA_MODE_BASIC, \b UDMA_MODE_AUTO, \b UDMA_MODE_PINGPONG, 786*5fd0122aSMatthias Ringwald //! \b UDMA_MODE_MEM_SCATTER_GATHER, or \b UDMA_MODE_PER_SCATTER_GATHER. 787*5fd0122aSMatthias Ringwald // 788*5fd0122aSMatthias Ringwald //***************************************************************************** 789*5fd0122aSMatthias Ringwald extern uint32_t DMA_getChannelMode(uint32_t channelStructIndex); 790*5fd0122aSMatthias Ringwald 791*5fd0122aSMatthias Ringwald //***************************************************************************** 792*5fd0122aSMatthias Ringwald // 793*5fd0122aSMatthias Ringwald //! Assigns a peripheral mapping for a DMA channel. 794*5fd0122aSMatthias Ringwald //! 795*5fd0122aSMatthias Ringwald //! \param mapping is a macro specifying the peripheral assignment for 796*5fd0122aSMatthias Ringwald //! a channel. 797*5fd0122aSMatthias Ringwald //! 798*5fd0122aSMatthias Ringwald //! This function assigns a peripheral mapping to a DMA channel. It is 799*5fd0122aSMatthias Ringwald //! used to select which peripheral is used for a DMA channel. The parameter 800*5fd0122aSMatthias Ringwald //! \e mapping should be one of the macros named \b UDMA_CHn_tttt from the 801*5fd0122aSMatthias Ringwald //! header file \e dma.h. For example, to assign DMA channel 0 to the 802*5fd0122aSMatthias Ringwald //! eUSCI AO RX channel, the parameter should be the macro 803*5fd0122aSMatthias Ringwald //! \b UDMA_CH1_EUSCIA0RX. 804*5fd0122aSMatthias Ringwald //! 805*5fd0122aSMatthias Ringwald //! Please consult the data sheet for a table showing all the 806*5fd0122aSMatthias Ringwald //! possible peripheral assignments for the DMA channels for a particular 807*5fd0122aSMatthias Ringwald //! device. 808*5fd0122aSMatthias Ringwald //! 809*5fd0122aSMatthias Ringwald //! \return None. 810*5fd0122aSMatthias Ringwald // 811*5fd0122aSMatthias Ringwald //***************************************************************************** 812*5fd0122aSMatthias Ringwald extern void DMA_assignChannel(uint32_t mapping); 813*5fd0122aSMatthias Ringwald 814*5fd0122aSMatthias Ringwald //***************************************************************************** 815*5fd0122aSMatthias Ringwald // 816*5fd0122aSMatthias Ringwald //! Initializes a software transfer of the corresponding DMA channel. This is 817*5fd0122aSMatthias Ringwald //! done if the user wants to force a DMA on the specified channel without the 818*5fd0122aSMatthias Ringwald //! hardware precondition. Specific channels can be configured using the 819*5fd0122aSMatthias Ringwald //! DMA_assignChannel function. 820*5fd0122aSMatthias Ringwald //! 821*5fd0122aSMatthias Ringwald //! \param channel is the channel to trigger the interrupt 822*5fd0122aSMatthias Ringwald //! 823*5fd0122aSMatthias Ringwald //! 824*5fd0122aSMatthias Ringwald //! \return None 825*5fd0122aSMatthias Ringwald // 826*5fd0122aSMatthias Ringwald //***************************************************************************** 827*5fd0122aSMatthias Ringwald extern void DMA_requestSoftwareTransfer(uint32_t channel); 828*5fd0122aSMatthias Ringwald 829*5fd0122aSMatthias Ringwald //***************************************************************************** 830*5fd0122aSMatthias Ringwald // 831*5fd0122aSMatthias Ringwald //! Assigns a specific DMA channel to the corresponding interrupt handler. For 832*5fd0122aSMatthias Ringwald //! MSP432 devices, there are three configurable interrupts, and one master 833*5fd0122aSMatthias Ringwald //! interrupt. This function will assign a specific DMA channel to the 834*5fd0122aSMatthias Ringwald //! provided configurable DMA interrupt. 835*5fd0122aSMatthias Ringwald //! 836*5fd0122aSMatthias Ringwald //! Note that once a channel is assigned to a configurable interrupt, it will be 837*5fd0122aSMatthias Ringwald //! masked in hardware from the master DMA interrupt (interruptNumber zero). This 838*5fd0122aSMatthias Ringwald //! function can also be used in conjunction with the DMAIntTrigger function 839*5fd0122aSMatthias Ringwald //! to provide the feature to software trigger specific channel interrupts. 840*5fd0122aSMatthias Ringwald //! 841*5fd0122aSMatthias Ringwald //! \param interruptNumber is the configurable interrupt to assign the given 842*5fd0122aSMatthias Ringwald //! channel. Valid values are: 843*5fd0122aSMatthias Ringwald //! - \b DMA_INT1 the first configurable DMA interrupt handler 844*5fd0122aSMatthias Ringwald //! - \b DMA_INT2 the second configurable DMA interrupt handler 845*5fd0122aSMatthias Ringwald //! - \b DMA_INT3 the third configurable DMA interrupt handler 846*5fd0122aSMatthias Ringwald //! 847*5fd0122aSMatthias Ringwald //! \param channel is the channel to assign the interrupt 848*5fd0122aSMatthias Ringwald //! 849*5fd0122aSMatthias Ringwald //! \return None. 850*5fd0122aSMatthias Ringwald // 851*5fd0122aSMatthias Ringwald //***************************************************************************** 852*5fd0122aSMatthias Ringwald extern void DMA_assignInterrupt(uint32_t interruptNumber, uint32_t channel); 853*5fd0122aSMatthias Ringwald 854*5fd0122aSMatthias Ringwald //***************************************************************************** 855*5fd0122aSMatthias Ringwald // 856*5fd0122aSMatthias Ringwald //! Enables the specified interrupt for the DMA controller. Note for interrupts 857*5fd0122aSMatthias Ringwald //! one through three, specific channels have to be mapped to the interrupt 858*5fd0122aSMatthias Ringwald //! using the DMA_assignInterrupt function. 859*5fd0122aSMatthias Ringwald //! 860*5fd0122aSMatthias Ringwald //! \param interruptNumber identifies which DMA interrupt is to be enabled. 861*5fd0122aSMatthias Ringwald //! This interrupt should be one of the following: 862*5fd0122aSMatthias Ringwald //! 863*5fd0122aSMatthias Ringwald //! - \b DMA_INT1 the first configurable DMA interrupt handler 864*5fd0122aSMatthias Ringwald //! - \b DMA_INT2 the second configurable DMA interrupt handler 865*5fd0122aSMatthias Ringwald //! - \b DMA_INT3 the third configurable DMA interrupt handler 866*5fd0122aSMatthias Ringwald //! 867*5fd0122aSMatthias Ringwald //! 868*5fd0122aSMatthias Ringwald //! \return None. 869*5fd0122aSMatthias Ringwald // 870*5fd0122aSMatthias Ringwald //***************************************************************************** 871*5fd0122aSMatthias Ringwald extern void DMA_enableInterrupt(uint32_t interruptNumber); 872*5fd0122aSMatthias Ringwald 873*5fd0122aSMatthias Ringwald //***************************************************************************** 874*5fd0122aSMatthias Ringwald // 875*5fd0122aSMatthias Ringwald //! Disables the specified interrupt for the DMA controller. 876*5fd0122aSMatthias Ringwald //! 877*5fd0122aSMatthias Ringwald //! \param interruptNumber identifies which DMA interrupt is to be disabled. 878*5fd0122aSMatthias Ringwald //! This interrupt should be one of the following: 879*5fd0122aSMatthias Ringwald //! 880*5fd0122aSMatthias Ringwald //! - \b DMA_INT1 the first configurable DMA interrupt handler 881*5fd0122aSMatthias Ringwald //! - \b DMA_INT2 the second configurable DMA interrupt handler 882*5fd0122aSMatthias Ringwald //! - \b DMA_INT3 the third configurable DMA interrupt handler 883*5fd0122aSMatthias Ringwald //! 884*5fd0122aSMatthias Ringwald //! Note for interrupts that are associated with a specific DMA channel 885*5fd0122aSMatthias Ringwald //! (DMA_INT1 - DMA_INT3), this function will also enable that specific 886*5fd0122aSMatthias Ringwald //! channel for interrupts. 887*5fd0122aSMatthias Ringwald //! 888*5fd0122aSMatthias Ringwald //! \return None. 889*5fd0122aSMatthias Ringwald // 890*5fd0122aSMatthias Ringwald //***************************************************************************** 891*5fd0122aSMatthias Ringwald extern void DMA_disableInterrupt(uint32_t interruptNumber); 892*5fd0122aSMatthias Ringwald 893*5fd0122aSMatthias Ringwald //***************************************************************************** 894*5fd0122aSMatthias Ringwald // 895*5fd0122aSMatthias Ringwald //! Gets the DMA controller channel interrupt status for interrupt zero. 896*5fd0122aSMatthias Ringwald //! 897*5fd0122aSMatthias Ringwald //! This function is used to get the interrupt status of the DMA controller. 898*5fd0122aSMatthias Ringwald //! The returned value is a 32-bit bit mask that indicates which channels are 899*5fd0122aSMatthias Ringwald //! requesting an interrupt. This function can be used from within an 900*5fd0122aSMatthias Ringwald //! interrupt handler to determine or confirm which DMA channel has requested 901*5fd0122aSMatthias Ringwald //! an interrupt. 902*5fd0122aSMatthias Ringwald //! 903*5fd0122aSMatthias Ringwald //! Note that this will only apply to interrupt zero for the DMA 904*5fd0122aSMatthias Ringwald //! controller as only one interrupt can be associated with interrupts one 905*5fd0122aSMatthias Ringwald //! through three. If an interrupt is assigned to an interrupt other 906*5fd0122aSMatthias Ringwald //! than interrupt zero, it will be masked by this function. 907*5fd0122aSMatthias Ringwald //! 908*5fd0122aSMatthias Ringwald //! \return Returns a 32-bit mask which indicates requesting DMA channels. 909*5fd0122aSMatthias Ringwald //! There is a bit for each channel and a 1 indicates that the channel 910*5fd0122aSMatthias Ringwald //! is requesting an interrupt. Multiple bits can be set. 911*5fd0122aSMatthias Ringwald // 912*5fd0122aSMatthias Ringwald //***************************************************************************** 913*5fd0122aSMatthias Ringwald extern uint32_t DMA_getInterruptStatus(void); 914*5fd0122aSMatthias Ringwald 915*5fd0122aSMatthias Ringwald //***************************************************************************** 916*5fd0122aSMatthias Ringwald // 917*5fd0122aSMatthias Ringwald //! Clears the DMA controller channel interrupt mask for interrupt zero. 918*5fd0122aSMatthias Ringwald //! 919*5fd0122aSMatthias Ringwald //! \param channel is the channel interrupt to clear. 920*5fd0122aSMatthias Ringwald //! 921*5fd0122aSMatthias Ringwald //! This function is used to clear the interrupt status of the DMA controller. 922*5fd0122aSMatthias Ringwald //! Note that only interrupts that weren't assigned to DMA interrupts one 923*5fd0122aSMatthias Ringwald //! through three using the DMA_assignInterrupt function will be affected by 924*5fd0122aSMatthias Ringwald //! this function. For other DMA interrupts, only one channel can be associated 925*5fd0122aSMatthias Ringwald //! and therefore clearing is unnecessary. 926*5fd0122aSMatthias Ringwald //! 927*5fd0122aSMatthias Ringwald //! \return None 928*5fd0122aSMatthias Ringwald // 929*5fd0122aSMatthias Ringwald //***************************************************************************** 930*5fd0122aSMatthias Ringwald extern void DMA_clearInterruptFlag(uint32_t channel); 931*5fd0122aSMatthias Ringwald 932*5fd0122aSMatthias Ringwald //***************************************************************************** 933*5fd0122aSMatthias Ringwald // 934*5fd0122aSMatthias Ringwald //! Registers an interrupt handler for the DMA controller. 935*5fd0122aSMatthias Ringwald //! 936*5fd0122aSMatthias Ringwald //! \param interruptNumber identifies which DMA interrupt is to be registered. 937*5fd0122aSMatthias Ringwald //! \param intHandler is a pointer to the function to be called when the 938*5fd0122aSMatthias Ringwald //! interrupt is called. 939*5fd0122aSMatthias Ringwald //! 940*5fd0122aSMatthias Ringwald //! This function registers and enables the handler to be called when the DMA 941*5fd0122aSMatthias Ringwald //! controller generates an interrupt. The \e interrupt parameter should be 942*5fd0122aSMatthias Ringwald //! one of the following: 943*5fd0122aSMatthias Ringwald //! 944*5fd0122aSMatthias Ringwald //! - \b DMA_INT0 the master DMA interrupt handler 945*5fd0122aSMatthias Ringwald //! - \b DMA_INT1 the first configurable DMA interrupt handler 946*5fd0122aSMatthias Ringwald //! - \b DMA_INT2 the second configurable DMA interrupt handler 947*5fd0122aSMatthias Ringwald //! - \b DMA_INT3 the third configurable DMA interrupt handler 948*5fd0122aSMatthias Ringwald //! - \b DMA_INTERR the DMA error interrupt handler 949*5fd0122aSMatthias Ringwald //! 950*5fd0122aSMatthias Ringwald //! \sa Interrupt_registerInterrupt() for important information about 951*5fd0122aSMatthias Ringwald //! registering interrupt handlers. 952*5fd0122aSMatthias Ringwald //! 953*5fd0122aSMatthias Ringwald //! \return None. 954*5fd0122aSMatthias Ringwald // 955*5fd0122aSMatthias Ringwald //***************************************************************************** 956*5fd0122aSMatthias Ringwald extern void DMA_registerInterrupt(uint32_t interruptNumber, 957*5fd0122aSMatthias Ringwald void (*intHandler)(void)); 958*5fd0122aSMatthias Ringwald 959*5fd0122aSMatthias Ringwald //***************************************************************************** 960*5fd0122aSMatthias Ringwald // 961*5fd0122aSMatthias Ringwald //! Unregisters an interrupt handler for the DMA controller. 962*5fd0122aSMatthias Ringwald //! 963*5fd0122aSMatthias Ringwald //! \param interruptNumber identifies which DMA interrupt to unregister. 964*5fd0122aSMatthias Ringwald //! 965*5fd0122aSMatthias Ringwald //! This function disables and unregisters the handler to be called for the 966*5fd0122aSMatthias Ringwald //! specified DMA interrupt. The \e interrupt parameter should be one of 967*5fd0122aSMatthias Ringwald //! \b the parameters as documented for the function 968*5fd0122aSMatthias Ringwald //! DMA_registerInterrupt(). 969*5fd0122aSMatthias Ringwald //! 970*5fd0122aSMatthias Ringwald //! Note for interrupts that are associated with a specific DMA channel 971*5fd0122aSMatthias Ringwald //! (DMA_INT1 - DMA_INT3), this function will also disable that specific 972*5fd0122aSMatthias Ringwald //! channel for interrupts. 973*5fd0122aSMatthias Ringwald //! 974*5fd0122aSMatthias Ringwald //! \sa Interrupt_registerInterrupt() for important information about 975*5fd0122aSMatthias Ringwald //! registering interrupt handlers. 976*5fd0122aSMatthias Ringwald //! 977*5fd0122aSMatthias Ringwald //! \return None. 978*5fd0122aSMatthias Ringwald // 979*5fd0122aSMatthias Ringwald //***************************************************************************** 980*5fd0122aSMatthias Ringwald extern void DMA_unregisterInterrupt(uint32_t interruptNumber); 981*5fd0122aSMatthias Ringwald 982*5fd0122aSMatthias Ringwald //***************************************************************************** 983*5fd0122aSMatthias Ringwald // 984*5fd0122aSMatthias Ringwald // Mark the end of the C bindings section for C++ compilers. 985*5fd0122aSMatthias Ringwald // 986*5fd0122aSMatthias Ringwald //***************************************************************************** 987*5fd0122aSMatthias Ringwald #ifdef __cplusplus 988*5fd0122aSMatthias Ringwald } 989*5fd0122aSMatthias Ringwald #endif 990*5fd0122aSMatthias Ringwald 991*5fd0122aSMatthias Ringwald //***************************************************************************** 992*5fd0122aSMatthias Ringwald // 993*5fd0122aSMatthias Ringwald // Close the Doxygen group. 994*5fd0122aSMatthias Ringwald //! @} 995*5fd0122aSMatthias Ringwald // 996*5fd0122aSMatthias Ringwald //***************************************************************************** 997*5fd0122aSMatthias Ringwald 998*5fd0122aSMatthias Ringwald #endif // __UDMA_H__ 999