xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8189es/include/osdep_intf.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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 
25 struct intf_priv {
26 
27 	u8 *intf_dev;
28 	u32	max_iosz; 	//USB2.0: 128, USB1.1: 64, SDIO:64
29 	u32	max_xmitsz; //USB2.0: unlimited, SDIO:512
30 	u32	max_recvsz; //USB2.0: unlimited, SDIO:512
31 
32 	volatile u8 *io_rwmem;
33 	volatile u8 *allocated_io_rwmem;
34 	u32	io_wsz; //unit: 4bytes
35 	u32	io_rsz;//unit: 4bytes
36 	u8 intf_status;
37 
38 	void (*_bus_io)(u8 *priv);
39 
40 /*
41 Under Sync. IRP (SDIO/USB)
42 A protection mechanism is necessary for the io_rwmem(read/write protocol)
43 
44 Under Async. IRP (SDIO/USB)
45 The protection mechanism is through the pending queue.
46 */
47 
48 	_mutex ioctl_mutex;
49 
50 
51 #ifdef PLATFORM_LINUX
52 	#ifdef CONFIG_USB_HCI
53 	// when in USB, IO is through interrupt in/out endpoints
54 	struct usb_device 	*udev;
55 	PURB	piorw_urb;
56 	u8 io_irp_cnt;
57 	u8 bio_irp_pending;
58 	_sema io_retevt;
59 	_timer	io_timer;
60 	u8 bio_irp_timeout;
61 	u8 bio_timer_cancel;
62 	#endif
63 #endif
64 
65 #ifdef PLATFORM_OS_XP
66 	#ifdef CONFIG_SDIO_HCI
67 		// below is for io_rwmem...
68 		PMDL pmdl;
69 		PSDBUS_REQUEST_PACKET  sdrp;
70 		PSDBUS_REQUEST_PACKET  recv_sdrp;
71 		PSDBUS_REQUEST_PACKET  xmit_sdrp;
72 
73 			PIRP		piorw_irp;
74 
75 	#endif
76 	#ifdef CONFIG_USB_HCI
77 		PURB	piorw_urb;
78 		PIRP		piorw_irp;
79 		u8 io_irp_cnt;
80 		u8 bio_irp_pending;
81 		_sema io_retevt;
82 	#endif
83 #endif
84 
85 };
86 
87 
88 #ifdef CONFIG_R871X_TEST
89 int rtw_start_pseudo_adhoc(_adapter *padapter);
90 int rtw_stop_pseudo_adhoc(_adapter *padapter);
91 #endif
92 
93 struct dvobj_priv *devobj_init(void);
94 void devobj_deinit(struct dvobj_priv *pdvobj);
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 void rtw_dev_unload(PADAPTER padapter);
100 
101 u32 rtw_start_drv_threads(_adapter *padapter);
102 void rtw_stop_drv_threads (_adapter *padapter);
103 #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN)
104 void rtw_cancel_dynamic_chk_timer(_adapter *padapter);
105 #endif
106 void rtw_cancel_all_timer(_adapter *padapter);
107 
108 uint loadparam(_adapter *adapter);
109 
110 #ifdef PLATFORM_LINUX
111 int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
112 
113 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname);
114 struct net_device *rtw_init_netdev(_adapter *padapter);
115 
116 void rtw_os_ndev_free(_adapter *adapter);
117 int rtw_os_ndev_init(_adapter *adapter, char *name);
118 void rtw_os_ndev_deinit(_adapter *adapter);
119 void rtw_os_ndevs_unregister(struct dvobj_priv *dvobj);
120 int rtw_os_ndevs_init(struct dvobj_priv *dvobj);
121 void rtw_os_ndevs_deinit(struct dvobj_priv *dvobj);
122 
123 #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35))
124 u16 rtw_recv_select_queue(struct sk_buff *skb);
125 #endif //LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)
126 
127 int rtw_ndev_notifier_register(void);
128 void rtw_ndev_notifier_unregister(void);
129 
130 #include "../os_dep/linux/rtw_proc.h"
131 
132 #ifdef CONFIG_IOCTL_CFG80211
133 #include "../os_dep/linux/ioctl_cfg80211.h"
134 #endif //CONFIG_IOCTL_CFG80211
135 
136 #endif //PLATFORM_LINUX
137 
138 
139 #ifdef PLATFORM_FREEBSD
140 extern int rtw_ioctl(struct ifnet * ifp, u_long cmd, caddr_t data);
141 #endif
142 
143 void rtw_ips_dev_unload(_adapter *padapter);
144 
145 #ifdef CONFIG_IPS
146 int rtw_ips_pwr_up(_adapter *padapter);
147 void rtw_ips_pwr_down(_adapter *padapter);
148 #endif
149 
150 #ifdef CONFIG_CONCURRENT_MODE
151 struct _io_ops;
152 _adapter *rtw_drv_if2_init(_adapter *primary_padapter, void (*set_intf_ops)(_adapter *primary_padapter,struct _io_ops *pops));
153 void rtw_drv_if2_free(_adapter *if2);
154 void rtw_drv_if2_stop(_adapter *if2);
155 #ifdef CONFIG_MULTI_VIR_IFACES
156 struct dvobj_priv;
157 _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, void (*set_intf_ops)(_adapter *primary_padapter,struct _io_ops *pops));
158 void rtw_drv_stop_vir_ifaces(struct dvobj_priv *dvobj);
159 void rtw_drv_free_vir_ifaces(struct dvobj_priv *dvobj);
160 #endif //CONFIG_MULTI_VIR_IFACES
161 #endif
162 
163 void rtw_ndev_destructor(_nic_hdl ndev);
164 
165 #ifdef CONFIG_ARP_KEEP_ALIVE
166 int	rtw_gw_addr_query(_adapter *padapter);
167 #endif
168 
169 int rtw_suspend_common(_adapter *padapter);
170 int rtw_resume_common(_adapter *padapter);
171 
172 #endif	//_OSDEP_INTF_H_
173 
174