Specifications
Macro Defined in
Header
MicroC/OS-II Implementation Single-Threaded
HAL Implementa‐
tion
ALT_FLAG_POST(group,
flags, opt)
os/alt_flag.h Call OSFlagPost() with the first
three input arguments set to
group, flags, and opt respectively.
The error code is the return value
of the macro.
Return 0
(success)
ALT_SEM(sem) os/alt_sem.h Create an OS_EVENT pointer with
the name sem.
Empty
statement
ALT_EXTERN_SEM(sem) os/alt_sem.h Create an external reference to an
OS_EVENT pointer with the name
sem.
Empty
statement
ALT_STATIC_SEM(sem) os/alt_sem.h Create a static OS_EVENT pointer
with the name sem.
Empty
statement
ALT_SEM_CREATE(sem,
value)
os/alt_sem.h Call OSSemCreate() with the
argument value to initialize the
OS_EVENT pointer sem. The return
value is zero on success, or
negative otherwise.
Return 0
(success)
ALT_SEM_PEND(sem,
timeout)
os/alt_sem.h Call OSSemPend() with the first
two argument set to sem and
timeout respectively. The error
code is the return value of the
macro.
Return 0
(success)
ALT_SEM_POST(sem) os/alt_sem.h Call OSSemPost() with the input
argument sem.
Return 0
(success)
The newlib ANSI C Standard Library
Programs based on MicroC/OS-II can also call the ANSI C standard library functions. Some
consideration is necessary in a multi-threaded environment to ensure that the C standard library
functions are thread-safe. The newlib C library stores all global variables in a single structure referenced
through the pointer _impure_ptr. However, the Altera MicroC/OS-II implementation creates a new
instance of the structure for each task. During a context switch, the value of _impure_ptr is updated to
point to the current task's version of this structure. In this way, the contents of the structure pointed to by
_impure_ptr are treated as thread local. For example, through this mechanism each task has its own
version of errno.
This thread-local data is allocated at the top of the task’s stack. You must make allowance for thread-local
data storage when allocating memory for stacks. In general, the _reent structure consumes approximately
900 bytes of data for the normal C library, or 90 bytes for the reduced-footprint C library.
For more information about the contents of the _reent structure, refer to the newlib documentation. On
the Windows Start menu, click Programs > Altera > Nios II > Nios II Documentation.
NII5V2
2015.05.14
The newlib ANSI C Standard Library
10-5
MicroC/OS-II Real-Time Operating System
Altera Corporation
Send Feedback