4 * Copyright (C) 2002, 2003, 2004 ReactOS Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 /* PRIVATE FUNCTIONS **********************************************************/
28 IntVideoPortInterruptRoutine(
29 IN
struct _KINTERRUPT
*Interrupt
,
30 IN PVOID ServiceContext
)
32 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
= ServiceContext
;
34 ASSERT(DeviceExtension
->DriverExtension
->InitializationData
.HwInterrupt
!= NULL
);
36 return DeviceExtension
->DriverExtension
->InitializationData
.HwInterrupt(
37 &DeviceExtension
->MiniPortDeviceExtension
);
41 IntVideoPortSetupInterrupt(
42 IN PDEVICE_OBJECT DeviceObject
,
43 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension
,
44 IN PVIDEO_PORT_CONFIG_INFO ConfigInfo
)
47 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
49 DeviceExtension
= (PVIDEO_PORT_DEVICE_EXTENSION
)DeviceObject
->DeviceExtension
;
52 * MSDN documentation for VIDEO_PORT_CONFIG_INFO states: "If a miniport driver's
53 * HwVidFindAdapter function finds that the video adapter does not generate
54 * interrupts or that it cannot determine a valid interrupt vector/level for
55 * the adapter, HwVidFindAdapter should set both BusInterruptVector and
56 * BusInterruptLevel to zero.
59 if (DriverExtension
->InitializationData
.HwInterrupt
!= NULL
&&
60 (ConfigInfo
->BusInterruptLevel
!= 0 ||
61 ConfigInfo
->BusInterruptVector
!= 0))
63 ULONG InterruptVector
;
67 InterruptVector
= HalGetInterruptVector(
68 ConfigInfo
->AdapterInterfaceType
,
69 ConfigInfo
->SystemIoBusNumber
,
70 ConfigInfo
->BusInterruptLevel
,
71 ConfigInfo
->BusInterruptVector
,
75 if (InterruptVector
== 0)
77 WARN_(VIDEOPRT
, "HalGetInterruptVector failed\n");
81 KeInitializeSpinLock(&DeviceExtension
->InterruptSpinLock
);
82 Status
= IoConnectInterrupt(
83 &DeviceExtension
->InterruptObject
,
84 IntVideoPortInterruptRoutine
,
86 &DeviceExtension
->InterruptSpinLock
,
90 ConfigInfo
->InterruptMode
,
91 DeviceExtension
->InterruptShared
,
95 if (!NT_SUCCESS(Status
))
97 WARN_(VIDEOPRT
, "IoConnectInterrupt failed with status 0x%08x\n", Status
);
105 /* PUBLIC FUNCTIONS ***********************************************************/
112 VideoPortEnableInterrupt(IN PVOID HwDeviceExtension
)
115 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
118 TRACE_(VIDEOPRT
, "VideoPortEnableInterrupt\n");
120 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
122 Status
= HalEnableSystemInterrupt(
123 DeviceExtension
->InterruptVector
,
125 DeviceExtension
->InterruptLevel
);
127 return Status
? NO_ERROR
: ERROR_INVALID_PARAMETER
;
129 /* FIXME: Function still present? If so what to use instead of HalEnableSystemInterrupt? */
131 return ERROR_INVALID_FUNCTION
;
140 VideoPortDisableInterrupt(IN PVOID HwDeviceExtension
)
143 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
146 TRACE_(VIDEOPRT
, "VideoPortDisableInterrupt\n");
148 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
150 Status
= HalDisableSystemInterrupt(
151 DeviceExtension
->InterruptVector
,
154 return Status
? NO_ERROR
: ERROR_INVALID_PARAMETER
;
156 /* FIXME: Function still present? If so what to use instead of HalDisableSystemInterrupt? */
158 return ERROR_INVALID_FUNCTION
;