Documentation

Custom Driver

Procedures for creating custom driver blocks

Because of the unique requirements of your board, you can be required to write a custom driver for your board. To write a custom driver for your board, see Custom Simulink Real-Time Drivers.

Functions

slrtdrivertool Construct skeleton for custom driver

C/C++ API

xpcPCIDevice Type definition for PCI configuration space structure
xpcTime Type definition of time structure
xpcAllocPhysicalMemory Allocate physical memory
xpcBusyWait Wait for specified length of time in seconds
xpcFreePhysicalMemory Free physical memory
xpcGetElapsedTime Return time since system boot
xpcGetPCIDeviceInfo Return information for PCI device
xpcInpB Read 8-bit data from data register
xpcInpW Read 16-bit data from data register
xpcInpDW Read 32-bit data from data register
xpcIsModelInit Return real-time application load state
xpcOutpB Write 8-bit data to data register
xpcOutpW Write 16-bit data to data register
xpcOutpDW Write 32-bit data to data register
xpcReserveMemoryRegion Return virtual address that corresponds to physical address and mark region as readable/writable
xpcShowPCIDeviceInfo Display contents of PCIDevice structure
xpcSubtractTime Return difference between two times

Topics

Before You Start

Collect the bus, I/O, and register requirements for the custom board.

S-Function Guidelines

Write an S-function for a custom driver.

Accessing Registers

Write I/O space and memory-mapped register access functions for your driver.

Creating a Custom Driver

Create a generic device driver block.

Debugging Notes

Prepare for debugging your device driver.

Was this topic helpful?