diff --git a/dsp-block-test/audio.h b/dsp-block-test/audio.h index e5cb676a..c56d8b8e 100644 --- a/dsp-block-test/audio.h +++ b/dsp-block-test/audio.h @@ -14,7 +14,7 @@ * to switch buffers and perform deinterleaving. * otherwise, copy and deinterleave in the ISR */ -#define DMA_DEINTERLEAVE_PINGPONG 0 +#define DMA_DEINTERLEAVE_PINGPONG 1 //! channel count #define CHANNELS 4 diff --git a/dsp-block-test/dma.c b/dsp-block-test/dma.c index 3d6abe34..d391dac9 100644 --- a/dsp-block-test/dma.c +++ b/dsp-block-test/dma.c @@ -6,16 +6,18 @@ #include "dma.h" #if DMA_DEINTERLEAVE_PINGPONG -// use descriptor mode to perform pingpong and deinterleave +// use large descriptor mode to perform pingpong and deinterleave typedef struct { - void *next; - void *start; - short config; - short x_count; - short x_mod; - short y_count; - short y_mod; + void *next; // NDPL, NDPH + void *start; // SAL, SAH + /* + short config; // DMACFG + short x_count; // XCNT + short x_mod; // XMOD + short y_count; // YCNT + short y_mod; // YMOD + */ } dma_desc_t; // for deinterleaving, inner loop over number of channels @@ -27,15 +29,16 @@ typedef struct { // each outer-loop increment, jump back to the next frame in the first channel #define Y_MOD (((1 - CHANNELS) * BLOCKSIZE + 1) * SAMPLESIZE) -#define DMA_FLOW_DESC 0x7700 +// large descriptor list, first 4 registers only (NDPL, NDPH, SAL, SAH) +#define DMA_FLOW_DESC 0x7400 // NB: need interrupt on both TX and RX to ensure correct process order -#define DMA_CONFIG ( WDSIZE_32 | DMA_FLOW_DESC | DI_EN | DMA2D ) +#define DMA_CONFIG ( DMA_FLOW_DESC | WDSIZE_32 | DI_EN | DMA2D ) -dma_desc_t descRx1 = { NULL, inputChannels1, WNR | DMA_CONFIG, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; -dma_desc_t descRx0 = { &descRx1, inputChannels0, WNR | DMA_CONFIG, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; +dma_desc_t descRx1 = { NULL, inputChannels1 }; //, DMA_CONFIG | WNR, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; +dma_desc_t descRx0 = { &descRx1, inputChannels0 }; //, DMA_CONFIG | WNR, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; -dma_desc_t descTx1 = { NULL, outputChannels1, DMA_CONFIG, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; -dma_desc_t descTx0 = { &descTx1, outputChannels0, DMA_CONFIG, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; +dma_desc_t descTx1 = { NULL, outputChannels1 }; //, DMA_CONFIG, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; +dma_desc_t descTx0 = { &descTx1, outputChannels0 }; //, DMA_CONFIG, X_COUNT, X_MOD, Y_COUNT, Y_MOD }; void init_dma(void) { @@ -49,8 +52,21 @@ void init_dma(void) { descRx1.next = &descRx0; descTx1.next = &descTx0; + *pDMA1_X_COUNT = X_COUNT; + *pDMA1_X_MODIFY = X_MOD; + *pDMA1_Y_COUNT = Y_COUNT; + *pDMA1_Y_MODIFY = Y_MOD; *pDMA1_NEXT_DESC_PTR = &descRx0; + //*pDMA1_START_ADDR = descRx0.start; + *pDMA1_CONFIG = DMA_CONFIG | WNR; + + *pDMA2_X_COUNT = X_COUNT; + *pDMA2_X_MODIFY = X_MOD; + *pDMA2_Y_COUNT = Y_COUNT; + *pDMA2_Y_MODIFY = Y_MOD; *pDMA2_NEXT_DESC_PTR = &descTx0; + //*pDMA2_START_ADDR = descTx0.start; + *pDMA2_CONFIG = DMA_CONFIG; } #else // 1d, autobuffer mode (no de-interleave, no pingpong diff --git a/dsp-block-test/dsp-block-test b/dsp-block-test/dsp-block-test index 21f1695b..d536d269 100755 Binary files a/dsp-block-test/dsp-block-test and b/dsp-block-test/dsp-block-test differ diff --git a/dsp-block-test/main.c b/dsp-block-test/main.c index ed5cdecf..7c2eb4c0 100644 --- a/dsp-block-test/main.c +++ b/dsp-block-test/main.c @@ -77,8 +77,8 @@ void init_codec(void) { void enable_dma_sport0(void) { *pDMA2_CONFIG = (*pDMA2_CONFIG | DMAEN); *pDMA1_CONFIG = (*pDMA1_CONFIG | DMAEN); - *pSPORT0_TCR1 = (*pSPORT0_TCR1 | TSPEN); - *pSPORT0_RCR1 = (*pSPORT0_RCR1 | RSPEN); + *pSPORT0_TCR1 = (*pSPORT0_TCR1 | TSPEN); + *pSPORT0_RCR1 = (*pSPORT0_RCR1 | RSPEN); } @@ -93,11 +93,10 @@ int main(void) { init_interrupts(); init_dma(); - module_init(); enable_dma_sport0(); - + // reset the codec init_codec(); diff --git a/dsp-block-test/module.c b/dsp-block-test/module.c index 24569cd2..f4edfbd4 100644 --- a/dsp-block-test/module.c +++ b/dsp-block-test/module.c @@ -25,5 +25,5 @@ void module_process_block(buffer_t *inChannels, buffer_t *outChannels, } } - osc_process_block(outChannels, numChannels, numFrames); + //osc_process_block(outChannels, numChannels, numFrames); }