1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Device Data Pump Class                                              */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  COMPONENT DEFINITION                                   RELEASE        */
27 /*                                                                        */
28 /*    ux_device_class_dpump.h                             PORTABLE C      */
29 /*                                                           6.1.10       */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Chaoqiong Xiao, Microsoft Corporation                               */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains all the header and extern functions used by the  */
37 /*    USBX device dpump class.                                            */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
44 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
45 /*                                            resulting in version 6.1    */
46 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
47 /*                                            added extern "C" keyword    */
48 /*                                            for compatibility with C++, */
49 /*                                            resulting in version 6.1.8  */
50 /*  01-31-2022     Chaoqiong Xiao           Modified comment(s),          */
51 /*                                            added standalone support,   */
52 /*                                            resulting in version 6.1.10 */
53 /*                                                                        */
54 /**************************************************************************/
55 
56 #ifndef UX_DEVICE_CLASS_DPUMP_H
57 #define UX_DEVICE_CLASS_DPUMP_H
58 
59 /* Determine if a C++ compiler is being used.  If so, ensure that standard
60    C is used to process the API information.  */
61 
62 #ifdef   __cplusplus
63 
64 /* Yes, C++ compiler is present.  Use standard C.  */
65 extern   "C" {
66 
67 #endif
68 
69 
70 /* Define Storage Class USB Class constants.  */
71 
72 #define UX_SLAVE_CLASS_DPUMP_CLASS                              0x99
73 #define UX_SLAVE_CLASS_DPUMP_SUBCLASS                           0x99
74 #define UX_SLAVE_CLASS_DPUMP_PROTOCOL                           0x99
75 
76 /* Define Data Pump Class packet equivalences.  */
77 #define UX_DEVICE_CLASS_DPUMP_PACKET_SIZE                       128
78 
79 
80 /* Define Slave DPUMP Class Calling Parameter structure */
81 
82 typedef struct UX_SLAVE_CLASS_DPUMP_PARAMETER_STRUCT
83 {
84     VOID                    (*ux_slave_class_dpump_instance_activate)(VOID *);
85     VOID                    (*ux_slave_class_dpump_instance_deactivate)(VOID *);
86 
87 } UX_SLAVE_CLASS_DPUMP_PARAMETER;
88 
89 /* Define Slave Data Pump Class structure.  */
90 
91 typedef struct UX_SLAVE_CLASS_DPUMP_STRUCT
92 {
93     UX_SLAVE_INTERFACE                  *ux_slave_class_dpump_interface;
94     UX_SLAVE_CLASS_DPUMP_PARAMETER      ux_slave_class_dpump_parameter;
95     UX_SLAVE_ENDPOINT                   *ux_slave_class_dpump_bulkin_endpoint;
96     UX_SLAVE_ENDPOINT                   *ux_slave_class_dpump_bulkout_endpoint;
97     ULONG                               ux_slave_class_dpump_alternate_setting;
98 #if defined(UX_DEVICE_STANDALONE)
99     UCHAR                               *ux_device_class_dpump_write_buffer;
100     ULONG                               ux_device_class_dpump_write_requested_length;
101     ULONG                               ux_device_class_dpump_write_transfer_length;
102     ULONG                               ux_device_class_dpump_write_actual_length;
103     UINT                                ux_device_class_dpump_write_state;
104     UINT                                ux_device_class_dpump_write_status;
105     UCHAR                               *ux_device_class_dpump_read_buffer;
106     ULONG                               ux_device_class_dpump_read_requested_length;
107     ULONG                               ux_device_class_dpump_read_transfer_length;
108     ULONG                               ux_device_class_dpump_read_actual_length;
109     UINT                                ux_device_class_dpump_read_state;
110     UINT                                ux_device_class_dpump_read_status;
111 #endif
112 } UX_SLAVE_CLASS_DPUMP;
113 
114 /* Define Device Data Pump Class prototypes.  */
115 
116 UINT    _ux_device_class_dpump_initialize(UX_SLAVE_CLASS_COMMAND *command);
117 UINT    _ux_device_class_dpump_activate(UX_SLAVE_CLASS_COMMAND *command);
118 UINT    _ux_device_class_dpump_deactivate(UX_SLAVE_CLASS_COMMAND *command);
119 UINT    _ux_device_class_dpump_entry(UX_SLAVE_CLASS_COMMAND *command);
120 UINT    _ux_device_class_dpump_read(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer,
121                                 ULONG requested_length, ULONG *actual_length);
122 UINT    _ux_device_class_dpump_read_run(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer,
123                                 ULONG requested_length, ULONG *actual_length);
124 UINT    _ux_device_class_dpump_write(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer,
125                                 ULONG requested_length, ULONG *actual_length);
126 UINT    _ux_device_class_dpump_write_run(UX_SLAVE_CLASS_DPUMP *dpump, UCHAR *buffer,
127                                 ULONG requested_length, ULONG *actual_length);
128 UINT    _ux_device_class_dpump_change(UX_SLAVE_CLASS_COMMAND *command);
129 
130 /* Define Device DPUMP Class API prototypes.  */
131 
132 #define ux_device_class_dpump_entry                               _ux_device_class_dpump_entry
133 #define ux_device_class_dpump_read                                _ux_device_class_dpump_read
134 #define ux_device_class_dpump_read_run                            _ux_device_class_dpump_read_run
135 #define ux_device_class_dpump_write                               _ux_device_class_dpump_write
136 #define ux_device_class_dpump_write_run                           _ux_device_class_dpump_write_run
137 
138 /* Determine if a C++ compiler is being used.  If so, complete the standard
139    C conditional started above.  */
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 #endif
145