wifi: renew patch drivers/net/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtl8723au / include / osdep_intf.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  * 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
17  *
18  *
19  ******************************************************************************/
20
21 #ifndef __OSDEP_INTF_H_
22 #define __OSDEP_INTF_H_
23
24 #include <drv_conf.h>
25 #include <osdep_service.h>
26 #include <drv_types.h>
27
28 struct intf_priv {
29         
30         u8 *intf_dev;
31         u32     max_iosz;       //USB2.0: 128, USB1.1: 64, SDIO:64
32         u32     max_xmitsz; //USB2.0: unlimited, SDIO:512
33         u32     max_recvsz; //USB2.0: unlimited, SDIO:512
34
35         volatile u8 *io_rwmem;
36         volatile u8 *allocated_io_rwmem;
37         u32     io_wsz; //unit: 4bytes
38         u32     io_rsz;//unit: 4bytes
39         u8 intf_status; 
40         
41         void (*_bus_io)(u8 *priv);      
42
43 /*
44 Under Sync. IRP (SDIO/USB)
45 A protection mechanism is necessary for the io_rwmem(read/write protocol)
46
47 Under Async. IRP (SDIO/USB)
48 The protection mechanism is through the pending queue.
49 */
50
51         _mutex ioctl_mutex;
52
53         
54 #ifdef PLATFORM_LINUX   
55         #ifdef CONFIG_USB_HCI   
56         // when in USB, IO is through interrupt in/out endpoints
57         struct usb_device       *udev;
58         PURB    piorw_urb;
59         u8 io_irp_cnt;
60         u8 bio_irp_pending;
61         _sema io_retevt;
62         _timer  io_timer;
63         u8 bio_irp_timeout;
64         u8 bio_timer_cancel;
65         #endif
66 #endif
67
68 #ifdef PLATFORM_OS_XP
69         #ifdef CONFIG_SDIO_HCI
70                 // below is for io_rwmem...     
71                 PMDL pmdl;
72                 PSDBUS_REQUEST_PACKET  sdrp;
73                 PSDBUS_REQUEST_PACKET  recv_sdrp;
74                 PSDBUS_REQUEST_PACKET  xmit_sdrp;
75
76                         PIRP            piorw_irp;
77
78         #endif
79         #ifdef CONFIG_USB_HCI
80                 PURB    piorw_urb;
81                 PIRP            piorw_irp;
82                 u8 io_irp_cnt;
83                 u8 bio_irp_pending;
84                 _sema io_retevt;        
85         #endif  
86 #endif
87
88 };      
89
90
91 #ifdef CONFIG_R871X_TEST
92 int rtw_start_pseudo_adhoc(_adapter *padapter);
93 int rtw_stop_pseudo_adhoc(_adapter *padapter);
94 #endif
95
96 u8 rtw_init_drv_sw(_adapter *padapter);
97 u8 rtw_free_drv_sw(_adapter *padapter);
98 u8 rtw_reset_drv_sw(_adapter *padapter);
99
100 u32 rtw_start_drv_threads(_adapter *padapter);
101 void rtw_stop_drv_threads (_adapter *padapter);
102 #ifdef CONFIG_WOWLAN
103 void rtw_cancel_dynamic_chk_timer(_adapter *padapter);
104 #endif
105 void rtw_cancel_all_timer(_adapter *padapter);
106
107 #ifdef PLATFORM_LINUX
108 int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
109
110 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname);
111 struct net_device *rtw_init_netdev(_adapter *padapter);
112
113 #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
114 u16 rtw_recv_select_queue(struct sk_buff *skb);
115 #endif //LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)
116
117 #ifdef CONFIG_PROC_DEBUG
118 void rtw_proc_init_one(struct net_device *dev);
119 void rtw_proc_remove_one(struct net_device *dev);
120 #else //!CONFIG_PROC_DEBUG
121 static void rtw_proc_init_one(struct net_device *dev){}
122 static void rtw_proc_remove_one(struct net_device *dev){}
123 #endif //!CONFIG_PROC_DEBUG
124 #endif //PLATFORM_LINUX
125
126
127 #ifdef PLATFORM_FREEBSD
128 extern int rtw_ioctl(struct ifnet * ifp, u_long cmd, caddr_t data);
129 #endif
130
131 void rtw_ips_dev_unload(_adapter *padapter);
132
133 #ifdef CONFIG_RF_GAIN_OFFSET
134 void rtw_bb_rf_gain_offset(_adapter *padapter);
135 #endif //CONFIG_RF_GAIN_OFFSET
136
137 #ifdef CONFIG_IPS
138 int rtw_ips_pwr_up(_adapter *padapter);
139 void rtw_ips_pwr_down(_adapter *padapter);
140 #endif
141
142 #ifdef CONFIG_CONCURRENT_MODE
143 struct _io_ops;
144 _adapter *rtw_drv_if2_init(_adapter *primary_padapter, void (*set_intf_ops)(struct _io_ops *pops));
145 void rtw_drv_if2_free(_adapter *if2);
146 void rtw_drv_if2_stop(_adapter *if2);
147 #endif
148
149 int rtw_drv_register_netdev(_adapter *padapter);
150 void rtw_ndev_destructor(_nic_hdl ndev);
151
152 int rtw_suspend_common(_adapter *padapter);
153 int rtw_resume_common(_adapter *padapter);
154
155 #ifdef CONFIG_ARP_KEEP_ALIVE
156 int     rtw_gw_addr_query(_adapter *padapter);
157 #endif
158
159 #endif  //_OSDEP_INTF_H_
160