ReactOS 0.4.15-dev-7924-g5949c20
interrupt.c File Reference
#include "videoprt.h"
#include <ndk/halfuncs.h>
#include <debug.h>
Include dependency graph for interrupt.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOLEAN NTAPI IntVideoPortInterruptRoutine (IN struct _KINTERRUPT *Interrupt, IN PVOID ServiceContext)
 
BOOLEAN NTAPI IntVideoPortSetupInterrupt (IN PDEVICE_OBJECT DeviceObject, IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension, IN PVIDEO_PORT_CONFIG_INFO ConfigInfo)
 
VP_STATUS NTAPI VideoPortEnableInterrupt (IN PVOID HwDeviceExtension)
 
VP_STATUS NTAPI VideoPortDisableInterrupt (IN PVOID HwDeviceExtension)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 26 of file interrupt.c.

Function Documentation

◆ IntVideoPortInterruptRoutine()

BOOLEAN NTAPI IntVideoPortInterruptRoutine ( IN struct _KINTERRUPT Interrupt,
IN PVOID  ServiceContext 
)

Definition at line 32 of file interrupt.c.

35{
37
39
40 return DeviceExtension->DriverExtension->InitializationData.HwInterrupt(
41 &DeviceExtension->MiniPortDeviceExtension);
42}
#define NULL
Definition: types.h:112
#define ASSERT(a)
Definition: mode.c:44
PVIDEO_HW_INTERRUPT HwInterrupt
Definition: video.h:676
VIDEO_PORT_DRIVER_EXTENSION * DriverExtension
Definition: videoprt.h:103
CHAR POINTER_ALIGNMENT MiniPortDeviceExtension[1]
Definition: videoprt.h:113
VIDEO_HW_INITIALIZATION_DATA InitializationData
Definition: videoprt.h:72
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:801

Referenced by IntVideoPortSetupInterrupt().

◆ IntVideoPortSetupInterrupt()

BOOLEAN NTAPI IntVideoPortSetupInterrupt ( IN PDEVICE_OBJECT  DeviceObject,
IN PVIDEO_PORT_DRIVER_EXTENSION  DriverExtension,
IN PVIDEO_PORT_CONFIG_INFO  ConfigInfo 
)

Definition at line 45 of file interrupt.c.

49{
51 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
52
53 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
54
55 /*
56 * MSDN documentation for VIDEO_PORT_CONFIG_INFO states: "If a miniport driver's
57 * HwVidFindAdapter function finds that the video adapter does not generate
58 * interrupts or that it cannot determine a valid interrupt vector/level for
59 * the adapter, HwVidFindAdapter should set both BusInterruptVector and
60 * BusInterruptLevel to zero.
61 */
62
63 if (DriverExtension->InitializationData.HwInterrupt != NULL &&
64 (ConfigInfo->BusInterruptLevel != 0 ||
65 ConfigInfo->BusInterruptVector != 0))
66 {
67 ULONG InterruptVector;
68 KIRQL Irql;
70
71 InterruptVector = HalGetInterruptVector(
72 ConfigInfo->AdapterInterfaceType,
73 ConfigInfo->SystemIoBusNumber,
74 ConfigInfo->BusInterruptLevel,
75 ConfigInfo->BusInterruptVector,
76 &Irql,
77 &Affinity);
78
79 if (InterruptVector == 0)
80 {
81 WARN_(VIDEOPRT, "HalGetInterruptVector failed\n");
82 return FALSE;
83 }
84
85 KeInitializeSpinLock(&DeviceExtension->InterruptSpinLock);
87 &DeviceExtension->InterruptObject,
89 DeviceExtension,
90 &DeviceExtension->InterruptSpinLock,
91 InterruptVector,
92 Irql,
93 Irql,
94 ConfigInfo->InterruptMode,
95 DeviceExtension->InterruptShared,
97 FALSE);
98
99 if (!NT_SUCCESS(Status))
100 {
101 WARN_(VIDEOPRT, "IoConnectInterrupt failed with status 0x%08x\n", Status);
102 return FALSE;
103 }
104 }
105
106 return TRUE;
107}
LONG NTSTATUS
Definition: precomp.h:26
_Out_ PKIRQL Irql
Definition: csq.h:179
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG_PTR KAFFINITY
Definition: compat.h:85
NTHALAPI ULONG NTAPI HalGetInterruptVector(INTERFACE_TYPE, ULONG, ULONG, ULONG, PKIRQL, PKAFFINITY)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
Status
Definition: gdiplustypes.h:25
if(dx< 0)
Definition: linetemp.h:194
NTSTATUS NTAPI IoConnectInterrupt(OUT PKINTERRUPT *InterruptObject, IN PKSERVICE_ROUTINE ServiceRoutine, IN PVOID ServiceContext, IN PKSPIN_LOCK SpinLock, IN ULONG Vector, IN KIRQL Irql, IN KIRQL SynchronizeIrql, IN KINTERRUPT_MODE InterruptMode, IN BOOLEAN ShareVector, IN KAFFINITY ProcessorEnableMask, IN BOOLEAN FloatingSave)
Definition: irq.c:22
PPCI_DRIVER_EXTENSION DriverExtension
Definition: pci.c:31
#define WARN_(ch,...)
Definition: debug.h:157
uint32_t ULONG
Definition: typedefs.h:59
struct _VIDEO_PORT_DEVICE_EXTENSTION * PVIDEO_PORT_DEVICE_EXTENSION
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
BOOLEAN NTAPI IntVideoPortInterruptRoutine(IN struct _KINTERRUPT *Interrupt, IN PVOID ServiceContext)
Definition: interrupt.c:32
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174

