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