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 /**   System                                                              */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  COMPONENT DEFINITION                                   RELEASE        */
26 /*                                                                        */
27 /*    ux_system.h                                         PORTABLE C      */
28 /*                                                           6.3.0        */
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 main system 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 /*  12-31-2020     Chaoqiong Xiao           Modified comment(s),          */
46 /*                                            added BOS support,          */
47 /*                                            resulting in version 6.1.3  */
48 /*  01-31-2022     Chaoqiong Xiao           Modified comment(s),          */
49 /*                                            added standalone support,   */
50 /*                                            added device printer name,  */
51 /*                                            resulting in version 6.1.10 */
52 /*  04-25-2022     Chaoqiong Xiao           Modified comment(s),          */
53 /*                                            added device CCID name,     */
54 /*                                            resulting in version 6.1.11 */
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_SYSTEM_HOST_H
62 #define UX_SYSTEM_HOST_H
63 
64 /* Define System component function prototypes.  Note that since ux_api.h
65    includes this file, the APIs are only declared if this file is included
66    by internal code in order to prevent duplicate declarations for
67    applications.  */
68 
69 
70 #ifdef UX_SOURCE_CODE
71 UINT  _ux_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size,
72                             VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size);
73 UINT  _ux_system_uninitialize(VOID);
74 UINT  _ux_system_tasks_run(VOID);
75 
76 UINT  _uxe_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size,
77                             VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size);
78 #endif
79 
80 /* Define System component external data references.  */
81 
82 extern UX_SYSTEM *_ux_system;
83 extern UX_SYSTEM_HOST *_ux_system_host;
84 extern UX_SYSTEM_SLAVE *_ux_system_slave;
85 extern UX_SYSTEM_OTG *_ux_system_otg;
86 extern UCHAR _ux_system_endpoint_descriptor_structure[];
87 extern UCHAR _ux_system_device_descriptor_structure[];
88 extern UCHAR _ux_system_configuration_descriptor_structure[];
89 extern UCHAR _ux_system_interface_descriptor_structure[];
90 extern UCHAR _ux_system_interface_association_descriptor_structure[];
91 extern UCHAR _ux_system_string_descriptor_structure[];
92 extern UCHAR _ux_system_dfu_functional_descriptor_structure[];
93 extern UCHAR _ux_system_hub_descriptor_structure[];
94 extern UCHAR _ux_system_hid_descriptor_structure[];
95 extern UCHAR _ux_system_class_audio_interface_descriptor_structure[];
96 extern UCHAR _ux_system_class_audio_input_terminal_descriptor_structure[];
97 extern UCHAR _ux_system_class_audio_output_terminal_descriptor_structure[];
98 extern UCHAR _ux_system_class_audio_feature_unit_descriptor_structure[];
99 extern UCHAR _ux_system_class_audio_streaming_interface_descriptor_structure[];
100 extern UCHAR _ux_system_class_audio_streaming_endpoint_descriptor_structure[];
101 extern UCHAR _ux_system_class_pima_storage_structure[];
102 extern UCHAR _ux_system_class_pima_object_structure[];
103 extern UCHAR _ux_system_ecm_interface_descriptor_structure[];
104 
105 extern UCHAR _ux_system_bos_descriptor_structure[];
106 extern UCHAR _ux_system_usb_2_0_extension_descriptor_structure[];
107 extern UCHAR _ux_system_container_id_descriptor_structure[];
108 
109 extern UINT  _ux_system_host_hcd_periodic_tree_entries[32];
110 
111 extern UCHAR _ux_system_host_class_hub_name[];
112 extern UCHAR _ux_system_host_class_printer_name[];
113 extern UCHAR _ux_system_host_class_storage_name[];
114 extern UCHAR _ux_system_host_class_hid_name[];
115 extern UCHAR _ux_system_host_class_audio_name[];
116 extern UCHAR _ux_system_host_class_cdc_acm_name[];
117 extern UCHAR _ux_system_host_class_cdc_dlc_name[];
118 extern UCHAR _ux_system_host_class_cdc_ecm_name[];
119 extern UCHAR _ux_system_host_class_prolific_name[];
120 extern UCHAR _ux_system_host_class_dpump_name[];
121 extern UCHAR _ux_system_host_class_pima_name[];
122 extern UCHAR _ux_system_host_class_asix_name[];
123 extern UCHAR _ux_system_host_class_swar_name[];
124 extern UCHAR _ux_system_host_class_gser_name[];
125 extern UCHAR _ux_system_host_class_hid_client_remote_control_name[];
126 extern UCHAR _ux_system_host_class_hid_client_mouse_name[];
127 extern UCHAR _ux_system_host_class_hid_client_keyboard_name[];
128 
129 extern UCHAR _ux_system_host_hcd_ohci_name[];
130 extern UCHAR _ux_system_host_hcd_ehci_name[];
131 extern UCHAR _ux_system_host_hcd_isp1161_name[];
132 extern UCHAR _ux_system_host_hcd_isp1362_name[];
133 extern UCHAR _ux_system_host_hcd_sh2_name[];
134 extern UCHAR _ux_system_host_hcd_rx_name[];
135 extern UCHAR _ux_system_host_hcd_pic32_name[];
136 extern UCHAR _ux_system_host_hcd_stm32_name[];
137 extern UCHAR _ux_system_host_hcd_musb_name[];
138 extern UCHAR _ux_system_host_hcd_atm7_name[];
139 extern UCHAR _ux_system_host_hcd_simulator_name[];
140 
141 extern UCHAR _ux_system_slave_class_storage_name[];
142 extern UCHAR _ux_system_slave_class_storage_vendor_id[];
143 extern UCHAR _ux_system_slave_class_storage_product_id[];
144 extern UCHAR _ux_system_slave_class_storage_product_rev[];
145 extern UCHAR _ux_system_slave_class_storage_product_serial[];
146 extern UCHAR _ux_system_slave_class_audio_name[];
147 extern UCHAR _ux_system_slave_class_cdc_acm_name[];
148 extern UCHAR _ux_system_slave_class_dpump_name[];
149 extern UCHAR _ux_system_slave_class_pima_name[];
150 extern UCHAR _ux_system_slave_class_hid_name[];
151 extern UCHAR _ux_system_slave_class_rndis_name[];
152 extern UCHAR _ux_system_slave_class_cdc_ecm_name[];
153 extern UCHAR _ux_system_slave_class_dfu_name[];
154 
155 extern UCHAR _ux_system_device_class_printer_name[];
156 extern UCHAR _ux_system_device_class_ccid_name[];
157 
158 #if defined(UX_HOST_SIDE_ONLY)
159 #define _ux_system_host_tasks_run      _ux_host_stack_tasks_run
160 #else
161 #define _ux_system_host_tasks_run      _ux_system_tasks_run
162 #endif
163 
164 #if defined(UX_DEVICE_SIDE_ONLY)
165 #define _ux_system_device_tasks_run    _ux_device_stack_tasks_run
166 #else
167 #define _ux_system_device_tasks_run    _ux_system_tasks_run
168 #endif
169 
170 #endif
171 
172