Documentation

Custom I/O Drivers

Because of the unique requirements of your board, your board can require a custom driver. To meet this requirement, you can negotiate a nonrecurring engineering contract with Speedgoat to create a custom driver for your board. See www.speedgoat.com/products.

The remaining material applies only if you cannot contract with Speedgoat to create a custom driver for your board.

Custom Driver Prerequisites

If you are required to write a custom driver for your board, you need information such as the following:

  • The bus that the hardware is running on

  • Whether the driver must handle interrupts or DMA

  • Whether there are block parameters to configure

For a simple driver, Simulink® Real-Time™ provides an authoring tool xpcdrivertool to generate the basic files.

In a future release, the xpcdrivertool function will be removed.

In addition to xpcdrivertool, you need to call the following C/C++ functions:

For more on preparing your custom driver, see:

Standard I/O Bus Drivers

An important requirement on your custom driver is the bus with which the hardware is designed to work. Each bus protocol has its own requirements.

Masking Drivers

To configure the key parameters for your custom driver, you can provide a mask dialog box like the dialog boxes associated with Simulink blocks.

Interrupt Support

Some hardware boards produce interrupts that your custom driver must handle. For more information on handling interrupts in a custom driver, see Use Interrupts in Simulink Real-Time and Add Interrupt Support.

You need to implement one or more of these functions:

Simulink Real-Time Driver Authoring Tool

When you write a custom driver block, you need a framework from which to start. The Simulink Real-Time driver authoring tool xpcdrivertool generates template files for a simple device driver that does not perform DMA or interrupt processing:

  • C source code and include files

  • Simulink S-function file

  • Optional mask file

  • Optional TLC and MEX files that you can use to integrate your driver with Simulink

In a future release, the xpcdrivertool function will be removed.

See Also

Was this topic helpful?