Specifications

Related Information
Developing Device Drivers for the Hardware Abstraction Layer
For more information about developing device drivers.
Developing Device Drivers for the Hardware Abstraction Layer
For more information about developing device drivers.
Nios II Software Build Tools on page 4-1
For more information about specifying file paths with the Nios II SBT, refer to "Nios II Embedded
Software Projects".
Thread-Safe HAL Drivers
To enable a driver to be ported between the HAL and MicroC/OS-II environments, Altera defines a set of
operating system-independent macros that provide access to operating system facilities. These macros
implement functionality that is only relevant to a multi-threaded environment. When compiled for a
MicroC/OS-II project, the macros expand to MicroC/OS-II API calls. When compiled for a single-
threaded HAL project, the macros expand to benign empty implementations. These macros are used in
Altera-provided device driver code, and you can use them if you need to write a device driver with similar
portability.
For more information about the functionality in the MicroC/OS-II environment, refer to MicroC/OS-II:
The Real-Time Kernel.
The path listed for the header file is relative to the <Nios II EDS install path>/components/micrium_uc_osii/
UCOSII/inc directory.
Table 10-1: OS-Independent Macros for Thread-Safe HAL Drivers
Macro Defined in
Header
MicroC/OS-II Implementation Single-Threaded
HAL Implementa‐
tion
ALT_FLAG_GRP(group) os/alt_flag.h Create a pointer to a flag group
with the name group.
Empty
statement
ALT_EXTERN_FLAG_
GRP(group)
os/alt_flag.h Create an external reference to a
pointer to a flag group with name
group.
Empty
statement
ALT_STATIC_FLAG_
GRP(group)
os/alt_flag.h Create a static pointer to a flag
group with the name group.
Empty
statement
ALT_FLAG_CREATE(group,
flags)
os/alt_flag.h Call OSFlagCreate() to initialize
the flag group pointer, group, with
the flags value flags. The error
code is the return value of the
macro.
Return 0
(success)
ALT_FLAG_PEND(group,
flags, wait_type,
timeout)
os/alt_flag.h Call OSFlagPend() with the first
four input arguments set to group,
flags, wait_type, and timeout
respectively. The error code is the
return value of the macro.
Return 0
(success)
10-4
Thread-Safe HAL Drivers
NII5V2
2015.05.14
Altera Corporation
MicroC/OS-II Real-Time Operating System
Send Feedback