User manual
DSM tutorials
• How fast does it need to run
• Can it function independently of the system clock frequency
• Can you perform multiple instantiations of the device driver
The size and speed of your device driver will be related to its complexity. If you require a device driver
that does a lot of work translating API functions to device commands you will have to trade this off
against hardware size or speed. This trade off can affect how you design your API, the more different
your API is to the device interface, the more complex (and therefore larger or slower) your device driver
is likely to become.
For your device driver to function independently of the system clock frequency you should use macros to
calculate the number of clock cycles for a required time delay from the system clock frequency. This is
demonstrated by the
RAM device driver example (see page 32).
The ability to create multiple instantiations of the device driver is useful for systems where several
copies of the same peripheral device are present. To achieve this you must limit the use of global
variables and Handel-C constructs which share hardware such as Handel-C functions. You can find a
description of Handel-C functions in the
Functions book in the DK online help. This is located under the
contents at:
DK Help>Handel-C Language Reference Manual>Functions and macros>Functions. The Flash
memory device driver example (see page 38) uses Handel-C macro procedures to implement a
device driver that can be instantiated multiple times.
3.4.1 Device driver design flow
The steps in this design flow are intended to give you a starting point for your own driver development;
they are not mandatory or comprehensive for all situations.
Step 1: Capture information about the target device
Use the manufacturers documentation to gather information about the target device. Essential
information includes:
• External connections to the device. Connection type (Input/Output/Tri-state) and technology
standard (LVTTL, CMOS, LVDS etc.)
• Device commands or operations, initialization routines
• Command timing, range of clocking frequencies if the device is synchronous
Read the schematics and any design notes available for your development system. You may find it
useful to create your own high-level block diagram which illustrates data and control flow between the
FPGA/PLD and your target device. List typical operations the programmer will want to perform with the
device.
Step 2: Prototype the API
Create a prototype API from your list of typical program operations. Include data type information,
decide if the API functions should be blocking or non-blocking.
Step 3: Implement Handel-C interface connections
Define Handel-C macro expressions for the pin names on your target FPGA which connect to the pins
on your peripheral device. Then define Handel-C interfaces to connect to your pins or busses. You can
find information about Handel-C interfaces in the DK online help: You can find a description of Handel-C
interfaces in the
Interfacing to logic or devices book in the DK online help. This is located under the
contents at:
DK Help>Handel-C Language Reference Manual>Interfacing to other logic or devices.
www.celoxica.com
Page 30