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 /**************************************************************************/
14 /** */
15 /** USBX Component */
16 /** */
17 /** Device Pima 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_pima.h"
29 #include "ux_device_stack.h"
30
31
32 /**************************************************************************/
33 /* */
34 /* FUNCTION RELEASE */
35 /* */
36 /* _ux_device_class_pima_object_delete PORTABLE C */
37 /* 6.1.10 */
38 /* AUTHOR */
39 /* */
40 /* Chaoqiong Xiao, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function informs the application that an object is to be */
45 /* deleted. The handle points to an object or all objects if -1 */
46 /* */
47 /* INPUT */
48 /* */
49 /* pima Pointer to pima class */
50 /* object_handle Handle of object to delete */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* Completion Status */
55 /* */
56 /* CALLS */
57 /* */
58 /* _ux_device_class_pima_response_send Send PIMA response */
59 /* */
60 /* CALLED BY */
61 /* */
62 /* Device Pima Class */
63 /* */
64 /* RELEASE HISTORY */
65 /* */
66 /* DATE NAME DESCRIPTION */
67 /* */
68 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
69 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
70 /* resulting in version 6.1 */
71 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
72 /* updated status handling, */
73 /* resulting in version 6.1.10 */
74 /* */
75 /**************************************************************************/
_ux_device_class_pima_object_delete(UX_SLAVE_CLASS_PIMA * pima,ULONG object_handle,ULONG object_format)76 UINT _ux_device_class_pima_object_delete(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle, ULONG object_format)
77 {
78
79 UINT status;
80
81 /* If trace is enabled, insert this event into the trace buffer. */
82 UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PIMA_OBJECT_DELETE, pima, object_handle, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
83
84 if (object_format == 0)
85
86 /* Invoke the application callback function. */
87 status = pima -> ux_device_class_pima_object_delete(pima, object_handle);
88 else
89
90 /* Not supported. */
91 status = UX_DEVICE_CLASS_PIMA_RC_FORMAT_UNSUPPORTED;
92
93 /* Response status. */
94 status = _ux_device_class_pima_response_send(pima, (status == UX_SUCCESS) ?
95 UX_DEVICE_CLASS_PIMA_RC_OK : status, 0, 0, 0, 0);
96
97 /* Return completion status. */
98 return(status);
99 }
100