1. Basic principles of mempart
UC/OS-II divides memory space into multiple memory partitions as needed, each of which consists of memory blocks of the same size. It is mainly included in the C source file OS _mem.c.
- OS _ext OS _mem osmemtbl [OS _max_mem_part];
- OS _ext OS _mem * osmemfreelist;
- Mempart control block struct:
Typedef struct OS _men {
Void * osmemaddr ;//First address
Void * osmemfreelist ;//Start address of the free space in the Partition
Int32u osmemblksize ;//Size of the block member space in the Partition
Int32u osmemnblks ;//Number of Block Structures
Int32u osmemnfree ;//Number of remaining idle Blocks
Int8u osmemname [];
} OS _mem;
2. mempart management functions
- OS _mem * osmemcreate (void * ADDR, int32u nblks,
Int32u blksize, int8u * ERR );
- Void * osmemget (OS _mem * pmem, int8u * ERR );//Apply for memory partition Blocks
- Int8u osmemput (OS _mem * pmem, void * pblk );//Release memory partition Blocks
- Int8u osmemquery (OS _mem * pmem, OS _mem_data *);
- Int8u osmemnameget (OS _mem * pmem, int8u * pname, int8u * ERR );
- Int8u osmemnameset (OS _mem * pmem, int8u * pname, int8u * ERR );
3. Several Questions about mempart
(1) Can I apply for a heap space of 1 B at a time?
(2) uC/OS-II stack space and stack space when applying for what is different?