Specifications

developers. Device drivers communicate directly with hardware through low-level hardware access
macros.
For further details about the HAL, refer to the "Developing Programs Using the Hardware Abstraction
Layer" and "Developing Device Drivers for the Hardware Abstraction Layer" chapters.
Related Information
Developing Programs Using the Hardware Abstraction Layer on page 6-1
Developing Device Drivers for the Hardware Abstraction Layer on page 7-1
Generic Device Models
The HAL provides generic device models for classes of peripherals found in embedded systems, such as
timers, Ethernet MAC/PHY chips, and I/O peripherals that transmit character data. The generic device
models are at the core of the HAL’s power. The generic device models allow you to write programs using a
consistent API, regardless of the underlying hardware.
Device Model Classes
The HAL provides models for the following classes of devices:
Character-mode devices—Hardware peripherals that send and/or receive characters serially, such as a
UART.
Timer devices—Hardware peripherals that count clock ticks and can generate periodic interrupt
requests.
File subsystems—A mechanism for accessing files stored in physical device(s). Depending on the
internal implementation, the file subsystem driver might access the underlying device(s) directly or use
a separate device driver. For example, you can write a flash file subsystem driver that accesses flash
using the HAL API for flash memory devices.
Ethernet devices—Devices that provide access to an Ethernet connection for a networking stack such
as the Altera-provided NicheStack
®
TCP/IP Stack - Nios II Edition. You need a networking stack to
use an ethernet device.
Direct memory access (DMA) devices—Peripherals that perform bulk data transactions from a data
source to a destination. Sources and destinations can be memory or another device, such as an
Ethernet connection.
Flash memory devices—Nonvolatile memory devices that use a special programming protocol to store
data.
Benefits to Application Developers
The HAL defines a set of functions that you use to initialize and access each class of device. The API is
consistent, regardless of the underlying implementation of the device hardware. For example, to access
character-mode devices and file subsystems, you can use the C standard library functions, such as
printf() and fopen(). For application developers, you need not write low-level routines just to establish
basic communication with the hardware for these classes of peripherals.
Benefits to Device Driver Developers
Each device model defines a set of driver functions necessary to manipulate the particular class of device.
If you are writing drivers for a new peripheral, you need only provide this set of driver functions. As a
result, your driver development task is predefined and well documented. In addition, you can use existing
HAL functions and applications to access the device, which saves software development effort. The HAL
calls driver functions to access hardware. Application programmers call the ANSI C or HAL API to access
NII5V2
2015.05.14
Generic Device Models
5-3
Overview of the Hardware Abstraction Layer
Altera Corporation
Send Feedback