28 #ifndef SYSTEM_LIBRARIES_INC_OC_STDLIB_H_ 29 #define SYSTEM_LIBRARIES_INC_OC_STDLIB_H_ 38 #define malloc_array(type,array_size,flags) _malloc(sizeof(type)*array_size,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore) 40 #define malloc(size,flags) _malloc(size,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore) 41 #define free(address,flags) _free(address,flags) 43 #define rawmalloc(size,flags) _rawmalloc(size,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore) 44 #define rawfree(address,size) _rawfree(address,size) 46 #define smartalloc(size,flags) _smartalloc(size,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore) 47 #define smartfree(address,size,flags) _smartfree(address,size,flags) 49 #define kmalloc(size,allocator,flags) _kmalloc(size,allocator,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore,0) 50 #define kfree(address,flags) _kfree(address,flags) 52 #define kamalloc(size,allocator,flags,alignment) _kmalloc(size,allocator,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore,alignment) 53 #define kafree(address,flags) _kfree(address,flags) 55 #define krawmalloc(map,size,flags) _krawmalloc(map,size,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore) 56 #define krawfree(map,address,size) _krawfree(map,address,size) 58 #define ksmartalloc(size,allocator,flags) _ksmartalloc(size,allocator,oC_FUNCTION, __LINE__,flags | AllocationFlags_ReleaseOnlyInCore) 59 #define ksmartfree(address,size,flags) _ksmartfree(address,size,flags | AllocationFlags_ReleaseOnlyInCore) 61 #define isarrayinram(array,size) isbufferinram(array,size*sizeof(array[0])) 62 #define isarrayinrom(array,size) isbufferinrom(array,size*sizeof(array[0])) 63 #define isarraycorrect(array,size) isarrayinram(array,size) || isarrayinrom(array,size) 72 #define _________________________________________TYPES_SECTION______________________________________________________________________________ 88 MemoryEventFlags_NotError = 0x8000 ,
90 MemoryEventFlags_MemoryFault = (1<<0),
91 MemoryEventFlags_BusFault = (1<<1),
92 MemoryEventFlags_AllocationError = (1<<2),
93 MemoryEventFlags_ReleaseError = (1<<3),
94 MemoryEventFlags_PossibleMemoryLeak = (1<<4),
95 MemoryEventFlags_BufferOverflow = (1<<5),
96 MemoryEventFlags_MemoryAllocated = MemoryEventFlags_NotError | (1<<6),
97 MemoryEventFlags_MemoryReleased = MemoryEventFlags_NotError | (1<<7),
98 MemoryEventFlags_RawMemoryAllocated = MemoryEventFlags_NotError | (1<<8),
99 MemoryEventFlags_RawMemoryReleased = MemoryEventFlags_NotError | (1<<9),
100 MemoryEventFlags_ModuleTurningOff = (1<<10),
101 MemoryEventFlags_MemoryExhausted = (1<<11),
102 MemoryEventFlags_PanicMemoryExhausted = (1<<12),
103 MemoryEventFlags_DataSectionOverflow = (1<<13),
104 MemoryEventFlags_ExternalMemoryExhausted = (1<<14),
105 MemoryEventFlags_PanicExternalMemoryExhausted = (1<<15),
107 MemoryEventFlags_AllErrors = 0x7FFF ,
108 MemoryEventFlags_All = 0xFFFF ,
109 } MemoryEventFlags_t;
120 AllocationFlags_Default = 0 ,
121 AllocationFlags_ZeroFill = 1<<0 ,
122 AllocationFlags_NoWait = 1<<1 ,
123 AllocationFlags_CanWait500Msecond = 1<<2 ,
124 AllocationFlags_CanWait1Second = 1<<3 ,
125 AllocationFlags_CanWaitForever = 1<<4 ,
126 AllocationFlags_ForceBlock = 1<<5 ,
127 AllocationFlags_UseExternalRam = 1<<6 ,
128 AllocationFlags_UseInternalRam = 1<<7 ,
129 AllocationFlags_UseDmaRam = 1<<8 ,
130 AllocationFlags_DmaRamFirst = 1<<8 ,
131 AllocationFlags_InternalRamFirst = 0<<9 ,
132 AllocationFlags_ExternalRamFirst = 1<<9 ,
133 AllocationFlags_ReleaseOnlyInCore = 1<<10,
149 typedef void (*MemoryEventHandler_t)(
void * Address , MemoryEventFlags_t Event,
const char * Function, uint32_t LineNumber );
175 typedef struct _HeapMap_t * oC_HeapMap_t;
186 #undef _________________________________________TYPES_SECTION______________________________________________________________________________ 194 #define _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________ 196 extern void * _malloc ( oC_UInt_t Size ,
const char * Function , uint32_t LineNumber , AllocationFlags_t Flags );
197 extern bool _free (
void * Address , AllocationFlags_t Flags );
199 extern void * _rawmalloc ( oC_UInt_t Size ,
const char * Function , uint32_t LineNumber , AllocationFlags_t Flags);
200 extern bool _rawfree (
void * Address , oC_UInt_t Size);
202 extern void * _kmalloc ( oC_UInt_t Size , Allocator_t
Allocator ,
const char * Function , uint32_t LineNumber , AllocationFlags_t Flags , oC_UInt_t Alignment );
203 extern bool _kfree (
void * Address , AllocationFlags_t Flags );
205 extern void * _krawmalloc ( oC_HeapMap_t Map , oC_UInt_t Size ,
const char * Function , uint32_t LineNumber , AllocationFlags_t Flags );
206 extern bool _krawfree ( oC_HeapMap_t Map ,
void * Address , oC_UInt_t Size );
208 extern void * _smartalloc ( oC_UInt_t Size ,
const char * Function , uint32_t LineNumber , AllocationFlags_t Flags );
209 extern bool _smartfree (
void * Address , oC_UInt_t Size , AllocationFlags_t Flags );
211 extern void * _ksmartalloc ( oC_UInt_t Size , Allocator_t
Allocator ,
const char * Function , uint32_t LineNumber , AllocationFlags_t Flags);
212 extern bool _ksmartfree (
void * Address , oC_UInt_t Size , AllocationFlags_t Flags);
214 extern bool isram (
const void * Address );
215 extern bool isrom (
const void * Address );
217 extern bool isbufferinram (
const void * Buffer , oC_UInt_t Size );
218 extern bool isbufferinrom (
const void * Buffer , oC_UInt_t Size );
220 extern bool isaddresscorrect (
const void * Address );
222 #undef _________________________________________INTERFACE_FUNCTIONS_SECTION________________________________________________________________ The file with interface for the GPIO driver.
identifier for allocations
The file contains definitions for the compiler, that helps to manage errors, etc. ...
MemoryEventHandler_t EventHandler
static const oC_Allocator_t Allocator
MemoryEventFlags_t EventFlags