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 /**   PIMA Class                                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  COMPONENT DEFINITION                                   RELEASE        */
27 /*                                                                        */
28 /*    ux_host_class_pima.h                                PORTABLE C      */
29 /*                                                           6.1.12       */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Chaoqiong Xiao, Microsoft Corporation                               */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains all the header and extern functions used by the  */
37 /*    USBX PIMA class.                                                    */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
44 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
45 /*                                            used UX prefix to refer to  */
46 /*                                            TX symbols instead of using */
47 /*                                            them directly,              */
48 /*                                            resulting in version 6.1    */
49 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
50 /*                                            added extern "C" keyword    */
51 /*                                            for compatibility with C++, */
52 /*                                            resulting in version 6.1.8  */
53 /*  07-29-2022     Chaoqiong Xiao           Modified comment(s),          */
54 /*                                            improved internal checks,   */
55 /*                                            resulting in version 6.1.12 */
56 /*                                                                        */
57 /**************************************************************************/
58 
59 #ifndef UX_HOST_CLASS_PIMA_H
60 #define UX_HOST_CLASS_PIMA_H
61 
62 /* Determine if a C++ compiler is being used.  If so, ensure that standard
63    C is used to process the API information.  */
64 
65 #ifdef   __cplusplus
66 
67 /* Yes, C++ compiler is present.  Use standard C.  */
68 extern   "C" {
69 
70 #endif
71 
72 /* Define PIMA Class constants.  */
73 
74 #define UX_HOST_CLASS_PIMA_CLASS_TRANSFER_TIMEOUT               300000
75 #define UX_HOST_CLASS_PIMA_CLASS                                0x06
76 #define UX_HOST_CLASS_PIMA_SUBCLASS                             0X01
77 #define UX_HOST_CLASS_PIMA_PROTOCOL                             0X01
78 #define UX_HOST_CLASS_PIMA_CS_INTERFACE                         0x24
79 #define UX_HOST_CLASS_PIMA_MAGIC_NUMBER                         0x50494D41
80 #define UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH                   256
81 #define UX_HOST_CLASS_PIMA_ARRAY_MAX_LENGTH                     256
82 #define UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH          64
83 #define UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS                      64
84 #if (UX_OVERFLOW_CHECK_ADD_ULONG(UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS, 1) || \
85     UX_OVERFLOW_CHECK_MULC_ULONG(UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS + 1, 4))
86 #error UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS too large, please decrease
87 #endif
88 #define UX_HOST_CLASS_PIMA_STORAGE_IDS_LENGTH                   ((UX_HOST_CLASS_PIMA_MAX_STORAGE_IDS + 1) * 4)
89 #define UX_HOST_CLASS_PIMA_MAX_PAYLOAD                          1024
90 #define UX_HOST_CLASS_PIMA_ZLP_NONE                             0
91 #define UX_HOST_CLASS_PIMA_ZLP_IN                               1
92 #define UX_HOST_CLASS_PIMA_ZLP_OUT                              2
93 
94 /* Define PIMA data phases.  */
95 
96 #define UX_HOST_CLASS_PIMA_DATA_PHASE_NONE                      0
97 #define UX_HOST_CLASS_PIMA_DATA_PHASE_IN                        1
98 #define UX_HOST_CLASS_PIMA_DATA_PHASE_OUT                       2
99 
100 /* Define PIMA session states.  */
101 
102 #define UX_HOST_CLASS_PIMA_SESSION_STATE_CLOSED                 0
103 #define UX_HOST_CLASS_PIMA_SESSION_STATE_OPENED                 1
104 
105 /* Define PIMA object and thumb states.  */
106 
107 #define UX_HOST_CLASS_PIMA_OBJECT_STATE_CLOSED                  0
108 #define UX_HOST_CLASS_PIMA_OBJECT_STATE_OPENED                  1
109 
110 /* Define PIMA object and thumb transfer status.  */
111 
112 #define UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_INACTIVE      0
113 #define UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ACTIVE        1
114 #define UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_COMPLETED     2
115 #define UX_HOST_CLASS_PIMA_OBJECT_TRANSFER_STATUS_ABORTED       3
116 
117 /* Define PIMA Cancel Request equivalences.  */
118 
119 #define UX_HOST_CLASS_PIMA_REQUEST_CANCEL_COMMAND               0x64
120 #define UX_HOST_CLASS_PIMA_REQUEST_CANCEL_DATA_LENGTH           0x06
121 #define UX_HOST_CLASS_PIMA_REQUEST_CANCEL_CODE                  0x04001
122 #define UX_HOST_CLASS_PIMA_REQUEST_CANCEL_OFFSET_CODE           0x00
123 #define UX_HOST_CLASS_PIMA_REQUEST_CANCEL_OFFSET_TRANSACTION_ID 0x02
124 
125 /* Define PIMA Reset Request equivalences.  */
126 
127 #define UX_HOST_CLASS_PIMA_REQUEST_RESET_DEVICE                 0x66
128 
129 /* Define PIMA Status Request equivalences.  */
130 
131 #define UX_HOST_CLASS_PIMA_REQUEST_STATUS_COMMAND               0x67
132 #define UX_HOST_CLASS_PIMA_REQUEST_STATUS_DATA_LENGTH           0x40
133 #define UX_HOST_CLASS_PIMA_REQUEST_STATUS_OFFSET_LENGTH         0x00
134 #define UX_HOST_CLASS_PIMA_REQUEST_STATUS_OFFSET_CODE           0x02
135 #define UX_HOST_CLASS_PIMA_REQUEST_STATUS_COMMAND_COUNTER       16
136 #define UX_HOST_CLASS_PIMA_REQUEST_STATUS_COMMAND_DELAY         1000
137 
138 /* Define PIMA command container type.  */
139 
140 #define UX_HOST_CLASS_PIMA_CT_UNDEFINED                         0x00
141 #define UX_HOST_CLASS_PIMA_CT_COMMAND_BLOCK                     0x01
142 #define UX_HOST_CLASS_PIMA_CT_DATA_BLOCK                        0x02
143 #define UX_HOST_CLASS_PIMA_CT_RESPONSE_BLOCK                    0x03
144 #define UX_HOST_CLASS_PIMA_CT_EVENT_BLOCK                       0x04
145 
146 /* Define PIMA Extended Event Data Request payload Format.  */
147 
148 #define UX_HOST_CLASS_PIMA_EEDR_EVENT_CODE                      0x00
149 #define UX_HOST_CLASS_PIMA_EEDR_TRANSACTION_ID                  0x02
150 #define UX_HOST_CLASS_PIMA_EEDR_NUMBER_PARAMETERS               0x06
151 #define UX_HOST_CLASS_PIMA_EEDR_SIZE_PARAMETER                  0x08
152 
153 /* Define PIMA Device Status Data Format.  */
154 
155 #define UX_HOST_CLASS_PIMA_DSD_LENGTH                           0x00
156 #define UX_HOST_CLASS_PIMA_DSD_CODE                             0x02
157 #define UX_HOST_CLASS_PIMA_DSD_PARAMETER                        0x04
158 
159 /* Define PIMA Command Header Format.  */
160 
161 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_LENGTH                0x00
162 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_TYPE                  0x04
163 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_CODE                  0x06
164 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_TRANSACTION_ID        0x08
165 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_1           0x0C
166 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_2           0x10
167 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_3           0x14
168 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_4           0x18
169 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_PARAMETER_5           0x1C
170 
171 #define UX_HOST_CLASS_PIMA_COMMAND_HEADER_SIZE                  0x0C
172 #define UX_HOST_CLASS_PIMA_CONTAINER_SIZE                       0x40
173 #define UX_HOST_CLASS_PIMA_ALL_HEADER_SIZE                      0x20
174 
175 /* Define PIMA Data Header Format.  */
176 
177 #define UX_HOST_CLASS_PIMA_DATA_HEADER_LENGTH                   0x00
178 #define UX_HOST_CLASS_PIMA_DATA_HEADER_TYPE                     0x04
179 #define UX_HOST_CLASS_PIMA_DATA_HEADER_CODE                     0x06
180 #define UX_HOST_CLASS_PIMA_DATA_HEADER_TRANSACTION_ID           0x08
181 #define UX_HOST_CLASS_PIMA_DATA_HEADER_SIZE                     0x0C
182 
183 
184 /* Define PIMA Response Header Format.  */
185 
186 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_LENGTH               0x00
187 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_TYPE                 0x04
188 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_CODE                 0x06
189 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_TRANSACTION_ID       0x08
190 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_1          0x0C
191 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_2          0x10
192 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_3          0x14
193 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_4          0x18
194 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_PARAMETER_5          0x1C
195 
196 #define UX_HOST_CLASS_PIMA_RESPONSE_HEADER_SIZE                 0x20
197 
198 /* Define PIMA Asynchronous Event Interrupt Data Format.  */
199 
200 #define UX_HOST_CLASS_PIMA_AEI_DATA_LENGTH                      0x00
201 #define UX_HOST_CLASS_PIMA_AEI_TYPE                             0x04
202 #define UX_HOST_CLASS_PIMA_AEI_EVENT_CODE                       0x06
203 #define UX_HOST_CLASS_PIMA_AEI_TRANSACTION_ID                   0x08
204 #define UX_HOST_CLASS_PIMA_AEI_PARAMETER_1                      0x0C
205 #define UX_HOST_CLASS_PIMA_AEI_PARAMETER_2                      0x10
206 #define UX_HOST_CLASS_PIMA_AEI_PARAMETER_3                      0x14
207 #define UX_HOST_CLASS_PIMA_AEI_MAX_LENGTH                       0x18
208 
209 /* Define PIMA Operation Commands.  */
210 
211 #define UX_HOST_CLASS_PIMA_OC_UNDEFINED                         0x1000
212 #define UX_HOST_CLASS_PIMA_OC_GET_DEVICE_INFO                   0x1001
213 #define UX_HOST_CLASS_PIMA_OC_OPEN_SESSION                      0x1002
214 #define UX_HOST_CLASS_PIMA_OC_CLOSE_SESSION                     0x1003
215 #define UX_HOST_CLASS_PIMA_OC_GET_STORAGE_IDS                   0x1004
216 #define UX_HOST_CLASS_PIMA_OC_GET_STORAGE_INFO                  0x1005
217 #define UX_HOST_CLASS_PIMA_OC_GET_NUM_OBJECTS                   0x1006
218 #define UX_HOST_CLASS_PIMA_OC_GET_OBJECT_HANDLES                0x1007
219 #define UX_HOST_CLASS_PIMA_OC_GET_OBJECT_INFO                   0x1008
220 #define UX_HOST_CLASS_PIMA_OC_GET_OBJECT                        0x1009
221 #define UX_HOST_CLASS_PIMA_OC_GET_THUMB                         0x100A
222 #define UX_HOST_CLASS_PIMA_OC_DELETE_OBJECT                     0x100B
223 #define UX_HOST_CLASS_PIMA_OC_SEND_OBJECT_INFO                  0x100C
224 #define UX_HOST_CLASS_PIMA_OC_SEND_OBJECT                       0x100D
225 #define UX_HOST_CLASS_PIMA_OC_INITIATE_CAPTURE                  0x100E
226 #define UX_HOST_CLASS_PIMA_OC_FORMAT_STORE                      0x100F
227 #define UX_HOST_CLASS_PIMA_OC_RESET_DEVICE                      0x1010
228 #define UX_HOST_CLASS_PIMA_OC_SELF_TEST                         0x1011
229 #define UX_HOST_CLASS_PIMA_OC_SET_OBJECT_PROTECTION             0x1012
230 #define UX_HOST_CLASS_PIMA_OC_POWER_DOWN                        0x1013
231 #define UX_HOST_CLASS_PIMA_OC_GET_DEVICE_PROP_DESC              0x1014
232 #define UX_HOST_CLASS_PIMA_OC_GET_DEVICE_PROP_VALUE             0x1015
233 #define UX_HOST_CLASS_PIMA_OC_SET_DEVICE_PROP_VALUE             0x1016
234 #define UX_HOST_CLASS_PIMA_OC_RESET_DEVICE_PROP_VALUE           0x1017
235 #define UX_HOST_CLASS_PIMA_OC_TERMINATE_OPEN_CAPTURE            0x1018
236 #define UX_HOST_CLASS_PIMA_OC_MOVE_OBJECT                       0x1019
237 #define UX_HOST_CLASS_PIMA_OC_COPY_OBJECT                       0x101A
238 #define UX_HOST_CLASS_PIMA_OC_GET_PARTIAL_OBJECT                0x101B
239 #define UX_HOST_CLASS_PIMA_OC_INITIATE_OPEN_CAPTURE             0x101C
240 
241 /* Define PIMA Response Codes.  */
242 
243 #define UX_HOST_CLASS_PIMA_RC_UNDEFINED                         0x2000
244 #define UX_HOST_CLASS_PIMA_RC_OK                                0x2001
245 #define UX_HOST_CLASS_PIMA_RC_GENERAL_ERROR                     0x2002
246 #define UX_HOST_CLASS_PIMA_RC_SESSION_NOT_OPEN                  0x2003
247 #define UX_HOST_CLASS_PIMA_RC_INVALID_TRANSACTION_ID            0x2004
248 #define UX_HOST_CLASS_PIMA_RC_OPERATION_NOT_SUPPORTED           0x2005
249 #define UX_HOST_CLASS_PIMA_RC_PARAMETER_NOT_SUPPORTED           0x2006
250 #define UX_HOST_CLASS_PIMA_RC_INCOMPLETE_TRANSFER               0x2007
251 #define UX_HOST_CLASS_PIMA_RC_INVALID_STORAGE_ID                0x2008
252 #define UX_HOST_CLASS_PIMA_RC_INVALID_OBJECT_HANDLE             0x2009
253 #define UX_HOST_CLASS_PIMA_RC_DEVICE_PROP_NOT_SUPPORTED         0x200A
254 #define UX_HOST_CLASS_PIMA_RC_INVALID_OBJECT_FORMAT_CODE        0x200B
255 #define UX_HOST_CLASS_PIMA_RC_STORE_FULL                        0x200C
256 #define UX_HOST_CLASS_PIMA_RC_OBJECT_WRITE_PROTECTED            0x200D
257 #define UX_HOST_CLASS_PIMA_RC_STORE_READ_ONLY                   0x200E
258 #define UX_HOST_CLASS_PIMA_RC_ACCESS_DENIED                     0x200F
259 #define UX_HOST_CLASS_PIMA_RC_NO_THUMBNAIL_PRESENT              0x2010
260 #define UX_HOST_CLASS_PIMA_RC_SELF_TEST_FAILED                  0x2011
261 #define UX_HOST_CLASS_PIMA_RC_PARTIAL_DELETION                  0x2012
262 #define UX_HOST_CLASS_PIMA_RC_STORE_NOT_AVAILABLE               0x2013
263 #define UX_HOST_CLASS_PIMA_RC_FORMAT_UNSUPPORTED                0x2014
264 #define UX_HOST_CLASS_PIMA_RC_NO_VALID_OBJECT_INFO              0x2015
265 #define UX_HOST_CLASS_PIMA_RC_INVALID_CODE_FORMAT               0x2016
266 #define UX_HOST_CLASS_PIMA_RC_UNKNOWN_VENDOR_CODE               0x2017
267 #define UX_HOST_CLASS_PIMA_RC_CAPTURE_ALREADY_TERMINATED        0x2018
268 #define UX_HOST_CLASS_PIMA_RC_DEVICE_BUSY                       0x2019
269 #define UX_HOST_CLASS_PIMA_RC_INVALID_PARENT_OBJECT             0x201A
270 #define UX_HOST_CLASS_PIMA_RC_INVALID_DEVICE_PROP_FORMAT        0x201B
271 #define UX_HOST_CLASS_PIMA_RC_INVALID_DEVICE_PROP_VALUE         0x201C
272 #define UX_HOST_CLASS_PIMA_RC_INVALID_PARAMETER                 0x201D
273 #define UX_HOST_CLASS_PIMA_RC_SESSION_ALREADY_OPENED            0x201E
274 #define UX_HOST_CLASS_PIMA_RC_TRANSACTION_CANCELED              0x201F
275 #define UX_HOST_CLASS_PIMA_RC_DESTINATION_UNSUPPORTED           0x2020
276 #define UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_OPENED             0x2021
277 #define UX_HOST_CLASS_PIMA_RC_OBJECT_ALREADY_CLOSED             0x2022
278 #define UX_HOST_CLASS_PIMA_RC_OBJECT_NOT_OPENED                 0x2023
279 
280 /* Define PIMA Event Codes.  */
281 
282 #define UX_HOST_CLASS_PIMA_EC_UNDEFINED                         0x4000
283 #define UX_HOST_CLASS_PIMA_EC_CANCEL_TRANSACTION                0x4001
284 #define UX_HOST_CLASS_PIMA_EC_OBJECT_ADDED                      0x4002
285 #define UX_HOST_CLASS_PIMA_EC_OBJECT_REMOVED                    0x4003
286 #define UX_HOST_CLASS_PIMA_EC_STORE_ADDED                       0x4004
287 #define UX_HOST_CLASS_PIMA_EC_STORE_REMOVED                     0x4005
288 #define UX_HOST_CLASS_PIMA_EC_DEVICE_PROP_CHANGED               0x4006
289 #define UX_HOST_CLASS_PIMA_EC_OBJECT_INFO_CHANGED               0x4007
290 #define UX_HOST_CLASS_PIMA_EC_DEVICE_INFO_CHANGED               0x4008
291 #define UX_HOST_CLASS_PIMA_EC_REQUEST_OBJECT_TRANSFER           0x4009
292 #define UX_HOST_CLASS_PIMA_EC_STORE_FULL                        0x400A
293 #define UX_HOST_CLASS_PIMA_EC_DEVICE_RESET                      0x400B
294 #define UX_HOST_CLASS_PIMA_EC_STORAGE_INFO_CHANGED              0x400C
295 #define UX_HOST_CLASS_PIMA_EC_CAPTURE_COMPLETE                  0x400D
296 #define UX_HOST_CLASS_PIMA_EC_UNREPORTED_STATUS                 0x400E
297 
298 /* Define PIMA Object Format Codes.  */
299 
300 #define UX_HOST_CLASS_PIMA_OFC_UNDEFINED                        0x3000
301 #define UX_HOST_CLASS_PIMA_OFC_ASSOCIATION                      0x3001
302 #define UX_HOST_CLASS_PIMA_OFC_SCRIPT                           0x3002
303 #define UX_HOST_CLASS_PIMA_OFC_EXECUTABLE                       0x3003
304 #define UX_HOST_CLASS_PIMA_OFC_TEXT                             0x3004
305 #define UX_HOST_CLASS_PIMA_OFC_HTML                             0x3005
306 #define UX_HOST_CLASS_PIMA_OFC_DPOF                             0x3006
307 #define UX_HOST_CLASS_PIMA_OFC_AIFF                             0x3007
308 #define UX_HOST_CLASS_PIMA_OFC_WAV                              0x3008
309 #define UX_HOST_CLASS_PIMA_OFC_MP3                              0x3009
310 #define UX_HOST_CLASS_PIMA_OFC_AVI                              0x300A
311 #define UX_HOST_CLASS_PIMA_OFC_MPEG                             0x300B
312 #define UX_HOST_CLASS_PIMA_OFC_ASF                              0x300C
313 #define UX_HOST_CLASS_PIMA_OFC_QT                               0x300D
314 #define UX_HOST_CLASS_PIMA_OFC_EXIF_JPEG                        0x3801
315 #define UX_HOST_CLASS_PIMA_OFC_TIFF_EP                          0x3802
316 #define UX_HOST_CLASS_PIMA_OFC_FLASHPIX                         0x3803
317 #define UX_HOST_CLASS_PIMA_OFC_BMP                              0x3804
318 #define UX_HOST_CLASS_PIMA_OFC_CIFF                             0x3805
319 #define UX_HOST_CLASS_PIMA_OFC_GIF                              0x3807
320 #define UX_HOST_CLASS_PIMA_OFC_JFIF                             0x3808
321 #define UX_HOST_CLASS_PIMA_OFC_PCD                              0x3809
322 #define UX_HOST_CLASS_PIMA_OFC_PICT                             0x380A
323 #define UX_HOST_CLASS_PIMA_OFC_PNG                              0x380B
324 #define UX_HOST_CLASS_PIMA_OFC_TIFF                             0x380D
325 #define UX_HOST_CLASS_PIMA_OFC_TIFF_IT                          0x380E
326 #define UX_HOST_CLASS_PIMA_OFC_JP2                              0x380F
327 #define UX_HOST_CLASS_PIMA_OFC_JPX                              0x3810
328 
329 /* Define PIMA Object Protection Status Values.  */
330 
331 #define UX_HOST_CLASS_PIMA_OPS_NO_PROTECTION                    0x0000
332 #define UX_HOST_CLASS_PIMA_OPS_READ_ONLY                        0x0001
333 
334 /* Define PIMA Storage Types Codes.  */
335 
336 #define UX_HOST_CLASS_PIMA_STC_UNDEFINED                        0x0000
337 #define UX_HOST_CLASS_PIMA_STC_FIXED_ROM                        0x0001
338 #define UX_HOST_CLASS_PIMA_STC_REMOVABLE_ROM                    0x0002
339 #define UX_HOST_CLASS_PIMA_STC_FIXED_RAM                        0x0003
340 #define UX_HOST_CLASS_PIMA_STC_REMOVABLE_RAM                    0x0004
341 
342 /* Define PIMA File System Types Codes.  */
343 
344 #define UX_HOST_CLASS_PIMA_FSTC_UNDEFINED                       0x0000
345 #define UX_HOST_CLASS_PIMA_FSTC_GENERIC_FLAT                    0x0001
346 #define UX_HOST_CLASS_PIMA_FSTC_GENERIC_HIERARCHICAL            0x0002
347 #define UX_HOST_CLASS_PIMA_FSTC_DCF                             0x0003
348 
349 /* Define PIMA event info structure.  */
350 
351 typedef struct UX_HOST_CLASS_PIMA_EVENT_STRUCT
352 {
353     struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
354                     *ux_host_class_pima_event_session;
355     struct UX_HOST_CLASS_PIMA_STRUCT
356                     *ux_host_class_pima_event_pima_instance;
357     ULONG           ux_host_class_pima_event_code;
358     ULONG           ux_host_class_pima_event_session_id;
359     ULONG           ux_host_class_pima_event_transaction_id;
360     ULONG           ux_host_class_pima_event_parameter_1;
361     ULONG           ux_host_class_pima_event_parameter_2;
362     ULONG           ux_host_class_pima_event_parameter_3;
363 
364 } UX_HOST_CLASS_PIMA_EVENT;
365 
366 /* Define PIMA structure.  */
367 
368 typedef struct UX_HOST_CLASS_PIMA_STRUCT
369 {
370 
371     struct UX_HOST_CLASS_PIMA_STRUCT
372                     *ux_host_class_pima_next_instance;
373     UX_HOST_CLASS   *ux_host_class_pima_class;
374     UX_DEVICE       *ux_host_class_pima_device;
375     UX_INTERFACE    *ux_host_class_pima_interface;
376     UX_ENDPOINT     *ux_host_class_pima_bulk_out_endpoint;
377     UX_ENDPOINT     *ux_host_class_pima_bulk_in_endpoint;
378     UX_ENDPOINT     *ux_host_class_pima_interrupt_endpoint;
379     UINT            ux_host_class_pima_state;
380     ULONG           ux_host_class_pima_transaction_id;
381     ULONG           ux_host_class_pima_operation_code;
382     ULONG           ux_host_class_pima_event_code;
383     ULONG           ux_host_class_pima_event_transaction_id;
384     ULONG           ux_host_class_pima_event_session;
385     ULONG           ux_host_class_pima_event_parameter_1;
386     ULONG           ux_host_class_pima_event_parameter_2;
387     ULONG           ux_host_class_pima_event_parameter_3;
388     UCHAR           *ux_host_class_pima_event_buffer;
389     UCHAR           *ux_host_class_pima_event_buffer_current_offset;
390     ULONG           ux_host_class_pima_event_buffer_current_length;
391     ULONG           ux_host_class_pima_event_buffer_expected_length;
392     struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
393                     *ux_host_class_pima_session;
394     UCHAR           *ux_host_class_pima_container;
395     UX_SEMAPHORE    ux_host_class_pima_semaphore;
396     VOID            *ux_host_class_pima_application;
397     ULONG           ux_host_class_pima_zlp_flag;
398 
399 } UX_HOST_CLASS_PIMA;
400 
401 /* Define PIMA Session structure.  */
402 
403 typedef struct UX_HOST_CLASS_PIMA_SESSION_STRUCT
404 {
405 
406     ULONG           ux_host_class_pima_session_magic;
407     ALIGN_TYPE      ux_host_class_pima_session_id;
408     ULONG           ux_host_class_pima_session_state;
409     struct UX_HOST_CLASS_PIMA_STRUCT
410                     *ux_host_class_pima_session_pima_instance;
411     ULONG           ux_host_class_pima_session_nb_storage_ids;
412     ULONG           ux_host_class_pima_session_nb_objects;
413     VOID            (*ux_host_class_pima_session_event_callback)(struct UX_HOST_CLASS_PIMA_EVENT_STRUCT *pima_event);
414 
415 } UX_HOST_CLASS_PIMA_SESSION;
416 
417 
418 /* Define PIMA command structure.  */
419 
420 typedef struct UX_HOST_CLASS_PIMA_COMMAND_STRUCT
421 {
422 
423     ULONG           ux_host_class_pima_command_nb_parameters;
424     ULONG           ux_host_class_pima_command_operation_code;
425     ULONG           ux_host_class_pima_command_parameter_1;
426     ULONG           ux_host_class_pima_command_parameter_2;
427     ULONG           ux_host_class_pima_command_parameter_3;
428     ULONG           ux_host_class_pima_command_parameter_4;
429     ULONG           ux_host_class_pima_command_parameter_5;
430 
431 } UX_HOST_CLASS_PIMA_COMMAND;
432 
433 /* Define PIMA object info structure.  */
434 
435 typedef struct UX_HOST_CLASS_PIMA_OBJECT_STRUCT
436 {
437 
438     ULONG           ux_host_class_pima_object_storage_id;
439     ULONG           ux_host_class_pima_object_format;
440     ULONG           ux_host_class_pima_object_protection_satus;
441     ULONG           ux_host_class_pima_object_compressed_size;
442     ULONG           ux_host_class_pima_object_thumb_format;
443     ULONG           ux_host_class_pima_object_thumb_compressed_size;
444     ULONG           ux_host_class_pima_object_thumb_pix_width;
445     ULONG           ux_host_class_pima_object_thumb_pix_height;
446     ULONG           ux_host_class_pima_object_image_pix_width;
447     ULONG           ux_host_class_pima_object_image_pix_height;
448     ULONG           ux_host_class_pima_object_image_bit_depth;
449     ULONG           ux_host_class_pima_object_parent_object;
450     ULONG           ux_host_class_pima_object_association_type;
451     ULONG           ux_host_class_pima_object_association_desc;
452     ULONG           ux_host_class_pima_object_sequence_number;
453     UCHAR           ux_host_class_pima_object_filename[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string.  */
454     UCHAR           ux_host_class_pima_object_capture_date[UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH];
455     UCHAR           ux_host_class_pima_object_modification_date[UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH];
456     UCHAR           ux_host_class_pima_object_keywords[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string.  */
457     ULONG           ux_host_class_pima_object_state;
458     ULONG           ux_host_class_pima_object_offset;
459     ULONG           ux_host_class_pima_object_transfer_status;
460     ULONG           ux_host_class_pima_object_handle_id;
461     ULONG           ux_host_class_pima_object_length;
462     UCHAR           *ux_host_class_pima_object_buffer;
463 
464 } UX_HOST_CLASS_PIMA_OBJECT;
465 
466 /* Define PIMA Object decompaction structure.  */
467 
468 #define UX_HOST_CLASS_PIMA_OBJECT_MAX_LENGTH                                512
469 #define UX_HOST_CLASS_PIMA_OBJECT_VARIABLE_OFFSET                           52
470 #define UX_HOST_CLASS_PIMA_OBJECT_ENTRIES                                   15
471 
472 /* Define PIMA device info structure.  */
473 
474 typedef struct UX_HOST_CLASS_PIMA_DEVICE_STRUCT
475 {
476 
477     ULONG            ux_host_class_pima_device_standard_version;
478     ULONG            ux_host_class_pima_device_vendor_extension_id;
479     ULONG            ux_host_class_pima_device_vendor_extension_version;
480     UCHAR            ux_host_class_pima_device_vendor_extension_desc[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string.  */
481     ULONG            ux_host_class_pima_device_functional_mode;
482     UCHAR            ux_host_class_pima_device_operations_supported[UX_HOST_CLASS_PIMA_ARRAY_MAX_LENGTH];
483     UCHAR            ux_host_class_pima_device_events_supported[UX_HOST_CLASS_PIMA_ARRAY_MAX_LENGTH];
484     UCHAR            ux_host_class_pima_device_properties_supported[UX_HOST_CLASS_PIMA_ARRAY_MAX_LENGTH];
485     UCHAR            ux_host_class_pima_device_capture_formats[UX_HOST_CLASS_PIMA_ARRAY_MAX_LENGTH];
486     UCHAR            ux_host_class_pima_device_image_formats[UX_HOST_CLASS_PIMA_ARRAY_MAX_LENGTH];
487     UCHAR            ux_host_class_pima_device_manufacturer[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string.  */
488     UCHAR            ux_host_class_pima_device_model[UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH];
489     UCHAR            ux_host_class_pima_device_version[UX_HOST_CLASS_PIMA_DATE_TIME_STRING_MAX_LENGTH];
490     UCHAR            ux_host_class_pima_device_serial_number[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string.  */
491 
492 } UX_HOST_CLASS_PIMA_DEVICE;
493 
494 /* Define PIMA Device decompaction structure.  */
495 
496 #define UX_HOST_CLASS_PIMA_DEVICE_MAX_LENGTH                                512
497 #define UX_HOST_CLASS_PIMA_DEVICE_STANDARD_VERSION                          0
498 #define UX_HOST_CLASS_PIMA_DEVICE_VENDOR_EXTENSION_ID                       2
499 #define UX_HOST_CLASS_PIMA_DEVICE_VENDOR_EXTENSION_VERSION                  6
500 #define UX_HOST_CLASS_PIMA_DEVICE_VENDOR_EXTENSION_DESC                     8
501 
502 /* Define PIMA storage info structure.  */
503 
504 typedef struct UX_HOST_CLASS_PIMA_STORAGE_STRUCT
505 {
506 
507     ULONG            ux_host_class_pima_storage_type;
508     ULONG            ux_host_class_pima_storage_file_system_type;
509     ULONG            ux_host_class_pima_storage_access_capability;
510     ULONG            ux_host_class_pima_storage_max_capacity_low;
511     ULONG            ux_host_class_pima_storage_max_capacity_high;
512     ULONG            ux_host_class_pima_storage_free_space_bytes_low;
513     ULONG            ux_host_class_pima_storage_free_space_bytes_high;
514     ULONG            ux_host_class_pima_storage_free_space_images;
515     UCHAR            ux_host_class_pima_storage_description[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string.  */
516     UCHAR            ux_host_class_pima_storage_volume_label[UX_HOST_CLASS_PIMA_UNICODE_MAX_LENGTH]; /* Null terminated unicode string.  */
517 
518 } UX_HOST_CLASS_PIMA_STORAGE;
519 
520 /* Define PIMA storage decompaction structure.  */
521 
522 #define UX_HOST_CLASS_PIMA_STORAGE_MAX_LENGTH                             512
523 #define UX_HOST_CLASS_PIMA_STORAGE_VARIABLE_OFFSET                        26
524 #define UX_HOST_CLASS_PIMA_STORAGE_ENTRIES                                8
525 
526 /* Define Pima Class function prototypes.  */
527 
528 UINT  _ux_host_class_pima_activate(UX_HOST_CLASS_COMMAND *command);
529 UINT  _ux_host_class_pima_configure(UX_HOST_CLASS_PIMA *cdc_acm);
530 UINT  _ux_host_class_pima_deactivate(UX_HOST_CLASS_COMMAND *command);
531 UINT  _ux_host_class_pima_endpoints_get(UX_HOST_CLASS_PIMA *cdc_acm);
532 UINT  _ux_host_class_pima_entry(UX_HOST_CLASS_COMMAND *command);
533 VOID  _ux_host_class_pima_notification(UX_TRANSFER *transfer_request);
534 UINT  _ux_host_class_pima_command(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_COMMAND *command,
535                                     ULONG direction, UCHAR *data_buffer, ULONG data_length,
536                                     ULONG max_payload_length);
537 UINT  _ux_host_class_pima_device_reset(UX_HOST_CLASS_PIMA *pima);
538 UINT  _ux_host_class_pima_num_objects_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id,
539                                         ULONG object_format_code);
540 UINT  _ux_host_class_pima_object_copy(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle,
541                                         ULONG storage_id, ULONG parent_object_handle);
542 UINT  _ux_host_class_pima_object_delete(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle);
543 UINT  _ux_host_class_pima_object_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
544                                         UCHAR *object_buffer, ULONG object_buffer_length, ULONG *object_actual_length);
545 UINT  _ux_host_class_pima_object_handles_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session,
546                                     ULONG *object_handles_array, ULONG object_handles_length, ULONG storage_id, ULONG object_format_code, ULONG object_handle_association);
547 UINT  _ux_host_class_pima_object_info_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
548 UINT  _ux_host_class_pima_object_info_send(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id, ULONG parent_object_id,
549                                         UX_HOST_CLASS_PIMA_OBJECT *object);
550 UINT  _ux_host_class_pima_object_move(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle, ULONG storage_id, ULONG parent_object_handle);
551 UINT  _ux_host_class_pima_object_send(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, UX_HOST_CLASS_PIMA_OBJECT *object,
552                                         UCHAR *object_buffer, ULONG object_buffer_length);
553 UINT  _ux_host_class_pima_read(UX_HOST_CLASS_PIMA *pima, UCHAR *data_pointer, ULONG data_length, ULONG max_payload_length);
554 UINT  _ux_host_class_pima_session_close(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session);
555 UINT  _ux_host_class_pima_session_open(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session);
556 UINT  _ux_host_class_pima_storage_ids_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG *storage_ids_array, ULONG storage_id_length);
557 UINT  _ux_host_class_pima_storage_info_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG storage_id, UX_HOST_CLASS_PIMA_STORAGE *storage);
558 UINT  _ux_host_class_pima_thumb_get(UX_HOST_CLASS_PIMA *pima, UX_HOST_CLASS_PIMA_SESSION *pima_session, ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object,
559                                         UCHAR *thumb_buffer, ULONG thumb_buffer_length, ULONG *thumb_actual_length);
560 UINT  _ux_host_class_pima_write(UX_HOST_CLASS_PIMA *pima, UCHAR *data_pointer, ULONG data_length, ULONG operation_code, ULONG max_payload_length);
561 UINT  _ux_host_class_pima_request_cancel(UX_HOST_CLASS_PIMA *pima);
562 UINT  _ux_host_class_pima_object_transfer_abort(UX_HOST_CLASS_PIMA *pima,
563                                         UX_HOST_CLASS_PIMA_SESSION *pima_session,
564                                         ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
565 UINT  _ux_host_class_pima_object_close(UX_HOST_CLASS_PIMA *pima,
566                                         UX_HOST_CLASS_PIMA_SESSION *pima_session,
567                                         ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
568 UINT  _ux_host_class_pima_object_open(UX_HOST_CLASS_PIMA *pima,
569                                         UX_HOST_CLASS_PIMA_SESSION *pima_session,
570                                         ULONG object_handle, UX_HOST_CLASS_PIMA_OBJECT *object);
571 UINT  _ux_host_class_pima_device_info_get(UX_HOST_CLASS_PIMA *pima,
572                                         UX_HOST_CLASS_PIMA_DEVICE *pima_device);
573 
574 /* Define Device PIMA Class API prototypes.  */
575 
576 #define ux_host_class_pima_entry                    _ux_host_class_pima_entry
577 #define ux_host_class_pima_device_info_get          _ux_host_class_pima_device_info_get
578 #define ux_host_class_pima_object_info_send         _ux_host_class_pima_object_info_send
579 #define ux_host_class_pima_object_info_get          _ux_host_class_pima_object_info_get
580 #define ux_host_class_pima_object_open              _ux_host_class_pima_object_open
581 #define ux_host_class_pima_object_get               _ux_host_class_pima_object_get
582 #define ux_host_class_pima_thumb_get                _ux_host_class_pima_thumb_get
583 #define ux_host_class_pima_object_send              _ux_host_class_pima_object_send
584 #define ux_host_class_pima_object_delete            _ux_host_class_pima_object_delete
585 #define ux_host_class_pima_object_transfer_abort    _ux_host_class_pima_object_transfer_abort
586 #define ux_host_class_pima_object_close             _ux_host_class_pima_object_close
587 #define ux_host_class_pima_session_open             _ux_host_class_pima_session_open
588 #define ux_host_class_pima_session_close            _ux_host_class_pima_session_close
589 #define ux_host_class_pima_storage_ids_get          _ux_host_class_pima_storage_ids_get
590 #define ux_host_class_pima_storage_info_get         _ux_host_class_pima_storage_info_get
591 #define ux_host_class_pima_object_handles_get       _ux_host_class_pima_object_handles_get
592 #define ux_host_class_pima_num_objects_get          _ux_host_class_pima_num_objects_get
593 
594 /* Determine if a C++ compiler is being used.  If so, complete the standard
595    C conditional started above.  */
596 #ifdef __cplusplus
597 }
598 #endif
599 
600 #endif
601