Files CCore/inc/sys/SysMemSpace.h CCore/src/sys/SysMemSpace.cpp
This part provides several memory allocation functions. These functions are used by XCore to allocate various purpose memory regions. They are all one-time called. A memory region must be aligned.
/* SysMemSpace.h */ #ifndef CCore_inc_sys_SysMemSpace_h #define CCore_inc_sys_SysMemSpace_h #include <CCore/inc/Gadget.h> namespace CCore { namespace Sys { /* functions */ // one-time call , aligned Space AllocHeapSpace(); Space AllocHeapSpace_int(); Space AllocHeapSpace_shared(); Space AllocLogSpace(); Space AllocVideoSpace(); } // namespace Sys } // namespace CCore #endif
AllocHeapSpace() returns the memory region for the main heap.
AllocHeapSpace_int() returns the memory region for the interrupt heap. This heap is also used for exception objects.
AllocHeapSpace_shared() returns the memory region for the shared heap. This memory is not cached and used to exchange data with peripheral devices.
AllocLogSpace() returns the memory for the system log.
AllocVideoSpace() return the memory for the video planes. If there is no video support on the board it can be empty.
The STD implementation is
/* SysMemSpace.cpp */ #include <CCore/inc/sys/SysMemSpace.h> #include <__std_init.h> namespace CCore { namespace Sys { /* functions */ Space AllocHeapSpace() { auto len=__std_get_heap_len(); void *mem=__std_alloc(len); return Space(mem,len); } Space AllocHeapSpace_int() { auto len=__std_get_heap_int_len(); void *mem=__std_alloc(len); return Space(mem,len); } Space AllocHeapSpace_shared() { return Space(__std_get_shared_mem(),__std_get_shared_mem_len()); } Space AllocLogSpace() { auto len=__std_get_syslog_len(); void *mem=__std_alloc(len); return Space(mem,len); } Space AllocVideoSpace() { return Space(__std_get_video_mem(),__std_get_video_mem_len()); } } // namespace Sys } // namespace CCore