Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / staging / rtl8723au / include / usb_ops.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_H_
16 #define __USB_OPS_H_
17
18 #include <osdep_service.h>
19 #include <drv_types.h>
20 #include <osdep_intf.h>
21 #include <usb_ops_linux.h>
22
23 #define REALTEK_USB_VENQT_READ          0xC0
24 #define REALTEK_USB_VENQT_WRITE         0x40
25 #define REALTEK_USB_VENQT_CMD_REQ       0x05
26 #define REALTEK_USB_VENQT_CMD_IDX       0x00
27
28 enum {
29         VENDOR_WRITE = 0x00,
30         VENDOR_READ = 0x01,
31 };
32
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)
36
37 void rtl8723au_set_hw_type(struct rtw_adapter *padapter);
38
39 void rtl8723au_recv_tasklet(void *priv);
40
41 void rtl8723au_xmit_tasklet(void *priv);
42
43 /* Increase and check if the continual_urb_error of this @param dvobjprive is
44  * larger than MAX_CONTINUAL_URB_ERR. Return result
45  */
46 static inline int rtw_inc_and_chk_continual_urb_error(struct dvobj_priv *dvobj)
47 {
48         int ret = false;
49         int value;
50
51         value = atomic_inc_return(&dvobj->continual_urb_error);
52         if (value > MAX_CONTINUAL_URB_ERR) {
53                 DBG_8723A("[dvobj:%p][ERROR] continual_urb_error:%d > %d\n",
54                           dvobj, value, MAX_CONTINUAL_URB_ERR);
55                 ret = true;
56         }
57         return ret;
58 }
59
60 /* Set the continual_urb_error of this @param dvobjprive to 0 */
61 static inline void rtw_reset_continual_urb_error(struct dvobj_priv *dvobj)
62 {
63         atomic_set(&dvobj->continual_urb_error, 0);
64 }
65
66 bool rtl8723au_chip_configure(struct rtw_adapter *padapter);
67
68 #endif /* __USB_OPS_H_ */