1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** USBX Component                                                        */
16 /**                                                                       */
17 /**   Host Data Pump Class                                                */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    ux_host_class_dpump.h                               PORTABLE C      */
28 /*                                                           6.1.10       */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    Chaoqiong Xiao, Microsoft Corporation                               */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file contains all the header and extern functions used by the  */
36 /*    USBX demo data pump class.                                          */
37 /*                                                                        */
38 /*  RELEASE HISTORY                                                       */
39 /*                                                                        */
40 /*    DATE              NAME                      DESCRIPTION             */
41 /*                                                                        */
42 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
43 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
44 /*                                            resulting in version 6.1    */
45 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
46 /*                                            added extern "C" keyword    */
47 /*                                            for compatibility with C++, */
48 /*                                            resulting in version 6.1.8  */
49 /*  01-31-2022     Chaoqiong Xiao           Modified comment(s),          */
50 /*                                            added standalone support,   */
51 /*                                            resulting in version 6.1.10 */
52 /*                                                                        */
53 /**************************************************************************/
54 
55 #ifndef UX_HOST_CLASS_DPUMP_H
56 #define UX_HOST_CLASS_DPUMP_H
57 
58 /* Determine if a C++ compiler is being used.  If so, ensure that standard
59    C is used to process the API information.  */
60 
61 #ifdef   __cplusplus
62 
63 /* Yes, C++ compiler is present.  Use standard C.  */
64 extern   "C" {
65 
66 #endif
67 
68 
69 /* Define Data Pump Class constants.  */
70 
71 #define UX_HOST_CLASS_DPUMP_CLASS_TRANSFER_TIMEOUT            300000
72 #define UX_HOST_CLASS_DPUMP_CLASS                             0x99
73 #define UX_HOST_CLASS_DPUMP_SUBCLASS                          0x99
74 #define UX_HOST_CLASS_DPUMP_PROTOCOL                          0x99
75 
76 /* Define Data Pump Class packet equivalences.  */
77 #define UX_HOST_CLASS_DPUMP_PACKET_SIZE                       128
78 
79 /* Define Data Pump Class Ioctl functions.  */
80 #define UX_HOST_CLASS_DPUMP_SELECT_ALTERNATE_SETTING          1
81 
82 /* Define Data Pump Class string constants.  */
83 
84 #define UX_HOST_CLASS_DPUMP_GENERIC_NAME                      "USB DPUMP"
85 
86 /* Define R/W lock bits for standalone mode.  */
87 
88 #define UX_HOST_CLASS_DPUMP_READ_LOCK                         (1u<<0)
89 #define UX_HOST_CLASS_DPUMP_WRITE_LOCK                        (1u<<1)
90 
91 /* Define Printer Class function prototypes.  */
92 
93 UINT    _ux_host_class_dpump_activate(UX_HOST_CLASS_COMMAND *command);
94 UINT    _ux_host_class_dpump_configure(UX_HOST_CLASS_DPUMP *dpump);
95 UINT    _ux_host_class_dpump_deactivate(UX_HOST_CLASS_COMMAND *command);
96 UINT    _ux_host_class_dpump_endpoints_get(UX_HOST_CLASS_DPUMP *dpump);
97 UINT    _ux_host_class_dpump_entry(UX_HOST_CLASS_COMMAND *command);
98 UINT    _ux_host_class_dpump_read (UX_HOST_CLASS_DPUMP *dpump, UCHAR *data_pointer,
99                                     ULONG requested_length, ULONG *actual_length);
100 UINT    _ux_host_class_dpump_write(UX_HOST_CLASS_DPUMP *dpump, UCHAR * data_pointer,
101                                     ULONG requested_length, ULONG *actual_length);
102 UINT    _ux_host_class_dpump_ioctl(UX_HOST_CLASS_DPUMP *dpump, ULONG ioctl_function,
103                                     VOID *parameter);
104 
105 
106 #define ux_host_class_dpump_entry                               _ux_host_class_dpump_entry
107 #define ux_host_class_dpump_read                                _ux_host_class_dpump_read
108 #define ux_host_class_dpump_write                               _ux_host_class_dpump_write
109 #define ux_host_class_dpump_ioctl                               _ux_host_class_dpump_ioctl
110 
111 /* Determine if a C++ compiler is being used.  If so, complete the standard
112    C conditional started above.  */
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif
118