Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

interrupt.c

Go to the documentation of this file.
00001 /*
00002  *  This program is free software; you can redistribute it and/or
00003  *  modify it under the terms of the GNU General Public License
00004  *  as published by the Free Software Foundation; either version
00005  *  2 of the License, or (at your option) any later version.
00006  *
00007  *  Copyright 1999-2004 Michael Klein <michael(dot)klein(at)puffin(dot)lb(dot)shuttle(dot)de>
00008  *  Copyright 2001-2004 Spiro Trikaliotis
00009  *
00010  */
00011 
00023 #include <wdm.h>
00024 #include "cbm_driver.h"
00025 #include "i_iec.h"
00026 
00040 BOOLEAN
00041 cbmiec_interrupt(IN PDEVICE_EXTENSION Pdx)
00042 {
00043     BOOLEAN isMyInt;
00044     UCHAR irqResult;
00045 
00046     FUNC_ENTER();
00047 
00048     PERF_EVENT_VERBOSE(0x2010, 0);
00049 
00050     /* acknowledge the interrupt */
00051     irqResult = READ_PORT_UCHAR(IN_PORT); 
00052     DBG_PPORT((DBG_PREFIX "irqResult before:     %02x", irqResult));
00053 
00054     DBG_IRQ(("Interrupt occurred"));
00055 
00059 /*   
00060     if ((irqResult & 0x04) == 0)
00061 
00062     Thus, we check DATA_IN directly:
00063 
00066     if (!CBMIEC_GET(PP_DATA_IN))
00067     {
00068         isMyInt = TRUE;
00069 
00070         DBG_IRQ(("It's a PP interrupt!"));
00071 
00072         if (Pdx->IrqCount != 0)
00073         {
00074             PERF_EVENT_VERBOSE(0x2011, 0);
00075             if (InterlockedDecrement(&Pdx->IrqCount) == 0)
00076             {
00077                 PERF_EVENT_VERBOSE(0x2012, 0);
00078                 CBMIEC_SET(PP_CLK_OUT);
00079                 DBG_SUCCESS((DBG_PREFIX "continue to send"));
00080 
00081 #ifdef USE_DPC
00082                 // Request a DPC which will wake up wait_for_listener()
00083 
00084                 DBG_DPC((DBG_PREFIX "IoRequestDpc() "));
00085 
00086                 DBG_IRQL( >= DISPATCH_LEVEL); // in fact, at DIRQL
00087                 IoRequestDpc(Pdx->Fdo, Pdx->IrpQueue.CurrentIrp, NULL);
00088                 PERF_EVENT_VERBOSE(0x2013, 0);
00089 
00090 #endif // #ifdef USE_DPC
00091 
00092             }
00093         }
00094         else
00095         {
00096             PERF_EVENT_VERBOSE(0x2014, Pdx->IrqCount);
00097             DBG_ERROR((DBG_PREFIX "****************************************************"));
00098             DBG_ERROR((DBG_PREFIX "Interrupt occurred, BUT ALREADY IRQCOUNT=0! ********"));
00099             DBG_ERROR((DBG_PREFIX "****************************************************"));
00100         }
00101     }
00102     else
00103     {
00104         isMyInt = FALSE;
00105         DBG_WARN((DBG_PREFIX "********************************************"));
00106         DBG_WARN((DBG_PREFIX "Interrupt occurred, but not for me! ********"));
00107         DBG_WARN((DBG_PREFIX "********************************************"));
00108     }
00109 
00110     irqResult = READ_PORT_UCHAR(IN_PORT); 
00111     DBG_PPORT((DBG_PREFIX "irqResult afterwards: %02x", irqResult));
00112 
00113     PERF_EVENT_VERBOSE(0x2015, 0);
00114 
00115     FUNC_LEAVE_BOOLEAN(isMyInt);
00116 }

Generated on Sun Apr 30 18:45:53 2006 for opencbm by  doxygen 1.4.2