xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8822bs/include/osdep_intf.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2017 Realtek Corporation.
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 
16 #ifndef __OSDEP_INTF_H_
17 #define __OSDEP_INTF_H_
18 
19 
20 struct intf_priv {
21 
22 	u8 *intf_dev;
23 	u32	max_iosz;	/* USB2.0: 128, USB1.1: 64, SDIO:64 */
24 	u32	max_xmitsz; /* USB2.0: unlimited, SDIO:512 */
25 	u32	max_recvsz; /* USB2.0: unlimited, SDIO:512 */
26 
27 	volatile u8 *io_rwmem;
28 	volatile u8 *allocated_io_rwmem;
29 	u32	io_wsz; /* unit: 4bytes */
30 	u32	io_rsz;/* unit: 4bytes */
31 	u8 intf_status;
32 
33 	void (*_bus_io)(u8 *priv);
34 
35 	/*
36 	Under Sync. IRP (SDIO/USB)
37 	A protection mechanism is necessary for the io_rwmem(read/write protocol)
38 
39 	Under Async. IRP (SDIO/USB)
40 	The protection mechanism is through the pending queue.
41 	*/
42 
43 	_mutex ioctl_mutex;
44 
45 
46 #ifdef PLATFORM_LINUX
47 #ifdef CONFIG_USB_HCI
48 	/* when in USB, IO is through interrupt in/out endpoints */
49 	struct usb_device	*udev;
50 	PURB	piorw_urb;
51 	u8 io_irp_cnt;
52 	u8 bio_irp_pending;
53 	_sema io_retevt;
54 	_timer	io_timer;
55 	u8 bio_irp_timeout;
56 	u8 bio_timer_cancel;
57 #endif
58 #endif
59 
60 };
61 
62 struct dvobj_priv *devobj_init(void);
63 void devobj_deinit(struct dvobj_priv *pdvobj);
64 
65 u8 rtw_init_drv_sw(_adapter *padapter);
66 u8 rtw_free_drv_sw(_adapter *padapter);
67 u8 rtw_reset_drv_sw(_adapter *padapter);
68 void rtw_dev_unload(PADAPTER padapter);
69 
70 u32 rtw_start_drv_threads(_adapter *padapter);
71 void rtw_stop_drv_threads(_adapter *padapter);
72 #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN)
73 void rtw_cancel_dynamic_chk_timer(_adapter *padapter);
74 #endif
75 void rtw_cancel_all_timer(_adapter *padapter);
76 
77 uint loadparam(_adapter *adapter);
78 
79 #ifdef PLATFORM_LINUX
80 int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
81 
82 int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname);
83 struct net_device *rtw_init_netdev(_adapter *padapter);
84 
85 void rtw_os_ndev_free(_adapter *adapter);
86 int rtw_os_ndev_init(_adapter *adapter, const char *name);
87 void rtw_os_ndev_deinit(_adapter *adapter);
88 void rtw_os_ndev_unregister(_adapter *adapter);
89 void rtw_os_ndevs_unregister(struct dvobj_priv *dvobj);
90 int rtw_os_ndevs_init(struct dvobj_priv *dvobj);
91 void rtw_os_ndevs_deinit(struct dvobj_priv *dvobj);
92 
93 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))
94 u16 rtw_recv_select_queue(struct sk_buff *skb);
95 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) */
96 
97 int rtw_ndev_notifier_register(void);
98 void rtw_ndev_notifier_unregister(void);
99 void rtw_inetaddr_notifier_register(void);
100 void rtw_inetaddr_notifier_unregister(void);
101 
102 #include "../os_dep/linux/rtw_proc.h"
103 
104 #ifdef CONFIG_IOCTL_CFG80211
105 	#include "../os_dep/linux/ioctl_cfg80211.h"
106 #endif /* CONFIG_IOCTL_CFG80211 */
107 
108 u8 rtw_rtnl_lock_needed(struct dvobj_priv *dvobj);
109 void rtw_set_rtnl_lock_holder(struct dvobj_priv *dvobj, _thread_hdl_ thd_hdl);
110 
111 #endif /* PLATFORM_LINUX */
112 
113 
114 #ifdef PLATFORM_FREEBSD
115 extern int rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
116 #endif
117 
118 void rtw_ips_dev_unload(_adapter *padapter);
119 
120 #ifdef CONFIG_IPS
121 int rtw_ips_pwr_up(_adapter *padapter);
122 void rtw_ips_pwr_down(_adapter *padapter);
123 #endif
124 
125 #ifdef CONFIG_CONCURRENT_MODE
126 struct _io_ops;
127 struct dvobj_priv;
128 _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, void (*set_intf_ops)(_adapter *primary_padapter, struct _io_ops *pops));
129 void rtw_drv_stop_vir_ifaces(struct dvobj_priv *dvobj);
130 void rtw_drv_free_vir_ifaces(struct dvobj_priv *dvobj);
131 #endif
132 
133 void rtw_ndev_destructor(_nic_hdl ndev);
134 #ifdef CONFIG_ARP_KEEP_ALIVE
135 int rtw_gw_addr_query(_adapter *padapter);
136 #endif
137 
138 int rtw_suspend_common(_adapter *padapter);
139 int rtw_resume_common(_adapter *padapter);
140 
141 #endif /* _OSDEP_INTF_H_ */
142