aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/irq.c10
-rw-r--r--src/lib/mem.c25
-rw-r--r--src/sys/schedule.c4
-rw-r--r--src/util/status.c2
4 files changed, 35 insertions, 6 deletions
diff --git a/src/cpu/irq.c b/src/cpu/irq.c
index e195261..7b6ae7e 100644
--- a/src/cpu/irq.c
+++ b/src/cpu/irq.c
@@ -11,6 +11,7 @@
#include <util/status.h>
#include <util/time.h>
+void testfxn(void);
void handle_data(unsigned char);
void c_irq_handler(void)
@@ -115,11 +116,10 @@ void handle_data(unsigned char data)
cmd[off] = (char) data;
off += 1;
release_mutex(&exe_cnt_m, SYS_PID);
- // heap Info
- } else if (data == 0x69) {
+ } else if (data == 0x61) {
cmd[off] = (char) data;
off += 1;
- add_thread(heap_info, 0, 5);
+ add_thread(testfxn, 0, 3);
// Else output
} else {
cmd[off] = (char) data;
@@ -147,3 +147,7 @@ void handle_data(unsigned char data)
write_string(&g_Drawer, "> ");
write_string(&g_Drawer, cmd);
}
+
+void testfxn(void)
+{
+}
diff --git a/src/lib/mem.c b/src/lib/mem.c
index 82f7f45..2f50d3d 100644
--- a/src/lib/mem.c
+++ b/src/lib/mem.c
@@ -1,6 +1,8 @@
#include <drivers/uart.h>
#include <globals.h>
+#include <graphics/lfb.h>
#include <lib/mem.h>
+#include <sys/schedule.h>
void memcpyrot(unsigned char* src, struct RotBuffer* rb, unsigned int n)
{
@@ -246,6 +248,28 @@ void* heap_top(void)
return rpi_heap_top;
}
+void vheap_info(void)
+{
+ unsigned char* base = rpi_heap;
+ unsigned long ioff = STACK_DRAW_WIDTH*STACK_DRAW_SIZE;
+ unsigned long yoff = STACK_DRAW_YOFF;
+ draw_cbox(ioff, yoff, STACK_DRAW_SIZE*STACK_DRAW_WIDTH, STACK_DRAW_SIZE * 8, 0x0);
+ while ((void*)base < rpi_heap_top) {
+ unsigned char size = base[MEM_SIZE_OFFSET];
+ if(base[MEM_USE_OFFSET] == 0) {
+ draw_cbox(ioff, yoff, STACK_DRAW_SIZE, STACK_DRAW_SIZE, 0x00FF00);
+ } else {
+ draw_cbox(ioff, yoff, STACK_DRAW_SIZE, STACK_DRAW_SIZE, 0xFF0000);
+ }
+ ioff += STACK_DRAW_SIZE;
+ if(ioff % STACK_DRAW_WIDTH == 0) {
+ yoff += STACK_DRAW_SIZE;
+ ioff = STACK_DRAW_WIDTH*STACK_DRAW_SIZE;
+ }
+ base += size + MEM_META_SIZE;
+ }
+}
+
void heap_info(void)
{
unsigned char* base = rpi_heap;
@@ -254,6 +278,7 @@ void heap_info(void)
if(base[MEM_USE_OFFSET] == 0) {
uart_char('F');
uart_char(' ');
+ } else {
}
uart_hex((unsigned long)(base + MEM_BASE_SIZE));
uart_string(" Size: ");
diff --git a/src/sys/schedule.c b/src/sys/schedule.c
index ad7feec..0e9df78 100644
--- a/src/sys/schedule.c
+++ b/src/sys/schedule.c
@@ -52,9 +52,7 @@ struct RStack get_stack(void)
void draw_stacks(void)
{
unsigned long ioff = 0;
- unsigned long yoff = 320;
-#define STACK_DRAW_WIDTH 32
-#define STACK_DRAW_SIZE 3
+ unsigned long yoff = STACK_DRAW_YOFF;
for(int i = 0; i < MAX_THREADS; i++) {
if(stacks_table[i])
draw_cbox(ioff, yoff, STACK_DRAW_SIZE, STACK_DRAW_SIZE, 0xFFFFFF);
diff --git a/src/util/status.c b/src/util/status.c
index bb6dd68..155f016 100644
--- a/src/util/status.c
+++ b/src/util/status.c
@@ -2,6 +2,7 @@
#include <globals.h>
#include <graphics/drawer.h>
#include <graphics/lfb.h>
+#include <lib/mem.h>
#include <symbols.h>
#include <sys/core.h>
#include <sys/schedule.h>
@@ -181,4 +182,5 @@ void status(void)
g_Drawer.y = y;
draw_stacks();
+ vheap_info();
}