CHAPTER 12

PREDESIGNED NIOS II I/O DRIVERS AND HAL API

Along with the set of commonly used I/O cores, Altera also provides predesigned device drivers and software libraries to access the underlying hardware. These drivers and libraries are integrated under the HAL (hardware abstraction layer) framework. HAL presents as a coherent interface and shields low-level details from application programs. In this chapter, we examine the basic concepts of HAL, discuss the software development process within this framework, and rewrite the flashing-LED program in Chapter 11 to illustrate its use.

12.1 OVERVIEW OF HAL

In Chapter 11, we demonstrate the derivation of simple ad hoc device drivers that match the specific requirements of the enhanced flashing-LED system. These device drivers need to be modified for each new application and will require a lot of time and effort. For many commonly used I/O peripherals, a better alternative is to develop a set of flexible and robust device drivers that can be shared by multiple applications. Altera provides a framework, known as HAL, for this purpose.

The role of HAL is somewhat murky since it does not fit any traditional paradigms. Altera literature vaguely refers to HAL as a lightweight run-time environment. To explain its role, we first examine two better understood paradigms and then point out the tasks performed by HAL.

image

Figure 12.1 Software hierarchy. ...

Get Embedded SoPC Design with Nios II Processor and Verilog Examples now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.