| Customize Help

Issuing commands to the Processing FPGA and retrieving results

Once you have specified register settings, source and destination image buffers, register result retrieval requests, and optionally linked information for each command context, you must queue the command(s), defined by these contexts, on the thread's system command queue using MfpgaCommandQueue(). Once on the queue, the commands will be executed in first-in first-out order as the Processing FPGA resources become available. Note that two commands can typically run at the same time if they don't reference the same buffers and they use different FPGA components that can access these buffers using different paths.

For linked command contexts, you will have to combine the commands, defined by these contexts, into a complex command once you are ready to queue them. You combine commands into a complex command by queuing all linked commands, except the last, using MfpgaCommandQueue() with M_WAIT. Then you should add the last command to the complex command using MfpgaCommandQueue() with M_DISPATCH; this closes the complex command and queues it on the system command queue.

The following example shows how to link two command contexts and then combine these commands into a complex command.

/* Output0 of the OffsetGain is connected to Input0 of the LutMap.           */
MfpgaSetLink(OffsetGainContext, M_OUTPUT0, LutMapContext, M_INPUT0, M_DEFAULT);

/* Queue the processing operation, we use the M_WAIT flag because            */
/* other MfpgaCommandQueue() follows.                                        */
/* This tells the software to wait for other MfpgaCommandQueue() operations. */
MfpgaCommandQueue(LutMapContext, M_DEFAULT, M_WAIT);

/* Queue the processing operation, using the M_DEFAULT flag.                 */
/* This tells the software to send the processing operation to the FPGA.     */
MfpgaCommandQueue(OffsetGainContext, M_DEFAULT, M_DEFAULT);

For Matrox imaging boards with on-board processors, the order in which you add commands to the complex command plays an important role; the command queued using MfpgaCommandQueue() with M_DISPATCH must be the command associated with the first PU in the processing chain.

The completion mode of an MfpgaCommandQueue() call specifies when the command should be tagged as complete. When tagged as complete, you can read back results from your destination buffer(s) or the variables passed to the register result retrieval requests. For complex commands, the completion mode of the last command added to the complex command determines the completion mode for the entire complex command. All other commands in the complex command should have their completion mode set to M_DEFAULT.

When you allocate an FPGA command context, you must specify how the command will be dispatched to the Matrox imaging board. You can specify that a command should run synchronously or asynchronously. A synchronous command (MfpgaCommandAlloc() with M_SYNCHRONOUS) causes the thread from which the command is dispatched to wait for the command to complete before executing subsequent statements. An asynchronous command ( MfpgaCommandAlloc() with M_ASYNCHRONOUS) causes the thread to continue executing subsequent statements without waiting for the command to complete. For complex commands, MIL uses the synchronous/asynchronous setting of the last command in the complex command (that is, the call to MfpgaCommandQueue() with M_DISPATCH).

The Host processor supports both M_SYNCHRONOUS and M_ASYNCHRONOUS settings; it can continue to work if the command is asynchronous. However on Matrox imaging boards with on-board processors, only the M_SYNCHRONOUS setting is supported: the thread of the on-board processor executing the call to MfpgaCommandAlloc() with M_DISPATCH always waits until each command has finished processing (synchronous operation).