User manual

DSM tutorials
3 Platform Support Library tutorial
3.1 Introduction
A Platform Support Library (PSL) is a Handel-C library containing functions for communicating with
peripheral devices on an FPGA/PLD platform. A collection of functions for a particular device is referred
to as a device driver. The PSL tutorial guide describes techniques and considerations for implementing
device drivers in Handel-C, and thereby creating a PSL.
A device driver has two interfaces, one for the device and one for the application programmer. The
device interface is defined by the device manufacturer, whereas the Application Programmers Interface
(API) is defined by the author of the device driver. Where possible, a device driver presents an API
which is less complex than the device interface by encapsulating device command timing and command
sequences.
DEVICE DRIVER INTERFACES
3.2 Using PAL
The functions presented in a device driver API reflect the characteristics of the device. For example, an
API function which reads data from a device will return data of a specific bit-width that corresponds to
that device. Different devices that achieve the same purpose but have different characteristics (such as
data width) will have APIs that reflect these differences.
Celoxica’s Platform Abstraction Layer (PAL) offers a way to abstract over the differences in device driver
APIs. PAL sits between the application and the device driver layer and translates calls to functions in the
PAL API into the calls in the device drivers API.
USING PAL TO CREATE PORTABLE DEVICE DRIVERS
PAL performs generalization of device driver APIs with auxiliary functions that can report the device
characteristics from within an application. For example, there are PAL functions for determining the data
width of a resource.
When you write a device driver you should make the API specific to the device and then use PAL to
make the device driver compatible with existing portable applications.
www.celoxica.com
Page 28