Skip to content

Commit c1cbdb2

Browse files
committed
Add file header and function headers to wdfserial driver project
1 parent cfa3342 commit c1cbdb2

18 files changed

Lines changed: 2115 additions & 39 deletions

File tree

src/windows/wdfserial/QCDSP.c

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
/*
1+
/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*
2+
3+
Q C D S P . C
4+
5+
GENERAL DESCRIPTION
6+
This file implements device control (IOCTL) callback for the
7+
wdfserial driver. It also notifies I/O worker threads that the
8+
state of framework queue has changed.
9+
210
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
311
SPDX-License-Identifier: BSD-3-Clause
4-
*/
12+
13+
*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
514

615
#include "QCMAIN.h"
716
#include "QCDSP.h"
@@ -14,6 +23,22 @@
1423
#include "QCDSP.tmh"
1524
#endif
1625

26+
/****************************************************************************
27+
*
28+
* function: QCDSP_EvtIoDeviceControl
29+
*
30+
* purpose: WDF callback for device I/O control requests. Dispatches each
31+
* IOCTL to the appropriate serial or vendor-specific handler.
32+
*
33+
* arguments:Queue = handle to the I/O queue.
34+
* Request = handle to the I/O request.
35+
* OutputBufferLength = length of the output buffer in bytes.
36+
* InputBufferLength = length of the input buffer in bytes.
37+
* IoControlCode = IOCTL code identifying the operation.
38+
*
39+
* returns: VOID
40+
*
41+
****************************************************************************/
1742
void QCDSP_EvtIoDeviceControl
1843
(
1944
WDFQUEUE Queue,
@@ -586,6 +611,19 @@ void QCDSP_EvtIoDeviceControl
586611
);
587612
}
588613

614+
/****************************************************************************
615+
*
616+
* function: QCDSP_EvtIoReadQueueReady
617+
*
618+
* purpose: WDF ready-notify callback for the read queue. Signals the read
619+
* thread that a new read request has arrived.
620+
*
621+
* arguments:Queue = handle to the read I/O queue.
622+
* Context = pointer to the device context.
623+
*
624+
* returns: VOID
625+
*
626+
****************************************************************************/
589627
void QCDSP_EvtIoReadQueueReady
590628
(
591629
WDFQUEUE Queue,
@@ -615,6 +653,19 @@ void QCDSP_EvtIoReadQueueReady
615653
}
616654
}
617655

