Code Sync up from tizen_2.4
[platform/core/connectivity/mtp-responder.git] / include / transport / mtp_usb_driver.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _MTP_USB_DRIVER_H_
18 #define _MTP_USB_DRIVER_H_
19
20 #include "mtp_datatype.h"
21 #include "mtp_msgq.h"
22
23 /* Start of driver related defines */
24 #define MTP_DRIVER_PATH                 "/dev/usb_mtp_gadget"
25
26 /* These values come from f_mtp_slp.h of kernel source */
27 #define MTP_IOCTL_LETTER                'Z'
28 #define MTP_GET_HIGH_FULL_SPEED         _IOR(MTP_IOCTL_LETTER, 1, int)
29 #define MTP_DISABLE                     _IO(MTP_IOCTL_LETTER, 2)
30 #define MTP_CLEAR_HALT                  _IO(MTP_IOCTL_LETTER, 3)
31 #define MTP_WRITE_INT_DATA              _IOW(MTP_IOCTL_LETTER, 4, char *)
32 #define MTP_SET_USER_PID                _IOW(MTP_IOCTL_LETTER, 5, int)
33 #define MTP_GET_SETUP_DATA              _IOR(MTP_IOCTL_LETTER, 6, char *)
34 #define MTP_SET_SETUP_DATA              _IOW(MTP_IOCTL_LETTER, 7, char *)
35 #define MTP_SEND_RESET_ACK              _IO(MTP_IOCTL_LETTER, 8)
36 #define MTP_SET_ZLP_DATA                _IO(MTP_IOCTL_LETTER, 9)
37 #define MTP_GET_MAX_PKT_SIZE            _IOR(MTP_IOCTL_LETTER, 22, void *)
38
39 #define SIG_SETUP                       44
40 /* End of driver related defines */
41
42 typedef struct mtp_max_pkt_size {
43         mtp_uint32 tx;
44         mtp_uint32 rx;
45 } mtp_max_pkt_size_t;
46
47 /* Maximum repeat count for USB error recovery */
48 #define MTP_USB_ERROR_MAX_RETRY         5
49
50 mtp_bool _transport_init_usb_device(void);
51 void _transport_deinit_usb_device(void);
52 void *_transport_thread_usb_write(void *arg);
53 void *_transport_thread_usb_read(void *arg);
54 mtp_int32 _transport_mq_init(msgq_id_t *rx_mqid, msgq_id_t *tx_mqid);
55 mtp_bool _transport_mq_deinit(msgq_id_t *rx_mqid, msgq_id_t *tx_mqid);
56 mtp_uint32 _transport_get_usb_packet_len(void);
57 mtp_uint32 _get_tx_pkt_size(void);
58 mtp_uint32 _get_rx_pkt_size(void);
59
60 #endif /* _MTP_USB_DRIVER_H_ */