Referenced by IntVideoPortFindAdapter().

◆ VideoPortDisableInterrupt()

VP_STATUS NTAPI VideoPortDisableInterrupt ( IN PVOID  HwDeviceExtension)

Definition at line 154 of file interrupt.c.

155{
156#ifndef _M_AMD64
157 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
158
159 /* Get the device extension */
160 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
161
162 /* Fail if the driver didn't register an ISR */
163 if (!DeviceExtension->DriverExtension->InitializationData.HwInterrupt)
164 {
165 /* No ISR, no interrupts */
167 }
168
169 /* Disable the interrupt and return */
170 HalDisableSystemInterrupt(DeviceExtension->InterruptVector, 0);
171 return NO_ERROR;
172#else
173 /* FIXME: Function still present? If so what to use instead of HalDisableSystemInterrupt? */
176#endif
177}
#define UNIMPLEMENTED
Definition: debug.h:115
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
VOID NTAPI HalDisableSystemInterrupt(IN ULONG Vector, IN KIRQL Irql)
Definition: pic.c:309
#define VIDEO_PORT_GET_DEVICE_EXTENSION(MiniportExtension)
Definition: videoprt.h:140

◆ VideoPortEnableInterrupt()

VP_STATUS NTAPI VideoPortEnableInterrupt ( IN PVOID  HwDeviceExtension)

Definition at line 116 of file interrupt.c.

117{
118#ifndef _M_AMD64
119 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
120 BOOLEAN InterruptValid;
121
122 /* Get the device extension */
123 DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
124
125 /* Fail if the driver didn't register an ISR */
126 if (!DeviceExtension->DriverExtension->InitializationData.HwInterrupt)
127 {
128 /* No ISR, no interrupts */
130 }
131
132 /* Re-enable the interrupt and return */
133 InterruptValid = HalEnableSystemInterrupt(DeviceExtension->InterruptVector,
134 0,
135 DeviceExtension->InterruptLevel);
136
137 /* Make sure the interrupt was valid */
138 ASSERT(InterruptValid == TRUE);
139
140 /* Return to caller */
141 return NO_ERROR;
142#else
143 /* FIXME: Function still present? If so what to use instead of HalEnableSystemInterrupt? */
146#endif
147}
unsigned char BOOLEAN
BOOLEAN NTAPI HalEnableSystemInterrupt(IN ULONG Vector, IN KIRQL Irql, IN KINTERRUPT_MODE InterruptMode)
Definition: pic.c:295