Merge pull request #159 from ayedm1/add_usbx_classes_free_memory_allocated

add missing free allocated memory for device classes, fix typo
This commit is contained in:
Frédéric Desbiens 2024-12-12 18:07:35 +01:00 committed by GitHub
commit 2d4a4aea0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 1075 additions and 631 deletions

View File

@ -90,6 +90,7 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_state_sync.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_tasks_run.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_thread.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_dfu_uninitialize.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_hid_activate.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_hid_control_request.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_hid_deactivate.c
@ -145,6 +146,7 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_storage_id_send.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_storage_info_get.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_thread.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_pima_uninitialize.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_printer_activate.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_printer_control_request.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_printer_deactivate.c
@ -170,6 +172,7 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_msg_query.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_msg_reset.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_msg_set.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_uninitialize.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_rndis_write.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_storage_activate.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_storage_control_request.c

View File

@ -23,7 +23,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_dfu.h PORTABLE C */
/* 6.3.0 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -62,6 +62,10 @@
/* 10-31-2023 Yajun xia Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* added dfu deinit function, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
@ -257,6 +261,7 @@ UINT _ux_device_class_dfu_deactivate(UX_SLAVE_CLASS_COMMAND *command);
UINT _ux_device_class_dfu_entry(UX_SLAVE_CLASS_COMMAND *command);
UINT _ux_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *command);
VOID _ux_device_class_dfu_thread(ULONG dfu_class);
UINT _ux_device_class_dfu_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
UCHAR _ux_device_class_dfu_state_get(UX_SLAVE_CLASS_DFU *dfu);
VOID _ux_device_class_dfu_state_sync(UX_SLAVE_CLASS_DFU *dfu);

View File

@ -25,7 +25,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_pima.h PORTABLE C */
/* 6.3.0 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -63,6 +63,10 @@
/* endpoint buffer in classes, */
/* added error checks support, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* added pima deinit function, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
@ -993,6 +997,7 @@ UINT _ux_device_class_pima_deactivate(UX_SLAVE_CLASS_COMMAND *command);
UINT _ux_device_class_pima_control_request(UX_SLAVE_CLASS_COMMAND *command);
UINT _ux_device_class_pima_device_info_send(UX_SLAVE_CLASS_PIMA *pima);
UINT _ux_device_class_pima_entry(UX_SLAVE_CLASS_COMMAND *command);
UINT _ux_device_class_pima_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
UINT _ux_device_class_pima_event_get(UX_SLAVE_CLASS_PIMA *pima,
UX_SLAVE_CLASS_PIMA_EVENT *pima_event);
UINT _ux_device_class_pima_event_set(UX_SLAVE_CLASS_PIMA *pima,

View File

@ -23,7 +23,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_rndis.h PORTABLE C */
/* 6.3.0 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -60,6 +60,10 @@
/* endpoint buffer in classes, */
/* improved error checking, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* added rndis deinit function,*/
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
@ -664,7 +668,7 @@ UINT _ux_device_class_rndis_msg_keep_alive(UX_SLAVE_CLASS_RNDIS *rndis, UX_SLAV
VOID _ux_device_class_rndis_interrupt_thread(ULONG rndis_class);
VOID _ux_device_class_rndis_bulkin_thread(ULONG rndis_class);
VOID _ux_device_class_rndis_bulkout_thread(ULONG rndis_class);
UINT _ux_device_class_rndis_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
/* Define Device RNDIS Class API prototypes. */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_audio_entry PORTABLE C */
/* 6.2.1 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -79,6 +79,9 @@
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.2.1 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_audio_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -106,7 +109,7 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the init function of the Audio class. */
/* Call the uninit function of the Audio class. */
status = _ux_device_class_audio_uninitialize(command);
/* Return the completion status. */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_ccid_entry PORTABLE C */
/* 6.1.11 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -70,6 +70,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_ccid_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -93,7 +96,7 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the init function of the CCID class. */
/* Call the uninit function of the CCID class. */
status = _ux_device_class_ccid_uninitialize(command);
/* Return the completion status. */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_acm_entry PORTABLE C */
/* 6.1 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -72,6 +72,10 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_acm_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -95,7 +99,7 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the init function of the CDC ACM class. */
/* Call the uninit function of the CDC ACM class. */
status = _ux_device_class_cdc_acm_uninitialize(command);
/* Return the completion status. */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_ecm_entry PORTABLE C */
/* 6.1 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -73,6 +73,10 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_ecm_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -95,7 +99,7 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the init function of the CDC_ECM class. */
/* Call the uninit function of the CDC_ECM class. */
status = _ux_device_class_cdc_ecm_uninitialize(command);
/* Return the completion status. */

View File

@ -46,7 +46,7 @@
/* */
/* INPUT */
/* */
/* command Pointer to storage command */
/* command Pointer to cdc ecm command */
/* */
/* OUTPUT */
/* */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_dfu_entry PORTABLE C */
/* 6.3.0 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -56,6 +56,7 @@
/* CALLS */
/* */
/* _ux_device_class_dfu_initialize Initialize dfu class */
/* _ux_device_class_dfu_uninitialize Uninitialize dfu class */
/* _ux_device_class_dfu_activate Activate dfu class */
/* _ux_device_class_dfu_deactivate Deactivate dfu class */
/* _ux_device_class_dfu_control_request Request control */
@ -74,6 +75,11 @@
/* 10-31-2023 Yajun Xia Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* added call of dfu uninit */
/* function, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_dfu_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -90,17 +96,24 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_INITIALIZE:
#ifdef UX_DEVICE_CLASS_DFU_ENABLE_ERROR_CHECKING
/* Call the init function of the DFU ACM class. */
/* Call the init function of the DFU class. */
status = _uxe_device_class_dfu_initialize(command);
#else
/* Call the init function of the DFU ACM class. */
/* Call the init function of the DFU class. */
status = _ux_device_class_dfu_initialize(command);
#endif /* UX_DEVICE_CLASS_DFU_ENABLE_ERROR_CHECKING */
/* Return the completion status. */
return(status);
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the uninit function of the DFU class. */
status = _ux_device_class_dfu_uninitialize(command);
/* Return the completion status. */
return(status);
case UX_SLAVE_CLASS_COMMAND_QUERY:

View File

@ -0,0 +1,102 @@
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/** */
/** USBX Component */
/** */
/** Device DFU Class */
/** */
/**************************************************************************/
/**************************************************************************/
#define UX_SOURCE_CODE
/* Include necessary system files. */
#include "ux_api.h"
#include "ux_device_class_dfu.h"
#include "ux_device_stack.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_dfu_uninitialize PORTABLE C */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function uninitializes the USB DFU device. */
/* */
/* INPUT */
/* */
/* command Pointer to dfu command */
/* */
/* OUTPUT */
/* */
/* Completion Status */
/* */
/* CALLS */
/* */
/* _ux_device_thread_delete Remove storage thread. */
/* _ux_utility_memory_free Free memory used by storage */
/* _ux_utility_event_flags_delete Remove flag event structure */
/* */
/* */
/* CALLED BY */
/* */
/* USBX Source Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* xx-xx-xxxx Mohamed ayed Initial Version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_dfu_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
{
UX_SLAVE_CLASS_DFU *dfu;
UX_SLAVE_CLASS *class_ptr;
/* Get the class container. */
class_ptr = command -> ux_slave_class_command_class_ptr;
/* Get the class instance in the container. */
dfu = (UX_SLAVE_CLASS_DFU *) class_ptr -> ux_slave_class_instance;
/* Sanity check. */
if (dfu != UX_NULL)
{
#if !defined(UX_DEVICE_STANDALONE)
/* Free resources and return error. */
_ux_device_thread_delete(&dfu -> ux_slave_class_dfu_thread);
_ux_utility_event_flags_delete(&dfu -> ux_slave_class_dfu_event_flags_group);
_ux_utility_memory_free(dfu -> ux_slave_class_dfu_thread_stack);
#endif
/* Free the resources. */
_ux_utility_memory_free(dfu);
}
/* Return completion status. */
return(UX_SUCCESS);
}

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_hid_entry PORTABLE C */
/* 6.1 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -75,6 +75,10 @@
/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -102,7 +106,7 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the init function of the HID class. */
/* Call the uninit function of the HID class. */
status = _ux_device_class_hid_uninitialize(command);
/* Return the completion status. */

