update panel to use new memory pool
authorJim Morris <morris@wolfman.com>
Mon, 23 Dec 2013 05:13:40 +0000 (21:13 -0800)
committerJim Morris <morris@wolfman.com>
Mon, 23 Dec 2013 05:13:40 +0000 (21:13 -0800)
add free ahb ram to mem command

src/modules/utils/panel/panels/ST7565.cpp
src/modules/utils/panel/panels/rrdglcd/RrdGlcd.cpp
src/modules/utils/simpleshell/SimpleShell.cpp

index 1787f05..68e97ee 100644 (file)
@@ -8,7 +8,7 @@
 #include "ST7565.h"
 #include "ST7565/glcdfont.h"
 #include "Kernel.h"
-#include "ahbmalloc.h"
+#include "platform_memory.h"
 
 //definitions for lcd
 #define LCDWIDTH 128
@@ -77,14 +77,15 @@ ST7565::ST7565() {
     // reverse display
     this->reversed= THEKERNEL->config->value(panel_checksum, reverse_checksum)->by_default(false)->as_bool();
 
-    framebuffer= (uint8_t *)ahbmalloc(FB_SIZE, AHB_BANK_0); // grab some memoery from USB_RAM
+    framebuffer= (uint8_t *)AHB0.alloc(FB_SIZE); // grab some memoery from USB_RAM
     if(framebuffer == NULL) {
         THEKERNEL->streams->printf("Not enough memory available for frame buffer");
     }
 }
 
 ST7565::~ST7565() {
-       //delete this->spi;
+       delete this->spi;
+    AHB0.dealloc(framebuffer);
 }
 
 //send commands to lcd
index 8d36960..aa90a6f 100644 (file)
@@ -1,6 +1,6 @@
 #include "RrdGlcd.h"
 
-#include "ahbmalloc.h"
+#include "platform_memory.h"
 
 static const uint8_t font5x8[] = {
     // 5x8 font each byte is consecutive x bits left aligned then each subsequent byte is Y 8 bytes per character
@@ -151,7 +151,7 @@ RrdGlcd::RrdGlcd(PinName mosi, PinName sclk, Pin cs) {
      //chip select
     this->cs= cs;
     this->cs.set(0);
-    fb= (uint8_t *)ahbmalloc(FB_SIZE, AHB_BANK_0); // grab some memoery from USB_RAM
+    fb= (uint8_t *)AHB0.alloc(FB_SIZE); // grab some memoery from USB_RAM
     if(fb == NULL) {
         THEKERNEL->streams->printf("Not enough memory available for frame buffer");
     }
@@ -161,7 +161,7 @@ RrdGlcd::RrdGlcd(PinName mosi, PinName sclk, Pin cs) {
 
 RrdGlcd::~RrdGlcd() {
     delete this->spi;
-    ahbfree(fb, FB_SIZE);
+    AHB0.dealloc(fb);
 }
 
 void RrdGlcd::setFrequency(int freq) {
index 1b62c47..062e4cd 100644 (file)
@@ -21,6 +21,7 @@
 #include "modules/tools/temperaturecontrol/TemperatureControlPublicAccess.h"
 #include "modules/robot/RobotPublicAccess.h"
 #include "NetworkPublicAccess.h"
+#include "platform_memory.h"
 
 extern unsigned int g_maximumHeapAddress;
 
@@ -294,6 +295,8 @@ void SimpleShell::mem_command( string parameters, StreamOutput *stream)
     stream->printf("Unused Heap: %lu bytes\r\n", m);
 
     heapWalk(stream, verbose);
+
+    stream->printf("Free AHB0: %lu, AHB1: %lu\n", AHB0.free(), AHB1.free());
 }
 
 static uint32_t getDeviceType()