ReactOS  0.4.14-dev-50-g13bb5e2
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 110 of file interrupt.cpp.

112 {
114  This->m_Status = This->m_SyncRoutine(This, This->m_DynamicContext);
115 
116  DPRINT("CInterruptSynchronizedRoutine this %p SyncRoutine %p Context %p Status %x\n", This, This->m_SyncRoutine, This->m_DynamicContext, This->m_Status);
117  return TRUE;
118 }
#define TRUE
Definition: types.h:120
void DPRINT(...)
Definition: polytest.cpp:61
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:798

◆ IInterruptServiceRoutine()

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

Definition at line 165 of file interrupt.cpp.

168 {
169  PLIST_ENTRY CurEntry;
172  BOOL Success, Ret;
173 
175 
176  DPRINT("IInterruptServiceRoutine Mode %u\n", This->m_Mode);
177 
178  Ret = FALSE;
179  if (This->m_Mode == InterruptSyncModeNormal)
180  {
181  CurEntry = This->m_ServiceRoutines.Flink;
182  while (CurEntry != &This->m_ServiceRoutines)
183  {
184  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
185  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
186  if (Status == STATUS_SUCCESS)
187  {
188  /* Mark as handled and break on the first success */
189  Ret = TRUE;
190  break;
191  }
192  CurEntry = CurEntry->Flink;
193  }
194  return Ret;
195  }
196  else if (This->m_Mode == InterruptSyncModeAll)
197  {
198  CurEntry = This->m_ServiceRoutines.Flink;
199  while (CurEntry != &This->m_ServiceRoutines)
200  {
201  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
202  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
203  if (Status == STATUS_SUCCESS)
204  {
205  /* Mark as handled but don't break */
206  Ret = TRUE;
207  }
208  CurEntry = CurEntry->Flink;
209  }
210  return Ret;
211  }
212  else if (This->m_Mode == InterruptSyncModeRepeat)
213  {
214  do
215  {
216  Success = FALSE;
217  CurEntry = This->m_ServiceRoutines.Flink;
218  while (CurEntry != &This->m_ServiceRoutines)
219  {
220  Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
221  Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
222  if (Status == STATUS_SUCCESS)
223  {
224  /* Mark as handled if it works at least once */
225  Success = TRUE;
226  Ret = TRUE;
227  }
228  CurEntry = CurEntry->Flink;
229  }
230  } while(Success);
231  return Ret;
232  }
233  else
234  {
235  DPRINT("Unknown mode %u\n", This->m_Mode);
236  return Ret;
237  }
238 }
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
LONG NTSTATUS
Definition: precomp.h:26
Definition: interrupt.cpp:17
unsigned int BOOL
Definition: ntddk_ex.h:94
void DPRINT(...)
Definition: polytest.cpp:61
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
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:798
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2966
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 323 of file interrupt.cpp.

329 {
332 
333  DPRINT("PcNewInterruptSync entered OutInterruptSync %p OuterUnknown %p ResourceList %p ResourceIndex %u Mode %d\n",
334  OutInterruptSync, OuterUnknown, ResourceList, ResourceIndex, Mode);
335 
336  if (!OutInterruptSync || !ResourceList || Mode < InterruptSyncModeNormal || Mode > InterruptSyncModeRepeat)
338 
339  if (ResourceIndex > ResourceList->NumberOfEntriesOfType(CmResourceTypeInterrupt))
341 
342  This = new(NonPagedPool, TAG_PORTCLASS)CInterruptSync(OuterUnknown);
343  if (!This)
345 
346  Status = This->QueryInterface(IID_IInterruptSync, (PVOID*)OutInterruptSync);
347 
348  if (!NT_SUCCESS(Status))
349  {
350  delete This;
351  return Status;
352  }
353 
354  ResourceList->AddRef();
355 
356  //
357  // initialize object
358  //
359  This->m_Mode = Mode;
360  This->m_ResourceIndex = ResourceIndex;
361  This->m_ResourceList = ResourceList;
362  InitializeListHead(&This->m_ServiceRoutines);
363  KeInitializeSpinLock(&This->m_Lock);
364 
365  return Status;
366 }
#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
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124

Referenced by STDMETHODIMP_().