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;
}
Содержание OMNii HDK XT10
Страница 4: ......
Страница 10: ......
Страница 12: ......
Страница 18: ......
Страница 20: ......
Страница 24: ......
Страница 26: ......
Страница 32: ......
Страница 72: ......
Страница 90: ......
Страница 92: ......
Страница 116: ......
Страница 124: ......
Страница 126: ......
Страница 130: ......
Страница 132: ......
Страница 154: ......
Страница 168: ......
Страница 170: ......
Страница 182: ......
Страница 184: ......
Страница 188: ......