阅读:1381回复:6
求中断处理程序的例子!要求有些实际寄存器操作的东西在里面比如判断中断是否为自己的,WDN for 2000下的。 符合要求就给分!!!!! :cool: |
|
|
沙发#
发布于:2002-11-13 09:49
绝对符合要求,这是个AMCC5933的驱程中的ISR程序,来自OSR,我的DRIVER也就在上面修改一下就成的。有问题可再问。
/////////////////////////////////////////////////////////////////////////////// // // OsrHandleInterrupt // // When the AMCC device generates an interrupt, this function is called. // Note that in our simple model of the world here, every transfer is // completed successfully. We just don\'t bother with error detection // and handling. If you wanted this to be a REAL driver, you\'d have to // do the appropriate error detection and handling. // // INPUTS: // // Interupt - Address of the KINTERRUPT Object for our device. // // ServiceContext - Address of our device extension. // // OUTPUTS: // // None. // // RETURNS: // // TRUE if our device is interrupting, FALSE otherwise. // // IRQL: // // This routine is called at IRQL == DIRQL. // // NOTES: // // As is true for all ISR\'s in NT, this routine is called with the // interrupt spin lock held. // /////////////////////////////////////////////////////////////////////////////// BOOLEAN OsrHandleInterrupt(PKINTERRUPT Interupt, PVOID ServiceContext) { BOOLEAN ourDeviceInterrupting = FALSE; POSR_DEVICE_EXT devExt = (POSR_DEVICE_EXT)ServiceContext; ULONG intRegister; ULONG csrRegister; #if DBG DbgPrint(\"OSRPCI: ISR entered\\n\"); #endif // // Get the current interrupt CSR from our device // intRegister = READ_PORT_ULONG(devExt->AmccBaseRegisterAddress+ICSR_OFF); #if DBG DbgPrint(\"*****************AMCC INTCSR = 0x%0x\\n\",intRegister); OsrPrintIntcsr(intRegister); #endif // // Is our device presently interrupting? // if (intRegister & AMCC_INT_INTERRUPTED) { // // Yes, it is! // ourDeviceInterrupting = TRUE; #if DBG DbgPrint(\"\\tInterrupt is ours.\\n\"); #endif // // Store away some context so when we get to our DpcForIsr we\'ll know // what caused the interrupt. Specifically, we accumulate bits in the // \"IntCsr\" field of our device extenstion indicating what interrupts // we\'ve seen from the device. Note that since we support simultaneous // read and write DMA operations, we could get both a read complete // interrupt and a write complete interrupt before the DpcForIsr has // had a chance to execute. Thus, we must carefully ACCUMULATE the // bits. // // N.B. We guard these bits with the Interrupt Spin Lock. The bits // cannot be set or cleared unless holding that lock. // devExt->IntCsr |= (intRegister & AMCC_INT_ACK_BITS); // // Acknowledge the interrupt on the device // WRITE_PORT_ULONG(devExt->AmccBaseRegisterAddress+ICSR_OFF, intRegister); // // IF the interrupt was as a result of a READ or WRITE operation // completing (either with success or error) request our DpcForIsr. // if(intRegister & (AMCC_INT_READ_COMP | AMCC_INT_WRITE_COMP)) { #if DBG DbgPrint(\"Requesting DPC\\n\"); #endif IoRequestDpc(devExt->DeviceObject, 0, NULL); } } return(ourDeviceInterrupting); } |
|
|
板凳#
发布于:2002-11-13 10:04
你的驱动使用什莫开发的DS?
|
|
|
地板#
发布于:2002-11-13 10:39
真是太巧了.
分给我,我给你原代码.用DS开发人S5933的中断处理程序. your email? |
|
|
地下室#
发布于:2002-11-13 11:28
全套驱动代码! 我给50分!
mail.fox@263.net |
|
|
5楼#
发布于:2002-11-13 11:32
成交!
cheers! |
|
|
6楼#
发布于:2005-08-11 11:18
接上面的帖子,中断服务程序做好后速度为1ms
|
|
|