MODDMA GPDMA Controller New features: transfer pins to memory buffer under periodic timer control and send double buffers to DAC

Dependents:   FirstTest WaveSim IO-dma-memmem DACDMAfuncgenlib ... more

Committer:
AjK
Date:
Sat Feb 05 08:53:26 2011 +0000
Revision:
8:cb4d323ce6fd
Parent:
0:c409efd8df78
1.5 See ChangeLog.c

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AjK 8:cb4d323ce6fd 1 /*
AjK 8:cb4d323ce6fd 2 Copyright (c) 2010 Andy Kirkham
AjK 8:cb4d323ce6fd 3
AjK 8:cb4d323ce6fd 4 Permission is hereby granted, free of charge, to any person obtaining a copy
AjK 8:cb4d323ce6fd 5 of this software and associated documentation files (the "Software"), to deal
AjK 8:cb4d323ce6fd 6 in the Software without restriction, including without limitation the rights
AjK 8:cb4d323ce6fd 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
AjK 8:cb4d323ce6fd 8 copies of the Software, and to permit persons to whom the Software is
AjK 8:cb4d323ce6fd 9 furnished to do so, subject to the following conditions:
AjK 8:cb4d323ce6fd 10
AjK 8:cb4d323ce6fd 11 The above copyright notice and this permission notice shall be included in
AjK 8:cb4d323ce6fd 12 all copies or substantial portions of the Software.
AjK 8:cb4d323ce6fd 13
AjK 8:cb4d323ce6fd 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
AjK 8:cb4d323ce6fd 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
AjK 8:cb4d323ce6fd 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AjK 8:cb4d323ce6fd 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
AjK 8:cb4d323ce6fd 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AjK 8:cb4d323ce6fd 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
AjK 8:cb4d323ce6fd 20 THE SOFTWARE.
AjK 8:cb4d323ce6fd 21 */
AjK 8:cb4d323ce6fd 22
AjK 8:cb4d323ce6fd 23 #ifdef NOCOMPILE
AjK 8:cb4d323ce6fd 24
AjK 8:cb4d323ce6fd 25 #ifndef MODDMA_CONFIG_H
AjK 8:cb4d323ce6fd 26 #define MODDMA_CONFIG_H
AjK 8:cb4d323ce6fd 27
AjK 8:cb4d323ce6fd 28 #include "mbed.h"
AjK 8:cb4d323ce6fd 29
AjK 8:cb4d323ce6fd 30 namespace AjK {
AjK 8:cb4d323ce6fd 31
AjK 8:cb4d323ce6fd 32 // Forward reference.
AjK 8:cb4d323ce6fd 33 class MODDMA;
AjK 8:cb4d323ce6fd 34
AjK 8:cb4d323ce6fd 35 class MODDMA_Channel_CFG_t {
AjK 8:cb4d323ce6fd 36 public:
AjK 8:cb4d323ce6fd 37
AjK 8:cb4d323ce6fd 38 // *****************************************
AjK 8:cb4d323ce6fd 39 // From GPDMA by NXP MCU SW Application Team
AjK 8:cb4d323ce6fd 40 // *****************************************
AjK 8:cb4d323ce6fd 41
AjK 8:cb4d323ce6fd 42 uint32_t ChannelNum; //!< DMA channel number, should be in range from 0 to 7.
AjK 8:cb4d323ce6fd 43 uint32_t TransferSize; //!< Length/Size of transfer
AjK 8:cb4d323ce6fd 44 uint32_t TransferWidth; //!< Transfer width - used for TransferType is GPDMA_TRANSFERTYPE_m2m only
AjK 8:cb4d323ce6fd 45 uint32_t SrcMemAddr; //!< Physical Src Addr, used in case TransferType is chosen as MODDMA::GPDMA_TRANSFERTYPE::m2m or MODDMA::GPDMA_TRANSFERTYPE::m2p
AjK 8:cb4d323ce6fd 46 uint32_t DstMemAddr; //!< Physical Destination Address, used in case TransferType is chosen as MODDMA::GPDMA_TRANSFERTYPE::m2m or MODDMA::GPDMA_TRANSFERTYPE::p2m
AjK 8:cb4d323ce6fd 47 uint32_t TransferType; //!< Transfer Type
AjK 8:cb4d323ce6fd 48 uint32_t SrcConn; ///!< Peripheral Source Connection type, used in case TransferType is chosen as
AjK 8:cb4d323ce6fd 49 uint32_t DstConn; //!< Peripheral Destination Connection type, used in case TransferType is chosen as
AjK 8:cb4d323ce6fd 50 uint32_t DMALLI; //!< Linker List Item structure data address if there's no Linker List, set as '0'
AjK 8:cb4d323ce6fd 51
AjK 8:cb4d323ce6fd 52 // Mbed specifics.
AjK 8:cb4d323ce6fd 53
AjK 8:cb4d323ce6fd 54 MODDMA_Channel_CFG_t() {
AjK 8:cb4d323ce6fd 55 isrIntTCStat = new FunctionPointer;
AjK 8:cb4d323ce6fd 56 isrIntErrStat = new FunctionPointer;
AjK 8:cb4d323ce6fd 57 }
AjK 8:cb4d323ce6fd 58
AjK 8:cb4d323ce6fd 59 ~MODDMA_Channel_CFG_t() {
AjK 8:cb4d323ce6fd 60 delete(isrIntTCStat);
AjK 8:cb4d323ce6fd 61 delete(isrIntErrStat);
AjK 8:cb4d323ce6fd 62 }
AjK 8:cb4d323ce6fd 63
AjK 8:cb4d323ce6fd 64 class MODDMA_Channel_CFG_t * channelNum(uint32_t n) { ChannelNum = n; return this; }
AjK 8:cb4d323ce6fd 65 class MODDMA_Channel_CFG_t * transferSize(uint32_t n) { TransferSize = n; return this; }
AjK 8:cb4d323ce6fd 66 class MODDMA_Channel_CFG_t * transferWidth(uint32_t n) { TransferWidth = n; return this; }
AjK 8:cb4d323ce6fd 67 class MODDMA_Channel_CFG_t * srcMemAddr(uint32_t n) { SrcMemAddr = n; return this; }
AjK 8:cb4d323ce6fd 68 class MODDMA_Channel_CFG_t * dstMemAddr(uint32_t n) { DstMemAddr = n; return this; }
AjK 8:cb4d323ce6fd 69 class MODDMA_Channel_CFG_t * transferType(uint32_t n) { TransferType = n; return this; }
AjK 8:cb4d323ce6fd 70 class MODDMA_Channel_CFG_t * srcConn(uint32_t n) { SrcConn = n; return this; }
AjK 8:cb4d323ce6fd 71 class MODDMA_Channel_CFG_t * dstConn(uint32_t n) { DstConn = n; return this; }
AjK 8:cb4d323ce6fd 72 class MODDMA_Channel_CFG_t * dmaLLI(uint32_t n) { DMALLI = n; return this; }
AjK 8:cb4d323ce6fd 73
AjK 8:cb4d323ce6fd 74 uint32_t channelNum(void) { return ChannelNum; }
AjK 8:cb4d323ce6fd 75
AjK 8:cb4d323ce6fd 76 FunctionPointer *isrIntTCStat;
AjK 8:cb4d323ce6fd 77 FunctionPointer *isrIntErrStat;
AjK 8:cb4d323ce6fd 78 };
AjK 8:cb4d323ce6fd 79
AjK 8:cb4d323ce6fd 80 /**
AjK 8:cb4d323ce6fd 81 * @brief GPDMA Linker List Item structure type definition
AjK 8:cb4d323ce6fd 82 */
AjK 8:cb4d323ce6fd 83 class GPDMA_LLI_t
AjK 8:cb4d323ce6fd 84 {
AjK 8:cb4d323ce6fd 85 public:
AjK 8:cb4d323ce6fd 86 uint32_t SrcAddr; //!< Source Address
AjK 8:cb4d323ce6fd 87 uint32_t DstAddr; //!< Destination address
AjK 8:cb4d323ce6fd 88 uint32_t NextLLI; //!< Next LLI address, otherwise set to '0'
AjK 8:cb4d323ce6fd 89 uint32_t Control; //!< GPDMA Control of this LLI
AjK 8:cb4d323ce6fd 90 };
AjK 8:cb4d323ce6fd 91
AjK 8:cb4d323ce6fd 92 }; // namespace AjK ends.
AjK 8:cb4d323ce6fd 93
AjK 8:cb4d323ce6fd 94 #endif
AjK 8:cb4d323ce6fd 95 #endif