O'Reilly logo

Embedded Software Development with eCos™ by Anthony J. Massa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.1. Overview

The HAL isolates architectural-dependent features and presents them in a general form to allow portability of other infrastructure components. Basically, the HAL is a software layer, with generalized Application Programming Interfaces (API), which encapsulates the specific hardware operations needed to complete the desired function.

An example that demonstrates how the HAL abstracts hardware-specific implementations for the same API call is shown in Code Listing 2.1 for the ARM architecture, and in Code Listing 2.2 for the PowerPC architecture.

Code Listing 2.1. ARM architecture implementation of HAL_ENABLE_INTERRUPTS() macro.
 1 #define HAL_ENABLE_INTERRUPTS() \ 2 asm volatile ( \ 3 "mrs r3,cpsr;" \ 4 "bic r3,r3,#0xC0;" \ 5 "msr ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required