关于InterruptInitialize函数

 

该函数会自动调用OEMInterrupEnable() 函数,如果关联失败,从以下几个方面招原因:

1,SYSINTR_XXX 的值是否映射到具体的物理IRQ。

2,查看OALINTR.H文件的函数,看你自定义的中断是否在该范围内(4.2smdk2410为例)

MapIrq2SysIntr(DWORD _Irq)
{
    if( _Irq<=20 )
        return ( SYSINTR_FIRMWARE + _Irq );
    else
        return (0xffffffff);
}

3,查看创建的事件是否成功,最好将IST挂起。

 

This function initializes a hardware interrupt with the kernel. This initialization allows the device driver to register an event and enable the interrupt. This function is callable from kernel-mode drivers and user-mode drivers.

Syntax

BOOL InterruptInitialize(
            DWORD idInt,
            HANDLE hEvent,
            LPVOID pvData,
            DWORD cbData 
            );

Parameters

idInt

[in] Interrupt identifier to be associated with this interrupt service thread (IST).

hEvent

[in] Event to be signaled when the interrupt is triggered.

pvData

[in] This parameter can be used as a pointer to a block of data that is passed to OEMInterruptEnable. The block of data can be initialization data, scratch space, and so on.

cbData

[in] Size of data pointed to by pvData.

Return Value

TRUE indicates success; FALSE indicates failure.

Remarks

This function must be called before using the hEvent parameter, which provides a link between the idInt parameter and the SYSINTR value returned by an ISR.

The hEvent parameter can only be used in a WaitForSingleObject call to wait for the event to be triggered by the kernel.

A WaitForMultipleObjects call with hEvent will fail.

If you use hEvent in a call to WaitForSingleObject before you call InterruptInitialize, InterruptInitialize will fail.

Requirements

OS Versions: Windows CE 2.10 and later.

Header: Pkfuncs.h.

Link Library: Coredll.lib.

posted @ 2008-12-13 15:35  Hill.Chang  阅读(1553)  评论(0编辑  收藏  举报