1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** USBX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** HID Remote Control Class */ |
19 |
|
|
/** */ |
20 |
|
|
/**************************************************************************/ |
21 |
|
|
/**************************************************************************/ |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#define UX_SOURCE_CODE |
27 |
|
|
|
28 |
|
|
#include "ux_api.h" |
29 |
|
|
#include "ux_host_class_hid.h" |
30 |
|
|
#include "ux_host_class_hid_remote_control.h" |
31 |
|
|
#include "ux_host_stack.h" |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
/**************************************************************************/ |
35 |
|
|
/* */ |
36 |
|
|
/* FUNCTION RELEASE */ |
37 |
|
|
/* */ |
38 |
|
|
/* _ux_host_class_hid_remote_control_deactivate PORTABLE C */ |
39 |
|
|
/* 6.3.0 */ |
40 |
|
|
/* AUTHOR */ |
41 |
|
|
/* */ |
42 |
|
|
/* Chaoqiong Xiao, Microsoft Corporation */ |
43 |
|
|
/* */ |
44 |
|
|
/* DESCRIPTION */ |
45 |
|
|
/* */ |
46 |
|
|
/* This function performs the deactivation of a HID Remote Control */ |
47 |
|
|
/* class instance. */ |
48 |
|
|
/* */ |
49 |
|
|
/* INPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* command Pointer to command */ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* Completion Status */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* _ux_host_class_hid_periodic_report_stop Stop periodic report */ |
60 |
|
|
/* _ux_utility_memory_free Release memory block */ |
61 |
|
|
/* */ |
62 |
|
|
/* CALLED BY */ |
63 |
|
|
/* */ |
64 |
|
|
/* HID Remote Control Class */ |
65 |
|
|
/* */ |
66 |
|
|
/**************************************************************************/ |
67 |
|
11 |
UINT _ux_host_class_hid_remote_control_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command) |
68 |
|
|
{ |
69 |
|
|
|
70 |
|
|
UX_HOST_CLASS_HID *hid; |
71 |
|
|
UX_HOST_CLASS_HID_CLIENT *hid_client; |
72 |
|
|
UX_HOST_CLASS_HID_REMOTE_CONTROL *remote_control_instance; |
73 |
|
|
UINT status; |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
/* Get the instance to the HID class. */ |
77 |
|
11 |
hid = command -> ux_host_class_hid_client_command_instance; |
78 |
|
|
|
79 |
|
|
/* Stop the periodic report. */ |
80 |
|
11 |
status = _ux_host_class_hid_periodic_report_stop(hid); |
81 |
|
|
|
82 |
|
|
/* Get the HID client pointer. */ |
83 |
|
11 |
hid_client = hid -> ux_host_class_hid_client; |
84 |
|
|
|
85 |
|
|
/* Get the remote control local instance. */ |
86 |
|
11 |
remote_control_instance = (UX_HOST_CLASS_HID_REMOTE_CONTROL *) hid_client -> ux_host_class_hid_client_local_instance; |
87 |
|
|
|
88 |
|
|
/* If trace is enabled, insert this event into the trace buffer. */ |
89 |
|
|
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_DEACTIVATE, hid, remote_control_instance, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0) |
90 |
|
|
|
91 |
|
|
/* We may need to inform the application |
92 |
|
|
if a function has been programmed in the system structure. */ |
93 |
✓✓ |
11 |
if (_ux_system_host -> ux_system_host_change_function != UX_NULL) |
94 |
|
|
{ |
95 |
|
|
|
96 |
|
|
/* Call system change function. */ |
97 |
|
5 |
_ux_system_host -> ux_system_host_change_function(UX_HID_CLIENT_REMOVAL, hid -> ux_host_class_hid_class, (VOID *) hid_client); |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
/* Unload all the memory used by the remote control client. */ |
101 |
|
11 |
_ux_utility_memory_free(remote_control_instance -> ux_host_class_hid_remote_control_usage_array); |
102 |
|
|
|
103 |
|
|
/* Now free the instance memory. */ |
104 |
|
11 |
_ux_utility_memory_free(hid_client -> ux_host_class_hid_client_local_instance); |
105 |
|
|
|
106 |
|
|
/* Return completion status. */ |
107 |
|
11 |
return(status); |
108 |
|
|
} |
109 |
|
|
|