阅读:1092回复:1
读usbbulk一个小问题不理解
在bulkpnp.c文件中有函数BulkUsb_IoIncrement里面的操作:
KeAcquireSpinLock(&DeviceExtension->IOCountLock, &oldIrql); result = InterlockedIncrement(&DeviceExtension->OutStandingIO); // // when OutStandingIO bumps from 1 to 2, clear the StopEvent // if(result == 2) { //不知道这里的判断有何作用? KeClearEvent(&DeviceExtension->StopEvent); } KeReleaseSpinLock(&DeviceExtension->IOCountLock, oldIrql); 还有与之对应的函数,BulkUsb_IoDecrement: KeAcquireSpinLock(&DeviceExtension->IOCountLock, &oldIrql); result = InterlockedDecrement(&DeviceExtension->OutStandingIO); if(result == 1) { //这个判断语句什么作用? KeSetEvent(&DeviceExtension->StopEvent, IO_NO_INCREMENT, FALSE); } if(result == 0) { //这个判断语句什么作用? ASSERT(Removed == DeviceExtension->DeviceState); KeSetEvent(&DeviceExtension->RemoveEvent, IO_NO_INCREMENT, FALSE); } KeReleaseSpinLock(&DeviceExtension->IOCountLock, oldIrql); 希望达人给予指点,谢谢。 |
|
|
沙发#
发布于:2005-06-22 15:14
怎么没人回答呢?
我再问个问题:KeSynchronizeExecution(pdx->InterruptObject, TransferFirst, (PVOID) pdx); 此函数的作用是同步TransferFirst和ISR,不太清楚它这个同步是什么意思,是先执行TransferFirst再执行ISR,还是基于某个临界区的同步操作? |
|
|