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 ******************************************************************************/
24 #define REALTEK_USB_VENQT_READ 0xC0
25 #define REALTEK_USB_VENQT_WRITE 0x40
26 #define REALTEK_USB_VENQT_CMD_REQ 0x05
27 #define REALTEK_USB_VENQT_CMD_IDX 0x00
33 #define ALIGNMENT_UNIT 16
34 #define MAX_VENDOR_REQ_CMD_SIZE 254 //8188cu SIE Support
35 #define MAX_USB_IO_CTL_SIZE (MAX_VENDOR_REQ_CMD_SIZE +ALIGNMENT_UNIT)
38 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
39 #define rtw_usb_control_msg(dev, pipe, request, requesttype, value, index, data, size, timeout_ms) \
40 usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), (data), (size), (timeout_ms))
41 #define rtw_usb_bulk_msg(usb_dev, pipe, data, len, actual_length, timeout_ms) \
42 usb_bulk_msg((usb_dev), (pipe), (data), (len), (actual_length), (timeout_ms))
44 #define rtw_usb_control_msg(dev, pipe, request, requesttype, value, index, data, size,timeout_ms) \
45 usb_control_msg((dev), (pipe), (request), (requesttype), (value), (index), (data), (size), \
46 ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1)
47 #define rtw_usb_bulk_msg(usb_dev, pipe, data, len, actual_length, timeout_ms) \
48 usb_bulk_msg((usb_dev), (pipe), (data), (len), (actual_length), \
49 ((timeout_ms) == 0) ||((timeout_ms)*HZ/1000>0)?((timeout_ms)*HZ/1000):1)
51 #include <usb_ops_linux.h>
52 #endif //PLATFORM_LINUX
54 #ifdef CONFIG_RTL8192C
55 void rtl8192cu_set_hw_type(_adapter *padapter);
56 void rtl8192cu_set_intf_ops(struct _io_ops *pops);
57 void rtl8192cu_recv_tasklet(void *priv);
58 void rtl8192cu_xmit_tasklet(void *priv);
61 #ifdef CONFIG_RTL8723A
62 void rtl8723au_set_hw_type(_adapter *padapter);
63 void rtl8723au_set_intf_ops(struct _io_ops *pops);
64 void rtl8192cu_recv_tasklet(void *priv);
65 void rtl8192cu_xmit_tasklet(void *priv);
68 #ifdef CONFIG_RTL8192D
69 void rtl8192du_set_hw_type(_adapter *padapter);
70 void rtl8192du_set_intf_ops(struct _io_ops *pops);
71 #ifndef PLATFORM_FREEBSD
72 void rtl8192du_recv_tasklet(void *priv);
73 #else // PLATFORM_FREEBSD
74 void rtl8192du_recv_tasklet(void *priv, int npending);
75 #ifdef CONFIG_RX_INDICATE_QUEUE
76 void rtw_rx_indicate_tasklet(void *priv, int npending);
77 #endif // CONFIG_RX_INDICATE_QUEUE
78 #endif // PLATFORM_FREEBSD
80 void rtl8192du_xmit_tasklet(void *priv);
83 #ifdef CONFIG_RTL8188E
84 void rtl8188eu_set_hw_type(_adapter *padapter);
85 void rtl8188eu_set_intf_ops(struct _io_ops *pops);
88 #if defined(CONFIG_RTL8812A) || defined(CONFIG_RTL8821A)
89 void rtl8812au_set_hw_type(_adapter *padapter);
90 void rtl8812au_set_intf_ops(struct _io_ops *pops);
93 #ifdef CONFIG_RTL8192E
94 void rtl8192eu_set_hw_type(_adapter *padapter);
95 void rtl8192eu_set_intf_ops(struct _io_ops *pops);
98 #ifdef CONFIG_RTL8723B
99 void rtl8723bu_set_hw_type(_adapter *padapter);
100 void rtl8723bu_set_intf_ops(struct _io_ops *pops);
101 void rtl8723bu_recv_tasklet(void *priv);
102 void rtl8723bu_xmit_tasklet(void *priv);
107 RTW_USB_SPEED_UNKNOWN = 0,
108 RTW_USB_SPEED_1_1 = 1,
113 #define IS_FULL_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_1_1)
114 #define IS_HIGH_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_2)
115 #define IS_SUPER_SPEED_USB(Adapter) (adapter_to_dvobj(Adapter)->usb_speed == RTW_USB_SPEED_3)
117 #define USB_SUPER_SPEED_BULK_SIZE 1024 // usb 3.0
118 #define USB_HIGH_SPEED_BULK_SIZE 512 // usb 2.0
119 #define USB_FULL_SPEED_BULK_SIZE 64 // usb 1.1
121 static inline u8 rtw_usb_bulk_size_boundary(_adapter * padapter,int buf_len)
125 if (IS_SUPER_SPEED_USB(padapter))
126 rst = (0 == (buf_len) % USB_SUPER_SPEED_BULK_SIZE)?_TRUE:_FALSE;
127 if (IS_HIGH_SPEED_USB(padapter))
128 rst = (0 == (buf_len) % USB_HIGH_SPEED_BULK_SIZE)?_TRUE:_FALSE;
130 rst = (0 == (buf_len) % USB_FULL_SPEED_BULK_SIZE)?_TRUE:_FALSE;
135 #endif //__USB_OPS_H_