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_objects_number_send PORTABLE C */
37 /* 6.1.10 */
38 /* AUTHOR */
39 /* */
40 /* Chaoqiong Xiao, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function returns the number of objects in the system. */
45 /* */
46 /* INPUT */
47 /* */
48 /* pima Pointer to pima class */
49 /* */
50 /* OUTPUT */
51 /* */
52 /* Completion Status */
53 /* */
54 /* CALLS */
55 /* */
56 /* _ux_device_class_pima_response_send Send PIMA response */
57 /* */
58 /* CALLED BY */
59 /* */
60 /* Device Pima Class */
61 /* */
62 /* RELEASE HISTORY */
63 /* */
64 /* DATE NAME DESCRIPTION */
65 /* */
66 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
67 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
68 /* resulting in version 6.1 */
69 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
70 /* updated status handling, */
71 /* resulting in version 6.1.10 */
72 /* */
73 /**************************************************************************/
_ux_device_class_pima_objects_number_send(UX_SLAVE_CLASS_PIMA * pima,ULONG storage_id,ULONG object_format_code,ULONG object_association)74 UINT _ux_device_class_pima_objects_number_send(UX_SLAVE_CLASS_PIMA *pima,
75 ULONG storage_id,
76 ULONG object_format_code,
77 ULONG object_association)
78 {
79
80 UINT status;
81 ULONG object_number;
82
83 UX_PARAMETER_NOT_USED(storage_id);
84
85 /* If trace is enabled, insert this event into the trace buffer. */
86 UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PIMA_OBJECTS_NUMBER_SEND, pima, storage_id, object_format_code, object_association, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
87
88 /* Get the number of objects from the application. */
89 status = pima -> ux_device_class_pima_object_number_get(pima, object_format_code, object_association, &object_number);
90
91 /* Result should always be OK, but to be sure .... */
92 if (status != UX_SUCCESS)
93
94 /* We return an error. */
95 _ux_device_class_pima_response_send(pima, status, 0, 0, 0, 0);
96
97 else
98
99 /* Now we return a response with success. */
100 _ux_device_class_pima_response_send(pima, UX_DEVICE_CLASS_PIMA_RC_OK, 1, object_number, 0, 0);
101
102 /* Return completion status. */
103 return(status);
104 }
105
106
107