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_storage_format PORTABLE C */
37 /* 6.1 */
38 /* AUTHOR */
39 /* */
40 /* Chaoqiong Xiao, Microsoft Corporation */
41 /* */
42 /* DESCRIPTION */
43 /* */
44 /* This function informs the application that the storage media */
45 /* should be reformatted. */
46 /* */
47 /* INPUT */
48 /* */
49 /* pima Pointer to pima class */
50 /* storage_id Storage ID */
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 /* */
72 /**************************************************************************/
_ux_device_class_pima_storage_format(UX_SLAVE_CLASS_PIMA * pima,ULONG storage_id)73 UINT _ux_device_class_pima_storage_format(UX_SLAVE_CLASS_PIMA *pima, ULONG storage_id)
74 {
75
76 UINT status;
77
78 /* If trace is enabled, insert this event into the trace buffer. */
79 UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PIMA_STORAGE_FORMAT, pima, storage_id, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
80
81 /* Invoke the application callback function. */
82 status = pima -> ux_device_class_pima_storage_format(pima, storage_id);
83
84 /* Check for error. */
85 if (status != UX_SUCCESS)
86
87 /* We return an error. */
88 _ux_device_class_pima_response_send(pima, status, 0, 0, 0, 0);
89
90 else
91
92 /* We return a response with success. */
93 _ux_device_class_pima_response_send(pima, UX_DEVICE_CLASS_PIMA_RC_OK, 0, 0, 0, 0);
94
95 /* Return completion status. */
96 return(status);
97 }
98
99
100