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