Chinaunix首页 | 论坛 | 博客
  • 博客访问: 245329
  • 博文数量: 63
  • 博客积分: 179
  • 博客等级: 入伍新兵
  • 技术积分: 342
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-27 20:29
文章分类

全部博文(63)

文章存档

2019年(2)

2013年(5)

2012年(53)

2011年(3)

分类: 嵌入式

2011-05-04 10:45:53

 wince driver中,与中断关联过的EVENT,在IST线程中使用WaitForMultipleObjects fail出错 
        最近在做wince的驱动中,想在一个IST线程中处理两个硬件中断,自己想偷懒,不想用两个线程来做,故就用WaitForMultipleObjects函数去等待那两个中断线程,一直不能成功。用GetLastError(),获取msg全是87,说是传参数有问题,但是我两个事件的创建都是成功的啊,没有相应的error的log信息。郁闷了一个下午,后来在查了帮助ms的帮助文档,终于找到原因了,我不能那样干。
自己记性不好,故记录在这里,以防自己忘记。同时希望,能对和我犯同样错误的看客有所帮助。呵呵
 
 
与中断关联过的EVENT,在IST线程中,只能使用
DWORD WaitForSingleObject(
  HANDLE hHandle,
  DWORD dwMilliseconds
);不能使用DWORD WaitForMultipleObjects(
  DWORD nCount,
  CONST HANDLE* lpHandles,
  BOOL fWaitAll,
  DWORD dwMilliseconds
);
详细wince的InterruptInitialize函数的帮助文档,
ms-help://MS.VSCC.v80/MS.VSIPCC.v80/MS.WindowsCE.v60.en/CE_OS_IntExplorer/html/4ae3a36b-759a-4103-8251-ecac4c440103.htm
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 be used only in a WaitForSingleObject call to wait for the event to be triggered by the kernel.A WaitForMultipleObjects call with hEvent fails.If you use hEvent in a call to WaitForSingleObject before you call InterruptInitialize, InterruptInitialize fails.InterruptInitialize is a kernel-mode-only function. For more information about kernel-mode-only functions, see Kernel Mode APIs.InterruptInitialize is used with device drivers and user-mode drivers. For more information about user-mode drivers, see User
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/bbw2008/archive/2011/05/04/6393329.aspx
阅读(1839) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~