User`s guide
10 Targeting Custom Hardware
10-2
Introduction
This chapter contains information on targeting custom hardware and
implementing device driver blocks. By implementing your own blocks, you can
create a library to include blocks for your particular I/O devices.
Typically, to target custom hardware, you must:
• Create a main program for your target system to execute the generated code.
• Create a system target file. This the entry point for the TLC program used
to transform the models into generated code. The system target file can use
the block target files and TLC function library provided by The MathWorks.
Or you can create your own block target files and TLC function library.
• Create a template makefile to build your real-time executable.
• Write device drivers. Device drivers consist of a Simulink C MEX S-function
and, optionally, a corresponding target file to inline the device instructions.
This chapter provides information on:
• Targeting custom hardware
• Creating a device driver block
• The basic structure of a device driver S-function
• How to implement operations performed by a device driver
• Compiling a device driver as a MEX-file
• Masking a device driver block
Device driver blocks can be implemented as S-functions. This chapter assumes
that you are familiar with the Simulink C-MEX S-function format and API. See
the Simulink documentation for more information on S-functions.
You can implement device driver blocks in two ways:
1 As C language S-functions (with no TLC files provided). This is referred to
as a noninlined S-function.
2 As inlined S-functions (using TLC files).