Memory Management API Changes

The table below shows the difference in API for memory management.

Memory Management API

µC/OS-II (os_mem.c)

µC/OS-III (os_mem.c)

Note

OS_MEM *
OSMemCreate(
    void         *addr,
    INT32U        nblks,
    INT32U        blksize,
    INT8U        *perr);
void
OSMemCreate(
    OS_MEM      *p_mem,
    CPU_CHAR    *p_name,
    void        *p_addr,
    OS_MEM_QTY   n_blks,
    OS_MEM_SIZE  blk_size,
    OS_ERR      *p_err);

(1)        

void *
OSMemGet(
    OS_MEM       *pmem,
    INT8U        *perr);
void *
OSMemGet(
    OS_MEM      *p_mem,
    OS_ERR      *p_err);

INT8U
OSMemNameGet(
    OS_MEM       *pmem,
    INT8U       **pname,
    INT8U        *perr);


void
OSMemNameSet(
    OS_MEM       *pmem,
    INT8U        *pname,
    INT8U        *perr);
void 
OSMemPut(
    OS_MEM      *p_mem,
    void        *p_blk,
    OS_ERR      *p_err);

(2)

INT8U
OSMemPut(
    OS_MEM       *pmem,
    void         *pblk);


INT8U
OSMemQuery(
    OS_MEM       *pmem,
    OS_MEM_DATA  *p_mem_data);

(3)

(1) In µC/OS-II, OSMemCreate() returns the address of an OS_MEM object, which is used as the “handle” to the newly created memory partition. In µC/OS-III, the application must allocate storage for an OS_MEM, which serves the same purpose. The benefit in µC/OS-III is that it is not necessary to predetermine the number of memory partitions at compile time.

(2) µC/OS-III does not need an OSMemNameSet() since the name of the memory partition is passed as an argument to OSMemCreate().

(3) µC/OS-III does not support query calls.