GPDMA (Direct Memory Access) and LLI (Link List Item) test see: http://mbed.org/users/okini3939/notebook/dma_jp/
MODDMA/DATALUTS.cpp@0:de79d4a48e63, 2013-09-13 (annotated)
- Committer:
- okini3939
- Date:
- Fri Sep 13 14:49:52 2013 +0000
- Revision:
- 0:de79d4a48e63
GPDMA (Direct Memory Access) and LLI (Link List Item) test
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 | #include "MODDMA.h" |
okini3939 | 0:de79d4a48e63 | 24 | |
okini3939 | 0:de79d4a48e63 | 25 | #ifndef MBED_H |
okini3939 | 0:de79d4a48e63 | 26 | #include "mbed.h" |
okini3939 | 0:de79d4a48e63 | 27 | #endif |
okini3939 | 0:de79d4a48e63 | 28 | |
okini3939 | 0:de79d4a48e63 | 29 | #ifndef MODDMA_CONFIG_H |
okini3939 | 0:de79d4a48e63 | 30 | #include "CONFIG.h" |
okini3939 | 0:de79d4a48e63 | 31 | #endif |
okini3939 | 0:de79d4a48e63 | 32 | |
okini3939 | 0:de79d4a48e63 | 33 | namespace AjK { |
okini3939 | 0:de79d4a48e63 | 34 | |
okini3939 | 0:de79d4a48e63 | 35 | uint32_t |
okini3939 | 0:de79d4a48e63 | 36 | MODDMA::LUTPerAddr(int n) |
okini3939 | 0:de79d4a48e63 | 37 | { |
okini3939 | 0:de79d4a48e63 | 38 | const uint32_t lut[] = { |
okini3939 | 0:de79d4a48e63 | 39 | (uint32_t)&LPC_SSP0->DR // SSP0 Tx |
okini3939 | 0:de79d4a48e63 | 40 | , (uint32_t)&LPC_SSP0->DR // SSP0 Rx |
okini3939 | 0:de79d4a48e63 | 41 | , (uint32_t)&LPC_SSP1->DR // SSP1 Tx |
okini3939 | 0:de79d4a48e63 | 42 | , (uint32_t)&LPC_SSP1->DR // SSP1 Rx |
okini3939 | 0:de79d4a48e63 | 43 | , (uint32_t)&LPC_ADC->ADGDR // ADC |
okini3939 | 0:de79d4a48e63 | 44 | , (uint32_t)&LPC_I2S->I2STXFIFO // I2S Tx |
okini3939 | 0:de79d4a48e63 | 45 | , (uint32_t)&LPC_I2S->I2SRXFIFO // I2S Rx |
okini3939 | 0:de79d4a48e63 | 46 | , (uint32_t)&LPC_DAC->DACR // DAC |
okini3939 | 0:de79d4a48e63 | 47 | , (uint32_t)&LPC_UART0->THR // UART0 Tx |
okini3939 | 0:de79d4a48e63 | 48 | , (uint32_t)&LPC_UART0->RBR // UART0 Rx |
okini3939 | 0:de79d4a48e63 | 49 | , (uint32_t)&LPC_UART1->THR // UART1 Tx |
okini3939 | 0:de79d4a48e63 | 50 | , (uint32_t)&LPC_UART1->RBR // UART1 Rx |
okini3939 | 0:de79d4a48e63 | 51 | , (uint32_t)&LPC_UART2->THR // UART2 Tx |
okini3939 | 0:de79d4a48e63 | 52 | , (uint32_t)&LPC_UART2->RBR // UART2 Rx |
okini3939 | 0:de79d4a48e63 | 53 | , (uint32_t)&LPC_UART3->THR // UART3 Tx |
okini3939 | 0:de79d4a48e63 | 54 | , (uint32_t)&LPC_UART3->RBR // UART3 Rx |
okini3939 | 0:de79d4a48e63 | 55 | , (uint32_t)&LPC_TIM0->MR0 // MAT0.0 |
okini3939 | 0:de79d4a48e63 | 56 | , (uint32_t)&LPC_TIM0->MR1 // MAT0.1 |
okini3939 | 0:de79d4a48e63 | 57 | , (uint32_t)&LPC_TIM1->MR0 // MAT1.0 |
okini3939 | 0:de79d4a48e63 | 58 | , (uint32_t)&LPC_TIM1->MR1 // MAT1.1 |
okini3939 | 0:de79d4a48e63 | 59 | , (uint32_t)&LPC_TIM2->MR0 // MAT2.0 |
okini3939 | 0:de79d4a48e63 | 60 | , (uint32_t)&LPC_TIM2->MR1 // MAT2.1 |
okini3939 | 0:de79d4a48e63 | 61 | , (uint32_t)&LPC_TIM3->MR0 // MAT3.0 |
okini3939 | 0:de79d4a48e63 | 62 | , (uint32_t)&LPC_TIM3->MR1 // MAT3.1 |
okini3939 | 0:de79d4a48e63 | 63 | }; |
okini3939 | 0:de79d4a48e63 | 64 | return lut[n & 0xFF]; |
okini3939 | 0:de79d4a48e63 | 65 | } |
okini3939 | 0:de79d4a48e63 | 66 | |
okini3939 | 0:de79d4a48e63 | 67 | uint32_t |
okini3939 | 0:de79d4a48e63 | 68 | MODDMA::Channel_p(int channel) |
okini3939 | 0:de79d4a48e63 | 69 | { |
okini3939 | 0:de79d4a48e63 | 70 | const uint32_t lut[] = { |
okini3939 | 0:de79d4a48e63 | 71 | (uint32_t)LPC_GPDMACH0 |
okini3939 | 0:de79d4a48e63 | 72 | , (uint32_t)LPC_GPDMACH1 |
okini3939 | 0:de79d4a48e63 | 73 | , (uint32_t)LPC_GPDMACH2 |
okini3939 | 0:de79d4a48e63 | 74 | , (uint32_t)LPC_GPDMACH3 |
okini3939 | 0:de79d4a48e63 | 75 | , (uint32_t)LPC_GPDMACH4 |
okini3939 | 0:de79d4a48e63 | 76 | , (uint32_t)LPC_GPDMACH5 |
okini3939 | 0:de79d4a48e63 | 77 | , (uint32_t)LPC_GPDMACH6 |
okini3939 | 0:de79d4a48e63 | 78 | , (uint32_t)LPC_GPDMACH7 |
okini3939 | 0:de79d4a48e63 | 79 | }; |
okini3939 | 0:de79d4a48e63 | 80 | return lut[channel & 0xFF]; |
okini3939 | 0:de79d4a48e63 | 81 | } |
okini3939 | 0:de79d4a48e63 | 82 | |
okini3939 | 0:de79d4a48e63 | 83 | uint8_t |
okini3939 | 0:de79d4a48e63 | 84 | MODDMA::LUTPerBurst(int n) |
okini3939 | 0:de79d4a48e63 | 85 | { |
okini3939 | 0:de79d4a48e63 | 86 | const uint8_t lut[] = { |
okini3939 | 0:de79d4a48e63 | 87 | (uint8_t)_4 // SSP0 Tx |
okini3939 | 0:de79d4a48e63 | 88 | , (uint8_t)_4 // SSP0 Rx |
okini3939 | 0:de79d4a48e63 | 89 | , (uint8_t)_4 // SSP1 Tx |
okini3939 | 0:de79d4a48e63 | 90 | , (uint8_t)_4 // SSP1 Rx |
okini3939 | 0:de79d4a48e63 | 91 | , (uint8_t)_1 // ADC |
okini3939 | 0:de79d4a48e63 | 92 | , (uint8_t)_32 // I2S channel 0 |
okini3939 | 0:de79d4a48e63 | 93 | , (uint8_t)_32 // I2S channel 1 |
okini3939 | 0:de79d4a48e63 | 94 | , (uint8_t)_1 // DAC |
okini3939 | 0:de79d4a48e63 | 95 | , (uint8_t)_1 // UART0 Tx |
okini3939 | 0:de79d4a48e63 | 96 | , (uint8_t)_1 // UART0 Rx |
okini3939 | 0:de79d4a48e63 | 97 | , (uint8_t)_1 // UART1 Tx |
okini3939 | 0:de79d4a48e63 | 98 | , (uint8_t)_1 // UART1 Rx |
okini3939 | 0:de79d4a48e63 | 99 | , (uint8_t)_1 // UART2 Tx |
okini3939 | 0:de79d4a48e63 | 100 | , (uint8_t)_1 // UART2 Rx |
okini3939 | 0:de79d4a48e63 | 101 | , (uint8_t)_1 // UART3 Tx |
okini3939 | 0:de79d4a48e63 | 102 | , (uint8_t)_1 // UART3 Rx |
okini3939 | 0:de79d4a48e63 | 103 | , (uint8_t)_1 // MAT0.0 |
okini3939 | 0:de79d4a48e63 | 104 | , (uint8_t)_1 // MAT0.1 |
okini3939 | 0:de79d4a48e63 | 105 | , (uint8_t)_1 // MAT1.0 |
okini3939 | 0:de79d4a48e63 | 106 | , (uint8_t)_1 // MAT1.1 |
okini3939 | 0:de79d4a48e63 | 107 | , (uint8_t)_1 // MAT2.0 |
okini3939 | 0:de79d4a48e63 | 108 | , (uint8_t)_1 // MAT2.1 |
okini3939 | 0:de79d4a48e63 | 109 | , (uint8_t)_1 // MAT3.0 |
okini3939 | 0:de79d4a48e63 | 110 | , (uint8_t)_1 // MAT3.1 |
okini3939 | 0:de79d4a48e63 | 111 | }; |
okini3939 | 0:de79d4a48e63 | 112 | return lut[n & 0xFFF]; |
okini3939 | 0:de79d4a48e63 | 113 | } |
okini3939 | 0:de79d4a48e63 | 114 | |
okini3939 | 0:de79d4a48e63 | 115 | uint8_t |
okini3939 | 0:de79d4a48e63 | 116 | MODDMA::LUTPerWid(int n) |
okini3939 | 0:de79d4a48e63 | 117 | { |
okini3939 | 0:de79d4a48e63 | 118 | const uint8_t lut[] = { |
okini3939 | 0:de79d4a48e63 | 119 | (uint8_t)byte // SSP0 Tx |
okini3939 | 0:de79d4a48e63 | 120 | , (uint8_t)byte // SSP0 Rx |
okini3939 | 0:de79d4a48e63 | 121 | , (uint8_t)byte // SSP1 Tx |
okini3939 | 0:de79d4a48e63 | 122 | , (uint8_t)byte // SSP1 Rx |
okini3939 | 0:de79d4a48e63 | 123 | , (uint8_t)word // ADC |
okini3939 | 0:de79d4a48e63 | 124 | , (uint8_t)word // I2S channel 0 |
okini3939 | 0:de79d4a48e63 | 125 | , (uint8_t)word // I2S channel 1 |
okini3939 | 0:de79d4a48e63 | 126 | , (uint8_t)word // DAC |
okini3939 | 0:de79d4a48e63 | 127 | , (uint8_t)byte // UART0 Tx |
okini3939 | 0:de79d4a48e63 | 128 | , (uint8_t)byte // UART0 Rx |
okini3939 | 0:de79d4a48e63 | 129 | , (uint8_t)byte // UART1 Tx |
okini3939 | 0:de79d4a48e63 | 130 | , (uint8_t)byte // UART1 Rx |
okini3939 | 0:de79d4a48e63 | 131 | , (uint8_t)byte // UART2 Tx |
okini3939 | 0:de79d4a48e63 | 132 | , (uint8_t)byte // UART2 Rx |
okini3939 | 0:de79d4a48e63 | 133 | , (uint8_t)byte // UART3 Tx |
okini3939 | 0:de79d4a48e63 | 134 | , (uint8_t)byte // UART3 Rx |
okini3939 | 0:de79d4a48e63 | 135 | , (uint8_t)word // MAT0.0 |
okini3939 | 0:de79d4a48e63 | 136 | , (uint8_t)word // MAT0.1 |
okini3939 | 0:de79d4a48e63 | 137 | , (uint8_t)word // MAT1.0 |
okini3939 | 0:de79d4a48e63 | 138 | , (uint8_t)word // MAT1.1 |
okini3939 | 0:de79d4a48e63 | 139 | , (uint8_t)word // MAT2.0 |
okini3939 | 0:de79d4a48e63 | 140 | , (uint8_t)word // MAT2.1 |
okini3939 | 0:de79d4a48e63 | 141 | , (uint8_t)word // MAT3.0 |
okini3939 | 0:de79d4a48e63 | 142 | , (uint8_t)word // MAT3.1 |
okini3939 | 0:de79d4a48e63 | 143 | }; |
okini3939 | 0:de79d4a48e63 | 144 | return lut[n & 0xFFF]; |
okini3939 | 0:de79d4a48e63 | 145 | } |
okini3939 | 0:de79d4a48e63 | 146 | |
okini3939 | 0:de79d4a48e63 | 147 | }; // namespace AjK ends |