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