ReactOS  0.4.15-dev-4616-g17e0e44
interrupt.cpp File Reference
#include "private.hpp"
#include <debug.h>
Include dependency graph for interrupt.cpp:

Go to the source code of this file.

Classes

struct  SYNC_ENTRY
 
class  CInterruptSync
 

Macros

#define NDEBUG
 

Typedefs

typedef struct SYNC_ENTRYPSYNC_ENTRY
 

Functions

BOOLEAN NTAPI CInterruptSynchronizedRoutine (IN PVOID ServiceContext)
 
BOOLEAN NTAPI IInterruptServiceRoutine (IN PKINTERRUPT Interrupt, IN PVOID ServiceContext)
 
NTSTATUS NTAPI PcNewInterruptSync (OUT PINTERRUPTSYNC *OutInterruptSync, IN PUNKNOWN OuterUnknown OPTIONAL, IN PRESOURCELIST ResourceList, IN ULONG ResourceIndex, IN INTERRUPTSYNCMODE Mode)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file interrupt.cpp.

Typedef Documentation

◆ PSYNC_ENTRY

Function Documentation

◆ CInterruptSynchronizedRoutine()

BOOLEAN NTAPI CInterruptSynchronizedRoutine ( IN PVOID  ServiceContext)

Definition at line 92 of file interrupt.cpp.

94 {
96  This->m_Status = This->m_SyncRoutine(This, This->m_DynamicContext);
97 
98  DPRINT("CInterruptSynchronizedRoutine this %p SyncRoutine %p Context %p Status %x\n", This, This->m_SyncRoutine, This->m_DynamicContext, This->m_Status);
99  return TRUE;
100 }
#define TRUE
Definition: types.h:120
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:800
#define DPRINT
Definition: sndvol32.h:71

◆ IInterruptServiceRoutine()

BOOLEAN NTAPI IInterruptServiceRoutine ( IN PKINTERRUPT  Interrupt,
IN PVOID  ServiceContext 
)

Definition at line 147 of file interrupt.cpp.

150 {
151  PLIST_ENTRY CurEntry;
154  BOOL Success, Ret;
155 
157 
158  DPRINT("IInterruptServiceRoutine Mode %u\n", This->m_Mode);
159 
160  Ret = FALSE;
161  if (This->m_Mode == InterruptSyncModeNormal)
162  {
163  CurEntry = This->m_ServiceRoutines.Flink;
164  while (CurEntry != &This->m_ServiceRoutines)
165  {
166  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
167  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
168  if (Status == STATUS_SUCCESS)
169  {
170  /* Mark as handled and break on the first success */
171  Ret = TRUE;
172  break;
173  }
174  CurEntry = CurEntry->Flink;
175  }
176  return Ret;
177  }
178  else if (This->m_Mode == InterruptSyncModeAll)
179  {
180  CurEntry = This->m_ServiceRoutines.Flink;
181  while (CurEntry != &This->m_ServiceRoutines)
182  {
183  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
184  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
185  if (Status == STATUS_SUCCESS)
186  {
187  /* Mark as handled but don't break */
188  Ret = TRUE;
189  }
190  CurEntry = CurEntry->Flink;
191  }
192  return Ret;
193  }
194  else if (This->m_Mode == InterruptSyncModeRepeat)
195  {
196  do
197  {
198  Success = FALSE;
199  CurEntry = This->m_ServiceRoutines.Flink;
200  while (CurEntry != &This->m_ServiceRoutines)
201  {
202  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
203  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
204  if (Status == STATUS_SUCCESS)
205  {
206  /* Mark as handled if it works at least once */
207  Success = TRUE;
208  Ret = TRUE;
209  }
210  CurEntry = CurEntry->Flink;
211  }
212  } while(Success);
213  return Ret;
214  }
215  else
216  {
217  DPRINT("Unknown mode %u\n", This->m_Mode);
218  return Ret;
219  }
220 }
struct _Entry Entry
Definition: kefuncs.h:629
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
Definition: interrupt.cpp:17
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:800
Definition: typedefs.h:119
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:82

◆ PcNewInterruptSync()

NTSTATUS NTAPI PcNewInterruptSync ( OUT PINTERRUPTSYNC OutInterruptSync,
IN PUNKNOWN OuterUnknown  OPTIONAL,
IN PRESOURCELIST  ResourceList,
IN ULONG  ResourceIndex,
IN INTERRUPTSYNCMODE  Mode 
)

Definition at line 305 of file interrupt.cpp.

311 {
314 
315  DPRINT("PcNewInterruptSync entered OutInterruptSync %p OuterUnknown %p ResourceList %p ResourceIndex %u Mode %d\n",
316  OutInterruptSync, OuterUnknown, ResourceList, ResourceIndex, Mode);
317 
318  if (!OutInterruptSync || !ResourceList || Mode < InterruptSyncModeNormal || Mode > InterruptSyncModeRepeat)
320 
321  if (ResourceIndex > ResourceList->NumberOfEntriesOfType(CmResourceTypeInterrupt))
323 
324  This = new(NonPagedPool, TAG_PORTCLASS)CInterruptSync(OuterUnknown);
325  if (!This)
327 
328  Status = This->QueryInterface(IID_IInterruptSync, (PVOID*)OutInterruptSync);
329 
330  if (!NT_SUCCESS(Status))
331  {
332  delete This;
333  return Status;
334  }
335 
336  ResourceList->AddRef();
337 
338  //
339  // initialize object
340  //
341  This->m_Mode = Mode;
342  This->m_ResourceIndex = ResourceIndex;
343  This->m_ResourceList = ResourceList;
344  InitializeListHead(&This->m_ServiceRoutines);
345  KeInitializeSpinLock(&This->m_Lock);
346 
347  return Status;
348 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG Mode
Definition: hubbusif.h:303
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define TAG_PORTCLASS
Definition: private.hpp:24
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:304
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:240
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define DPRINT
Definition: sndvol32.h:71

Referenced by CMiniport::ProcessResources(), CAC97MiniportWaveRT::ProcessResources(), and STDMETHODIMP_().