diff options
Diffstat (limited to 'supervisor/memory.h')
| -rwxr-xr-x | supervisor/memory.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/supervisor/memory.h b/supervisor/memory.h index 4f8317a2d..f4359ca46 100755 --- a/supervisor/memory.h +++ b/supervisor/memory.h @@ -39,8 +39,11 @@ typedef struct { uint32_t length; // in bytes } supervisor_allocation; + + void memory_init(void); void free_memory(supervisor_allocation* allocation); +supervisor_allocation* allocation_from_ptr(void *ptr); supervisor_allocation* allocate_remaining_memory(void); // Allocate a piece of a given length in bytes. If high_address is true then it should be allocated @@ -48,4 +51,14 @@ supervisor_allocation* allocate_remaining_memory(void); // statically allocated memory. supervisor_allocation* allocate_memory(uint32_t length, bool high_address); +static inline uint16_t align32_size(uint16_t size) { + if (size % 4 != 0) { + return (size & 0xfffc) + 0x4; + } + return size; +} + +// Called after the heap is freed in case the supervisor wants to save some values. +void supervisor_move_memory(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_MEMORY_H |
