Cannot Initialize interrupt

Hi,

I develop a sample program (.exe) for activate interrupt. It’s ok. I try to create a driver with this code. Unfortunately, I
have an error message when I call : Int_InterruptInitialize.

"DEBUGMSG(TRUE, (_T("\nCannot Initialize interrupt for %s"), conf));" 

See my code source on link.

Can you help me ?
Best regard, thank you for your help.

Source

Function Int_InterruptInitialize defined and implemented at Toradex CE libs and intended to use at user level code. Divers should use a kernel provided interrupt functions.

Thank you for your answer.

I don’t understand, I looked in the header “int.h”
I see this comment : This function can be used in Kernel mode as well as in User mode.

//******************************************************************************
/// Win CE 5.0/6.0/7.0/2013 compatible version of InterruptInitialize()\n
/// **This function can be used in Kernel mode as well as in User mode.**
/// @caveat     On Tegra modules, this function requires Windows CE image V0.1beta7 or later.
/// @param[in]            hInt            Handle to the interrupt library, 
///                                       obtained by calling Int_Init()
/// @param[in]            idInt           Interrupt ID
/// @param[in]            hEvent          Event Handle
/// @param[in]            pvData          Pointer to data buffer
/// @param[in]            cbData          Size of data buffer
/// @retval               TRUE            Success
/// @retval               FALSE           Failure
BOOL Int_InterruptInitialize(HANDLE hInt, DWORD idInt, HANDLE hEvent, LPVOID pvData, DWORD cbData);

It’s an error in the documentation ?

Dear @JessyGiaco

The documentation is correct. But for most situations it doesn’t make much sense to call our library functions in Kernel mode. The library was written to make the Kernel mode functions accessible to user applications, which is not required if you are in Kernel mode anyway.

When called in Kernel mode, Int_InterruptInitialize() simply executes:

{
    InterruptDone(idInt);  
    return InterruptInitialize(idInt, hEvent, pvData, cbData);
}

Next Steps

  1. Please try to call these functions directly, instead of Int_InterruptInitialize(). You can omit the first call, it only helps sometimes to cleanup unfinished interrupt processing from a previous run.
    However, in general you may need to reboot your system if any interrupt processing was not properly finished!

The Microsoft documentation on these functions can be found here:

  1. Call GetLastError().
    Hopefully the returned error code can give a hint to what went wrong.

  2. Analyze the parameters you pass to InterruptInitialize().

  3. Reboot WinCe before any test.

  4. Use the debugger to step into InterruptInitialize().

Regards, Andy