|
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 | +
|
2 | 12 | Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
3 | 13 | SPDX-License-Identifier: BSD-3-Clause |
4 | | -*/ |
| 14 | +
|
| 15 | +*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/ |
5 | 16 |
|
6 | 17 | #include "QCMAIN.h" |
7 | 18 | #include "QCPNP.h" |
|
14 | 25 | #include "QCINT.tmh" |
15 | 26 | #endif |
16 | 27 |
|
| 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 | + ****************************************************************************/ |
17 | 40 | NTSTATUS QCINT_InitInterruptPipe(PDEVICE_CONTEXT pDevContext) |
18 | 41 | { |
19 | 42 | NTSTATUS ntStatus = STATUS_SUCCESS; |
@@ -49,6 +72,18 @@ NTSTATUS QCINT_InitInterruptPipe(PDEVICE_CONTEXT pDevContext) |
49 | 72 | } |
50 | 73 |
|
51 | 74 |
|
| 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 | + ****************************************************************************/ |
52 | 87 | VOID QCINT_ReadInterruptPipe(PVOID pContext) |
53 | 88 | { |
54 | 89 | NTSTATUS status = STATUS_SUCCESS; |
@@ -471,6 +506,19 @@ VOID QCINT_ReadInterruptPipe(PVOID pContext) |
471 | 506 | PsTerminateSystemThread(status); |
472 | 507 | } |
473 | 508 |
|
| 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 | + ****************************************************************************/ |
474 | 522 | NTSTATUS StopInterruptService |
475 | 523 | ( |
476 | 524 | PDEVICE_CONTEXT pDevContext, |
@@ -522,6 +570,18 @@ NTSTATUS StopInterruptService |
522 | 570 | return ntStatus; |
523 | 571 | } |
524 | 572 |
|
| 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 | + ****************************************************************************/ |
525 | 585 | VOID QCINT_HandleSerialStateNotification(PDEVICE_CONTEXT pDevContext) |
526 | 586 | { |
527 | 587 | PUSB_NOTIFICATION_STATUS pUartStatus; |
@@ -617,6 +677,21 @@ VOID QCINT_HandleSerialStateNotification(PDEVICE_CONTEXT pDevContext) |
617 | 677 | ); |
618 | 678 | } |
619 | 679 |
|
| 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 | + ****************************************************************************/ |
620 | 695 | void QCINT_InterruptPipeCompletion |
621 | 696 | ( |
622 | 697 | WDFREQUEST Request, |
|
0 commit comments