• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
74 #define NETDEV_SET_PRIVATE(dev, drv)    dev->priv = drv
75 #define NETDEV_GET_PRIVATE(dev)         dev->priv
76 #else
77 #define NETDEV_SET_PRIVATE(dev, drv)    dev->ml_priv = drv
78 #define NETDEV_GET_PRIVATE(dev)         dev->ml_priv
79 #endif
80 
81 #define ti_nodprintf(log, fmt, args...)
82 
83 typedef enum
84 {
85    TIWLAN_LOG_ERROR,
86    TIWLAN_LOG_INFO,
87    TIWLAN_LOG_OTHER,
88    TIWLAN_LOG_DUMMY
89 } EWlanDrvIfLog;
90 
91 /*
92  * TCmdRespUnion is defined for each OS:
93  * For Linx and WM that defined is empty.
94  * For OSE the new typedef includes all "Done" typedefs in union from EMP code (H files).
95  */
96 typedef struct
97 {
98 } TCmdRespUnion;
99 
100 
101 /* Driver object */
102 typedef struct
103 {
104     TWlanDrvIfCommon         tCommon;   /* The driver object common part */
105 
106     int                      irq;       /* The OS IRQ handle */
107     unsigned long            irq_flags; /* The IRQ flags */
108     struct workqueue_struct *tiwlan_wq; /* Work Queue */
109     struct work_struct       tWork;     /* The OS work handle. */
110     spinlock_t               lock;      /* The OS spinlock handle. */
111     unsigned long            flags;     /* For saving the cpu flags during spinlock */
112     TI_HANDLE                hPollTimer;/* Polling timer for working without interrupts (debug) */
113     struct net_device_stats  stats;     /* The driver's statistics for OS reports. */
114     struct sock             *wl_sock;   /* The OS socket used for sending it the driver events */
115     struct net_device       *netdev;    /* The OS handle for the driver interface. */
116     int                      wl_packet; /* Remember to stay awake */
117     int                      wl_count;  /* Wifi wakelock counter */
118 #ifdef CONFIG_HAS_WAKELOCK
119     struct wake_lock         wl_wifi;   /* Wifi wakelock */
120     struct wake_lock         wl_rxwake; /* Wifi rx wakelock */
121 #endif
122     NDIS_HANDLE              ConfigHandle;/* Temp - For Windows compatibility */
123 
124 } TWlanDrvIfObj, *TWlanDrvIfObjPtr;
125 
126 
127 #define NETDEV(drv) (((TWlanDrvIfObj*)(drv))->netdev)
128 
129 #endif /* WLAN_DRV_IF_H*/
130