Chapter 4: Software
Omnii HDK API Functions
Psion Teklogix Omnii HDK User Manual
51
4.7.4.17 Hdk7545_ExpansionGetIrq
Syntax
DWORD Hdk7545_ExpansionGetIrq( HANDLE hdk, DWORD pin, DWORD *irq );
Parameters
•
hdk – [in] an open HDK handle.
•
pin – [in] the ID of the expansion connector pin. The pin parameter must be set to one of the
HDK7545_GPIO_PIN_EXPANSION_xxx values.
•
irq – [out] pointer to the IRQ value.
Description
Used to retrieve the IRQ value associated with the specified pin. The value returned can then be
used to request a system interrupt.
Returns
•
ERROR_SUCCESS – if successful.
•
ERROR_INVALID_HANDLE – the specified handle is invalid.
•
ERROR_INVALID_PARAMETER – the specified pin is not valid, or the irq pointer is null.
•
ERROR_INVALID_DATA - an exception was generated.
•
Other errors are possible.
Sample Code
// interrupt handling for an expansion GPIO.
DWORD GetIRQ()
{
Hdk7545_Connector expansionSlot = Hdk7545_Connector_Expansion1;
HANDLE hEvent = CreateEvent(0, FALSE, FALSE, 0);
if( hEvent == 0 ) {
return ERROR_OUTOFMEMORY;
}
HANDLE hdkHandle = INVALID_HANDLE_VALUE;
DWORD result = Hdk7545_Open(&hdkHandle, expansionSlot);
if( result != ERROR_SUCCESS ) {
return ERROR_NOT_SUPPORTED;
}
// assume HDK7545_GPIO_PIN_EXPANSION_GPIO1_RXD is configured as an
// input with interrupts enabled.
DWORD irq = 0;
result = Hdk7545_ExpansionGetIrq(hdkHandle,
HDK7545_GPIO_PIN_EXPANSION_GPIO1_RXD, &irq);
if( result != ERROR_SUCCESS ) {
Hdk7545_Close(&hdkHandle);
return result;
}
DWORD sysIntr = 0;
BOOL ok = KernelIoControl(IOCTL_HAL_REQUEST_SYSINTR, &irq, sizeof(irq),
&sysIntr, sizeof(sysIntr), 0);
if( !ok || sysIntr == SYSINTR_UNDEFINED || sysIntr == 0 ) {
Hdk7545_Close(&hdkHandle);
return ERROR_NO_SYSTEM_RESOURCES;
}
Summary of Contents for OMNii HDK XT10
Page 4: ......
Page 10: ......
Page 12: ......
Page 18: ......
Page 20: ......
Page 24: ......
Page 26: ......
Page 32: ......
Page 72: ......
Page 90: ......
Page 92: ......
Page 116: ......
Page 124: ......
Page 126: ......
Page 130: ......
Page 132: ......
Page 154: ......
Page 168: ......
Page 170: ......
Page 182: ......
Page 184: ......
Page 188: ......