1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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.
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
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
20 #ifndef __USB_OPS_LINUX_H__
21 #define __USB_OPS_LINUX_H__
23 #define VENDOR_CMD_MAX_DATA_LEN 254
25 #define RTW_USB_CONTROL_MSG_TIMEOUT_TEST 10/* ms */
26 #define RTW_USB_CONTROL_MSG_TIMEOUT 500/* ms */
28 #define MAX_USBCTRL_VENDORREQ_TIMES 10
30 #define RTW_USB_BULKOUT_TIME 5000/* ms */
32 #define REALTEK_USB_VENQT_READ 0xC0
33 #define REALTEK_USB_VENQT_WRITE 0x40
35 #define ALIGNMENT_UNIT 16
36 #define MAX_VENDOR_REQ_CMD_SIZE 254 /* 8188cu SIE Support */
37 #define MAX_USB_IO_CTL_SIZE (MAX_VENDOR_REQ_CMD_SIZE + ALIGNMENT_UNIT)
39 #define USB_HIGH_SPEED_BULK_SIZE 512
40 #define USB_FULL_SPEED_BULK_SIZE 64
42 #define _usbctrl_vendorreq_async_callback(urb, regs) \
43 _usbctrl_vendorreq_async_callback(urb)
44 #define usb_bulkout_zero_complete(purb, regs) \
45 usb_bulkout_zero_complete(purb)
46 #define usb_write_mem_complete(purb, regs) \
47 usb_write_mem_complete(purb)
48 #define usb_write_port_complete(purb, regs) \
49 usb_write_port_complete(purb)
50 #define usb_read_port_complete(purb, regs) \
51 usb_read_port_complete(purb)
52 #define usb_read_interrupt_complete(purb, regs) \
53 usb_read_interrupt_complete(purb)
55 static inline u8 rtw_usb_bulk_size_boundary(struct adapter *padapter,
59 struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter);
61 if (pdvobjpriv->ishighspeed)
62 rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE) ?
65 rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE) ?
70 unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr);
72 u8 usb_read8(struct adapter *adapter, u32 addr);
73 u16 usb_read16(struct adapter *adapter, u32 addr);
74 u32 usb_read32(struct adapter *adapter, u32 addr);
76 u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
77 void usb_read_port_cancel(struct adapter *adapter);
79 int usb_write8(struct adapter *adapter, u32 addr, u8 val);
80 int usb_write16(struct adapter *adapter, u32 addr, u16 val);
81 int usb_write32(struct adapter *adapter, u32 addr, u32 val);
83 u32 usb_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
84 void usb_write_port_cancel(struct adapter *adapter);