...
void *OSMemGet (OS_MEM *p_mem,
...
OS_ERR *p_err)
...
...
File |
...
...
Called from |
...
Code enabled by |
...
...
|
...
...
Task or ISR |
...
|
Anchor
OSMemGet()
obtains a memory block from a memory partition. It is assumed that the application knows the size of each memory block obtained. Also, the application must return the memory block [using OSMemPut()
] to the same memory partition when it no longer requires it. OSMemGet()
may be called more than once until all memory blocks are allocated.Arguments
...
p_mem
Anchor
is a pointer to the desired memory partition control block.
Anchor
p_err
is a pointer to a variable that holds an error code:
...
class | WebWorks_Indent_1 |
---|
...
OS_ERR_NONE
...
...
class | WebWorks_Indent_2 |
---|
...
if a memory block is available and returned to the application.
...
class | WebWorks_Indent_1 |
---|
...
OS_ERR_MEM_INVALID_P_MEM
...
class | WebWorks_Indent_2 |
---|
...
if OS_CFG_ARG_CHK_EN
is set to 1
in os_cfg.h
: if p_mem
is a NULL
pointer.
...
class | WebWorks_Indent_1 |
---|
...
...
OS_ERR_MEM_NO_FREE_BLKS
...
class | WebWorks_Indent_2 |
---|
...
...
if the memory partition does not contain additional memory blocks to allocate.
...
...
Returned Value
Anchor
OSMemGet()
returns a pointer to the allocated memory block if one is available. If a memory block is not available from the memory partition, OSMemGet()
returns a NULL
pointer. It is up to the application to “cast” the pointer to the proper data type since OSMemGet()
returns a void *
.anchorNotes/Warnings
...
...
Example
...
rowspan | 14 |
---|
...