diff options
| author | Lucian Copeland <hierophect@gmail.com> | 2020-04-15 10:29:05 -0400 |
|---|---|---|
| committer | Lucian Copeland <hierophect@gmail.com> | 2020-04-15 10:29:05 -0400 |
| commit | 54abfc2e8b88ed0dd1caaf3ac926466b0aba717a (patch) | |
| tree | b5154c84f807ee6ce3b0716b3a8d7b64dca46061 /supervisor/shared/memory.c | |
| parent | 0f87a75f4f0675ff55e31437907101226d5fb66b (diff) | |
| parent | ae549fc9da555778884ff64a2ffe45df0a5248db (diff) | |
translations-merge
Diffstat (limited to 'supervisor/shared/memory.c')
| -rwxr-xr-x | supervisor/shared/memory.c | 11 |
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; |
