diff options
| author | Tangyuxin <[email protected]> | 2021-12-16 16:23:58 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-16 16:23:58 +0800 |
| commit | d724eed9fc09269c3c6e921c1f8b2df573508419 (patch) | |
| tree | 92f8528e0efbe28d4632692896d0bcaa2e45b3b6 /include/rtdef.h | |
| parent | 874f6c84f19f8ca24ebd00a9a95e7af02afc49a0 (diff) | |
分离内存分配接口与内存分配算法 (#5175)
* [kernel][mem] Multiple instances of small memory allocation algorithm
* [kernel][mem] Change small memory management algorithm memory header flag
* [kernel][mem] Fix assertion problem
* [kernel][slab] Multiple instances of slab memory management algorithm
* [kernel][memheap] Remove rt_malloc/rt_free/rt_realloc and other related memory interfaces
* [kernel][mem] Clean up memory space of small memory management objects
* [kernel][kservice] Add memory application interface and thread protection interface
* [kernel][kservice] Fix function return value problem
* [kernel][memheap] Optimize memheaptrace print
* [kernel][memheap] Support best mode
* [kernel][memory] Remove semaphore lock
* [kernel][memheap] Add locked flag
* [kernel][memory] Support malloc memory in interrupt
* [kernel][memheap] Add 'memheapcheck' cmd
* [kernel][mem] Fix failure to request full memory
* [kernel][memheap] Fix compilation warning
* [kernel][mem] Fix mem realloc ASSERT
* [examples][testcases] Add small mem testcase
* [examples][mem_tc] Modify test memory size
* [examples][testcases] Add slab memory management algorithm test case
* [examples][testcases] fix small memory management algorithm test case
* [kernel][memory] Adjusting memory allocation algorithm object definition and interface
* [kernel][memory] Fix compilation warning
* [examples][utest] Fix mem test case
* [examples][utest] fix slab test case
* [utest][testcases] Shorten test time
* [kernel][memory] Formatting code
* [examples][utest] Adjust test run time
* [examples][utest] Formatting code
* [bsp] update all rtconfig.h
Diffstat (limited to 'include/rtdef.h')
| -rw-r--r-- | include/rtdef.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/include/rtdef.h b/include/rtdef.h index 74db37555a..b45b304aa8 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -431,7 +431,8 @@ enum rt_object_class_type RT_Object_Class_Device = 0x09, /**< The object is a device. */ RT_Object_Class_Timer = 0x0a, /**< The object is a timer. */ RT_Object_Class_Module = 0x0b, /**< The object is a module. */ - RT_Object_Class_Unknown = 0x0c, /**< The object is unknown. */ + RT_Object_Class_Memory = 0x0c, /**< The object is a memory. */ + RT_Object_Class_Unknown = 0x0e, /**< The object is unknown. */ RT_Object_Class_Static = 0x80 /**< The object is a static object. */ }; @@ -817,11 +818,35 @@ typedef struct rt_messagequeue *rt_mq_t; /**@{*/ +#ifdef RT_USING_HEAP +/* + * memory structure + */ +struct rt_memory +{ + struct rt_object parent; /**< inherit from rt_object */ + const char * algorithm; /**< Memory management algorithm name */ + rt_ubase_t address; /**< memory start address */ + rt_size_t total; /**< memory size */ + rt_size_t used; /**< size used */ + rt_size_t max; /**< maximum usage */ +}; +typedef struct rt_memory *rt_mem_t; +#endif + /* * memory management * heap & partition */ +#ifdef RT_USING_SMALL_MEM +typedef rt_mem_t rt_smem_t; +#endif + +#ifdef RT_USING_SLAB +typedef rt_mem_t rt_slab_t; +#endif + #ifdef RT_USING_MEMHEAP /** * memory item on the heap @@ -860,6 +885,7 @@ struct rt_memheap struct rt_memheap_item free_header; /**< free block list header */ struct rt_semaphore lock; /**< semaphore lock */ + rt_bool_t locked; /**< External lock mark */ }; #endif |
