Sei sulla pagina 1di 2

Abstraction layer eases I/O integration

By Stephen McMillan can choose any SBC or I/O hardware device at a general or able one bus location to output
Chief Technologist product from a vendor, and abstract level rather than at a data to another. When an inter-
SBS Technologies Inc. they will all work together off- detailed hardware level. It func- rupt occurs, control is trans-
the-shelf, saving a lot of time tions like an API, but it resides ferred to the OS, which deter-
Device drivers are as critical to and money in software and at the device level, which is be- mines the action to be taken.
the operation of computer pe- hardware. low the standard API level. However, there are no naming
ripherals and external devices An abstraction layer acts as The abstraction layer can be conventions or arguments to
as electricity is to a light bulb. an interface within an OS, called from the OS kernel or enable or disable interrupts.
A device driver is a software sitting between SBCs and driv- from a device driver, but in ei- Plus, interrupts are handled
layer between a system’s appli- ers, allowing the OS to manipu- ther case, the calling program differently from one bus to an-
cations and the actual hardware late the hardware. As exten- interacts with the device in a other. Software code for inter-
device that an operating system sions of the OS, drivers enable more general way than it would rupts is usually written directly
(OS) uses to interact with, such applications to access hardware otherwise, providing the devel- into the BSP, which is limiting.
as a video display or network resources such as memory, I/O, oper with a key advantage— If the interrupt code is ex-
adapter. Device drivers make interrupts and device registers. device independence from the tracted into an abstraction layer
embedded hardware available with no specific hardware refer-
to the OS, while the application ences, it can have the flexibil-
determines the manner in ity to drive a wider variety of
which an embedded board will Application layer I/O hardware.
operate. In a DMA architecture,
With hundreds of single- which allows a peripheral to
board computers (SBCs) and read and write to memory with-
thousands of I/O cards in the out the intervention of a CPU,
market, there are few ready- a memory location accessed by
made I/O drivers. Hence, de- I/O driver Embedded OS an application maps a virtual
velopers are continually re- kernel address to real (physical)
questing vendor support for memory. During the course of
SBC-to-I/O integration. One BSP execution of an application, the
way to service developers’ re- abstraction same virtual address may be
quests is to have the application mapped to many different
designer send in its board sup- physical addresses as data and
port package (BSP) some soft- Board support package programs are paged out and
ware files along with its SBC paged in to other locations.
hardware so the device drivers There are no common calls
can be ported by the board ven- Hardware (SBC with I/O card) that assist with address transla-
dor. Another way is for the de- tions between virtual and physi-
signer to sign a non-disclosure cal addresses for various hard-
agreement with the embedded ware devices and as such, devel-
board vendor so that the source A series of rectangles shows an application on top followed by an OS opers need a file (abstraction
code for the device driver can kernel, I/O driver, abstraction layer, BSP and hardware. layer) to allow the DMA engine
be sent to the application de- to access those translations.
signer to write the I/O drivers. Missing from most BSPs, application and the OS. A fairly Once the address translations
In this case, the application de- though, is a set of well-defined typical depiction of a software have been resolved (using the
signer may have to wade routines to interface the SBC solution using abstraction will abstraction layer software),
through more than 100,000 motherboard with add-on I/O show a series of rectangles with data can be written to memory
lines of code to find their spe- hardware. an application layer on top, an in 16-, 32- and 64bit locations,
cific BSP calls. Either way, the Writing I/O drivers requires OS kernel I/O driver, abstrac- completing the transaction.
project is delayed. in-depth knowledge of the OS tion layer, BSP and hardware. The clock, an internal tim-
Alternatively, an abstraction internals, APIs and bus proto- ing device that feeds the CPU a
layer can be applied to the prob- cols, as well as of kernel-level Common routines certain number of pulses de-
lem of I/O drivers for SBCs. An debugging to ensure that the An abstraction layer generally pending on the speed of the
abstraction layer is a common code closest to the machine ac- deals with low-level hardware processor, can synchronize the
set of software routines that in- tivates I/O hardware directly and software issues (e.g. device- data pulses between sender and
terfaces the BSP and I/O and/or interfaces to another register programming, bus- receiver in a communications
driver, allowing a driver to be software layer to drive the I/O mastering attributes and timing device, keep track of the time of
written without needing any hardware. There are also prob- issues) that enable developers day, make this data available to
knowledge of the specific BSP, lems associated with untested to write drivers that support the software in a real-time ap-
underlying hardware or proces- hardware—some developers various OS. The same is true for plication and interrupt the
sor type. The use of an abstrac- may spend valuable time trying I/O drivers, with the major por- CPU at regular intervals so the
tion layer not only saves devel- to get the I/O driver to work tions of common routines for OS can divide its time between
opers time and money on when their problem is really I/O cards being those that active users and/or applica-
the integration of off-board with the hardware. handle interrupts, address tions, among other functions.
peripherals, it also evaluates An abstraction layer, inter- translation and clocking or Since processors run at differ-
different I/O products, OS face between the driver and timing functions. ent speeds, the number of
and SBCs. With device driver other software components, al- Interrupts, signals that get pulses or ticks/second is not a
interoperability, a customer lows an OS to interact with a the attention of the CPU, en- constant factor. An abstraction
layer that does not contain any any knowledge of processor porting file that contains the hardware requires a massive
processor-specific code can be types, the specific BSP or the abstraction routines that serve amount of time for anyone to
used for clocking functions, underlying hardware on which as a basis for the abstraction tackle. Using an abstraction
calling on an actual driver with it runs. Integrating a new piece layer for the new hardware. De- layer to interface I/O drivers
processor-specific information. of I/O hardware entails booting velopers can often use a code and SBCs will save customers
the SBC and downloading the from a similar SBC as a starting time and money on the integra-
Easy integration driver object with no compiling point for their abstraction layer tion of off-board peripherals.
The common routines enabled required. An abstraction-layer routine. Then, they can more efficiently
by the abstraction layer allow an approach facilitates the easy ad- In summary, writing drivers evaluate many other I/O prod-
I/O driver to be written without dition of new hardware with a for each and ever y piece of ucts, OS and SBCs.

Potrebbero piacerti anche