2 * PROJECT: ReactOS Drivers
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/sac/driver/dispatch.c
5 * PURPOSE: Driver for the Server Administration Console (SAC) for EMS
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES ******************************************************************/
13 /* GLOBALS *******************************************************************/
17 /* FUNCTIONS *****************************************************************/
21 DispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject
,
24 return STATUS_NOT_IMPLEMENTED
;
29 DispatchShutdownControl(IN PDEVICE_OBJECT DeviceObject
,
32 return STATUS_NOT_IMPLEMENTED
;
37 DispatchCreate(IN PSAC_DEVICE_EXTENSION DeviceExtension
,
40 return STATUS_NOT_IMPLEMENTED
;
45 DispatchClose(IN PSAC_DEVICE_EXTENSION DeviceExtension
,
48 return STATUS_NOT_IMPLEMENTED
;
53 Dispatch(IN PDEVICE_OBJECT DeviceObject
,
56 return STATUS_NOT_IMPLEMENTED
;
61 TimerDpcRoutine(IN PKDPC Dpc
,
62 IN PVOID DeferredContext
,
63 IN PVOID SystemArgument1
,
64 IN PVOID SystemArgument2
)
66 HEADLESS_RSP_GET_BYTE ByteValue
;
70 PSAC_DEVICE_EXTENSION SacExtension
;
72 /* Update our counter */
73 _InterlockedExchangeAdd(&TimerDpcCount
, 1);
75 /* Set defaults and loop for new characters */
77 ValueSize
= sizeof(ByteValue
);
80 /* Ask the kernel for a byte */
81 Status
= HeadlessDispatch(HeadlessCmdGetByte
,
87 /* Break out if there's nothing interesting */
88 if (!NT_SUCCESS(Status
)) break;
89 if (!ByteValue
.Value
) break;
91 /* Update the serial port buffer */
92 SerialPortBuffer
[SerialPortProducerIndex
] = ByteValue
.Value
;
95 /* Update the index, let it roll-over if needed */
96 _InterlockedExchange(&SerialPortProducerIndex
,
97 (SerialPortProducerIndex
+ 1) &
98 (SAC_SERIAL_PORT_BUFFER_SIZE
- 1));
99 } while (ByteValue
.Value
);
101 /* Did we get anything */
104 /* Signal the worker thread that there is work to do */
105 SacExtension
= DeferredContext
;
106 KeSetEvent(&SacExtension
->Event
, SacExtension
->PriorityBoost
, FALSE
);
112 UnloadHandler(IN PDRIVER_OBJECT DriverObject
)
114 PDEVICE_OBJECT DeviceObject
, NextDevice
;
115 SAC_DBG(SAC_DBG_ENTRY_EXIT
, "SAC UnloadHandler: Entering.\n");
117 /* Go overy ever device part of the driver */
118 DeviceObject
= DriverObject
->DeviceObject
;
121 /* Free and delete the information about this device */
122 NextDevice
= DeviceObject
->NextDevice
;
123 FreeDeviceData(DeviceObject
);
124 IoDeleteDevice(DeviceObject
);
126 /* Move on to the next one */
127 DeviceObject
= NextDevice
;
130 /* Free the driver data and exit */
132 SAC_DBG(SAC_DBG_ENTRY_EXIT
, "SAC UnloadHandler: Exiting.\n");