| MIL 10 Reference
| Customize Help
| Save Settings

MfpgaHookFunction



See also
Availability
Available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Not supported on:
Not supported on Host system
Not supported on Matrox CronosPlus
Not supported on Matrox GPU processing driver
Not supported on Matrox GigE Vision driver
Not supported on Matrox IEEE 1394 IIDC driver
Not supported on Matrox Iris GT
Not supported on Matrox Morphis
Not supported on Matrox Morphis QxT
Not supported on Matrox Orion HD
Not supported on Matrox USB3 Vision driver (requires Update 19)
Not supported on Matrox Vio
Fully supported on:
Fully supported on Matrox Radient eCL
Fully supported on Matrox Radient eV-CXP
Fully supported on Matrox Solios eA/XA
Fully supported on Matrox Solios ecl/xcl/ev-cl

For any information regarding a MIL system added during a MIL Update, see the MIL system’s release note

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
None.
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
)
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
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse 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 l m p q r
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
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse 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 l m p q r
Collapse Value > 0

Specifies the function identifier of the required PU.

j k l m p q r
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
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse 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 l m p q r
Collapse 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 l m p q r
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
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse 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 l m p q r
Collapse 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 l m p q r
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
CollapseValue Description
MIL system-specific
tooltip (†)
Collapse 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 l m p q r
Collapse 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 l m p q r
Collapse 0x01 +

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

(summarize)
j k l m p q r
Collapse 0x02 +

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

j k l m p q r
Collapse 0x04 +

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

j k l m p q r
Collapse 0x08 +

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

j k l m p q r
Collapse 0x10 +

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

j k l m p q r
Collapse 0x20 +

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

j k l m p q r
Collapse 0x40 +

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

j k l m p q r
Combination constant 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
CollapseCombination value Description
MIL system-specific
tooltip (†)
Collapse M_UNHOOK

Unhooks a hooked function from the specified event.

j k l m p q r
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