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 u16 rtw_os_recv_select_queue(u8 *msdu, enum rtw_rx_llc_hdl llc_hdl); 94 95 int rtw_ndev_notifier_register(void); 96 void rtw_ndev_notifier_unregister(void); 97 void rtw_inetaddr_notifier_register(void); 98 void rtw_inetaddr_notifier_unregister(void); 99 struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev); 100 101 #include "../os_dep/linux/rtw_proc.h" 102 #include "../os_dep/linux/nlrtw.h" 103 #ifdef CONFIG_PLATFORM_CMAP_INTFS 104 #include "../os_dep/linux/custom_multiap_intfs/custom_multiap_intfs.h" 105 #endif 106 107 #ifdef CONFIG_IOCTL_CFG80211 108 #include "../os_dep/linux/ioctl_cfg80211.h" 109 #endif /* CONFIG_IOCTL_CFG80211 */ 110 111 u8 rtw_rtnl_lock_needed(struct dvobj_priv *dvobj); 112 void rtw_set_rtnl_lock_holder(struct dvobj_priv *dvobj, _thread_hdl_ thd_hdl); 113 114 #endif /* PLATFORM_LINUX */ 115 116 117 #ifdef PLATFORM_FREEBSD 118 extern int rtw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); 119 #endif 120 121 void rtw_ips_dev_unload(_adapter *padapter); 122 123 #ifdef CONFIG_IPS 124 int rtw_ips_pwr_up(_adapter *padapter); 125 void rtw_ips_pwr_down(_adapter *padapter); 126 #endif 127 128 #ifdef CONFIG_CONCURRENT_MODE 129 struct _io_ops; 130 struct dvobj_priv; 131 _adapter *rtw_drv_add_vir_if(_adapter *primary_padapter, void (*set_intf_ops)(_adapter *primary_padapter, struct _io_ops *pops)); 132 void rtw_drv_stop_vir_ifaces(struct dvobj_priv *dvobj); 133 void rtw_drv_free_vir_ifaces(struct dvobj_priv *dvobj); 134 #endif 135 136 void rtw_ndev_destructor(_nic_hdl ndev); 137 #ifdef CONFIG_ARP_KEEP_ALIVE 138 int rtw_gw_addr_query(_adapter *padapter); 139 #endif 140 141 int rtw_suspend_common(_adapter *padapter); 142 int rtw_resume_common(_adapter *padapter); 143 144 #endif /* _OSDEP_INTF_H_ */ 145