diff options
| author | Benjamin Shockley <benjaminshockley@hotmail.com> | 2020-08-20 13:48:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-20 13:48:15 -0500 |
| commit | 0084f0af24e4e219bc040c52ee723959423de6e2 (patch) | |
| tree | 1aebdb362f08bf6417caa87836e3e4e739afc964 /supervisor/memory.h | |
| parent | 9aebe2f1efc99871fcf283c304e3a8700050d736 (diff) | |
| parent | 4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff) | |
Merge pull request #2 from adafruit/master
Master
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 |
