ptp_host.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 167 行

H
167
字号
/*******************************************************************
 * 
 *  Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: 
 *
 *  Author: Amlogic Software
 *  Created: Fri Nov 11 00:09:54 2005
 *
 *******************************************************************/
#ifndef  __PTP_HOST_H_
#define __PTP_HOST_H_

#include "ptp.h"
/* 
 * PTP device IO command
 */
#define PTP_IO_GET_DEV_INFO     _IO('P', 1)
#define PTP_IO_OPEN_SESSION     _IO('P', 2)
#define PTP_IO_CLOSE_SESSION     _IO('P', 3)
#define PTP_IO_GET_STORAGE_IDS    _IO('P', 4)
#define PTP_IO_GET_STORAGE_INFO      _IO('P', 5)
#define PTP_IO_GET_NUM_OBJECTS     _IO('P', 6)
#define PTP_IO_GET_OBJECTHANDLES      _IO('P', 7)
#define PTP_IO_GET_OBJECT_INFO      _IO('P', 8)
#define PTP_IO_GET_OBJECT_CMD    _IO('P', 9)
#define PTP_IO_GET_OBJECT_DATA      _IO('P', 10)
#define PTP_IO_GET_OBJECT_RES      _IO('P', 11)
#define PTP_IO_CANCEL_CMD      _IO('P', 12)
#define PTP_IO_DEV_RESET      _IO('P', 13)
#define PTP_IO_DEV_STSTUS      _IO('P', 14)
#define PTP_IO_GET_THUMB      _IO('P', 15)
#define PTP_IO_FREE_OBJECTHANDLES 	_IO('P', 16)
#define PTP_IO_GET_PARTIAL_OBJECT       _IO('P', 17)

#define PTP_IO_KODAK_GET_LCB_INFO       _IO('P', 18)

/*
*	USB Still Image Class 
*/
#define PTP_CANCEL_REQ_CODE 	0x4001
#define PTP_CANCEL_REQUEST 	0x64
#define PTP_REQUEST_TYPE 	0x21
#define PTP_RESET_REQUEST 		0x66
#define PTP_GET_DEVICE_STATUS	0x67

/* USB interface class */
#ifndef USB_CLASS_PTP
#define USB_CLASS_PTP		6
#endif

/* USB control message data phase direction */
#ifndef USB_DP_HTD
#define USB_DP_HTD		(0x00 << 7)	// host to device
#endif
#ifndef USB_DP_DTH
#define USB_DP_DTH		(0x01 << 7)	// device to host
#endif

/* PTP class specific requests */
#ifndef USB_REQ_DEVICE_RESET
#define USB_REQ_DEVICE_RESET		0x66
#endif
#ifndef USB_REQ_GET_DEVICE_STATUS
#define USB_REQ_GET_DEVICE_STATUS	0x67
#endif

/* USB Feature selector HALT */
#ifndef USB_FEATURE_HALT
#define USB_FEATURE_HALT	0x00
#endif

typedef struct dev_status_data_s{
			uint16_t length;
			uint16_t code;
			uint32_t Parameter1;
			uint32_t Parameter2;
}dev_status_data_t;

typedef dev_status_data_t DeviceStatusData_t;

#pragma Pack(1)
typedef struct cancel_req_data_s{
	uint16_t Cancellation_Code;
	uint32_t TransactionID;
} cancel_req_data_t;
#pragma Pack()	 


typedef struct ptp_get_numobjects_req_s {
 	uint32_t storage;
	uint32_t objectformatcode;
	uint32_t associationOH;
	uint32_t* numobjects;
} ptp_get_numobjects_req_t;

typedef struct ptp_get_handles_req_s {
 	uint32_t storage;
	uint32_t objectformatcode;
	uint32_t associationOH;
	PTPObjectHandles* objecthandles;
} ptp_get_handles_req_t;

typedef struct ptp_free_handles_req_s {
	PTPObjectHandles* objecthandles;
} ptp_free_handles_req_t;

typedef struct ptp_get_object_info_req_s {
 	uint32_t handle;
	PTPObjectInfo* objectinfo;
} ptp_get_object_info_req_t;

typedef struct ptp_get_storage_info_req_s {
 	uint32_t 	storageid;
	PTPStorageInfo* storageinfo;
} ptp_get_storage_info_req_t;


typedef struct ptp_get_object_cmd_req_s {
 	uint32_t handle;
} ptp_get_object_cmd_req_t;

typedef struct ptp_get_object_data_req_s {
 	uint32_t handle;
	void *data;
	unsigned offset;
	unsigned len;
	unsigned act_len;
} ptp_get_object_data_req_t;

typedef struct ptp_get_object_res_req_s {
 	uint32_t handle;
} ptp_get_object_res_req_t;

typedef struct ptp_get_dev_status_req_s {
 	dev_status_data_t *dev_status;
} ptp_get_dev_status_req_t;

typedef struct ptp_get_thumb_req_s {
 	uint32_t handle;
	void *data;
	unsigned* len;
} ptp_get_thumb_req_t;

avfs_device_driver usb_ptp_initialize( avfs_device_major_number major, avfs_device_minor_number minor,void * arg);
avfs_device_driver usb_ptp_open( avfs_device_major_number major, avfs_device_minor_number minor,void * arg);
avfs_device_driver usb_ptp_read( avfs_device_major_number major, avfs_device_minor_number minor,void * arg);
avfs_device_driver usb_ptp_write( avfs_device_major_number major, avfs_device_minor_number minor,void * arg);
avfs_device_driver usb_ptp_ioctl( avfs_device_major_number major, avfs_device_minor_number minor,void * arg);
avfs_device_driver usb_ptp_close( avfs_device_major_number major, avfs_device_minor_number minor,void * arg);

#define USB_PTP_DRIVER_TABLE \
    { \
        usb_ptp_initialize, \
        usb_ptp_open, \
        usb_ptp_close, \
        usb_ptp_read, \
        usb_ptp_write, \
        usb_ptp_ioctl, \
    }

//int usb_ptp_host_init(void);
void usb_ptp_host_exit(void);


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?