GPDMA (Direct Memory Access) and LLI (Link List Item) test see: http://mbed.org/users/okini3939/notebook/dma_jp/

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
okini3939
Date:
Fri Sep 13 15:19:09 2013 +0000
Parent:
0:de79d4a48e63
Commit message:
fix more lli

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Sep 13 14:49:52 2013 +0000
+++ b/main.cpp	Fri Sep 13 15:19:09 2013 +0000
@@ -1,10 +1,10 @@
 #include "mbed.h"
 #include "MODDMA.h"
 
-#define LLI_NUM 4
+#define LLI_NUM 5
 
 Serial pc(USBTX, USBRX);
-DigitalOut myled(LED1);
+DigitalOut myled(LED1), errled(LED4);
 
 MODDMA dma;
 MODDMA_Config *dmacfg;
@@ -18,28 +18,27 @@
     int i;
     MODDMA_Config *config = dma.getConfig();
 
+    myled = ! myled;
+
     for (i = 0; i < LLI_NUM; i ++) {
         dmadata[i][0] = '0' + dmacount;
     }
+
     dmacount ++;
-    if (dmacount >= 10) {
-        dma.Disable( (MODDMA::CHANNELS)config->channelNum() );
+    if (dmacount > 10) {
+        lli[LLI_NUM - 1]->Control = NULL;
     }
-/*
-    i = (dmacount & 1) ? 0 : 1;
-    if (dmacount < 5) {
-        dmadata[0][0] = '0' + dmacount;
-        dmadata[1][0] = '0' + dmacount;
-    } else {
-        dma.Disable( (MODDMA::CHANNELS)config->channelNum() );
-    }
-*/
+
     // Clear DMA IRQ flags.
     if (dma.irqType() == MODDMA::TcIrq) dma.clearTcIrq();    
     if (dma.irqType() == MODDMA::ErrIrq) dma.clearErrIrq();    
 }
 
 void err_callback () {
+    MODDMA_Config *config = dma.getConfig();
+
+    errled = 1;
+    dma.Disable( (MODDMA::CHANNELS)config->channelNum() );
 }