| Customize Help
| Save Settings

MfpgaHookFunction



Function Map
Synopsis
Hook a function to an event generated by a PU on a target system.
Syntax
void MfpgaHookFunction(
MIL_ID MilSystemId, //in
MIL_INT DeviceNumber, //in
MIL_INT FunctionId, //in
MIL_INT SubFunctionId, //in
MIL_INT64 FunctionNumber, //in
MIL_INT HookType, //in
MIL_FPGA_HOOK_FUNCTION_PTR HookHandlerPtr, //in
void *UserDataPtr //in-out
)
Description

This function allows you to attach or detach a user-defined function to an event generated by a specified PU in the FPGA configuration loaded in a Processing FPGA on a target system. Once a hook-handler function is defined and hooked to an event, it is automatically called when the event occurs. You can only hook one function to an event; additional hooks that are attached to the same event will not be handled.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
MilSystemId

Specifies the identifier of the system that has the required Processing FPGA.

DeviceNumber

Specifies the Processing FPGA on the system which has the required PU. This parameter must be set to the following value:

function map For specifying the rank of the Processing FPGA
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_DEVn

Specifies the rank of the Processing FPGA on the board, where n can be a value between 0 and the total number of Processing FPGAs-1.

j k
M10
l m p r
U27
y
U75
aa
FunctionId

Specifies the function identifier of the PU. The function identifier is specified in the header of the target PU's FPGA register file. For the function identifiers of Matrox PUs, see the Matrox FPGA Component Reference. Note that the range of custom PU function identifiers is between 0xFC00 and 0xFDFF, inclusive. This parameter can be set to one of the following values:

function map For specifying the function identifier
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_DEFAULT

Specifies the default function identifier. You can specify M_DEFAULT if the HookType parameter is set to M_INTERRUPT_OVERRUN.

(summarize)
j k
M10
l m p r
U27
y
U75
aa
Click to summarize Value > 0

Specifies the function identifier of the required PU.

j k
M10
l m p r
U27
y
U75
aa
SubFunctionId

Specifies the subfunction identifier of the PU. Several different Matrox PUs can exist, each with slightly different optimizations, functionalities, or restrictions. Each variation is given a number called a subfunction identifier that uniquely identifies the variation. The subfunction identifier is specified in the header of the target PU's FPGA register file. You can set this parameter to one of the following:

function map For specifying the subfunction identifier
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_DEFAULT

Specifies the default subfunction identifier. Use this setting if the instances of the PU with the specified function identifier in your FPGA configuration all have the same subfunction identifier. You should also use this setting if you are using a custom PU.

(summarize)
j k
M10
l m p r
U27
y
U75
aa
Click to summarize Value > 0

Specifies the subfunction identifier of the required PU. For the subfunction identifiers of Matrox PUs, see the Matrox FPGA Component Reference.

(summarize)
j k
M10
l m p r
U27
y
U75
aa
FunctionNumber

Specifies the specific PU instance on which to hook a function if two or more instances are present in the FPGA configuration, loaded on the Processing FPGA. This parameter can be set to the following value:

function map For specifying the rank of a PU
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_DEFAULT

Specifies the default instance of a PU on which to hook a function. You can specify M_DEFAULT if you have selected M_INTERRUPT_OVERRUN as your HookType.

(summarize)
j k
M10
l m p r
U27
y
U75
aa
Click to summarize M_DEVn

Specifies the rank of the PU in the FPGA configuration loaded on the Processing FPGA, where n represents the specific PU instance and starts at 0. The higher the instance's base address, the higher the index.

(summarize)
j k
M10
l m p r
U27
y
U75
aa
HookType

Specifies the Processing FPGA event type. Note that the event type count starts at 0x1, whereas interrupts are numbered starting at 0.

This parameter can be set to one of the following:

function map For specifying the Processing FPGA event type
Click to summarizeValue Description MIL system-specific
tooltip (‡)
Click to summarize M_END_OF_PROCESSING +

Calls the hook-handler function whenever the specified PU generates an end-of-processing interrupt (or an interrupt on interrupt 0).

j k
M10
l m p r
U27
y
U75
aa
Click to summarize M_INTERRUPT_OVERRUN +

Calls the hook-handler function if the end-of-processing interrupt is signaled before the previous one is serviced by the driver.

j k
M10
l m p r
U27
y
U75
aa
Click to summarize 0x01 +

Calls the hook-handler function if the PU's interrupt 0 is raised. Same as M_END_OF_PROCESSING.

(summarize)
j k
M10
l m p r
U27
y
U75
aa
Click to summarize 0x02 +

Calls the hook-handler function if the PU's interrupt 1 is raised.

j k
M10
l m p r
U27
y
U75
aa
Click to summarize 0x04 +

Calls the hook-handler function if the PU's interrupt 2 is raised.

j k
M10
l m p r
U27
y
U75
aa
Click to summarize 0x08 +

Calls the hook-handler function if the PU's interrupt 3 is raised.

j k
M10
l m p r
U27
y
U75
aa
Click to summarize 0x10 +

Calls the hook-handler function if the PU's interrupt 4 is raised.

j k
M10
l m p r
U27
y
U75
aa
Click to summarize 0x20 +

Calls the hook-handler function if the PU's interrupt 5 is raised.

j k
M10
l m p r
U27
y
U75
aa
Click to summarize 0x40 +

Calls the hook-handler function if the PU's interrupt 6 is raised.

j k
M10
l m p r
U27
y
U75
aa
Combination value for the values listed in For specifying the Processing FPGA event type.

You can add the following value to the above-mentioned values to specify to unhook a function.

function map For unhooking a function
Click to summarizeCombination value Description MIL system-specific
tooltip (‡)
Click to summarize M_UNHOOK

Unhooks a hooked function from the specified event.

j k
M10
l m p r
U27
y
U75
aa
HookHandlerPtr

Specifies the address of the function that should be called when an event occurs.

The hook-handler function, pointed to by HookHandlerPtr, must be declared as follows:

MIL_INT MFTYPE HookHandler(
MIL_INT HookType,
MIL_ID EventId,
void *UserDataPtr
)

Parameters
HookType

Type of event hooked.

EventId

Event identifier to pass to MfpgaGetHookInfo() when inquiring about the hooked event.

UserDataPtr

Data pointer that was passed to MfpgaHookFunction().

Note that the HookHandlerPtr function can have any name.

Upon successful completion, the hook-handler function should return M_NULL. Note, MFTYPE and MFPGAHOOKFCTPTR are reserved MIL predefined types for functions and data pointers, respectively.

UserDataPtr

Specifies the address of the user data that you want to make available to the hook-handler function. This address is passed to the hook-handler function, through its UserDataPtr parameter, when the specified event occurs. Set this parameter to M_NULL if not used.

Compilation information
Header Include mil.h; milfpga.h.
Library Use mil.lib; milfpga.lib.
DLL Requires mil.dll; milfpga.dll.
DEVn DEFAULT DEFAULT DEFAULT DEVn END OF PROCESSING INTERRUPT OVERRUN UNHOOK M_DEVn M_DEVn