User`s guide
5 Interrupt Support
matlabroot\toolbox\rtw\targets\xpc\target\build\
xpcblocks\thirdpartydrivers\
When modifying an existing hook file:
• Change the nam es of all of the functions to match those you have selected
for your board.
• Do not change the function signatures.
• Do not remove the
__cdecl string.
• The
PreHook and PostHook functions run with interrupts disab led. Do not
change the interrupt status in thes e functions.
When writing the interrupt functions, note the following:
• When an interrupt occurs, the kernel calls the
PreHook function.
Note This function is run with interrupts disabled. If this function cannot
turn off the interrupt, a n infinite loop will occur because the interrupt
service routine (ISR) will continuously call the
PreHook function.
• Because the PostHook function has limited use, you most likely do not need
to define this function. Set this function to
'NULL' if you do not need it.
• The generated code calls the
Start function during the startup phase of
model execution as the last action, after the model has called all
mdlStart
routines.
This function is typically used to enable interrupts from the board. The
target application is ready to accept interrupts a few microseconds after
this function is called. Do not try to enable interrupts from the board
mdlStart function.
• When a target application stops executing, the generated code calls the
Stop function first. Disable interrupts from the board in this function.
Filling in the Driver board Structure
This section describes how to fill in a driver board structure, element by
element.
5-10