1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
104
105
106
107
108
109
110
111
112
114
115
116
117
118
120
121
122
123
124
128
129
130
131
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
169
170
171
172
174
176
185
186
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
223
224
225
226
227
228
229
230
231
233
234
235
...
...
...
#define UX_SOURCE_CODE
#include "ux_api.h"
#include "ux_host_class_storage.h"
#include "ux_host_stack.h"
#if !defined(UX_HOST_STANDALONE)...
...
UINT _ux_host_class_storage_device_initialize(UX_HOST_CLASS_STORAGE *storage)
{
UINT status;
ULONG lun_index;
#if defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
UX_HOST_CLASS_STORAGE_MEDIA *storage_media;
UX_HOST_CLASS *class_inst;
UINT inst_index;/* ... */
#endif
status = _ux_host_class_storage_device_support_check(storage);
if (status != UX_SUCCESS)
return(status);
/* ... */
status = _ux_host_class_storage_max_lun_get(storage);
if (status != UX_SUCCESS)
return(status);
/* ... */
status = _ux_host_class_storage_endpoints_get(storage);
if (status != UX_SUCCESS)
return(status);
/* ... */
_ux_utility_delay_ms(UX_HOST_CLASS_STORAGE_DEVICE_INIT_DELAY);
#if defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
class_inst = storage -> ux_host_class_storage_class;/* ... */
#endif
for (lun_index = 0; lun_index <= storage -> ux_host_class_storage_max_lun; lun_index++)
{
storage -> ux_host_class_storage_lun = lun_index;
status = _ux_host_class_storage_media_characteristics_get(storage);
if (status == UX_HOST_CLASS_MEDIA_NOT_SUPPORTED)
{
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_MEDIA_NOT_SUPPORTED);
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_HOST_CLASS_MEDIA_NOT_SUPPORTED, storage, 0, 0, UX_TRACE_ERRORS, 0, 0)
continue;
}if (status == UX_HOST_CLASS_MEDIA_NOT_SUPPORTED) { ... }
if (status != UX_SUCCESS)
return(status);
status = _ux_host_class_storage_media_format_capacity_get(storage);
if (status != UX_SUCCESS)
return(status);
storage -> ux_host_class_storage_lun_types[lun_index] = storage -> ux_host_class_storage_media_type;
/* ... */
switch (storage -> ux_host_class_storage_media_type)
{
case UX_HOST_CLASS_STORAGE_MEDIA_FAT_DISK:
case UX_HOST_CLASS_STORAGE_MEDIA_FAT_DISK:
case UX_HOST_CLASS_STORAGE_MEDIA_OPTICAL_DISK:
case UX_HOST_CLASS_STORAGE_MEDIA_OPTICAL_DISK:
case UX_HOST_CLASS_STORAGE_MEDIA_IOMEGA_CLICK:
#if !defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
/* ... */
_ux_host_class_storage_media_mount(storage, 0);/* ... */
#endif
break;
case UX_HOST_CLASS_STORAGE_MEDIA_IOMEGA_CLICK:
case UX_HOST_CLASS_STORAGE_MEDIA_CDROM:
default:
/* ... */
break;default
}switch (storage -> ux_host_class_storage_media_type) { ... }
#if defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
storage_media = (UX_HOST_CLASS_STORAGE_MEDIA *) class_inst -> ux_host_class_media;
for (inst_index = 0; inst_index < UX_HOST_CLASS_STORAGE_MAX_MEDIA;
storage_media ++, inst_index++)
{
if (storage_media -> ux_host_class_storage_media_status != UX_USED)
{
storage_media -> ux_host_class_storage_media_status = UX_USED;
storage_media -> ux_host_class_storage_media_storage = storage;
storage_media -> ux_host_class_storage_media_lun = (UCHAR)storage -> ux_host_class_storage_lun;
storage_media -> ux_host_class_storage_media_sector_size = (USHORT)storage -> ux_host_class_storage_sector_size;
storage_media -> ux_host_class_storage_media_number_sectors = storage -> ux_host_class_storage_last_sector_number + 1;
if (_ux_system_host -> ux_system_host_change_function != UX_NULL)
{
_ux_system_host -> ux_system_host_change_function(UX_STORAGE_MEDIA_INSERTION,
storage -> ux_host_class_storage_class, (VOID *) storage_media);
}if (_ux_system_host -> ux_system_host_change_function != UX_NULL) { ... }
break;
}if (storage_media -> ux_host_class_storage_media_status != UX_USED) { ... }
}for (inst_index = 0; inst_index < UX_HOST_CLASS_STORAGE_MAX_MEDIA; storage_media ++, inst_index++) { ... }
/* ... */#endif
}for (lun_index = 0; lun_index <= storage -> ux_host_class_storage_max_lun; lun_index++) { ... }
/* ... */
return(UX_SUCCESS);
}{ ... }
#endif...