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 /** USBX Component */ 14 /** */ 15 /** Device HID Class */ 16 /** */ 17 /**************************************************************************/ 18 /**************************************************************************/ 19 20 #define UX_SOURCE_CODE 21 22 23 /* Include necessary system files. */ 24 25 #include "ux_api.h" 26 #include "ux_device_class_hid.h" 27 #include "ux_device_stack.h" 28 29 30 #if defined(UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT) 31 /**************************************************************************/ 32 /* */ 33 /* FUNCTION RELEASE */ 34 /* */ 35 /* _ux_device_class_hid_receiver_uninitialize PORTABLE C */ 36 /* 6.3.0 */ 37 /* AUTHOR */ 38 /* */ 39 /* Chaoqiong Xiao, Microsoft Corporation */ 40 /* */ 41 /* DESCRIPTION */ 42 /* */ 43 /* This function uninitialize the USB HID device receiver. It's only */ 44 /* done once. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* receiver Pointer to receiver instance */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* Completion Status */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* _ux_utility_memory_free Free memory */ 57 /* _ux_utility_thread_delete Delete thread */ 58 /* */ 59 /* CALLED BY */ 60 /* */ 61 /* USBX Source Code */ 62 /* */ 63 /* RELEASE HISTORY */ 64 /* */ 65 /* DATE NAME DESCRIPTION */ 66 /* */ 67 /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ 68 /* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ 69 /* added zero copy support, */ 70 /* resulting in version 6.3.0 */ 71 /* */ 72 /**************************************************************************/ _ux_device_class_hid_receiver_uninitialize(UX_DEVICE_CLASS_HID_RECEIVER * receiver)73VOID _ux_device_class_hid_receiver_uninitialize(UX_DEVICE_CLASS_HID_RECEIVER *receiver) 74 { 75 76 #if !defined(UX_DEVICE_STANDALONE) 77 78 /* Delete receiver thread. */ 79 _ux_utility_thread_delete(&receiver -> ux_device_class_hid_receiver_thread); 80 #endif 81 82 #if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_HID_ZERO_COPY) 83 84 /* Free cache safe event memory. */ 85 _ux_utility_memory_free(receiver -> ux_device_class_hid_receiver_events -> ux_device_class_hid_received_event_data); 86 #endif 87 88 /* Free receiver and events memory. */ 89 _ux_utility_memory_free(receiver); 90 } 91 #endif 92