User`s guide
Generating Custom Driver Templates
Note Use the xPC Target Driver Authoring Tool to build the C Mex file if
you have not edited the C source code file (
testdriver.c). If you have edited
thisfileandwanttokeepthosechange s, do not use the xPC T arget Driver
Authoring Tool to build the driver. Doing so overwrites your changes to the
C source code. Instead, use the
mex function (see “Creating a C ME X File
UsingthemexFunction”onpage7-9).
Creating a C MEX File Using the xPC Target Authoring Tool
1 In the xPC Target Driver Authoring Tool, click the Main tab.
2 Select Generate block and mask.
3 Click the Build button.
Thetoolcreatesthefile
sfcn_testdriver.mexw32.
Creating a C MEX File Using the mex Function
1 In the MATLA B Command W indow, c hange directory to the one that
contains the d river files.
2 Compile and l in k the MEX-file. For example:
mex sfcn_testdriver.c tes tdri ver.c
This function creates the sfcn_testdriver.win32mex file.
Customizing the Device Driver Mask
The xPC Target Driver Authoring Tool creates a mask for the device driver.
You can customize this block mask as described in Chapter 4, “Masking
Drivers”. If you customize the mask, do not use the x PC Target Driv er
Authoring Tool aga i n to build your fil es . Doing so overwrites the driver files
and you will lose your mask customizations.
7-9