| 1 |
/** |
| 2 |
****************************************************************************** |
| 3 |
* @file usbh_mtp_ptp.h |
| 4 |
* @author MCD Application Team |
| 5 |
* @version V3.0.0 |
| 6 |
* @date 18-February-2014 |
| 7 |
* @brief Header file for usbh_mtp_ptp.c |
| 8 |
****************************************************************************** |
| 9 |
* @attention |
| 10 |
* |
| 11 |
* <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
| 12 |
* |
| 13 |
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
| 14 |
* You may not use this file except in compliance with the License. |
| 15 |
* You may obtain a copy of the License at: |
| 16 |
* |
| 17 |
* http://www.st.com/software_license_agreement_liberty_v2 |
| 18 |
* |
| 19 |
* Unless required by applicable law or agreed to in writing, software |
| 20 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 21 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 22 |
* See the License for the specific language governing permissions and |
| 23 |
* limitations under the License. |
| 24 |
* |
| 25 |
****************************************************************************** |
| 26 |
*/ |
| 27 |
|
| 28 |
/* Define to prevent recursive ----------------------------------------------*/ |
| 29 |
#ifndef __USBH_MTP_PTP_H__ |
| 30 |
#define __USBH_MTP_PTP_H__ |
| 31 |
|
| 32 |
/* Includes ------------------------------------------------------------------*/ |
| 33 |
#include "usbh_core.h" |
| 34 |
|
| 35 |
/** @addtogroup USBH_LIB |
| 36 |
* @{ |
| 37 |
*/ |
| 38 |
|
| 39 |
/** @addtogroup USBH_CLASS |
| 40 |
* @{ |
| 41 |
*/ |
| 42 |
|
| 43 |
/** @addtogroup USBH_MTP_PTP_CLASS |
| 44 |
* @{ |
| 45 |
*/ |
| 46 |
|
| 47 |
/** @defgroup USBH_MTP_PTP |
| 48 |
* @brief This file is the Header file for usbh_mtp_ptp.c |
| 49 |
* @{ |
| 50 |
*/ |
| 51 |
|
| 52 |
|
| 53 |
/* Operation Codes */ |
| 54 |
|
| 55 |
/* PTP v1.0 operation codes */ |
| 56 |
#define PTP_OC_Undefined 0x1000 |
| 57 |
#define PTP_OC_GetDeviceInfo 0x1001 |
| 58 |
#define PTP_OC_OpenSession 0x1002 |
| 59 |
#define PTP_OC_CloseSession 0x1003 |
| 60 |
#define PTP_OC_GetStorageIDs 0x1004 |
| 61 |
#define PTP_OC_GetStorageInfo 0x1005 |
| 62 |
#define PTP_OC_GetNumObjects 0x1006 |
| 63 |
#define PTP_OC_GetObjectHandles 0x1007 |
| 64 |
#define PTP_OC_GetObjectInfo 0x1008 |
| 65 |
#define PTP_OC_GetObject 0x1009 |
| 66 |
#define PTP_OC_GetThumb 0x100A |
| 67 |
#define PTP_OC_DeleteObject 0x100B |
| 68 |
#define PTP_OC_SendObjectInfo 0x100C |
| 69 |
#define PTP_OC_SendObject 0x100D |
| 70 |
#define PTP_OC_InitiateCapture 0x100E |
| 71 |
#define PTP_OC_FormatStore 0x100F |
| 72 |
#define PTP_OC_ResetDevice 0x1010 |
| 73 |
#define PTP_OC_SelfTest 0x1011 |
| 74 |
#define PTP_OC_SetObjectProtection 0x1012 |
| 75 |
#define PTP_OC_PowerDown 0x1013 |
| 76 |
#define PTP_OC_GetDevicePropDesc 0x1014 |
| 77 |
#define PTP_OC_GetDevicePropValue 0x1015 |
| 78 |
#define PTP_OC_SetDevicePropValue 0x1016 |
| 79 |
#define PTP_OC_ResetDevicePropValue 0x1017 |
| 80 |
#define PTP_OC_TerminateOpenCapture 0x1018 |
| 81 |
#define PTP_OC_MoveObject 0x1019 |
| 82 |
#define PTP_OC_CopyObject 0x101A |
| 83 |
#define PTP_OC_GetPartialObject 0x101B |
| 84 |
#define PTP_OC_InitiateOpenCapture 0x101C |
| 85 |
|
| 86 |
/* PTP v1.1 operation codes */ |
| 87 |
#define PTP_OC_StartEnumHandles 0x101D |
| 88 |
#define PTP_OC_EnumHandles 0x101E |
| 89 |
#define PTP_OC_StopEnumHandles 0x101F |
| 90 |
#define PTP_OC_GetVendorExtensionMaps 0x1020 |
| 91 |
#define PTP_OC_GetVendorDeviceInfo 0x1021 |
| 92 |
#define PTP_OC_GetResizedImageObject 0x1022 |
| 93 |
#define PTP_OC_GetFilesystemManifest 0x1023 |
| 94 |
#define PTP_OC_GetStreamInfo 0x1024 |
| 95 |
#define PTP_OC_GetStream 0x1025 |
| 96 |
|
| 97 |
/* Microsoft / MTP extension codes */ |
| 98 |
#define PTP_OC_GetObjectPropsSupported 0x9801 |
| 99 |
#define PTP_OC_GetObjectPropDesc 0x9802 |
| 100 |
#define PTP_OC_GetObjectPropValue 0x9803 |
| 101 |
#define PTP_OC_SetObjectPropValue 0x9804 |
| 102 |
#define PTP_OC_GetObjPropList 0x9805 |
| 103 |
#define PTP_OC_SetObjPropList 0x9806 |
| 104 |
#define PTP_OC_GetInterdependendPropdesc 0x9807 |
| 105 |
#define PTP_OC_SendObjectPropList 0x9808 |
| 106 |
#define PTP_OC_GetObjectReferences 0x9810 |
| 107 |
#define PTP_OC_SetObjectReferences 0x9811 |
| 108 |
#define PTP_OC_UpdateDeviceFirmware 0x9812 |
| 109 |
#define PTP_OC_Skip 0x9820 |
| 110 |
|
| 111 |
|
| 112 |
/* Response Codes */ |
| 113 |
|
| 114 |
/* PTP v1.0 response codes */ |
| 115 |
#define PTP_RC_Undefined 0x2000 |
| 116 |
#define PTP_RC_OK 0x2001 |
| 117 |
#define PTP_RC_GeneralError 0x2002 |
| 118 |
#define PTP_RC_SessionNotOpen 0x2003 |
| 119 |
#define PTP_RC_InvalidTransactionID 0x2004 |
| 120 |
#define PTP_RC_OperationNotSupported 0x2005 |
| 121 |
#define PTP_RC_ParameterNotSupported 0x2006 |
| 122 |
#define PTP_RC_IncompleteTransfer 0x2007 |
| 123 |
#define PTP_RC_InvalidStorageId 0x2008 |
| 124 |
#define PTP_RC_InvalidObjectHandle 0x2009 |
| 125 |
#define PTP_RC_DevicePropNotSupported 0x200A |
| 126 |
#define PTP_RC_InvalidObjectFormatCode 0x200B |
| 127 |
#define PTP_RC_StoreFull 0x200C |
| 128 |
#define PTP_RC_ObjectWriteProtected 0x200D |
| 129 |
#define PTP_RC_StoreReadOnly 0x200E |
| 130 |
#define PTP_RC_AccessDenied 0x200F |
| 131 |
#define PTP_RC_NoThumbnailPresent 0x2010 |
| 132 |
#define PTP_RC_SelfTestFailed 0x2011 |
| 133 |
#define PTP_RC_PartialDeletion 0x2012 |
| 134 |
#define PTP_RC_StoreNotAvailable 0x2013 |
| 135 |
#define PTP_RC_SpecificationByFormatUnsupported 0x2014 |
| 136 |
#define PTP_RC_NoValidObjectInfo 0x2015 |
| 137 |
#define PTP_RC_InvalidCodeFormat 0x2016 |
| 138 |
#define PTP_RC_UnknownVendorCode 0x2017 |
| 139 |
#define PTP_RC_CaptureAlreadyTerminated 0x2018 |
| 140 |
#define PTP_RC_DeviceBusy 0x2019 |
| 141 |
#define PTP_RC_InvalidParentObject 0x201A |
| 142 |
#define PTP_RC_InvalidDevicePropFormat 0x201B |
| 143 |
#define PTP_RC_InvalidDevicePropValue 0x201C |
| 144 |
#define PTP_RC_InvalidParameter 0x201D |
| 145 |
#define PTP_RC_SessionAlreadyOpened 0x201E |
| 146 |
#define PTP_RC_TransactionCanceled 0x201F |
| 147 |
#define PTP_RC_SpecificationOfDestinationUnsupported 0x2020 |
| 148 |
/* PTP v1.1 response codes */ |
| 149 |
#define PTP_RC_InvalidEnumHandle 0x2021 |
| 150 |
#define PTP_RC_NoStreamEnabled 0x2022 |
| 151 |
#define PTP_RC_InvalidDataSet 0x2023 |
| 152 |
|
| 153 |
/* USB container types */ |
| 154 |
|
| 155 |
#define PTP_USB_CONTAINER_UNDEFINED 0x0000 |
| 156 |
#define PTP_USB_CONTAINER_COMMAND 0x0001 |
| 157 |
#define PTP_USB_CONTAINER_DATA 0x0002 |
| 158 |
#define PTP_USB_CONTAINER_RESPONSE 0x0003 |
| 159 |
#define PTP_USB_CONTAINER_EVENT 0x0004 |
| 160 |
|
| 161 |
/* PTP/IP definitions */ |
| 162 |
#define PTPIP_INIT_COMMAND_REQUEST 1 |
| 163 |
#define PTPIP_INIT_COMMAND_ACK 2 |
| 164 |
#define PTPIP_INIT_EVENT_REQUEST 3 |
| 165 |
#define PTPIP_INIT_EVENT_ACK 4 |
| 166 |
#define PTPIP_INIT_FAIL 5 |
| 167 |
#define PTPIP_CMD_REQUEST 6 |
| 168 |
#define PTPIP_CMD_RESPONSE 7 |
| 169 |
#define PTPIP_EVENT 8 |
| 170 |
#define PTPIP_START_DATA_PACKET 9 |
| 171 |
#define PTPIP_DATA_PACKET 10 |
| 172 |
#define PTPIP_CANCEL_TRANSACTION 11 |
| 173 |
#define PTPIP_END_DATA_PACKET 12 |
| 174 |
#define PTPIP_PING 13 |
| 175 |
#define PTPIP_PONG 14 |
| 176 |
|
| 177 |
/* Transaction data phase description */ |
| 178 |
#define PTP_DP_NODATA 0x0000 /* no data phase */ |
| 179 |
#define PTP_DP_SENDDATA 0x0001 /* sending data */ |
| 180 |
#define PTP_DP_GETDATA 0x0002 /* receiving data */ |
| 181 |
#define PTP_DP_DATA_MASK 0x00ff /* data phase mask */ |
| 182 |
|
| 183 |
/** @defgroup USBH_MTP_PTP_Exported_Types |
| 184 |
* @{ |
| 185 |
*/ |
| 186 |
|
| 187 |
typedef enum |
| 188 |
{ |
| 189 |
PTP_REQ_IDLE = 0, |
| 190 |
PTP_REQ_SEND = 1, |
| 191 |
PTP_REQ_WAIT, |
| 192 |
PTP_REQ_ERROR, |
| 193 |
} |
| 194 |
PTP_RequestStateTypeDef; |
| 195 |
|
| 196 |
typedef enum |
| 197 |
{ |
| 198 |
PTP_IDLE = 0, |
| 199 |
PTP_OP_REQUEST_STATE, |
| 200 |
PTP_OP_REQUEST_WAIT_STATE, |
| 201 |
PTP_DATA_OUT_PHASE_STATE, |
| 202 |
PTP_DATA_OUT_PHASE_WAIT_STATE, |
| 203 |
PTP_DATA_IN_PHASE_STATE, |
| 204 |
PTP_DATA_IN_PHASE_WAIT_STATE, |
| 205 |
PTP_RESPONSE_STATE, |
| 206 |
PTP_RESPONSE_WAIT_STATE, |
| 207 |
PTP_ERROR, |
| 208 |
} |
| 209 |
PTP_ProcessStateTypeDef; |
| 210 |
|
| 211 |
/* PTP request/response/event general PTP container (transport independent) */ |
| 212 |
typedef struct |
| 213 |
{ |
| 214 |
uint16_t Code; |
| 215 |
uint32_t SessionID; |
| 216 |
uint32_t Transaction_ID; |
| 217 |
/* params may be of any type of size less or equal to uint32_t */ |
| 218 |
uint32_t Param1; |
| 219 |
uint32_t Param2; |
| 220 |
uint32_t Param3; |
| 221 |
/* events can only have three parameters */ |
| 222 |
uint32_t Param4; |
| 223 |
uint32_t Param5; |
| 224 |
/* the number of meaningfull parameters */ |
| 225 |
uint8_t Nparam; |
| 226 |
} |
| 227 |
PTP_ContainerTypedef; |
| 228 |
|
| 229 |
#define PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE 1024 |
| 230 |
#define PTP_USB_BULK_HS_MAX_PACKET_LEN_READ 1024 |
| 231 |
#define PTP_USB_BULK_HDR_LEN (2*sizeof(uint32_t)+2*sizeof(uint16_t)) |
| 232 |
#define PTP_USB_BULK_PAYLOAD_LEN_WRITE (PTP_USB_BULK_HS_MAX_PACKET_LEN_WRITE-PTP_USB_BULK_HDR_LEN) |
| 233 |
#define PTP_USB_BULK_PAYLOAD_LEN_READ (PTP_USB_BULK_HS_MAX_PACKET_LEN_READ-PTP_USB_BULK_HDR_LEN) |
| 234 |
#define PTP_USB_BULK_REQ_LEN (PTP_USB_BULK_HDR_LEN+5*sizeof(uint32_t)) |
| 235 |
#define PTP_USB_BULK_REQ_RESP_MAX_LEN 63 |
| 236 |
|
| 237 |
typedef struct |
| 238 |
{ |
| 239 |
uint32_t length; |
| 240 |
uint16_t type; |
| 241 |
uint16_t code; |
| 242 |
uint32_t trans_id; |
| 243 |
uint32_t param1; |
| 244 |
uint32_t param2; |
| 245 |
uint32_t param3; |
| 246 |
uint32_t param4; |
| 247 |
uint32_t param5; |
| 248 |
} |
| 249 |
PTP_RespContainerTypedef; |
| 250 |
|
| 251 |
|
| 252 |
typedef struct |
| 253 |
{ |
| 254 |
uint32_t length; |
| 255 |
uint16_t type; |
| 256 |
uint16_t code; |
| 257 |
uint32_t trans_id; |
| 258 |
uint32_t param1; |
| 259 |
uint32_t param2; |
| 260 |
uint32_t param3; |
| 261 |
uint32_t param4; |
| 262 |
uint32_t param5; |
| 263 |
} |
| 264 |
PTP_OpContainerTypedef; |
| 265 |
|
| 266 |
typedef struct |
| 267 |
{ |
| 268 |
uint32_t length; |
| 269 |
uint16_t type; |
| 270 |
uint16_t code; |
| 271 |
uint32_t trans_id; |
| 272 |
union { |
| 273 |
struct { |
| 274 |
uint32_t param1; |
| 275 |
uint32_t param2; |
| 276 |
uint32_t param3; |
| 277 |
uint32_t param4; |
| 278 |
uint32_t param5; |
| 279 |
} params; |
| 280 |
uint8_t data[PTP_USB_BULK_PAYLOAD_LEN_READ]; |
| 281 |
}payload; |
| 282 |
} |
| 283 |
PTP_DataContainerTypedef; |
| 284 |
|
| 285 |
/* PTP USB Asynchronous Event Interrupt Data Format */ |
| 286 |
typedef struct |
| 287 |
{ |
| 288 |
uint32_t length; |
| 289 |
uint16_t type; |
| 290 |
uint16_t code; |
| 291 |
uint32_t trans_id; |
| 292 |
uint32_t param1; |
| 293 |
uint32_t param2; |
| 294 |
uint32_t param3; |
| 295 |
} |
| 296 |
PTP_EventContainerTypedef; |
| 297 |
|
| 298 |
/* Structure for PTP Transport process */ |
| 299 |
typedef struct |
| 300 |
{ |
| 301 |
PTP_ProcessStateTypeDef state; |
| 302 |
PTP_RequestStateTypeDef req_state; |
| 303 |
PTP_OpContainerTypedef op_container; |
| 304 |
PTP_DataContainerTypedef data_container; |
| 305 |
PTP_RespContainerTypedef resp_container; |
| 306 |
|
| 307 |
/* ptp transaction ID */ |
| 308 |
uint32_t transaction_id; |
| 309 |
|
| 310 |
/* ptp session ID */ |
| 311 |
uint32_t session_id; |
| 312 |
|
| 313 |
/* device flags */ |
| 314 |
uint32_t flags; |
| 315 |
|
| 316 |
/****** PTP transfer control *******/ |
| 317 |
|
| 318 |
/* Data pointer */ |
| 319 |
uint8_t *data_ptr; |
| 320 |
|
| 321 |
/* Data length */ |
| 322 |
int32_t data_length; |
| 323 |
|
| 324 |
/* Data length */ |
| 325 |
uint32_t data_packet; |
| 326 |
|
| 327 |
/* Data length */ |
| 328 |
uint32_t iteration; |
| 329 |
|
| 330 |
/* Packet Index */ |
| 331 |
uint32_t data_packet_counter; |
| 332 |
|
| 333 |
/****** Object transfer control *******/ |
| 334 |
|
| 335 |
/* object pointer */ |
| 336 |
uint8_t *object_ptr; |
| 337 |
|
| 338 |
} |
| 339 |
PTP_HandleTypeDef; |
| 340 |
|
| 341 |
/* DeviceInfo data offset */ |
| 342 |
#define PTP_di_StandardVersion 0 |
| 343 |
#define PTP_di_VendorExtensionID 2 |
| 344 |
#define PTP_di_VendorExtensionVersion 6 |
| 345 |
#define PTP_di_VendorExtensionDesc 8 |
| 346 |
#define PTP_di_FunctionalMode 8 |
| 347 |
#define PTP_di_OperationsSupported 10 |
| 348 |
|
| 349 |
/* Max info items size */ |
| 350 |
#define PTP_SUPPORTED_OPERATIONS_NBR 100 |
| 351 |
#define PTP_SUPPORTED_EVENTS_NBR 100 |
| 352 |
#define PTP_SUPPORTED_PROPRIETIES_NBR 100 |
| 353 |
#define PTP_CAPTURE_FORMATS_NBR 100 |
| 354 |
#define PTP_IMAGE_FORMATS_NBR 100 |
| 355 |
#define PTP_MAX_STR_SIZE 255 |
| 356 |
/* PTP device info structure */ |
| 357 |
typedef struct |
| 358 |
{ |
| 359 |
uint16_t StandardVersion; |
| 360 |
uint32_t VendorExtensionID; |
| 361 |
uint16_t VendorExtensionVersion; |
| 362 |
uint8_t VendorExtensionDesc[PTP_MAX_STR_SIZE]; |
| 363 |
uint16_t FunctionalMode; |
| 364 |
uint32_t OperationsSupported_len; |
| 365 |
uint16_t OperationsSupported[PTP_SUPPORTED_OPERATIONS_NBR]; |
| 366 |
uint32_t EventsSupported_len; |
| 367 |
uint16_t EventsSupported[PTP_SUPPORTED_EVENTS_NBR]; |
| 368 |
uint32_t DevicePropertiesSupported_len; |
| 369 |
uint16_t DevicePropertiesSupported[PTP_SUPPORTED_PROPRIETIES_NBR]; |
| 370 |
uint32_t CaptureFormats_len; |
| 371 |
uint16_t CaptureFormats[PTP_CAPTURE_FORMATS_NBR]; |
| 372 |
uint32_t ImageFormats_len; |
| 373 |
uint16_t ImageFormats[PTP_IMAGE_FORMATS_NBR]; |
| 374 |
uint8_t Manufacturer[PTP_MAX_STR_SIZE]; |
| 375 |
uint8_t Model[PTP_MAX_STR_SIZE]; |
| 376 |
uint8_t DeviceVersion[PTP_MAX_STR_SIZE]; |
| 377 |
uint8_t SerialNumber[PTP_MAX_STR_SIZE]; |
| 378 |
} |
| 379 |
PTP_DeviceInfoTypedef; |
| 380 |
|
| 381 |
#define PTP_MAX_STORAGE_UNITS_NBR 5 |
| 382 |
/* PTP storageIDs structute (returned by GetStorageIDs) */ |
| 383 |
typedef struct |
| 384 |
{ |
| 385 |
uint32_t n; |
| 386 |
uint32_t Storage [PTP_MAX_STORAGE_UNITS_NBR]; |
| 387 |
} |
| 388 |
PTP_StorageIDsTypedef; |
| 389 |
|
| 390 |
/* PTP StorageInfo structure (returned by GetStorageInfo) */ |
| 391 |
|
| 392 |
#define PTP_si_StorageType 0 |
| 393 |
#define PTP_si_FilesystemType 2 |
| 394 |
#define PTP_si_AccessCapability 4 |
| 395 |
#define PTP_si_MaxCapability 6 |
| 396 |
#define PTP_si_FreeSpaceInBytes 14 |
| 397 |
#define PTP_si_FreeSpaceInImages 22 |
| 398 |
#define PTP_si_StorageDescription 26 |
| 399 |
|
| 400 |
|
| 401 |
/* PTP Storage Types */ |
| 402 |
|
| 403 |
#define PTP_ST_Undefined 0x0000 |
| 404 |
#define PTP_ST_FixedROM 0x0001 |
| 405 |
#define PTP_ST_RemovableROM 0x0002 |
| 406 |
#define PTP_ST_FixedRAM 0x0003 |
| 407 |
#define PTP_ST_RemovableRAM 0x0004 |
| 408 |
|
| 409 |
/* PTP FilesystemType Values */ |
| 410 |
|
| 411 |
#define PTP_FST_Undefined 0x0000 |
| 412 |
#define PTP_FST_GenericFlat 0x0001 |
| 413 |
#define PTP_FST_GenericHierarchical 0x0002 |
| 414 |
#define PTP_FST_DCF 0x0003 |
| 415 |
|
| 416 |
/* PTP StorageInfo AccessCapability Values */ |
| 417 |
|
| 418 |
#define PTP_AC_ReadWrite 0x0000 |
| 419 |
#define PTP_AC_ReadOnly 0x0001 |
| 420 |
#define PTP_AC_ReadOnly_with_Object_Deletion 0x0002 |
| 421 |
|
| 422 |
typedef struct |
| 423 |
{ |
| 424 |
uint16_t StorageType; |
| 425 |
uint16_t FilesystemType; |
| 426 |
uint16_t AccessCapability; |
| 427 |
uint64_t MaxCapability; |
| 428 |
uint64_t FreeSpaceInBytes; |
| 429 |
uint32_t FreeSpaceInImages; |
| 430 |
uint8_t StorageDescription[PTP_MAX_STR_SIZE]; |
| 431 |
uint8_t VolumeLabel[PTP_MAX_STR_SIZE]; |
| 432 |
} |
| 433 |
PTP_StorageInfoTypedef; |
| 434 |
|
| 435 |
/* PTP Object Format Codes */ |
| 436 |
|
| 437 |
/* ancillary formats */ |
| 438 |
#define PTP_OFC_Undefined 0x3000 |
| 439 |
#define PTP_OFC_Defined 0x3800 |
| 440 |
#define PTP_OFC_Association 0x3001 |
| 441 |
#define PTP_OFC_Script 0x3002 |
| 442 |
#define PTP_OFC_Executable 0x3003 |
| 443 |
#define PTP_OFC_Text 0x3004 |
| 444 |
#define PTP_OFC_HTML 0x3005 |
| 445 |
#define PTP_OFC_DPOF 0x3006 |
| 446 |
#define PTP_OFC_AIFF 0x3007 |
| 447 |
#define PTP_OFC_WAV 0x3008 |
| 448 |
#define PTP_OFC_MP3 0x3009 |
| 449 |
#define PTP_OFC_AVI 0x300A |
| 450 |
#define PTP_OFC_MPEG 0x300B |
| 451 |
#define PTP_OFC_ASF 0x300C |
| 452 |
#define PTP_OFC_QT 0x300D /* guessing */ |
| 453 |
/* image formats */ |
| 454 |
#define PTP_OFC_EXIF_JPEG 0x3801 |
| 455 |
#define PTP_OFC_TIFF_EP 0x3802 |
| 456 |
#define PTP_OFC_FlashPix 0x3803 |
| 457 |
#define PTP_OFC_BMP 0x3804 |
| 458 |
#define PTP_OFC_CIFF 0x3805 |
| 459 |
#define PTP_OFC_Undefined_0x3806 0x3806 |
| 460 |
#define PTP_OFC_GIF 0x3807 |
| 461 |
#define PTP_OFC_JFIF 0x3808 |
| 462 |
#define PTP_OFC_PCD 0x3809 |
| 463 |
#define PTP_OFC_PICT 0x380A |
| 464 |
#define PTP_OFC_PNG 0x380B |
| 465 |
#define PTP_OFC_Undefined_0x380C 0x380C |
| 466 |
#define PTP_OFC_TIFF 0x380D |
| 467 |
#define PTP_OFC_TIFF_IT 0x380E |
| 468 |
#define PTP_OFC_JP2 0x380F |
| 469 |
#define PTP_OFC_JPX 0x3810 |
| 470 |
/* ptp v1.1 has only DNG new */ |
| 471 |
#define PTP_OFC_DNG 0x3811 |
| 472 |
|
| 473 |
/* MTP extensions */ |
| 474 |
#define PTP_OFC_MTP_MediaCard 0xb211 |
| 475 |
#define PTP_OFC_MTP_MediaCardGroup 0xb212 |
| 476 |
#define PTP_OFC_MTP_Encounter 0xb213 |
| 477 |
#define PTP_OFC_MTP_EncounterBox 0xb214 |
| 478 |
#define PTP_OFC_MTP_M4A 0xb215 |
| 479 |
#define PTP_OFC_MTP_ZUNEUNDEFINED 0xb217 /* Unknown file type */ |
| 480 |
#define PTP_OFC_MTP_Firmware 0xb802 |
| 481 |
#define PTP_OFC_MTP_WindowsImageFormat 0xb881 |
| 482 |
#define PTP_OFC_MTP_UndefinedAudio 0xb900 |
| 483 |
#define PTP_OFC_MTP_WMA 0xb901 |
| 484 |
#define PTP_OFC_MTP_OGG 0xb902 |
| 485 |
#define PTP_OFC_MTP_AAC 0xb903 |
| 486 |
#define PTP_OFC_MTP_AudibleCodec 0xb904 |
| 487 |
#define PTP_OFC_MTP_FLAC 0xb906 |
| 488 |
#define PTP_OFC_MTP_SamsungPlaylist 0xb909 |
| 489 |
#define PTP_OFC_MTP_UndefinedVideo 0xb980 |
| 490 |
#define PTP_OFC_MTP_WMV 0xb981 |
| 491 |
#define PTP_OFC_MTP_MP4 0xb982 |
| 492 |
#define PTP_OFC_MTP_MP2 0xb983 |
| 493 |
#define PTP_OFC_MTP_3GP 0xb984 |
| 494 |
#define PTP_OFC_MTP_UndefinedCollection 0xba00 |
| 495 |
#define PTP_OFC_MTP_AbstractMultimediaAlbum 0xba01 |
| 496 |
#define PTP_OFC_MTP_AbstractImageAlbum 0xba02 |
| 497 |
#define PTP_OFC_MTP_AbstractAudioAlbum 0xba03 |
| 498 |
#define PTP_OFC_MTP_AbstractVideoAlbum 0xba04 |
| 499 |
#define PTP_OFC_MTP_AbstractAudioVideoPlaylist 0xba05 |
| 500 |
#define PTP_OFC_MTP_AbstractContactGroup 0xba06 |
| 501 |
#define PTP_OFC_MTP_AbstractMessageFolder 0xba07 |
| 502 |
#define PTP_OFC_MTP_AbstractChapteredProduction 0xba08 |
| 503 |
#define PTP_OFC_MTP_AbstractAudioPlaylist 0xba09 |
| 504 |
#define PTP_OFC_MTP_AbstractVideoPlaylist 0xba0a |
| 505 |
#define PTP_OFC_MTP_AbstractMediacast 0xba0b |
| 506 |
#define PTP_OFC_MTP_WPLPlaylist 0xba10 |
| 507 |
#define PTP_OFC_MTP_M3UPlaylist 0xba11 |
| 508 |
#define PTP_OFC_MTP_MPLPlaylist 0xba12 |
| 509 |
#define PTP_OFC_MTP_ASXPlaylist 0xba13 |
| 510 |
#define PTP_OFC_MTP_PLSPlaylist 0xba14 |
| 511 |
#define PTP_OFC_MTP_UndefinedDocument 0xba80 |
| 512 |
#define PTP_OFC_MTP_AbstractDocument 0xba81 |
| 513 |
#define PTP_OFC_MTP_XMLDocument 0xba82 |
| 514 |
#define PTP_OFC_MTP_MSWordDocument 0xba83 |
| 515 |
#define PTP_OFC_MTP_MHTCompiledHTMLDocument 0xba84 |
| 516 |
#define PTP_OFC_MTP_MSExcelSpreadsheetXLS 0xba85 |
| 517 |
#define PTP_OFC_MTP_MSPowerpointPresentationPPT 0xba86 |
| 518 |
#define PTP_OFC_MTP_UndefinedMessage 0xbb00 |
| 519 |
#define PTP_OFC_MTP_AbstractMessage 0xbb01 |
| 520 |
#define PTP_OFC_MTP_UndefinedContact 0xbb80 |
| 521 |
#define PTP_OFC_MTP_AbstractContact 0xbb81 |
| 522 |
#define PTP_OFC_MTP_vCard2 0xbb82 |
| 523 |
#define PTP_OFC_MTP_vCard3 0xbb83 |
| 524 |
#define PTP_OFC_MTP_UndefinedCalendarItem 0xbe00 |
| 525 |
#define PTP_OFC_MTP_AbstractCalendarItem 0xbe01 |
| 526 |
#define PTP_OFC_MTP_vCalendar1 0xbe02 |
| 527 |
#define PTP_OFC_MTP_vCalendar2 0xbe03 |
| 528 |
#define PTP_OFC_MTP_UndefinedWindowsExecutable 0xbe80 |
| 529 |
#define PTP_OFC_MTP_MediaCast 0xbe81 |
| 530 |
#define PTP_OFC_MTP_Section 0xbe82 |
| 531 |
|
| 532 |
/* MTP specific Object Properties */ |
| 533 |
#define PTP_OPC_StorageID 0xDC01 |
| 534 |
#define PTP_OPC_ObjectFormat 0xDC02 |
| 535 |
#define PTP_OPC_ProtectionStatus 0xDC03 |
| 536 |
#define PTP_OPC_ObjectSize 0xDC04 |
| 537 |
#define PTP_OPC_AssociationType 0xDC05 |
| 538 |
#define PTP_OPC_AssociationDesc 0xDC06 |
| 539 |
#define PTP_OPC_ObjectFileName 0xDC07 |
| 540 |
#define PTP_OPC_DateCreated 0xDC08 |
| 541 |
#define PTP_OPC_DateModified 0xDC09 |
| 542 |
#define PTP_OPC_Keywords 0xDC0A |
| 543 |
#define PTP_OPC_ParentObject 0xDC0B |
| 544 |
#define PTP_OPC_AllowedFolderContents 0xDC0C |
| 545 |
#define PTP_OPC_Hidden 0xDC0D |
| 546 |
#define PTP_OPC_SystemObject 0xDC0E |
| 547 |
#define PTP_OPC_PersistantUniqueObjectIdentifier 0xDC41 |
| 548 |
#define PTP_OPC_SyncID 0xDC42 |
| 549 |
#define PTP_OPC_PropertyBag 0xDC43 |
| 550 |
#define PTP_OPC_Name 0xDC44 |
| 551 |
#define PTP_OPC_CreatedBy 0xDC45 |
| 552 |
#define PTP_OPC_Artist 0xDC46 |
| 553 |
#define PTP_OPC_DateAuthored 0xDC47 |
| 554 |
#define PTP_OPC_Description 0xDC48 |
| 555 |
#define PTP_OPC_URLReference 0xDC49 |
| 556 |
#define PTP_OPC_LanguageLocale 0xDC4A |
| 557 |
#define PTP_OPC_CopyrightInformation 0xDC4B |
| 558 |
#define PTP_OPC_Source 0xDC4C |
| 559 |
#define PTP_OPC_OriginLocation 0xDC4D |
| 560 |
#define PTP_OPC_DateAdded 0xDC4E |
| 561 |
#define PTP_OPC_NonConsumable 0xDC4F |
| 562 |
#define PTP_OPC_CorruptOrUnplayable 0xDC50 |
| 563 |
#define PTP_OPC_ProducerSerialNumber 0xDC51 |
| 564 |
#define PTP_OPC_RepresentativeSampleFormat 0xDC81 |
| 565 |
#define PTP_OPC_RepresentativeSampleSize 0xDC82 |
| 566 |
#define PTP_OPC_RepresentativeSampleHeight 0xDC83 |
| 567 |
#define PTP_OPC_RepresentativeSampleWidth 0xDC84 |
| 568 |
#define PTP_OPC_RepresentativeSampleDuration 0xDC85 |
| 569 |
#define PTP_OPC_RepresentativeSampleData 0xDC86 |
| 570 |
#define PTP_OPC_Width 0xDC87 |
| 571 |
#define PTP_OPC_Height 0xDC88 |
| 572 |
#define PTP_OPC_Duration 0xDC89 |
| 573 |
#define PTP_OPC_Rating 0xDC8A |
| 574 |
#define PTP_OPC_Track 0xDC8B |
| 575 |
#define PTP_OPC_Genre 0xDC8C |
| 576 |
#define PTP_OPC_Credits 0xDC8D |
| 577 |
#define PTP_OPC_Lyrics 0xDC8E |
| 578 |
#define PTP_OPC_SubscriptionContentID 0xDC8F |
| 579 |
#define PTP_OPC_ProducedBy 0xDC90 |
| 580 |
#define PTP_OPC_UseCount 0xDC91 |
| 581 |
#define PTP_OPC_SkipCount 0xDC92 |
| 582 |
#define PTP_OPC_LastAccessed 0xDC93 |
| 583 |
#define PTP_OPC_ParentalRating 0xDC94 |
| 584 |
#define PTP_OPC_MetaGenre 0xDC95 |
| 585 |
#define PTP_OPC_Composer 0xDC96 |
| 586 |
#define PTP_OPC_EffectiveRating 0xDC97 |
| 587 |
#define PTP_OPC_Subtitle 0xDC98 |
| 588 |
#define PTP_OPC_OriginalReleaseDate 0xDC99 |
| 589 |
#define PTP_OPC_AlbumName 0xDC9A |
| 590 |
#define PTP_OPC_AlbumArtist 0xDC9B |
| 591 |
#define PTP_OPC_Mood 0xDC9C |
| 592 |
#define PTP_OPC_DRMStatus 0xDC9D |
| 593 |
#define PTP_OPC_SubDescription 0xDC9E |
| 594 |
#define PTP_OPC_IsCropped 0xDCD1 |
| 595 |
#define PTP_OPC_IsColorCorrected 0xDCD2 |
| 596 |
#define PTP_OPC_ImageBitDepth 0xDCD3 |
| 597 |
#define PTP_OPC_Fnumber 0xDCD4 |
| 598 |
#define PTP_OPC_ExposureTime 0xDCD5 |
| 599 |
#define PTP_OPC_ExposureIndex 0xDCD6 |
| 600 |
#define PTP_OPC_DisplayName 0xDCE0 |
| 601 |
#define PTP_OPC_BodyText 0xDCE1 |
| 602 |
#define PTP_OPC_Subject 0xDCE2 |
| 603 |
#define PTP_OPC_Priority 0xDCE3 |
| 604 |
#define PTP_OPC_GivenName 0xDD00 |
| 605 |
#define PTP_OPC_MiddleNames 0xDD01 |
| 606 |
#define PTP_OPC_FamilyName 0xDD02 |
| 607 |
#define PTP_OPC_Prefix 0xDD03 |
| 608 |
#define PTP_OPC_Suffix 0xDD04 |
| 609 |
#define PTP_OPC_PhoneticGivenName 0xDD05 |
| 610 |
#define PTP_OPC_PhoneticFamilyName 0xDD06 |
| 611 |
#define PTP_OPC_EmailPrimary 0xDD07 |
| 612 |
#define PTP_OPC_EmailPersonal1 0xDD08 |
| 613 |
#define PTP_OPC_EmailPersonal2 0xDD09 |
| 614 |
#define PTP_OPC_EmailBusiness1 0xDD0A |
| 615 |
#define PTP_OPC_EmailBusiness2 0xDD0B |
| 616 |
#define PTP_OPC_EmailOthers 0xDD0C |
| 617 |
#define PTP_OPC_PhoneNumberPrimary 0xDD0D |
| 618 |
#define PTP_OPC_PhoneNumberPersonal 0xDD0E |
| 619 |
#define PTP_OPC_PhoneNumberPersonal2 0xDD0F |
| 620 |
#define PTP_OPC_PhoneNumberBusiness 0xDD10 |
| 621 |
#define PTP_OPC_PhoneNumberBusiness2 0xDD11 |
| 622 |
#define PTP_OPC_PhoneNumberMobile 0xDD12 |
| 623 |
#define PTP_OPC_PhoneNumberMobile2 0xDD13 |
| 624 |
#define PTP_OPC_FaxNumberPrimary 0xDD14 |
| 625 |
#define PTP_OPC_FaxNumberPersonal 0xDD15 |
| 626 |
#define PTP_OPC_FaxNumberBusiness 0xDD16 |
| 627 |
#define PTP_OPC_PagerNumber 0xDD17 |
| 628 |
#define PTP_OPC_PhoneNumberOthers 0xDD18 |
| 629 |
#define PTP_OPC_PrimaryWebAddress 0xDD19 |
| 630 |
#define PTP_OPC_PersonalWebAddress 0xDD1A |
| 631 |
#define PTP_OPC_BusinessWebAddress 0xDD1B |
| 632 |
#define PTP_OPC_InstantMessengerAddress 0xDD1C |
| 633 |
#define PTP_OPC_InstantMessengerAddress2 0xDD1D |
| 634 |
#define PTP_OPC_InstantMessengerAddress3 0xDD1E |
| 635 |
#define PTP_OPC_PostalAddressPersonalFull 0xDD1F |
| 636 |
#define PTP_OPC_PostalAddressPersonalFullLine1 0xDD20 |
| 637 |
#define PTP_OPC_PostalAddressPersonalFullLine2 0xDD21 |
| 638 |
#define PTP_OPC_PostalAddressPersonalFullCity 0xDD22 |
| 639 |
#define PTP_OPC_PostalAddressPersonalFullRegion 0xDD23 |
| 640 |
#define PTP_OPC_PostalAddressPersonalFullPostalCode 0xDD24 |
| 641 |
#define PTP_OPC_PostalAddressPersonalFullCountry 0xDD25 |
| 642 |
#define PTP_OPC_PostalAddressBusinessFull 0xDD26 |
| 643 |
#define PTP_OPC_PostalAddressBusinessLine1 0xDD27 |
| 644 |
#define PTP_OPC_PostalAddressBusinessLine2 0xDD28 |
| 645 |
#define PTP_OPC_PostalAddressBusinessCity 0xDD29 |
| 646 |
#define PTP_OPC_PostalAddressBusinessRegion 0xDD2A |
| 647 |
#define PTP_OPC_PostalAddressBusinessPostalCode 0xDD2B |
| 648 |
#define PTP_OPC_PostalAddressBusinessCountry 0xDD2C |
| 649 |
#define PTP_OPC_PostalAddressOtherFull 0xDD2D |
| 650 |
#define PTP_OPC_PostalAddressOtherLine1 0xDD2E |
| 651 |
#define PTP_OPC_PostalAddressOtherLine2 0xDD2F |
| 652 |
#define PTP_OPC_PostalAddressOtherCity 0xDD30 |
| 653 |
#define PTP_OPC_PostalAddressOtherRegion 0xDD31 |
| 654 |
#define PTP_OPC_PostalAddressOtherPostalCode 0xDD32 |
| 655 |
#define PTP_OPC_PostalAddressOtherCountry 0xDD33 |
| 656 |
#define PTP_OPC_OrganizationName 0xDD34 |
| 657 |
#define PTP_OPC_PhoneticOrganizationName 0xDD35 |
| 658 |
#define PTP_OPC_Role 0xDD36 |
| 659 |
#define PTP_OPC_Birthdate 0xDD37 |
| 660 |
#define PTP_OPC_MessageTo 0xDD40 |
| 661 |
#define PTP_OPC_MessageCC 0xDD41 |
| 662 |
#define PTP_OPC_MessageBCC 0xDD42 |
| 663 |
#define PTP_OPC_MessageRead 0xDD43 |
| 664 |
#define PTP_OPC_MessageReceivedTime 0xDD44 |
| 665 |
#define PTP_OPC_MessageSender 0xDD45 |
| 666 |
#define PTP_OPC_ActivityBeginTime 0xDD50 |
| 667 |
#define PTP_OPC_ActivityEndTime 0xDD51 |
| 668 |
#define PTP_OPC_ActivityLocation 0xDD52 |
| 669 |
#define PTP_OPC_ActivityRequiredAttendees 0xDD54 |
| 670 |
#define PTP_OPC_ActivityOptionalAttendees 0xDD55 |
| 671 |
#define PTP_OPC_ActivityResources 0xDD56 |
| 672 |
#define PTP_OPC_ActivityAccepted 0xDD57 |
| 673 |
#define PTP_OPC_Owner 0xDD5D |
| 674 |
#define PTP_OPC_Editor 0xDD5E |
| 675 |
#define PTP_OPC_Webmaster 0xDD5F |
| 676 |
#define PTP_OPC_URLSource 0xDD60 |
| 677 |
#define PTP_OPC_URLDestination 0xDD61 |
| 678 |
#define PTP_OPC_TimeBookmark 0xDD62 |
| 679 |
#define PTP_OPC_ObjectBookmark 0xDD63 |
| 680 |
#define PTP_OPC_ByteBookmark 0xDD64 |
| 681 |
#define PTP_OPC_LastBuildDate 0xDD70 |
| 682 |
#define PTP_OPC_TimetoLive 0xDD71 |
| 683 |
#define PTP_OPC_MediaGUID 0xDD72 |
| 684 |
#define PTP_OPC_TotalBitRate 0xDE91 |
| 685 |
#define PTP_OPC_BitRateType 0xDE92 |
| 686 |
#define PTP_OPC_SampleRate 0xDE93 |
| 687 |
#define PTP_OPC_NumberOfChannels 0xDE94 |
| 688 |
#define PTP_OPC_AudioBitDepth 0xDE95 |
| 689 |
#define PTP_OPC_ScanDepth 0xDE97 |
| 690 |
#define PTP_OPC_AudioWAVECodec 0xDE99 |
| 691 |
#define PTP_OPC_AudioBitRate 0xDE9A |
| 692 |
#define PTP_OPC_VideoFourCCCodec 0xDE9B |
| 693 |
#define PTP_OPC_VideoBitRate 0xDE9C |
| 694 |
#define PTP_OPC_FramesPerThousandSeconds 0xDE9D |
| 695 |
#define PTP_OPC_KeyFrameDistance 0xDE9E |
| 696 |
#define PTP_OPC_BufferSize 0xDE9F |
| 697 |
#define PTP_OPC_EncodingQuality 0xDEA0 |
| 698 |
#define PTP_OPC_EncodingProfile 0xDEA1 |
| 699 |
#define PTP_OPC_BuyFlag 0xD901 |
| 700 |
|
| 701 |
/* WiFi Provisioning MTP Extension property codes */ |
| 702 |
#define PTP_OPC_WirelessConfigurationFile 0xB104 |
| 703 |
|
| 704 |
|
| 705 |
/* PTP Association Types */ |
| 706 |
#define PTP_AT_Undefined 0x0000 |
| 707 |
#define PTP_AT_GenericFolder 0x0001 |
| 708 |
#define PTP_AT_Album 0x0002 |
| 709 |
#define PTP_AT_TimeSequence 0x0003 |
| 710 |
#define PTP_AT_HorizontalPanoramic 0x0004 |
| 711 |
#define PTP_AT_VerticalPanoramic 0x0005 |
| 712 |
#define PTP_AT_2DPanoramic 0x0006 |
| 713 |
#define PTP_AT_AncillaryData 0x0007 |
| 714 |
|
| 715 |
#define PTP_MAX_HANDLER_NBR 0x255 |
| 716 |
typedef struct |
| 717 |
{ |
| 718 |
uint32_t n; |
| 719 |
uint32_t Handler[PTP_MAX_HANDLER_NBR]; |
| 720 |
} |
| 721 |
PTP_ObjectHandlesTypedef; |
| 722 |
|
| 723 |
|
| 724 |
#define PTP_oi_StorageID 0 |
| 725 |
#define PTP_oi_ObjectFormat 4 |
| 726 |
#define PTP_oi_ProtectionStatus 6 |
| 727 |
#define PTP_oi_ObjectCompressedSize 8 |
| 728 |
#define PTP_oi_ThumbFormat 12 |
| 729 |
#define PTP_oi_ThumbCompressedSize 14 |
| 730 |
#define PTP_oi_ThumbPixWidth 18 |
| 731 |
#define PTP_oi_ThumbPixHeight 22 |
| 732 |
#define PTP_oi_ImagePixWidth 26 |
| 733 |
#define PTP_oi_ImagePixHeight 30 |
| 734 |
#define PTP_oi_ImageBitDepth 34 |
| 735 |
#define PTP_oi_ParentObject 38 |
| 736 |
#define PTP_oi_AssociationType 42 |
| 737 |
#define PTP_oi_AssociationDesc 44 |
| 738 |
#define PTP_oi_SequenceNumber 48 |
| 739 |
#define PTP_oi_filenamelen 52 |
| 740 |
#define PTP_oi_Filename 53 |
| 741 |
|
| 742 |
typedef struct |
| 743 |
{ |
| 744 |
uint32_t StorageID; |
| 745 |
uint16_t ObjectFormat; |
| 746 |
uint16_t ProtectionStatus; |
| 747 |
/* In the regular objectinfo this is 32bit, but we keep the general object size here |
| 748 |
that also arrives via other methods and so use 64bit */ |
| 749 |
uint64_t ObjectCompressedSize; |
| 750 |
uint16_t ThumbFormat; |
| 751 |
uint32_t ThumbCompressedSize; |
| 752 |
uint32_t ThumbPixWidth; |
| 753 |
uint32_t ThumbPixHeight; |
| 754 |
uint32_t ImagePixWidth; |
| 755 |
uint32_t ImagePixHeight; |
| 756 |
uint32_t ImageBitDepth; |
| 757 |
uint32_t ParentObject; |
| 758 |
uint16_t AssociationType; |
| 759 |
uint32_t AssociationDesc; |
| 760 |
uint32_t SequenceNumber; |
| 761 |
uint8_t Filename[PTP_MAX_STR_SIZE]; |
| 762 |
uint32_t CaptureDate; |
| 763 |
uint32_t ModificationDate; |
| 764 |
uint8_t Keywords[PTP_MAX_STR_SIZE]; |
| 765 |
} |
| 766 |
PTP_ObjectInfoTypedef; |
| 767 |
|
| 768 |
/* Object Property Describing Dataset (DevicePropDesc) */ |
| 769 |
|
| 770 |
typedef union _PTP_PropertyValueTypedef |
| 771 |
{ |
| 772 |
char str[PTP_MAX_STR_SIZE]; |
| 773 |
uint8_t u8; |
| 774 |
int8_t i8; |
| 775 |
uint16_t u16; |
| 776 |
int16_t i16; |
| 777 |
uint32_t u32; |
| 778 |
int32_t i32; |
| 779 |
uint64_t u64; |
| 780 |
int64_t i64; |
| 781 |
|
| 782 |
struct array { |
| 783 |
uint32_t count; |
| 784 |
union _PTP_PropertyValueTypedef *v; |
| 785 |
} a; |
| 786 |
}PTP_PropertyValueTypedef; |
| 787 |
|
| 788 |
typedef struct |
| 789 |
{ |
| 790 |
PTP_PropertyValueTypedef MinimumValue; |
| 791 |
PTP_PropertyValueTypedef MaximumValue; |
| 792 |
PTP_PropertyValueTypedef StepSize; |
| 793 |
} |
| 794 |
PTP_PropDescRangeFormTypedef; |
| 795 |
|
| 796 |
/* Property Describing Dataset, Enum Form */ |
| 797 |
|
| 798 |
typedef struct |
| 799 |
{ |
| 800 |
uint16_t NumberOfValues; |
| 801 |
PTP_PropertyValueTypedef SupportedValue[PTP_SUPPORTED_PROPRIETIES_NBR]; |
| 802 |
} |
| 803 |
PTP_PropDescEnumFormTypedef; |
| 804 |
|
| 805 |
/* (MTP) Object Property pack/unpack */ |
| 806 |
#define PTP_opd_ObjectPropertyCode 0 |
| 807 |
#define PTP_opd_DataType 2 |
| 808 |
#define PTP_opd_GetSet 4 |
| 809 |
#define PTP_opd_FactoryDefaultValue 5 |
| 810 |
|
| 811 |
typedef struct |
| 812 |
{ |
| 813 |
uint16_t ObjectPropertyCode; |
| 814 |
uint16_t DataType; |
| 815 |
uint8_t GetSet; |
| 816 |
PTP_PropertyValueTypedef FactoryDefaultValue; |
| 817 |
uint32_t GroupCode; |
| 818 |
uint8_t FormFlag; |
| 819 |
union { |
| 820 |
PTP_PropDescEnumFormTypedef Enum; |
| 821 |
PTP_PropDescRangeFormTypedef Range; |
| 822 |
} FORM; |
| 823 |
} |
| 824 |
PTP_ObjectPropDescTypeDef; |
| 825 |
|
| 826 |
/* Metadata lists for MTP operations */ |
| 827 |
typedef struct |
| 828 |
{ |
| 829 |
uint16_t property; |
| 830 |
uint16_t datatype; |
| 831 |
uint32_t ObjectHandle; |
| 832 |
PTP_PropertyValueTypedef propval; |
| 833 |
} |
| 834 |
MTP_PropertiesTypedef; |
| 835 |
|
| 836 |
|
| 837 |
/* Device Property Form Flag */ |
| 838 |
|
| 839 |
#define PTP_DPFF_None 0x00 |
| 840 |
#define PTP_DPFF_Range 0x01 |
| 841 |
#define PTP_DPFF_Enumeration 0x02 |
| 842 |
|
| 843 |
/* Object Property Codes used by MTP (first 3 are same as DPFF codes) */ |
| 844 |
#define PTP_OPFF_None 0x00 |
| 845 |
#define PTP_OPFF_Range 0x01 |
| 846 |
#define PTP_OPFF_Enumeration 0x02 |
| 847 |
#define PTP_OPFF_DateTime 0x03 |
| 848 |
#define PTP_OPFF_FixedLengthArray 0x04 |
| 849 |
#define PTP_OPFF_RegularExpression 0x05 |
| 850 |
#define PTP_OPFF_ByteArray 0x06 |
| 851 |
#define PTP_OPFF_LongString 0xFF |
| 852 |
|
| 853 |
/* Device Property pack/unpack */ |
| 854 |
|
| 855 |
#define PTP_dpd_DevicePropertyCode 0 |
| 856 |
#define PTP_dpd_DataType 2 |
| 857 |
#define PTP_dpd_GetSet 4 |
| 858 |
#define PTP_dpd_FactoryDefaultValue 5 |
| 859 |
|
| 860 |
/* Device Property Describing Dataset (DevicePropDesc) */ |
| 861 |
|
| 862 |
typedef struct |
| 863 |
{ |
| 864 |
uint16_t DevicePropertyCode; |
| 865 |
uint16_t DataType; |
| 866 |
uint8_t GetSet; |
| 867 |
PTP_PropertyValueTypedef FactoryDefaultValue; |
| 868 |
PTP_PropertyValueTypedef CurrentValue; |
| 869 |
uint8_t FormFlag; |
| 870 |
union { |
| 871 |
PTP_PropDescEnumFormTypedef Enum; |
| 872 |
PTP_PropDescRangeFormTypedef Range; |
| 873 |
} FORM; |
| 874 |
} |
| 875 |
PTP_DevicePropDescTypdef; |
| 876 |
|
| 877 |
/* DataType Codes */ |
| 878 |
|
| 879 |
#define PTP_DTC_UNDEF 0x0000 |
| 880 |
#define PTP_DTC_INT8 0x0001 |
| 881 |
#define PTP_DTC_UINT8 0x0002 |
| 882 |
#define PTP_DTC_INT16 0x0003 |
| 883 |
#define PTP_DTC_UINT16 0x0004 |
| 884 |
#define PTP_DTC_INT32 0x0005 |
| 885 |
#define PTP_DTC_UINT32 0x0006 |
| 886 |
#define PTP_DTC_INT64 0x0007 |
| 887 |
#define PTP_DTC_UINT64 0x0008 |
| 888 |
#define PTP_DTC_INT128 0x0009 |
| 889 |
#define PTP_DTC_UINT128 0x000A |
| 890 |
|
| 891 |
#define PTP_DTC_ARRAY_MASK 0x4000 |
| 892 |
|
| 893 |
#define PTP_DTC_AINT8 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT8) |
| 894 |
#define PTP_DTC_AUINT8 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT8) |
| 895 |
#define PTP_DTC_AINT16 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT16) |
| 896 |
#define PTP_DTC_AUINT16 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT16) |
| 897 |
#define PTP_DTC_AINT32 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT32) |
| 898 |
#define PTP_DTC_AUINT32 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT32) |
| 899 |
#define PTP_DTC_AINT64 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT64) |
| 900 |
#define PTP_DTC_AUINT64 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT64) |
| 901 |
#define PTP_DTC_AINT128 (PTP_DTC_ARRAY_MASK | PTP_DTC_INT128) |
| 902 |
#define PTP_DTC_AUINT128 (PTP_DTC_ARRAY_MASK | PTP_DTC_UINT128) |
| 903 |
|
| 904 |
#define PTP_DTC_STR 0xFFFF |
| 905 |
|
| 906 |
/* PTP Event Codes */ |
| 907 |
|
| 908 |
#define PTP_EC_Undefined 0x4000 |
| 909 |
#define PTP_EC_CancelTransaction 0x4001 |
| 910 |
#define PTP_EC_ObjectAdded 0x4002 |
| 911 |
#define PTP_EC_ObjectRemoved 0x4003 |
| 912 |
#define PTP_EC_StoreAdded 0x4004 |
| 913 |
#define PTP_EC_StoreRemoved 0x4005 |
| 914 |
#define PTP_EC_DevicePropChanged 0x4006 |
| 915 |
#define PTP_EC_ObjectInfoChanged 0x4007 |
| 916 |
#define PTP_EC_DeviceInfoChanged 0x4008 |
| 917 |
#define PTP_EC_RequestObjectTransfer 0x4009 |
| 918 |
#define PTP_EC_StoreFull 0x400A |
| 919 |
#define PTP_EC_DeviceReset 0x400B |
| 920 |
#define PTP_EC_StorageInfoChanged 0x400C |
| 921 |
#define PTP_EC_CaptureComplete 0x400D |
| 922 |
#define PTP_EC_UnreportedStatus 0x400E |
| 923 |
|
| 924 |
|
| 925 |
/** |
| 926 |
* @} |
| 927 |
*/ |
| 928 |
|
| 929 |
/** @defgroup USBH_MTP_PTP_Exported_Macros |
| 930 |
* @{ |
| 931 |
*/ |
| 932 |
/** |
| 933 |
* @} |
| 934 |
*/ |
| 935 |
|
| 936 |
/** @defgroup USBH_MTP_PTP_Exported_Variables |
| 937 |
* @{ |
| 938 |
*/ |
| 939 |
|
| 940 |
/** |
| 941 |
* @} |
| 942 |
*/ |
| 943 |
|
| 944 |
/** @defgroup USBH_MTP_PTP_Exported_FunctionsPrototype |
| 945 |
* @{ |
| 946 |
*/ |
| 947 |
USBH_StatusTypeDef USBH_PTP_Init(USBH_HandleTypeDef *phost); |
| 948 |
USBH_StatusTypeDef USBH_PTP_Process (USBH_HandleTypeDef *phost); |
| 949 |
|
| 950 |
USBH_StatusTypeDef USBH_PTP_SendRequest (USBH_HandleTypeDef *phost, PTP_ContainerTypedef *req); |
| 951 |
USBH_StatusTypeDef USBH_PTP_GetResponse (USBH_HandleTypeDef *phost, PTP_ContainerTypedef *req); |
| 952 |
|
| 953 |
USBH_StatusTypeDef USBH_PTP_OpenSession (USBH_HandleTypeDef *phost, uint32_t session); |
| 954 |
USBH_StatusTypeDef USBH_PTP_GetDeviceInfo (USBH_HandleTypeDef *phost, PTP_DeviceInfoTypedef *dev_info); |
| 955 |
USBH_StatusTypeDef USBH_PTP_GetStorageIds (USBH_HandleTypeDef *phost, PTP_StorageIDsTypedef *storage_ids); |
| 956 |
|
| 957 |
USBH_StatusTypeDef USBH_PTP_GetStorageInfo (USBH_HandleTypeDef *phost, |
| 958 |
uint32_t storage_id, |
| 959 |
PTP_StorageInfoTypedef *storage_info); |
| 960 |
|
| 961 |
USBH_StatusTypeDef USBH_PTP_GetNumObjects (USBH_HandleTypeDef *phost, |
| 962 |
uint32_t storage_id, |
| 963 |
uint32_t objectformatcode, |
| 964 |
uint32_t associationOH, |
| 965 |
uint32_t* numobs); |
| 966 |
|
| 967 |
USBH_StatusTypeDef USBH_PTP_GetObjectHandles (USBH_HandleTypeDef *phost, |
| 968 |
uint32_t storage_id, |
| 969 |
uint32_t objectformatcode, |
| 970 |
uint32_t associationOH, |
| 971 |
PTP_ObjectHandlesTypedef* objecthandles); |
| 972 |
|
| 973 |
USBH_StatusTypeDef USBH_PTP_GetObjectInfo (USBH_HandleTypeDef *phost, |
| 974 |
uint32_t handle, |
| 975 |
PTP_ObjectInfoTypedef* objectinfo); |
| 976 |
|
| 977 |
USBH_StatusTypeDef USBH_PTP_DeleteObject (USBH_HandleTypeDef *phost, |
| 978 |
uint32_t handle, |
| 979 |
uint32_t objectformatcode); |
| 980 |
|
| 981 |
USBH_StatusTypeDef USBH_PTP_GetObject (USBH_HandleTypeDef *phost, |
| 982 |
uint32_t handle, |
| 983 |
uint8_t *object); |
| 984 |
|
| 985 |
USBH_StatusTypeDef USBH_PTP_GetPartialObject(USBH_HandleTypeDef *phost, |
| 986 |
uint32_t handle, |
| 987 |
uint32_t offset, |
| 988 |
uint32_t maxbytes, uint8_t *object, |
| 989 |
uint32_t *len); |
| 990 |
|
| 991 |
USBH_StatusTypeDef USBH_PTP_GetObjectPropsSupported (USBH_HandleTypeDef *phost, |
| 992 |
uint16_t ofc, |
| 993 |
uint32_t *propnum, |
| 994 |
uint16_t *props); |
| 995 |
|
| 996 |
USBH_StatusTypeDef USBH_PTP_GetObjectPropDesc (USBH_HandleTypeDef *phost, |
| 997 |
uint16_t opc, |
| 998 |
uint16_t ofc, |
| 999 |
PTP_ObjectPropDescTypeDef *opd); |
| 1000 |
|
| 1001 |
USBH_StatusTypeDef USBH_PTP_GetObjectPropList (USBH_HandleTypeDef *phost, |
| 1002 |
uint32_t handle, |
| 1003 |
MTP_PropertiesTypedef *pprops, |
| 1004 |
uint32_t *nrofprops); |
| 1005 |
|
| 1006 |
USBH_StatusTypeDef USBH_PTP_SendObject (USBH_HandleTypeDef *phost, |
| 1007 |
uint32_t handle, |
| 1008 |
uint8_t *object, |
| 1009 |
uint32_t size); |
| 1010 |
|
| 1011 |
USBH_StatusTypeDef USBH_PTP_GetDevicePropDesc (USBH_HandleTypeDef *phost, |
| 1012 |
uint16_t propcode, |
| 1013 |
PTP_DevicePropDescTypdef* devicepropertydesc); |
| 1014 |
|
| 1015 |
/** |
| 1016 |
* @} |
| 1017 |
*/ |
| 1018 |
|
| 1019 |
#endif //__USBH_MTP_PTP_H__ |
| 1020 |
|
| 1021 |
|
| 1022 |
/** |
| 1023 |
* @} |
| 1024 |
*/ |
| 1025 |
|
| 1026 |
/** |
| 1027 |
* @} |
| 1028 |
*/ |
| 1029 |
|
| 1030 |
/** |
| 1031 |
* @} |
| 1032 |
*/ |
| 1033 |
|
| 1034 |
/** |
| 1035 |
* @} |
| 1036 |
*/ |
| 1037 |
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
| 1038 |
|