Interrupt Handler for AX88796BLI driver WEC2013 iMX6

This is a continuation on from https://www.toradex.com/community/questions/52495/ax88796bli-wec2013-driver-for-colibri-imx6.html. I’m just looking to get the driver compiled for now and “see what happens”.

I’m looking to convert the code that initialises the interrupt:

        if (!KernelIoControl(IOCTL_HAL_GPIO2IRQ, &dwIntGPIO, sizeof(DWORD), &dwIrq, sizeof(DWORD), NULL))
        {
            goto fail3;
        }
        dwEdge = GPIO_LEVEL_HIGH;
        if (!KernelIoControl(IOCTL_HAL_IRQEDGE, &dwIrq, 1, &dwEdge, 1, NULL))

Compiler is complaining about missing definition for IOCTL_HAL_GPIO2IRQ and IOCTL_HAL_IRQEDGE. I guess these have been specifically defined for the PXA320 - is there an equivalent value for the iMX6?

GPIO_LEVEL_HIGH is also defined at the top of this source file, but will this value still be valid for the iMX6?

Have you downloadedour WinCE CE8 BSP for iMX6:

iMX6 WEC Software | Toradex Developer Center ?

The one that contains the TORADEXIMX6BIN folder? Yes, and this has been copied to the C:\WINCE800 folder - followed the comment in Workspace setup - Technical Support - Toradex Community . However, the SRC folder in the BSP download does not contain any sources. Is there a BSP download that contains the sources? The one I downloaded is version 1.6. Do the BSP sources have the required definitions?

Hi @eeflores ,

This is the KernelIoControl definition for IRQ2GPIO on iMX6:

#define IOCTL_HAL_IRQ2GPIO     CTL_CODE(FILE_DEVICE_HAL, 2238, METHOD_BUFFERED, FILE_ANY_ACCESS)

This is the KernelIoControl definition for IRQEDGE (the usage and name changed slightly on iMX6):

typedef enum
{
    DDK_GPIO_INTR_LOW_LEV   = 0,
    DDK_GPIO_INTR_HIGH_LEV  = 1,
    DDK_GPIO_INTR_RISE_EDGE = 2,
    DDK_GPIO_INTR_FALL_EDGE = 3,
    DDK_GPIO_INTR_BOTH_EDGE = 4,
    DDK_GPIO_INTR_NONE      = -1
} DDK_GPIO_INTR;

typedef struct
{
	DWORD				pin;
	DWORD				mode;
} SETIRQMODE;

#define IOCTL_HAL_SETIRQMODE	CTL_CODE(FILE_DEVICE_HAL, 2200, METHOD_BUFFERED, FILE_ANY_ACCESS)

//Usage Example:
SETIRQMODE irqmode;
irqmode.gpio = 10;
irqmode.mode = DDK_GPIO_INTR_HIGH_LEV;
KernelIoControl(IOCTL_HAL_SETIRQMODE, &irqmode, sizeof(irqmode), NULL, 0, NULL);

Hope this helps.