1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
10 /**************************************************************************/
11
12
13 /**************************************************************************/
14 /**************************************************************************/
15 /** */
16 /** USBX Component */
17 /** */
18 /** Storage 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_storage.h"
30 #include "ux_host_stack.h"
31
32
33 #if defined(UX_HOST_STANDALONE)
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _ux_host_class_storage_media_check PORTABLE C */
39 /* 6.1.10 */
40 /* AUTHOR */
41 /* */
42 /* Chaoqiong Xiao, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function runs state machine to check and mount/unmount storage */
47 /* media for current selected logic unit number (LUN). */
48 /* */
49 /* It's valid only in standalone mode. */
50 /* It's blocking. */
51 /* */
52 /* INPUT */
53 /* */
54 /* storage Pointer to storage class */
55 /* sector_start Starting sector */
56 /* sector_count Number of sectors to read */
57 /* data_pointer Pointer to data to read */
58 /* */
59 /* OUTPUT */
60 /* */
61 /* Completion Status */
62 /* */
63 /* CALLS */
64 /* */
65 /* _ux_host_class_storage_check_run Runs check state machine */
66 /* */
67 /* CALLED BY */
68 /* */
69 /* Storage Class */
70 /* */
71 /* RELEASE HISTORY */
72 /* */
73 /* DATE NAME DESCRIPTION */
74 /* */
75 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.1.10 */
76 /* */
77 /**************************************************************************/
_ux_host_class_storage_media_check(UX_HOST_CLASS_STORAGE * storage)78 UINT _ux_host_class_storage_media_check(UX_HOST_CLASS_STORAGE *storage)
79 {
80 UINT status;
81 do {
82 status = _ux_host_class_storage_check_run(storage);
83 } while(status == UX_STATE_WAIT);
84 return(storage -> ux_host_class_storage_status);
85 }
86 #endif
87