summaryrefslogtreecommitdiff
path: root/supervisor/shared/memory.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-04-14 17:14:44 -0700
committerScott Shawcroft <scott@tannewt.org>2020-04-14 17:14:44 -0700
commitb580b34cbf1c48ef3de1dbeb5f44ec3d06b704af (patch)
tree9ec02ce5a6e78fb0383058972d09938813f39db3 /supervisor/shared/memory.c
parent7dfcae6067ee07ad644278a66aaa114759b181a8 (diff)
parent7ed1483b89d24bb4dd44f9c4c8271c438303b9fe (diff)
Merge remote-tracking branch 'adafruit/master' into lower_power
Diffstat (limited to 'supervisor/shared/memory.c')
-rwxr-xr-xsupervisor/shared/memory.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c
index 14c3b4979..d52334eb4 100755
--- a/supervisor/shared/memory.c
+++ b/supervisor/shared/memory.c
@@ -31,7 +31,7 @@
#include "supervisor/shared/display.h"
-#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT 8
+#define CIRCUITPY_SUPERVISOR_ALLOC_COUNT (12)
static supervisor_allocation allocations[CIRCUITPY_SUPERVISOR_ALLOC_COUNT];
// We use uint32_t* to ensure word (4 byte) alignment.
@@ -82,6 +82,15 @@ void free_memory(supervisor_allocation* allocation) {
allocation->ptr = NULL;
}
+supervisor_allocation* allocation_from_ptr(void *ptr) {
+ for (size_t index = 0; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) {
+ if (allocations[index].ptr == ptr) {
+ return &allocations[index];
+ }
+ }
+ return NULL;
+}
+
supervisor_allocation* allocate_remaining_memory(void) {
if (low_address == high_address) {
return NULL;