Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
nsdynmemLIB.h File Reference
Dynamical Memory API for library model. More...
Go to the source code of this file.
Data Structures | |
struct | mem_stat_t |
/struct mem_stat_t /brief Struct for Memory stats Buffer structure More... | |
Typedefs | |
typedef struct mem_stat_t | mem_stat_t |
/struct mem_stat_t /brief Struct for Memory stats Buffer structure | |
Enumerations | |
enum | heap_fail_t { NS_DYN_MEM_NULL_FREE, NS_DYN_MEM_DOUBLE_FREE, NS_DYN_MEM_ALLOCATE_SIZE_NOT_VALID, NS_DYN_MEM_POINTER_NOT_VALID, NS_DYN_MEM_HEAP_SECTOR_CORRUPTED, NS_DYN_MEM_HEAP_SECTOR_UNITIALIZED } |
Dynamically heap system failure call back event types. More... | |
Functions | |
void | ns_dyn_mem_init (uint8_t *heap, uint16_t h_size, void(*passed_fptr)(heap_fail_t), mem_stat_t *info_ptr) |
Init and set Dynamical heap pointer and length. | |
void | ns_dyn_mem_free (void *heap_ptr) |
Free allocated memory. | |
void * | ns_dyn_mem_temporary_alloc (int16_t alloc_size) |
Allocate temporary data. | |
void * | ns_dyn_mem_alloc (int16_t alloc_size) |
Allocate long period data. | |
const mem_stat_t * | ns_dyn_mem_get_mem_stat (void) |
Get pointer to the current mem_stat_t set via ns_dyn_mem_init. |
Detailed Description
Dynamical Memory API for library model.
Definition in file nsdynmemLIB.h.
Typedef Documentation
typedef struct mem_stat_t mem_stat_t |
/struct mem_stat_t /brief Struct for Memory stats Buffer structure
Enumeration Type Documentation
enum heap_fail_t |
Dynamically heap system failure call back event types.
- Enumerator:
NS_DYN_MEM_NULL_FREE ns_dyn_mem_free(), NULL pointer free [obsolete - no longer faulted]
NS_DYN_MEM_DOUBLE_FREE ns_dyn_mem_free(), Possible double pointer free
NS_DYN_MEM_ALLOCATE_SIZE_NOT_VALID Allocate size is 0 or smaller or size is bigger than max heap size.
NS_DYN_MEM_POINTER_NOT_VALID ns_dyn_mem_free(), try to free pointer which not at heap sector
NS_DYN_MEM_HEAP_SECTOR_CORRUPTED Heap system detect sector corruption.
NS_DYN_MEM_HEAP_SECTOR_UNITIALIZED ns_dyn_mem_free(), ns_dyn_mem_temporary_alloc() or ns_dyn_mem_alloc() called before ns_dyn_mem_init()
Definition at line 35 of file nsdynmemLIB.h.
Function Documentation
void* ns_dyn_mem_alloc | ( | int16_t | alloc_size ) |
Allocate long period data.
Space allocate started from end of the heap sector
- Parameters:
-
alloc_size Allocated data size
- Returns:
- 0, Allocate Fail
- >0, Pointer to allocated data sector.
Definition at line 18 of file FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/cs_nvm/test/test_cs_nvm_unit/unittest/stubs/nsdynmemLIB_stub.c.
void ns_dyn_mem_free | ( | void * | heap_ptr ) |
Free allocated memory.
- Parameters:
-
heap_ptr Pointer to allocated memory
- Returns:
- 0, Free OK
- <0, Free Fail
Definition at line 44 of file FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/cs_nvm/test/test_cs_nvm_unit/unittest/stubs/nsdynmemLIB_stub.c.
const mem_stat_t* ns_dyn_mem_get_mem_stat | ( | void | ) |
Get pointer to the current mem_stat_t set via ns_dyn_mem_init.
Get pointer to the statistics information, if one is set during the initialization. This may be useful for statistics collection purposes.
Note: the caller may not modify the returned structure.
- Returns:
- NULL, no mem_stat_t was given on initialization
- !=0, Pointer to mem_stat_t.
Definition at line 108 of file nsdynmemLIB.c.
void ns_dyn_mem_init | ( | uint8_t * | heap, |
uint16_t | h_size, | ||
void(*)(heap_fail_t) | passed_fptr, | ||
mem_stat_t * | info_ptr | ||
) |
Init and set Dynamical heap pointer and length.
- Parameters:
-
heap_ptr Pointer to dynamically heap buffer heap_size size of the heap buffer
- Returns:
- None
Definition at line 14 of file FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/cs_nvm/test/test_cs_nvm_unit/unittest/stubs/nsdynmemLIB_stub.c.
void* ns_dyn_mem_temporary_alloc | ( | int16_t | alloc_size ) |
Allocate temporary data.
Space allocate started from beginning of the heap sector
- Parameters:
-
alloc_size Allocated data size
- Returns:
- 0, Allocate Fail
- >0, Pointer to allocated data sector.
Definition at line 31 of file FEATURE_COMMON_PAL/nanostack-hal-mbed-cmsis-rtos/cs_nvm/test/test_cs_nvm_unit/unittest/stubs/nsdynmemLIB_stub.c.
Generated on Tue Jul 12 2022 17:35:03 by
