forked from rhempel/umm_malloc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathumm_malloc.h
More file actions
51 lines (38 loc) · 1.67 KB
/
umm_malloc.h
File metadata and controls
51 lines (38 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// ----------------------------------------------------------------------------
// umm_malloc.h - a memory allocator for embedded systems (microcontrollers)
//
// See copyright notice in LICENSE.TXT
// ----------------------------------------------------------------------------
#ifndef UMM_MALLOC_H
#define UMM_MALLOC_H
// ----------------------------------------------------------------------------
// A couple of macros to make packing structures less compiler dependent
#define UMM_H_ATTPACKPRE
#define UMM_H_ATTPACKSUF __attribute__((__packed__))
// ----------------------------------------------------------------------------
// A couple of macros to make it easier to protect the memory allocator
// in a multitasking system. You should set these macros up to use whatever
// your system uses for this purpose. You can disable interrupts entirely, or
// just disable task switching - it's up to you
//
// NOTE WELL that these macros MUST be allowed to nest, because umm_free() is
// called from within umm_malloc()
#define UMM_CRITICAL_ENTRY()
#define UMM_CRITICAL_EXIT()
// ----------------------------------------------------------------------------
typedef struct UMM_HEAP_INFO_t {
unsigned short int totalEntries;
unsigned short int usedEntries;
unsigned short int freeEntries;
unsigned short int totalBlocks;
unsigned short int usedBlocks;
unsigned short int freeBlocks;
}
UMM_HEAP_INFO;
extern UMM_HEAP_INFO heapInfo;
extern char __umm_heap_start[];
extern char __umm_heap_end[];
extern size_t __umm_heap_size;
void *umm_info( void *ptr, int force );
// ----------------------------------------------------------------------------
#endif // UMM_MALLOC_H