Ignore:
Timestamp:
Mar 3, 2011, 8:43:04 PM (14 years ago)
Author:
David Azarewicz
Message:

Interrupt fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk/drv32/rmhelp.cpp

    r518 r545  
    149149//******************************************************************************
    150150//******************************************************************************
    151 //PS+++ see to irq.cpp
    152 #ifdef ACPI
    153 #ifdef __cplusplus
    154 extern "C" {
    155 #endif
    156 struct SaveIRQForSlot
    157 {
    158     ULONG  ulSlotNo;
    159     BYTE   LowIRQ;
    160     BYTE   HighIRQ;
    161     BYTE   Pin;
    162 };
    163 extern struct SaveIRQForSlot sISRHigh[];
    164 extern int  SaveIRQCounter;
    165 #ifdef __cplusplus
    166 }
    167 #endif
    168 #endif
    169 BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared)
    170 {
    171   RESOURCESTRUCT        Resource;
    172   HRESOURCE             hres;
    173   APIRET                rc;
    174 
    175   Resource.ResourceType          = RS_TYPE_IRQ;
    176 #ifdef ACPI  //PS+++
    177   Resource.IRQResource.PCIIrqPin = (USHORT)(sISRHigh[SaveIRQCounter].Pin & 0xf);
    178   if (sISRHigh[SaveIRQCounter].HighIRQ)
    179       Resource.IRQResource.IRQLevel  = (USHORT)sISRHigh[SaveIRQCounter].HighIRQ & 0xff;
    180   else
    181       Resource.IRQResource.IRQLevel  = (USHORT)ulIrq & 0xff;
    182 #else
    183   Resource.IRQResource.IRQLevel  = (USHORT)ulIrq & 0xff;
    184   Resource.IRQResource.PCIIrqPin = 0;
    185 #endif
    186   Resource.IRQResource.IRQFlags  = ( fShared ) ? RS_IRQ_SHARED : RS_IRQ_EXCLUSIVE;
    187 
    188   rc = RMAllocResource(DriverHandle,                    // Handle to driver.
    189                        FlatToSel((ULONG)&hres),         // OUT:  "allocated" resource node handle
     151BOOL RMRequestIRQ(ULONG ulIrq, BOOL fShared, PHRESOURCE phRes)
     152{
     153        RESOURCESTRUCT  Resource;
     154        HRESOURCE               hres;
     155        APIRET          rc;
     156
     157        Resource.ResourceType          = RS_TYPE_IRQ;
     158        Resource.IRQResource.IRQLevel  = (USHORT)ulIrq & 0xff;
     159        Resource.IRQResource.PCIIrqPin = 0;
     160        Resource.IRQResource.IRQFlags  = ( fShared ) ? RS_IRQ_SHARED : RS_IRQ_EXCLUSIVE;
     161
     162        rc = RMAllocResource(DriverHandle,                      // Handle to driver.
     163                       FlatToSel((ULONG)&hres),                 // OUT:  "allocated" resource node handle
    190164                       FlatToSel((ULONG)&Resource));    // Resource to allocate.
    191165
    192   if( rc == 0 && ctResHandles < MAX_RESHANDLES )
    193   {
    194     arResHandles[ctResHandles++] = hres;        return TRUE;
    195   }
    196 
    197   dprintf(("RMAllocResource[%d] IRQ rc = %d\n", ctResHandles, rc));
    198 
    199   return rc == 0;
     166        if (rc == 0) {
     167                if (ctResHandles < MAX_RESHANDLES ) arResHandles[ctResHandles++] = hres;
     168                *phRes = hres;
     169        }
     170
     171        dprintf(("RMAllocResource[%d] IRQ rc = %d\n", ctResHandles, rc));
     172
     173        return rc == 0;
     174}
     175
     176//******************************************************************************
     177//******************************************************************************
     178BOOL RMDeallocateIRQ(HRESOURCE hRes)
     179{
     180        ULONG ulI;
     181
     182        RMDeallocResource(DriverHandle, hRes);
     183
     184        for (ulI=0; ulI<ctResHandles; ulI++) {
     185                if (arResHandles[ulI] == hRes) {
     186                        arResHandles[ulI] = 0;
     187                        break;
     188                }               
     189        }
     190
     191        return 0;
    200192}
    201193
Note: See TracChangeset for help on using the changeset viewer.