Intel® FPGA SDK for OpenCL™ Pro Edition: Custom Platform Toolkit User Guide

ID 683085
Date 3/28/2022
Document Table of Contents

2.3.9. aocl_mmd_set_device_interrupt_handler

The aocl_mmd_set_device_interrupt_handler function sets the device interrupt handler for the opened device.
When the device internals identify an asynchronous exception event (for example, a bit correction event), the device interrupt handler is called to notify the OpenCL™ runtime of the event.
Attention: Ignore the interrupts from the device until this handler is set.


int aocl_mmd_set_device_interrupt_handler( int handle,
                        aocl_mmd_device_interrupt_handler_fn fn,
                        void* user_data );

Function Arguments

  • handle—A positive int value representing the handle to the board obtained from the aocl_mmd_open() call.

  • fn—The callback function to invoke when a kernel interrupt occurs. The fn argument is of type aocl_mmd_device_interrupt_handler_fn, which is defined as follows:
    typedef void (*aocl_mmd_device_interrupt_handler_fn)( int handle, aocl_mmd_interrupt_info* data_in, void* user_data );

    aocl_mmd_interrupt_info is defined as:

    typedef struct {
       unsigned long long int exception_type;
       void *user_private_info;
       size_t user_cb;
    } aocl_mmd_interrupt_info;


    • exception_type acts as a bitfield that contains exactly one bit, corresponding to an exception number.
    • user_private_info and user_cb represent pointers to binary data that the OpenCL implementation return. These pointers log additional information that is helpful for debugging the error.

  • user_data—The void* type user-provided data that passes to fn when it is called.

Return Value

If the function executes successfully, the return value is 0.

If the function fails to execute, a negative return value indicates an error.