1 /* 2 * WlanDrvIf.h 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 35 /* 36 * src/WlanDrvIf.h 37 * 38 */ 39 40 #ifndef WLAN_DRV_IF_H 41 #define WLAN_DRV_IF_H 42 43 #include <linux/version.h> 44 #include <linux/completion.h> 45 #include <linux/netdevice.h> 46 #include <linux/workqueue.h> 47 #include <mach/gpio.h> 48 #ifdef CONFIG_HAS_WAKELOCK 49 #include <linux/wakelock.h> 50 #endif 51 52 #include "tidef.h" 53 #include "WlanDrvCommon.h" 54 #include "paramOut.h" 55 #include "DrvMain.h" 56 #include "windows_types.h" 57 58 #define TIWLAN_DRV_NAME "tiwlan" 59 #define DRIVERWQ_NAME "tiwlan_wq" 60 #define TIWLAN_DRV_IF_NAME TIWLAN_DRV_NAME"%d" 61 62 #ifdef TI_DBG 63 #define ti_dprintf(log, fmt, args...) do { \ 64 if (log != TIWLAN_LOG_OTHER) { \ 65 printk(KERN_INFO fmt, ## args); \ 66 } \ 67 } while (0) 68 #else 69 #define ti_dprintf(log, fmt, args...) 70 #endif 71 72 73 #define ti_nodprintf(log, fmt, args...) 74 75 76 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) 77 #define NETDEV_SET_PRIVATE(dev, drv) dev->priv = drv 78 #define NETDEV_GET_PRIVATE(dev) dev->priv 79 #else 80 #define NETDEV_SET_PRIVATE(dev, drv) dev->ml_priv = drv 81 #define NETDEV_GET_PRIVATE(dev) dev->ml_priv 82 #endif 83 84 85 typedef enum 86 { 87 TIWLAN_LOG_ERROR, 88 TIWLAN_LOG_INFO, 89 TIWLAN_LOG_OTHER, 90 TIWLAN_LOG_DUMMY 91 } EWlanDrvIfLog; 92 93 /* 94 * TCmdRespUnion is defined for each OS: 95 * For Linx and WM that defined is empty. 96 * For OSE the new typedef includes all "Done" typedefs in union from EMP code (H files). 97 */ 98 typedef struct 99 { 100 } TCmdRespUnion; 101 102 103 /* Driver object */ 104 typedef struct 105 { 106 TWlanDrvIfCommon tCommon; /* The driver object common part */ 107 108 int irq; /* The OS IRQ handle */ 109 unsigned long irq_flags; /* The IRQ flags */ 110 struct workqueue_struct *tiwlan_wq; /* Work Queue */ 111 struct work_struct tWork; /* The OS work handle. */ 112 spinlock_t lock; /* The OS spinlock handle. */ 113 unsigned long flags; /* For saving the cpu flags during spinlock */ 114 TI_HANDLE hPollTimer;/* Polling timer for working without interrupts (debug) */ 115 struct net_device_stats stats; /* The driver's statistics for OS reports. */ 116 struct sock *wl_sock; /* The OS socket used for sending it the driver events */ 117 struct net_device *netdev; /* The OS handle for the driver interface. */ 118 int wl_packet; /* Remember to stay awake */ 119 int wl_count; /* Wifi wakelock counter */ 120 #ifdef CONFIG_HAS_WAKELOCK 121 struct wake_lock wl_wifi; /* Wifi wakelock */ 122 struct wake_lock wl_rxwake; /* Wifi rx wakelock */ 123 #endif 124 NDIS_HANDLE ConfigHandle;/* Temp - For Windows compatibility */ 125 126 } TWlanDrvIfObj, *TWlanDrvIfObjPtr; 127 128 129 #define NETDEV(drv) (((TWlanDrvIfObj*)(drv))->netdev) 130 131 #endif /* WLAN_DRV_IF_H*/ 132