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 /**   Device Stack                                                        */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 /**************************************************************************/
23 /*                                                                        */
24 /*  COMPONENT DEFINITION                                   RELEASE        */
25 /*                                                                        */
26 /*    ux_device_stack.h                                   PORTABLE C      */
27 /*                                                           6.3.0        */
28 /*  AUTHOR                                                                */
29 /*                                                                        */
30 /*    Chaoqiong Xiao, Microsoft Corporation                               */
31 /*                                                                        */
32 /*  DESCRIPTION                                                           */
33 /*                                                                        */
34 /*    This file defines the equivalences for the USBX Device Stack        */
35 /*    component.                                                          */
36 /*                                                                        */
37 /*  RELEASE HISTORY                                                       */
38 /*                                                                        */
39 /*    DATE              NAME                      DESCRIPTION             */
40 /*                                                                        */
41 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
42 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
43 /*                                            resulting in version 6.1    */
44 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
45 /*                                            added extern "C" keyword    */
46 /*                                            for compatibility with C++, */
47 /*                                            resulting in version 6.1.8  */
48 /*  01-31-2022     Chaoqiong Xiao           Modified comment(s),          */
49 /*                                            added standalone support,   */
50 /*                                            resulting in version 6.1.10 */
51 /*  07-29-2022     Chaoqiong Xiao           Modified comment(s),          */
52 /*                                            fixed parameter/variable    */
53 /*                                            names conflict C++ keyword, */
54 /*                                            resulting in version 6.1.12 */
55 /*  10-31-2023     Chaoqiong Xiao           Modified comment(s),          */
56 /*                                            added error checks support, */
57 /*                                            resulting in version 6.3.0  */
58 /*                                                                        */
59 /**************************************************************************/
60 
61 #ifndef UX_DEVICE_STACK_H
62 #define UX_DEVICE_STACK_H
63 
64 /* Determine if a C++ compiler is being used.  If so, ensure that standard
65    C is used to process the API information.  */
66 
67 #ifdef   __cplusplus
68 
69 /* Yes, C++ compiler is present.  Use standard C.  */
70 extern   "C" {
71 
72 #endif
73 
74 
75 /* Define USB Device Stack prototypes.  */
76 
77 UINT    _ux_device_stack_alternate_setting_get(ULONG interface_value);
78 UINT    _ux_device_stack_alternate_setting_set(ULONG interface_value, ULONG alternate_setting_value);
79 UINT    _ux_device_stack_class_register(UCHAR *class_name,
80                     UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *),
81                     ULONG configuration_number,
82                     ULONG interface_number,
83                     VOID *parameter);
84 UINT    _ux_device_stack_clear_feature(ULONG request_type, ULONG request_value, ULONG request_index);
85 UINT    _ux_device_stack_configuration_get(VOID);
86 UINT    _ux_device_stack_configuration_set(ULONG configuration_value);
87 UINT    _ux_device_stack_control_request_process(UX_SLAVE_TRANSFER *transfer_request);
88 UINT    _ux_device_stack_descriptor_send(ULONG descriptor_type, ULONG request_index, ULONG host_length);
89 UINT    _ux_device_stack_disconnect(VOID);
90 UINT    _ux_device_stack_endpoint_stall(UX_SLAVE_ENDPOINT *endpoint);
91 UINT    _ux_device_stack_get_status(ULONG request_type, ULONG request_index, ULONG request_length);
92 UINT    _ux_device_stack_host_wakeup(VOID);
93 UINT    _ux_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed,
94                     UCHAR * device_framework_full_speed, ULONG device_framework_length_full_speed,
95                     UCHAR * string_framework, ULONG string_framework_length,
96                     UCHAR * language_id_framework, ULONG language_id_framework_length,
97                     UINT (*ux_system_slave_change_function)(ULONG));
98 UINT    _ux_device_stack_interface_delete(UX_SLAVE_INTERFACE *ux_interface);
99 UINT    _ux_device_stack_interface_get(UINT interface_value);
100 UINT    _ux_device_stack_interface_set(UCHAR * device_framework, ULONG device_framework_length,
101                     ULONG alternate_setting_value);
102 UINT    _ux_device_stack_interface_start(UX_SLAVE_INTERFACE *ux_interface);
103 UINT    _ux_device_stack_set_feature(ULONG request_type, ULONG request_value, ULONG request_index);
104 UINT    _ux_device_stack_transfer_all_request_abort(UX_SLAVE_ENDPOINT *endpoint, ULONG completion_code);
105 UINT    _ux_device_stack_transfer_request(UX_SLAVE_TRANSFER *transfer_request, ULONG slave_length, ULONG host_length);
106 UINT    _ux_device_stack_transfer_abort(UX_SLAVE_TRANSFER *transfer_request, ULONG completion_code);
107 UINT    _ux_device_stack_class_unregister(UCHAR *class_name, UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *));
108 UINT    _ux_device_stack_microsoft_extension_register(ULONG vendor_request, UINT (*vendor_request_function)(ULONG, ULONG, ULONG, ULONG, UCHAR *, ULONG *));
109 UINT    _ux_device_stack_uninitialize(VOID);
110 
111 UINT    _ux_device_stack_tasks_run(VOID);
112 UINT    _ux_device_stack_transfer_run(UX_SLAVE_TRANSFER *transfer_request, ULONG slave_length, ULONG host_length);
113 
114 UINT    _uxe_device_stack_class_register(UCHAR *class_name,
115                                     UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *),
116                                     ULONG configuration_number,
117                                     ULONG interface_number,
118                                     VOID *parameter);
119 UINT    _uxe_device_stack_class_unregister(UCHAR *class_name,
120                                     UINT (*class_entry_function)(struct UX_SLAVE_CLASS_COMMAND_STRUCT *));
121 
122 UINT    _uxe_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed,
123                                     UCHAR * device_framework_full_speed, ULONG device_framework_length_full_speed,
124                                     UCHAR * string_framework, ULONG string_framework_length,
125                                     UCHAR * language_id_framework, ULONG language_id_framework_length,
126                                     UINT (*ux_system_slave_change_function)(ULONG));
127 
128 
129 /* Determine if a C++ compiler is being used.  If so, complete the standard
130    C conditional started above.  */
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif
136 
137