I acquired my Board (TAO3530 - OMAP3530 CPU) from 3rd party vendor (Technexion) , but they seem to use TI's Windows CE 6.0 R3 BSP - from BSQUARE? , So.. would you please help me?
I implemented a gpio pin interrupt in SPI_IOControl function in spi.c device driver using gpio device driver interface, like below.
1) When I create a gpio interrupt event (ISTEvent0) as auto reset, the code works ok.
But when I try to create a gpio interrupt event as manual reset, the below code does not work ok. And GetLastError API call returns 0x57 (invalid parameter) error.
Can I fix this problem?
2) In fact, I want to run the gpio IST as the highest priority thread, but CeSetThreadPriority API call alone looks not enough, because the gpio IST with priority 0 looks delayed even by the lowest priority program execution (like FreeCell.exe) !!
I heard, somwhat vaguely, that above 1) may be the answer
Any idea please?
I attach my code below. Thank you~
==============================================
//------------------------------------------------------------------------------
// global variables
static ECG_DEVICE s_EcgDevice =
{
FALSE,
// DEFAULT_SAMPLE_RATE_HZ,
0,
0,
0
};
DWORD gIntrEcg = SYSINTR_NOP;
HANDLE ISTEvent0;
BOOL mytest;
//------------------------------------------------------------------------------
//
// Function: SPI_IOControl
//
// This function sends a command to a device.
//
BOOL SPI_IOControl(
) {
case My_READDATA:
s_EcgDevice.nDrdyGPIO=21;
s_EcgDevice.hGPIO = GPIOOpen();
// Setup nPENIRQ for input mode, falling edge detect, debounce enable
GPIOSetMode(s_EcgDevice.hGPIO, s_EcgDevice.nDrdyGPIO, GPIO_DIR_INPUT|GPIO_INT_HIGH_LOW|GPIO_DEBOUNCE_ENABLE);
// Get the IRQ for the GPIO
s_EcgDevice.nDrdyIRQ = GPIOGetSystemIrq(s_EcgDevice.hGPIO, s_EcgDevice.nDrdyGPIO);
// why does this routine necessary ?
GPIOGetMode(s_EcgDevice.hGPIO, s_EcgDevice.nDrdyIRQ);
// Get sysintr values from the OAL for PENIRQ interrupt
if (!KernelIoControl(
IOCTL_HAL_REQUEST_SYSINTR,
&(s_EcgDevice.nDrdyIRQ),
sizeof(s_EcgDevice.nDrdyIRQ),
&gIntrEcg,
sizeof(gIntrEcg),
NULL
) ) ;
ISTEvent0=CreateEvent(NULL, FALSE, FALSE, NULL);// manual reset --> returne 0x57 error
mytest = InterruptInitialize(gIntrEcg, ISTEvent0, NULL, 0);
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)DataReadThread, NULL, 0, NULL);
if(!CeSetThreadPriority(hThread , 0) ) {return 0;}
break;
}
}