Specifications

Data Widths and the HAL Type Definitions
For embedded processors such as the Nios II processor, it is often important to know the exact width and
precision of data. Because the ANSI C data types do not explicitly define data width, the HAL uses a set of
standard type definitions instead. The ANSI C types are supported, but their data widths are dependent
on the compiler’s convention.
The header file alt_types.h defines the HAL type definitions.
Table 6-1: The HAL Type Definitions
Type Meaning
alt_8 Signed 8-bit integer.
alt_u8 Unsigned 8-bit integer.
alt_16 Signed 16-bit integer.
alt_u16 Unsigned 16-bit integer.
alt_32 Signed 32-bit integer.
alt_u32 Unsigned 32-bit integer.
alt_64 Signed 64-bit integer.
alt_u64 Unsigned 64-bit integer.
Table 6-2: GNU Toolchain Data Widths
Type Meaning
char 8 bits.
short 16 bits.
long 32 bits.
int 32 bits.
UNIX-Style Interface
The HAL API provides a number of UNIX-style functions. The UNIX-style functions provide a familiar
development environment for new Nios II programmers, and can ease the task of porting existing code to
run in the HAL environment. The HAL uses these functions primarily to provide the system interface for
the ANSI C standard library. For example, the functions perform device access required by the C library
functions defined in stdio.h.
The following list contains all of the available UNIX-style functions:
_exit()
close()
fstat()
getpid()
gettimeofday()
6-4
Data Widths and the HAL Type Definitions
NII5V2
2015.05.14
Altera Corporation
Developing Programs Using the Hardware Abstraction Layer
Send Feedback