User`s guide
Implementation Overview
8-13
Adding Device Driver Blocks
The real-time program communicates with the I/O devices installed in the
VxWorks target chassis via a set of device drivers. These device drivers contain
the necessary code that runs on the target processor for interfacing to specific
I/O devices.
To make device drivers easy to use, they are implemented as Simulink
S-functions using C code MEX-files. This means you can connect them to your
model like any other block and the code generator automatically includes a call
totheblock’sCcodeinthegeneratedcode.
You can also inline S-functions via the Target Language Compiler. Inlining
allows you to restrict function calls to only those that are necessary for the
S-function. This can greatly increase the efficiency of the S-function. For more
information about inlining S-functions, see Writing S-Functions and the Target
Language Compiler Reference Guide.
You can have multiple instances of device driver blocks in your model. See
Chapter 10, “Targeting Custom Hardware,” for more information about
creating device drivers.
Configuring the Template Makefile
To configure the VxWorks template, tornado.tmf, you must specify
information about the environment in which you are using VxWorks. This
section lists the lines in the file that you must edit.
VxWorks Configuration
To provide information used by VxWorks, you must specify the type of target
and the specific CPU on the target. The target type is then used to locate the
correct cross compiler and linker for your system.
The CPU type is used to define the
CPU macrowhichisinturnusedbymanyof
the VxWorks header files. Refer to the VxWorks Programmer’s Guide for
information on the appropriate values to use.
This information is in the section labeled
#-------------- VxWorks Configuration --------------