1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/*++
Copyright (c) 1991, 1992, 1993 Microsoft Corporation
Module Name:
flush.c
Abstract:
This module contains the code that is very specific to flush
operations in the serial driver
Environment:
Kernel mode
--*/
#include "precomp.h"
#if defined(EVENT_TRACING)
#include "flush.tmh"
#endif
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, SerialFlush)
#endif
#pragma warning(push)
#pragma warning(disable:28118) // this callback will run at IRQL=PASSIVE_LEVEL
_Use_decl_annotations_
NTSTATUS
SerialFlush(
WDFDEVICE Device,
PIRP Irp
)
/*++
Routine Description:
This is the dispatch routine for flush. Flushing works by placing
this request in the write queue. When this request reaches the
front of the write queue we simply complete it since this implies
that all previous writes have completed.
Arguments:
DeviceObject - Pointer to the device object for this device
Irp - Pointer to the IRP for the current request
Return Value:
Could return status success, cancelled, or pending.
--*/
{
PSERIAL_DEVICE_EXTENSION extension;
extension = SerialGetDeviceExtension(Device);
SerialDbgPrintEx(TRACE_LEVEL_INFORMATION, DBG_WRITE, ">SerialFlush(%p, %p)\n", Device, Irp);
PAGED_CODE();
WdfIoQueueStopSynchronously(extension->WriteQueue);
//
// Flush is done - restart the queue
//
WdfIoQueueStart(extension->WriteQueue);
Irp->IoStatus.Information = 0L;
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
SerialDbgPrintEx(TRACE_LEVEL_INFORMATION, DBG_WRITE, "<SerialFlush\n");
return STATUS_SUCCESS;
}
#pragma warning(pop) // enable 28118 again
|