View File

@ -32,7 +32,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_hid_uninitialize PORTABLE C */
/* 6.3.0 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -82,6 +82,11 @@
/* added a new mode to manage */
/* endpoint buffer in classes, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* added sanity check before */
/* freed hid memory, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
@ -97,6 +102,11 @@ UX_SLAVE_CLASS *class_ptr;
/* Get the class instance in the container. */
hid = (UX_SLAVE_CLASS_HID *) class_ptr -> ux_slave_class_instance;
/* Sanity check. */
if (hid != UX_NULL)
{
#if !defined(UX_DEVICE_STANDALONE)
/* Remove HID thread. */
@ -135,7 +145,7 @@ UX_SLAVE_CLASS *class_ptr;
/* Free the resources. */
_ux_utility_memory_free(hid);
}
/* Return completion status. */
return(UX_SUCCESS);
}

View File

@ -56,6 +56,7 @@
/* CALLS */
/* */
/* _ux_device_class_pima_initialize Initialize pima class */
/* _ux_device_class_pima_uninitialize Uninitialize pima class */
/* _ux_device_class_pima_activate Activate pima class */
/* _ux_device_class_pima_deactivate Deactivate pima class */
/* _ux_device_class_pima_control_request Request control */
@ -74,6 +75,11 @@
/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* added call of pima uninit */
/* function, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_pima_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -99,6 +105,14 @@ UINT status;
/* Return the completion status. */
return(status);
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the uninit function of the PIMA class. */
status = _ux_device_class_pima_uninitialize(command);
/* Return the completion status. */
return(status);
case UX_SLAVE_CLASS_COMMAND_QUERY:
/* Check the CLASS definition in the interface descriptor. */

