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 /** USBX Component */ 16 /** */ 17 /** Device Printer Class */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 #define UX_SOURCE_CODE 23 24 25 /* Include necessary system files. */ 26 27 #include "ux_api.h" 28 #include "ux_device_class_printer.h" 29 #include "ux_device_stack.h" 30 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _ux_device_class_printer_uninitialize PORTABLE C */ 37 /* 6.2.0 */ 38 /* AUTHOR */ 39 /* */ 40 /* Chaoqiong Xiao, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function uninitialize the printer class. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* command Pointer to a class command */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* Completion Status */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* _ux_device_mutex_delete Delete Mutex */ 57 /* _ux_utility_memory_free Free used local memory */ 58 /* */ 59 /* CALLED BY */ 60 /* */ 61 /* Device Printer Class */ 62 /* */ 63 /* RELEASE HISTORY */ 64 /* */ 65 /* DATE NAME DESCRIPTION */ 66 /* */ 67 /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ 68 /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ 69 /* fixed standalone compile, */ 70 /* resulting in version 6.1.11 */ 71 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ 72 /* fixed parameter/variable */ 73 /* names conflict C++ keyword, */ 74 /* resulting in version 6.1.12 */ 75 /* 10-31-2022 Yajun Xia Modified comment(s), */ 76 /* added standalone support, */ 77 /* resulting in version 6.2.0 */ 78 /* */ 79 /**************************************************************************/ _ux_device_class_printer_uninitialize(UX_SLAVE_CLASS_COMMAND * command)80UINT _ux_device_class_printer_uninitialize(UX_SLAVE_CLASS_COMMAND *command) 81 { 82 83 UX_DEVICE_CLASS_PRINTER *printer; 84 UX_SLAVE_CLASS *class_ptr; 85 86 /* Get the class container. */ 87 class_ptr = command -> ux_slave_class_command_class_ptr; 88 89 /* Get the class instance in the container. */ 90 printer = (UX_DEVICE_CLASS_PRINTER *) class_ptr -> ux_slave_class_instance; 91 92 /* Sanity check. */ 93 if (printer != UX_NULL) 94 { 95 #if !defined(UX_DEVICE_STANDALONE) 96 /* Delete the IN endpoint mutex. */ 97 _ux_device_mutex_delete(&printer -> ux_device_class_printer_endpoint_in_mutex); 98 99 /* Out Mutex. */ 100 _ux_device_mutex_delete(&printer -> ux_device_class_printer_endpoint_out_mutex); 101 #endif 102 /* Free the resources. */ 103 _ux_utility_memory_free(printer); 104 } 105 106 /* Return completion status. */ 107 return(UX_SUCCESS); 108 } 109