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