ReactOS  0.4.15-dev-3203-gacde1e0
fxpnpstatemachine.hpp
Go to the documentation of this file.
1 //
2 // Copyright (C) Microsoft. All rights reserved.
3 //
4 #ifndef _FXPNPSTATEMACHINE_H_
5 #define _FXPNPSTATEMACHINE_H_
6 
7 // @@SMVERIFY_SPLIT_BEGIN
8 
9 typedef
12  FxPkgPnp* This
13  );
14 
15 //
16 // Treat these values as a bit field when comparing for known dropped events in
17 // the current state and treat them as values when they known transition events
18 // from state to the next.
19 //
20 enum FxPnpEvent {
21  PnpEventInvalid = 0x000000,
22  PnpEventAddDevice = 0x000001,
23  PnpEventStartDevice = 0x000002,
26  PnpEventQueryRemove = 0x000010,
27  PnpEventQueryStop = 0x000020,
29  PnpEventCancelStop = 0x000080,
30  PnpEventStop = 0x000100,
31  PnpEventRemove = 0x000200,
33  PnpEventEject = 0x000800,
42  PnpEventDeviceInD0 = 0x100000,
44 
45  //
46  // Not a real event, just a value that shows all of the events which have
47  // queued the pnp irp. If we drop one of these events, we *must* complete
48  // the pended pnp irp. See PnpProcessEventInner.
49  //
55  PnpEventStop |
58 
59  //
60  // Not a real event, just a value that indicates all of the events which
61  // goto the head of the queue and are always processed, even if the state is
62  // locked.
63  //
70 
71  PnpEventNull = 0xFFFFFFFF,
72 };
73 
74 //
75 // Bit packed ULONG.
76 //
78  struct {
79  //
80  // Indicates whether the state is open to all events
81  //
83 
84  //
85  // Bit of events we know we can drop in this state
86  //
88  } Bits;
89 
90  struct {
91  //
92  // Maps to the same bit location as QueueOpen. Since we start
93  // KnownDroppedEvents at the next bit, start our bits by at the next
94  // bit as well.
95  //
97 
98  //
99  // These are defined so that we can easily tell in the debugger what
100  // each set bit in KnownDroppedEvents maps to in the FxPnpEvent enum
101  //
122  } BitsByName;
123 };
124 
127 
129 
131 };
132 
134 
136  //
137  // Framework internal function
138  //
140 
142 
144 
146 
147 };
148 
150 
151 #if FX_STATE_MACHINE_VERIFY
152 #define MAX_PNP_STATE_ENTRY_FN_RETURN_STATES (5)
153 
154 struct PNP_STATE_ENTRY_FUNCTION_TARGET_STATE {
155  //
156  // Return value from state entry function
157  //
159 
160  //
161  // type of device the returning state applies to
162  //
163  FxStateMachineDeviceType DeviceType;
164 
165  //
166  // Info about the state transition
167  //
168  PSTR Comment;
169 };
170 
171 typedef const PNP_STATE_ENTRY_FUNCTION_TARGET_STATE* CPPNP_STATE_ENTRY_FUNCTION_TARGET_STATE;
172 
173 struct PNP_STATE_ENTRY_FN_RETURN_STATE_TABLE {
174  //
175  // array of state transitions caused by state entry function
176  //
177  PNP_STATE_ENTRY_FUNCTION_TARGET_STATE TargetStates[MAX_PNP_STATE_ENTRY_FN_RETURN_STATES];
178 };
179 
180 typedef const PNP_STATE_ENTRY_FN_RETURN_STATE_TABLE* CPPNP_STATE_ENTRY_FN_RETURN_STATE_TABLE;
181 #endif //FX_STATE_MACHINE_VERIFY
182 
183 // @@SMVERIFY_SPLIT_END
184 
185 //
186 // This type of union is done so that we can
187 // 1) shrink the array element to the smallest size possible
188 // 2) keep types within the structure so we can dump it in the debugger
189 //
191  struct {
200  } S;
201 
203 };
204 
205 
208  VOID
210  {
211  RtlZeroMemory(&m_Queue[0], sizeof(m_Queue));
212  RtlZeroMemory(&m_States, sizeof(m_States));
213 
216  }
217 
219 
221 
223 };
224 
225 #endif // _FXPNPSTATEMACHINE_H_
enum _WDF_DEVICE_PNP_STATE WDF_DEVICE_PNP_STATE
FxPnpMachineStateHistory m_States
WDF_DEVICE_PNP_STATE State6
WDF_DEVICE_PNP_STATE TargetState
ULONG PnpEventPowerDownFailedKnown
ULONG PnpEventStartDeviceFailedKnown
WDF_DEVICE_PNP_STATE State8
const PNP_EVENT_TARGET_STATE * CPPNP_EVENT_TARGET_STATE
struct FxPnpMachineStateHistory::@4533 S
_In_ ULONG _In_ ULONG State
Definition: potypes.h:516
CPPNP_EVENT_TARGET_STATE OtherTargetStates
PFN_PNP_STATE_ENTRY_FUNCTION StateFunc
ULONG PnpEventChildrenRemovalCompleteKnown
UCHAR IncrementHistoryIndex(VOID)
#define EVENT_TRAP_FIELD
Definition: fxpkgpnp.hpp:64
WDF_DEVICE_PNP_STATE State4
WDF_DEVICE_PNP_STATE State7
const UCHAR PnpEventQueueDepth
Definition: fxpkgpnp.hpp:33
#define FALSE
Definition: types.h:117
ULONG PnpEventStartDeviceCompleteKnown
unsigned char BOOLEAN
WDF_DEVICE_PNP_STATE State3
DeviceType
Definition: mmdrv.h:41
WDF_DEVICE_PNP_STATE State1
struct FxPnpStateInfo::@4531 Bits
FxPnpEvent m_Queue[PnpEventQueueDepth]
WDF_DEVICE_PNP_STATE State5
struct FxPnpStateInfo::@4532 BitsByName
FxPnpStateInfo StateInfo
PNP_EVENT_TARGET_STATE FirstTargetState
USHORT History[PnpEventQueueDepth]
unsigned short USHORT
Definition: pedump.c:61
signed char * PSTR
Definition: retypes.h:7
WDF_DEVICE_PNP_STATE(* PFN_PNP_STATE_ENTRY_FUNCTION)(FxPkgPnp *This)
WDF_DEVICE_PNP_STATE State2
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
const PNP_STATE_TABLE * CPPNP_STATE_TABLE