Documentation

Before You Start

Introduction

This topic assumes that you satisfy the requirements outlined earlier in Expected Background and that you have reviewed the following sections to prepare:

It also assumes that you already have a board for which you want to write a driver. Before you start, use the following checklist to specify the driver you want to write:

  • Determine the functions of your board that you want to access with your driver.

  • Determine the bus type for the board.

    • PCI

    • ISA

  • Select the I/O access mapping type.

    • I/O port mapped

    • Memory address mapped

  • Select polling versus interrupt.

  • Specify the blocks for the drivers. Identify

    • Input and output ports

    • Mask parameters

    • Work variables to be shared between driver start, output, and terminate routines

  • Determine your timing considerations.

  • Decide whether you use Inlined functions.

    If yes, see the Target Language Compiler documentation of the Simulink® Coder™.

Driver Types

  • Standard I/O

  • Communication

  • DMA

  • Interrupt-driven

Bus Types and I/O Access

The Simulink Real-Time™ software supports two standard bus types: ISA and PCI.

A driver performs I/O accesses through either I/O ports or memory addresses (memory mapped) in a manner defined by the bus type.

ISA Bus

The ISA bus is a 16-bit bus with an 8-MHz clock. Another form of ISA bus is the PC/104. The driver performs I/O accesses as follows:

  • I/O ports — Use board switches or jumpers to select I/O port addresses and memory-mapped regions.

  • Memory addresses — Use only memory addresses between 0xA0000 and 0xFFFFF.

PCI Bus

The PCI bus is a 32-bit or 64-bit bus with a 33- MHz or 66-MHz clock. Another form of PCI bus is the PC/104+ (PC/104-Plus). The driver performs I/O accesses as follows:

  • I/O ports — Use the BIOS to determine the I/O port address during PCI PNP (Plug and Play) configuration.

  • Memory addresses — Use the upper memory address space, typically greater than 2 GB.

Register Access

A device board supports either I/O port or memory-mapped access to onboard registers. See the board manufacturer's register programming documentation.

Inlining Simulink Real-Time Drivers

You can choose to inline or not inline Simulink Real-Time drivers. Note the distinction between Simulink and Simulink Coder conditional compilation. If you implement a device driver as an inlined S-function, the driver can coexist with Simulink Real-Time device drivers.

Inlining drivers allows you to customize code generated from Simulink Coder. If you choose to create inlined drivers, you must use the Simulink Coder Target Language Compiler.

    Note:   For convenience, you can create a noninlined version of the driver first, and create an inlined driver for the Target Language Compiler from the first driver.

Was this topic helpful?