Linux-libre 4.9.135-gnu
[librecmc/linux-libre.git] / drivers / staging / rtl8188eu / include / usb_ops_linux.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  ******************************************************************************/
15 #ifndef __USB_OPS_LINUX_H__
16 #define __USB_OPS_LINUX_H__
17
18 #define VENDOR_CMD_MAX_DATA_LEN 254
19
20 #define RTW_USB_CONTROL_MSG_TIMEOUT_TEST        10/* ms */
21 #define RTW_USB_CONTROL_MSG_TIMEOUT     500/* ms */
22
23 #define MAX_USBCTRL_VENDORREQ_TIMES     10
24
25 #define RTW_USB_BULKOUT_TIME    5000/* ms */
26
27 #define REALTEK_USB_VENQT_READ          0xC0
28 #define REALTEK_USB_VENQT_WRITE         0x40
29
30 #define ALIGNMENT_UNIT                  16
31 #define MAX_VENDOR_REQ_CMD_SIZE 254     /* 8188cu SIE Support */
32 #define MAX_USB_IO_CTL_SIZE     (MAX_VENDOR_REQ_CMD_SIZE + ALIGNMENT_UNIT)
33
34 #define USB_HIGH_SPEED_BULK_SIZE        512
35 #define USB_FULL_SPEED_BULK_SIZE        64
36
37 #define _usbctrl_vendorreq_async_callback(urb, regs)    \
38         _usbctrl_vendorreq_async_callback(urb)
39 #define usb_bulkout_zero_complete(purb, regs)           \
40         usb_bulkout_zero_complete(purb)
41 #define usb_write_mem_complete(purb, regs)              \
42         usb_write_mem_complete(purb)
43 #define usb_write_port_complete(purb, regs)             \
44         usb_write_port_complete(purb)
45 #define usb_read_port_complete(purb, regs)              \
46         usb_read_port_complete(purb)
47 #define usb_read_interrupt_complete(purb, regs)         \
48         usb_read_interrupt_complete(purb)
49
50 unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr);
51
52 u8 usb_read8(struct adapter *adapter, u32 addr);
53 u16 usb_read16(struct adapter *adapter, u32 addr);
54 u32 usb_read32(struct adapter *adapter, u32 addr);
55
56 u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
57 void usb_read_port_cancel(struct adapter *adapter);
58
59 int usb_write8(struct adapter *adapter, u32 addr, u8 val);
60 int usb_write16(struct adapter *adapter, u32 addr, u16 val);
61 int usb_write32(struct adapter *adapter, u32 addr, u32 val);
62
63 u32 usb_write_port(struct adapter *adapter, u32 addr, u32 cnt, struct xmit_buf *pmem);
64 void usb_write_port_cancel(struct adapter *adapter);
65
66 #endif