View File

@ -0,0 +1,116 @@
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/** */
/** USBX Component */
/** */
/** Device PIMA Class */
/** */
/**************************************************************************/
/**************************************************************************/
#define UX_SOURCE_CODE
/* Include necessary system files. */
#include "ux_api.h"
#include "ux_device_class_pima.h"
#include "ux_device_stack.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_pima_uninitialize PORTABLE C */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function uninitializes the USB pima device. */
/* */
/* INPUT */
/* */
/* command Pointer to pima command */
/* */
/* OUTPUT */
/* */
/* Completion Status */
/* */
/* CALLS */
/* */
/* _ux_device_thread_delete Remove storage thread. */
/* _ux_utility_memory_free Free memory used by storage */
/* _ux_utility_semaphore_delete Remove semaphore structure */
/* */
/* */
/* CALLED BY */
/* */
/* USBX Source Code */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_pima_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
{
UX_SLAVE_CLASS_PIMA *pima;
UX_SLAVE_CLASS *class_ptr;
/* Get the class container. */
class_ptr = command -> ux_slave_class_command_class_ptr;
/* Get the class instance in the container. */
pima = (UX_SLAVE_CLASS_PIMA *) class_ptr -> ux_slave_class_instance;
/* Sanity check. */
if (pima != UX_NULL)
{
#if !defined(UX_DEVICE_STANDALONE)
/* Remove PIMA thread. */
_ux_device_thread_delete(&class_ptr -> ux_slave_class_thread);
/* Remove the thread used by PIMA. */
_ux_utility_memory_free(class_ptr -> ux_slave_class_thread_stack);
/* Remove PIMA interrupt thread. */
_ux_device_thread_delete(&pima -> ux_device_class_pima_interrupt_thread);
/* Remove the interrupt semaphore used by PIMA. */
_ux_device_semaphore_delete(&pima -> ux_device_class_pima_interrupt_thread_semaphore);
/* Remove the interrupt thread used by PIMA. */
_ux_utility_memory_free(pima -> ux_device_class_pima_interrupt_thread_stack );
#endif
#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1
_ux_utility_memory_free(pima -> ux_device_class_pima_endpoint_buffer);
#endif
}
/* Free the resources. */
_ux_utility_memory_free(pima);
/* Return completion status. */
return(UX_SUCCESS);
}

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_printer_entry PORTABLE C */
/* 6.2.1 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -74,6 +74,9 @@
/* 03-08-2023 Yajun Xia Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.2.1 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_printer_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -101,7 +104,7 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the init function of the Printer class. */
/* Call the uninit function of the Printer class. */
status = _ux_device_class_printer_uninitialize(command);
/* Return the completion status. */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_entry PORTABLE C */
/* 6.1 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -56,6 +56,7 @@
/* CALLS */
/* */
/* _ux_device_class_rndis_initialize Initialize rndis class */
/* _ux_device_class_rndis_uninitialize Uninitialize rndis class */
/* _ux_device_class_rndis_activate Activate rndis class */
/* _ux_device_class_rndis_deactivate Deactivate rndis class */
/* _ux_device_class_rndis_control_request Request control */
@ -71,6 +72,11 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* added call of rndis uninit */
/* function, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_rndis_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -91,6 +97,13 @@ UINT status;
/* Return the completion status. */
return(status);
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the uninit function of the RNDIS class. */
status = _ux_device_class_rndis_uninitialize(command);
/* Return the completion status. */
return(status);
case UX_SLAVE_CLASS_COMMAND_QUERY:

