Skip to content

Commit 2d4a4ae

Browse files
authored
Merge pull request #159 from ayedm1/add_usbx_classes_free_memory_allocated
add missing free allocated memory for device classes, fix typo
2 parents 6cd34fd + 13b1909 commit 2d4a4ae

20 files changed

+1076
-632
lines changed

common/usbx_device_classes/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ target_sources(${PROJECT_NAME} PRIVATE
9090
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_state_sync.c
9191
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_tasks_run.c
9292
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_thread.c
93+
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_uninitialize.c
9394
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_hid_activate.c
9495
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_hid_control_request.c
9596
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_hid_deactivate.c
@@ -145,6 +146,7 @@ target_sources(${PROJECT_NAME} PRIVATE
145146
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_storage_id_send.c
146147
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_storage_info_get.c
147148
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_thread.c
149+
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_uninitialize.c
148150
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_printer_activate.c
149151
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_printer_control_request.c
150152
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_printer_deactivate.c
@@ -170,6 +172,7 @@ target_sources(${PROJECT_NAME} PRIVATE
170172
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_msg_query.c
171173
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_msg_reset.c
172174
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_msg_set.c
175+
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_uninitialize.c
173176
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_write.c
174177
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_storage_activate.c
175178
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_storage_control_request.c

common/usbx_device_classes/inc/ux_device_class_dfu.h

+36-31
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
/***************************************************************************
2-
* Copyright (c) 2024 Microsoft Corporation
3-
*
2+
* Copyright (c) 2024 Microsoft Corporation
3+
*
44
* This program and the accompanying materials are made available under the
55
* terms of the MIT License which is available at
66
* https://opensource.org/licenses/MIT.
7-
*
7+
*
88
* SPDX-License-Identifier: MIT
99
**************************************************************************/
1010

1111
/**************************************************************************/
1212
/**************************************************************************/
13-
/** */
14-
/** USBX Component */
13+
/** */
14+
/** USBX Component */
1515
/** */
1616
/** DFU Class */
1717
/** */
1818
/**************************************************************************/
1919
/**************************************************************************/
2020

21-
/**************************************************************************/
22-
/* */
23-
/* COMPONENT DEFINITION RELEASE */
24-
/* */
25-
/* ux_device_class_dfu.h PORTABLE C */
26-
/* 6.3.0 */
21+
/**************************************************************************/
22+
/* */
23+
/* COMPONENT DEFINITION RELEASE */
24+
/* */
25+
/* ux_device_class_dfu.h PORTABLE C */
26+
/* 6.x */
2727
/* AUTHOR */
2828
/* */
2929
/* Chaoqiong Xiao, Microsoft Corporation */
3030
/* */
3131
/* DESCRIPTION */
32-
/* */
33-
/* This file defines the equivalences for the USBX Device Class DFU */
34-
/* ACM component. */
35-
/* */
36-
/* RELEASE HISTORY */
37-
/* */
38-
/* DATE NAME DESCRIPTION */
39-
/* */
32+
/* */
33+
/* This file defines the equivalences for the USBX Device Class DFU */
34+
/* ACM component. */
35+
/* */
36+
/* RELEASE HISTORY */
37+
/* */
38+
/* DATE NAME DESCRIPTION */
39+
/* */
4040
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
4141
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
4242
/* used UX prefix to refer to */
@@ -62,29 +62,33 @@
6262
/* 10-31-2023 Yajun xia Modified comment(s), */
6363
/* added error checks support, */
6464
/* resulting in version 6.3.0 */
65+
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
66+
/* added dfu deinit function, */
67+
/* remove extra spaces, */
68+
/* resulting in version 6.x */
6569
/* */
6670
/**************************************************************************/
6771

6872
#ifndef UX_DEVICE_CLASS_DFU_H
6973
#define UX_DEVICE_CLASS_DFU_H
7074

71-
/* Determine if a C++ compiler is being used. If so, ensure that standard
72-
C is used to process the API information. */
75+
/* Determine if a C++ compiler is being used. If so, ensure that standard
76+
C is used to process the API information. */
7377

74-
#ifdef __cplusplus
78+
#ifdef __cplusplus
7579

76-
/* Yes, C++ compiler is present. Use standard C. */
77-
extern "C" {
80+
/* Yes, C++ compiler is present. Use standard C. */
81+
extern "C" {
7882

79-
#endif
83+
#endif
8084

8185
/* Internal option: enable the basic USBX error checking. This define is typically used
8286
while debugging application. */
8387
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_CLASS_DFU_ENABLE_ERROR_CHECKING)
8488
#define UX_DEVICE_CLASS_DFU_ENABLE_ERROR_CHECKING
8589
#endif
8690

87-
/* Define DFU class descriptor capabilities. */
91+
/* Define DFU class descriptor capabilities. */
8892
#define UX_SLAVE_CLASS_DFU_CAPABILITY_WILL_DETACH 0x08
8993
#define UX_SLAVE_CLASS_DFU_CAPABILITY_MANIFESTATION_TOLERANT 0x04
9094
#define UX_SLAVE_CLASS_DFU_CAPABILITY_CAN_UPLOAD 0x02
@@ -187,7 +191,7 @@ extern "C" {
187191
/* Define DFU application notification signals. */
188192
#define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_OK 0
189193
#define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_BUSY 1
190-
#define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_ERROR 2
194+
#define UX_SLAVE_CLASS_DFU_MEDIA_STATUS_ERROR 2
191195

192196
/* Define DFU thread event signals. */
193197
#define UX_DEVICE_CLASS_DFU_THREAD_EVENT_DISCONNECT 0x1u
@@ -257,6 +261,7 @@ UINT _ux_device_class_dfu_deactivate(UX_SLAVE_CLASS_COMMAND *command);
257261
UINT _ux_device_class_dfu_entry(UX_SLAVE_CLASS_COMMAND *command);
258262
UINT _ux_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *command);
259263
VOID _ux_device_class_dfu_thread(ULONG dfu_class);
264+
UINT _ux_device_class_dfu_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
260265

261266
UCHAR _ux_device_class_dfu_state_get(UX_SLAVE_CLASS_DFU *dfu);
262267
VOID _ux_device_class_dfu_state_sync(UX_SLAVE_CLASS_DFU *dfu);
@@ -270,10 +275,10 @@ UINT _uxe_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *command);
270275
#define ux_device_class_dfu_state_get _ux_device_class_dfu_state_get
271276
#define ux_device_class_dfu_state_sync _ux_device_class_dfu_state_sync
272277

273-
/* Determine if a C++ compiler is being used. If so, complete the standard
274-
C conditional started above. */
278+
/* Determine if a C++ compiler is being used. If so, complete the standard
279+
C conditional started above. */
275280
#ifdef __cplusplus
276-
}
277-
#endif
281+
}
282+
#endif
278283

279284
#endif /* UX_DEVICE_CLASS_DFU_H */

0 commit comments

Comments
 (0)