656+
/****************************************************************************
657+
*
658+
* function: QCDSP_EvtIoWriteQueueReady
659+
*
660+
* purpose: WDF ready-notify callback for the write queue. Signals the write
661+
* thread that a new write request has arrived.
662+
*
663+
* arguments:Queue = handle to the write I/O queue.
664+
* Context = pointer to the device context.
665+
*
666+
* returns: VOID
667+
*
668+
****************************************************************************/
618669
void QCDSP_EvtIoWriteQueueReady
619670
(
620671
WDFQUEUE Queue,

src/windows/wdfserial/QCDSP.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
/*
1+
/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*
2+
3+
Q C D S P . H
4+
5+
GENERAL DESCRIPTION
6+
IOCTL dispatch and I/O queue state-change callback declarations.
7+
28
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
39
SPDX-License-Identifier: BSD-3-Clause
4-
*/
10+
11+
*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
512

613
#ifndef QCDSP_H
714
#define QCDSP_H

src/windows/wdfserial/QCINT.c

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
/*
1+
/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*
2+
3+
Q C I N T . C
4+
5+
GENERAL DESCRIPTION
6+
This file implements the CDC interrupt pipe handler for the wdfserial
7+
driver. It manages the interrupt notification kernel thread that
8+
receives SERIAL_STATE notifications from the device, decodes modem
9+
status bits (DSR, CTS, RI, DCD, break), updates the UART state, and
10+
handles D0 entry/exit power transitions for the interrupt pipe.
11+
212
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
313
SPDX-License-Identifier: BSD-3-Clause
4-
*/
14+
15+
*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
516

617
#include "QCMAIN.h"
718
#include "QCPNP.h"
@@ -14,6 +25,18 @@
1425
#include "QCINT.tmh"
1526
#endif
1627

28+
/****************************************************************************
29+
*
30+
* function: QCINT_InitInterruptPipe
31+
*
32+
* purpose: Creates the interrupt pipe worker thread and waits for it to
33+
* signal that it has started successfully.
34+
*
35+
* arguments:pDevContext = pointer to the device context.
36+
*
37+
* returns: NT Status
38+
*
39+
****************************************************************************/
1740
NTSTATUS QCINT_InitInterruptPipe(PDEVICE_CONTEXT pDevContext)
1841
{
1942
NTSTATUS ntStatus = STATUS_SUCCESS;
@@ -49,6 +72,18 @@ NTSTATUS QCINT_InitInterruptPipe(PDEVICE_CONTEXT pDevContext)
4972
}
5073

5174

75+
/****************************************************************************
76+
*
77+
* function: QCINT_ReadInterruptPipe
78+
*
79+
* purpose: Worker thread routine that continuously reads from the USB
80+
* interrupt IN pipe and dispatches CDC notifications.
81+
*
82+
* arguments:pContext = pointer to the device context.
83+
*
84+
* returns: VOID
85+
*
86+
****************************************************************************/
5287
VOID QCINT_ReadInterruptPipe(PVOID pContext)
5388
{
5489
NTSTATUS status = STATUS_SUCCESS;
@@ -471,6 +506,19 @@ VOID QCINT_ReadInterruptPipe(PVOID pContext)
471506
PsTerminateSystemThread(status);
472507
}
473508

509+
/****************************************************************************
510+
*
511+
* function: StopInterruptService
512+
*
513+
* purpose: Signals the interrupt pipe thread to stop and optionally waits
514+
* for the thread to exit before returning.
515+
*
516+
* arguments:pDevContext = pointer to the device context.
517+
* bWait = if TRUE, blocks until the thread has terminated.
518+
*
519+
* returns: NT Status
520+
*
521+
****************************************************************************/
474522
NTSTATUS StopInterruptService
475523
(
476524
PDEVICE_CONTEXT pDevContext,
@@ -522,6 +570,18 @@ NTSTATUS StopInterruptService
522570
return ntStatus;
523571
}
524572

573+
/****************************************************************************
574+
*
575+
* function: QCINT_HandleSerialStateNotification
576+
*
577+
* purpose: Processes a CDC SERIAL_STATE notification received on the
578+
* interrupt pipe and updates the device UART state accordingly.
579+
*
580+
* arguments:pDevContext = pointer to the device context.
581+
*
582+
* returns: VOID
583+
*
584+
****************************************************************************/
525585
VOID QCINT_HandleSerialStateNotification(PDEVICE_CONTEXT pDevContext)
526586
{
527587
PUSB_NOTIFICATION_STATUS pUartStatus;
@@ -617,6 +677,21 @@ VOID QCINT_HandleSerialStateNotification(PDEVICE_CONTEXT pDevContext)
617677
);
618678
}
619679

680+
/****************************************************************************
681+
*
682+
* function: QCINT_InterruptPipeCompletion
683+
*
684+
* purpose: WDF completion routine for interrupt pipe read requests. Sets
685+
* the completion event to wake the interrupt thread.
686+
*
687+
* arguments:Request = handle to the completed I/O request.
688+
* Target = handle to the I/O target.
689+
* Params = pointer to the request completion parameters.
690+
* Context = pointer to the device context.
691+
*
692+
* returns: VOID
693+
*
694+
****************************************************************************/
620695
void QCINT_InterruptPipeCompletion
621696
(
622697
WDFREQUEST Request,

src/windows/wdfserial/QCINT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Q C I N T . H
44
55
GENERAL DESCRIPTION
6-
This file contains definitions for USB interrupt operations.
6+
CDC interrupt pipe management function and worker thread declarations.
77
88
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
99
SPDX-License-Identifier: BSD-3-Clause

0 commit comments

Comments
 (0)