DMA library for the KL25Z

Dependents:   SimpleDMA_HelloWorld RTOS_SPI spiDMAtest Pinscape_Controller_v1 ... more

Introduction

SimpleDMA is a standard library for different DMA peripherals. Currently the LPC1768, KL46Z and KL25Z are supported. It provided one set of functions for different peripherals. It does not allow for usage of all the advanced functions, partially because the goal was to provide a simple interface, and partially because they are different for different microcontrollers.

Examples

Helloworld: http://mbed.org/users/Sissors/code/SimpleDMA_HelloWorld/

Example in a library (SPI): http://mbed.org/users/Sissors/code/RTOS_SPI/

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Thu Dec 26 16:31:54 2013 +0000
Parent:
3:34f5bf8adfa0
Child:
5:d9f46ef80e20
Commit message:
Always enable IRQ to finish the DMA transfer
; (Shouldn't be needed, but works for now)

Changed in this revision

SimpleDMA.h Show annotated file Show diff for this revision Revisions of this file
SimpleDMA_KL25.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/SimpleDMA.h	Thu Dec 26 12:19:29 2013 +0000
+++ b/SimpleDMA.h	Thu Dec 26 16:31:54 2013 +0000
@@ -110,13 +110,11 @@
 * @param function - function to call upon completion (may be a member function)
 */
 void attach(void (*function)(void)) {
-    irq_en = function;
     _callback.attach(function);
     }
     
 template<typename T>
     void attach(T *object, void (T::*member)(void)) {
-        irq_en = object;
         _callback.attach(object, member);
     }
 
@@ -152,7 +150,6 @@
 
 //IRQ handlers
 FunctionPointer _callback;
-bool irq_en;
 void irq_handler(void);
 
 static SimpleDMA *irq_owner[4];
--- a/SimpleDMA_KL25.cpp	Thu Dec 26 12:19:29 2013 +0000
+++ b/SimpleDMA_KL25.cpp	Thu Dec 26 16:31:54 2013 +0000
@@ -76,23 +76,17 @@
 }
 
 
-int SimpleDMA::start(int length) {
+int SimpleDMA::start(int length) {  
     if (auto_channel)
         _channel = getFreeChannel();
     else
         while(isBusy());
-        
-    DMA0->DMA[_channel].DSR_BCR |= DMA_DSR_BCR_DONE_MASK ;
     
     if (length > 0xFFFFF)
         return -1;
-    
-    if (irq_en) {
-        DCR |= (1UL<<31);
+
+    DCR |= (1UL<<31);
         irq_owner[_channel] = this;
-        }
-    else
-        DCR &= ~(1UL<<31);
     
     //Set registers:
     DMA0->DMA[_channel].SAR = SAR;