zynq_7010/camtp.h

80 lines
2.0 KiB
C
Executable File

/*
* CAMTP Responder
* Copyright (c) 2020 Holdtecs Technologies
*
* CAMTP Responder is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* CAMTP Responder is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 3 for more details.
*
* You should have received a copy of the GNU General Public License
* along with CAMTP Responder; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file camtp.h
* @brief Main CAMMTP protocol functions.
* @author Barry Ruan <cubex@foxmail.com>
*/
#ifndef _INC_CAMTP_H_
#define _INC_CAMTP_H_
#define MAX_STORAGE_NB 16
#define MAX_CFG_STRING_SIZE 512
#pragma pack()
typedef struct mtp_usb_cfg_
{
uint16_t usb_vendor_id;
uint16_t usb_product_id;
uint8_t usb_class;
uint8_t usb_subclass;
uint8_t usb_protocol;
uint16_t usb_dev_version;
uint16_t usb_max_packet_size;
uint8_t usb_functionfs_mode;
char usb_device_path[MAX_CFG_STRING_SIZE + 1];
char usb_endpoint_in[MAX_CFG_STRING_SIZE + 1];
char usb_endpoint_out[MAX_CFG_STRING_SIZE + 1];
char usb_endpoint_intin[MAX_CFG_STRING_SIZE + 1];
char usb_string_manufacturer[MAX_CFG_STRING_SIZE + 1];
char usb_string_product[MAX_CFG_STRING_SIZE + 1];
char usb_string_serial[MAX_CFG_STRING_SIZE + 1];
char usb_string_version[MAX_CFG_STRING_SIZE + 1];
char usb_string_interface[MAX_CFG_STRING_SIZE + 1];
int wait_connection;
int loop_on_disconnect;
int show_hidden_files;
int val_umask;
}camtp_usb_cfg;
typedef struct camtp_ctx_
{
uint32_t session_id;
camtp_usb_cfg usb_cfg;
void * usb_ctx;
volatile int cancel_req;
}camtp_ctx;
int camtp_load_config_file(camtp_ctx * context, const char * conffile);
#endif