ReactOS 0.4.15-dev-8417-gb6b82fe
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 11 of file interrupt.cpp.

Typedef Documentation

◆ PSYNC_ENTRY

Function Documentation

◆ CInterruptSynchronizedRoutine()

BOOLEAN NTAPI CInterruptSynchronizedRoutine ( IN PVOID  ServiceContext)

Definition at line 84 of file interrupt.cpp.

86{
88 This->m_Status = This->m_SyncRoutine(This, This->m_DynamicContext);
89
90 DPRINT("CInterruptSynchronizedRoutine this %p SyncRoutine %p Context %p Status %x\n", This, This->m_SyncRoutine, This->m_DynamicContext, This->m_Status);
91 return TRUE;
92}
#define TRUE
Definition: types.h:120
#define DPRINT
Definition: sndvol32.h:73
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID ServiceContext
Definition: iofuncs.h:801

◆ IInterruptServiceRoutine()

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

Definition at line 139 of file interrupt.cpp.

142{
143 PLIST_ENTRY CurEntry;
146 BOOL Success, Ret;
147
149
150 DPRINT("IInterruptServiceRoutine Mode %u\n", This->m_Mode);
151
152 Ret = FALSE;
153 if (This->m_Mode == InterruptSyncModeNormal)
154 {
155 CurEntry = This->m_ServiceRoutines.Flink;
156 while (CurEntry != &This->m_ServiceRoutines)
157 {
158 Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
159 Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
160 if (Status == STATUS_SUCCESS)
161 {
162 /* Mark as handled and break on the first success */
163 Ret = TRUE;
164 break;
165 }
166 CurEntry = CurEntry->Flink;
167 }
168 return Ret;
169 }
170 else if (This->m_Mode == InterruptSyncModeAll)
171 {
172 CurEntry = This->m_ServiceRoutines.Flink;
173 while (CurEntry != &This->m_ServiceRoutines)
174 {
175 Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
176 Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
177 if (Status == STATUS_SUCCESS)
178 {
179 /* Mark as handled but don't break */
180 Ret = TRUE;
181 }
182 CurEntry = CurEntry->Flink;
183 }
184 return Ret;
185 }
186 else if (This->m_Mode == InterruptSyncModeRepeat)
187 {
188 do
189 {
190 Success = FALSE;
191 CurEntry = This->m_ServiceRoutines.Flink;
192 while (CurEntry != &This->m_ServiceRoutines)
193 {
194 Entry = CONTAINING_RECORD(CurEntry, SYNC_ENTRY, ListEntry);
195 Status = Entry->SyncRoutine((CInterruptSync*)This, Entry->DynamicContext);
196 if (Status == STATUS_SUCCESS)
197 {
198 /* Mark as handled if it works at least once */
199 Success = TRUE;
200 Ret = TRUE;
201 }
202 CurEntry = CurEntry->Flink;
203 }
204 } while(Success);
205 return Ret;
206 }
207 else
208 {
209 DPRINT("Unknown mode %u\n", This->m_Mode);
210 return Ret;
211 }
212}
LONG NTSTATUS
Definition: precomp.h:26
#define FALSE
Definition: types.h:117
@ Success
Definition: eventcreate.c:712
unsigned int BOOL
Definition: ntddk_ex.h:94
Status
Definition: gdiplustypes.h:25
@ InterruptSyncModeAll
Definition: portcls.h:841
@ InterruptSyncModeNormal
Definition: portcls.h:840
@ InterruptSyncModeRepeat
Definition: portcls.h:842
#define STATUS_SUCCESS
Definition: shellext.h:65
base of all file and directory entries
Definition: entries.h:83
Definition: interrupt.cpp:15
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ PcNewInterruptSync()

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

Definition at line 295 of file interrupt.cpp.

301{
304
305 DPRINT("PcNewInterruptSync entered OutInterruptSync %p OuterUnknown %p ResourceList %p ResourceIndex %u Mode %d\n",
306 OutInterruptSync, OuterUnknown, ResourceList, ResourceIndex, Mode);
307
308 if (!OutInterruptSync || !ResourceList || Mode < InterruptSyncModeNormal || Mode > InterruptSyncModeRepeat)
310
311 if (ResourceIndex > ResourceList->NumberOfEntriesOfType(CmResourceTypeInterrupt))
313
314 This = new(NonPagedPool, TAG_PORTCLASS)CInterruptSync(OuterUnknown);
315 if (!This)
317
318 Status = This->QueryInterface(IID_IInterruptSync, (PVOID*)OutInterruptSync);
319
320 if (!NT_SUCCESS(Status))
321 {
322 delete This;
323 return Status;
324 }
325
326 ResourceList->AddRef();
327
328 //
329 // initialize object
330 //
331 This->m_Mode = Mode;
332 This->m_ResourceIndex = ResourceIndex;
333 This->m_ResourceList = ResourceList;
334 InitializeListHead(&This->m_ServiceRoutines);
335 KeInitializeSpinLock(&This->m_Lock);
336
337 return Status;
338}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
_In_ ULONG Mode
Definition: hubbusif.h:303
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define TAG_PORTCLASS
Definition: private.hpp:24
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

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