View File

@ -0,0 +1,131 @@
/***************************************************************************
* Copyright (c) 2024 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/** */
/** USBX Component */
/** */
/** Device RNDIS Class */
/** */
/**************************************************************************/
/**************************************************************************/
#define UX_SOURCE_CODE
/* Include necessary system files. */
#include "ux_api.h"
#include "ux_device_class_rndis.h"
#include "ux_device_stack.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_uninitialize PORTABLE C */
/* 6.xx */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function deinitializes the resources for the specified RNDIS */
/* instance. */
/* */
/* INPUT */
/* */
/* command Pointer to rndis command */
/* */
/* OUTPUT */
/* */
/* Completion Status */
/* */
/* CALLS */
/* */
/* _ux_device_mutex_delete Delete mutex */
/* _ux_device_thread_delete Delete thread */
/* _ux_utility_memory_free Free memory */
/* _ux_utility_event_flags_delete Delete event flags */
/* _ux_device_semaphore_delete Delete semaphore */
/* */
/* CALLED BY */
/* */
/* Device RNDIS Class */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* xx-xx-xxxx Mohamed ayed Initial Version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_rndis_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
{
UX_SLAVE_CLASS_RNDIS *rndis;
UX_SLAVE_CLASS *class_ptr;
/* Get the class container. */
class_ptr = command -> ux_slave_class_command_class_ptr;
/* Get the class instance in the container. */
rndis = (UX_SLAVE_CLASS_RNDIS *) class_ptr -> ux_slave_class_instance;
/* Sanity check. */
if (rndis != UX_NULL)
{
/* Deinitialize resources. We do not check if they have been allocated
because if they weren't, the class register (called by the application)
would have failed. */
#if !defined(UX_DEVICE_STANDALONE)
/* Delete the queue mutex. */
_ux_device_mutex_delete(&rndis -> ux_slave_class_rndis_mutex);
/* Delete bulk out thread . */
_ux_device_thread_delete(&rndis -> ux_slave_class_rndis_bulkout_thread);
/* Free bulk out thread stack. */
_ux_utility_memory_free(rndis -> ux_slave_class_rndis_bulkout_thread_stack);
/* Delete interrupt thread. */
_ux_device_thread_delete(&rndis -> ux_slave_class_rndis_interrupt_thread);
/* Free interrupt thread stack. */
_ux_utility_memory_free(rndis -> ux_slave_class_rndis_interrupt_thread_stack);
/* Delete bulk in thread. */
_ux_device_thread_delete(&rndis -> ux_slave_class_rndis_bulkin_thread);
/* Free bulk in thread stack. */
_ux_utility_memory_free(rndis -> ux_slave_class_rndis_bulkin_thread_stack);
/* Delete the interrupt thread sync event flags group. */
_ux_device_event_flags_delete(&rndis -> ux_slave_class_rndis_event_flags_group);
#endif
/* Free the resources. */
#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1
_ux_utility_memory_free(rndis -> ux_device_class_rndis_endpoint_buffer);
#endif
_ux_utility_memory_free(rndis);
}
/* Return completion status. */
return(UX_SUCCESS);
}

View File

@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_storage_entry PORTABLE C */
/* 6.3.0 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -77,6 +77,10 @@
/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* remove extra spaces, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_storage_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -104,7 +108,7 @@ UINT status;
case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
/* Call the init function of the Storage class. */
/* Call the uninit function of the Storage class. */
status = _ux_device_class_storage_uninitialize(command);
/* Return the completion status. */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_video_entry PORTABLE C */
/* 6.3.0 */
/* 6.x */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -74,6 +74,9 @@
/* 10-31-2023 Yajun xia Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.3.0 */
/* xx-xx-xxxx Mohamed ayed Modified comment(s), */
/* fix typo, */
/* resulting in version 6.x */
/* */
/**************************************************************************/
UINT _ux_device_class_video_entry(UX_SLAVE_CLASS_COMMAND *command)
@ -94,7 +97,7 @@ UINT status;
status = _uxe_device_class_video_initialize(command);
#else
/* Call the init function of the Video class. */
/* Call the uninit function of the Video class. */
status = _ux_device_class_video_initialize(command);
#endif /* UX_DEVICE_CLASS_VIDEO_ENABLE_ERROR_CHECKING */