MODSERIAL with support for KL25Z + RTOS (beta, putc + puts currently)

Dependents:   kl25z_USB_4

Fork of MODSERIAL by Erik -

Files at this revision

API Documentation at this revision

Comitter:
AjK
Date:
Tue Mar 08 01:42:25 2011 +0000
Parent:
16:8b1dbf4cce4e
Child:
18:21ef26402365
Commit message:
1.17 See ChangeLog.c

Changed in this revision

ChangeLog.c Show annotated file Show diff for this revision Revisions of this file
MODSERIAL.h Show annotated file Show diff for this revision Revisions of this file
--- a/ChangeLog.c	Sat Feb 12 08:59:03 2011 +0000
+++ b/ChangeLog.c	Tue Mar 08 01:42:25 2011 +0000
@@ -1,5 +1,8 @@
 /* $Id:$
 
+1.17   08/Mar/2011
+       Fixed a memory leak in the DMA code.
+       
 1.16 - 12 Feb 2011
     
     * Missed one, doh!
--- a/MODSERIAL.h	Sat Feb 12 08:59:03 2011 +0000
+++ b/MODSERIAL.h	Tue Mar 08 01:42:25 2011 +0000
@@ -820,6 +820,8 @@
     
 #ifdef MODDMA_H
 
+    MODDMA_Config *config;
+    
     /**
      * Set the "void pointer" moddma_p to be a pointer to a
      * MODDMA controller class instance. Used to manage the
@@ -855,7 +857,7 @@
             case 3: conn = MODDMA::UART3_Tx; break;
         }
         
-        MODDMA_Config *config = new MODDMA_Config;
+        config = new MODDMA_Config;
         config
          ->channelNum    ( (MODDMA::CHANNELS)(dmaSendChannel & 0x7) )
          ->srcMemAddr    ( (uint32_t) buffer )
@@ -867,7 +869,7 @@
         ; // config end
         
         // Setup the configuration.
-        if (dma->Setup(config) != MODDMA::Ok) {
+        if (dma->Setup(config) == 0) { 
             return -1;
         }
         
@@ -920,6 +922,7 @@
         if (dma->irqType() == MODDMA::ErrIrq) dma->clearErrIrq();
         dmaSendChannel = -1;
         _isrDmaSendComplete.call();
+        delete(config);
     }
     
 #endif // MODDMA_H