~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to ubuntu/ndiswrapper/ndiswrapper.h

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-04kado7d1u2er2rl
Tags: 3.2.0-16.25
Add new lowlatency kernel flavour

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 */
 
15
 
 
16
#ifndef _NDISWRAPPER_H_
 
17
#define _NDISWRAPPER_H_
 
18
 
 
19
#define DRIVER_VERSION "1.56"
 
20
#define UTILS_VERSION "1.9"
 
21
 
 
22
#define DRIVER_NAME "ndiswrapper"
 
23
#define DRIVER_CONFIG_DIR "/etc/ndiswrapper"
 
24
 
 
25
#define SSID_MAX_WPA_IE_LEN 40
 
26
#define NDIS_ESSID_MAX_SIZE 32
 
27
#define NDIS_ENCODING_TOKEN_MAX 32
 
28
#define MAX_ENCR_KEYS 4
 
29
#define TX_RING_SIZE 16
 
30
#define NDIS_MAX_RATES 8
 
31
#define NDIS_MAX_RATES_EX 16
 
32
#define WLAN_EID_GENERIC 221
 
33
#define MAX_WPA_IE_LEN 64
 
34
#define MAX_STR_LEN 512
 
35
 
 
36
#define WRAP_PCI_BUS 5
 
37
#define WRAP_PCMCIA_BUS 8
 
38
/* some USB devices, e.g., DWL-G120 have BusType as 0 */
 
39
#define WRAP_INTERNAL_BUS 0
 
40
/* documentation at msdn says 15 is PNP bus, but inf files from all
 
41
 * vendors say 15 is USB; which is correct? */
 
42
#define WRAP_USB_BUS 15
 
43
 
 
44
/* NDIS device must be 0, for compatability with old versions of
 
45
 * ndiswrapper where device type for NDIS drivers is 0 */
 
46
#define WRAP_NDIS_DEVICE 0
 
47
#define WRAP_USB_DEVICE 1
 
48
#define WRAP_BLUETOOTH_DEVICE1 2
 
49
#define WRAP_BLUETOOTH_DEVICE2 3
 
50
 
 
51
#define WRAP_DEVICE_BUS(dev, bus) ((dev) << 8 | (bus))
 
52
#define WRAP_BUS(dev_bus) ((dev_bus) & 0x000FF)
 
53
#define WRAP_DEVICE(dev_bus) ((dev_bus) >> 8)
 
54
 
 
55
#define MAX_DRIVER_NAME_LEN 32
 
56
#define MAX_VERSION_STRING_LEN 64
 
57
#define MAX_SETTING_NAME_LEN 128
 
58
#define MAX_SETTING_VALUE_LEN 256
 
59
 
 
60
#define MAX_DRIVER_PE_IMAGES 4
 
61
#define MAX_DRIVER_BIN_FILES 5
 
62
#define MAX_DEVICE_SETTINGS 512
 
63
 
 
64
#define MAX_ALLOCATED_URBS 15
 
65
 
 
66
#define DEV_ANY_ID -1
 
67
 
 
68
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
 
69
#define MACSTRSEP "%02x:%02x:%02x:%02x:%02x:%02x"
 
70
#define MACSTR "%02x%02x%02x%02x%02x%02x"
 
71
#define MACINTADR(a) (int*)&((a)[0]), (int*)&((a)[1]), (int*)&((a)[2]), \
 
72
                (int*)&((a)[3]), (int*)&((a)[4]), (int*)&((a)[5])
 
73
 
 
74
#ifdef __KERNEL__
 
75
/* DEBUG macros */
 
76
 
 
77
#define MSG(level, fmt, ...)                            \
 
78
        printk(level "ndiswrapper (%s:%d): " fmt "\n",  \
 
79
               __func__, __LINE__ , ## __VA_ARGS__)
 
80
 
 
81
#define WARNING(fmt, ...) MSG(KERN_WARNING, fmt, ## __VA_ARGS__)
 
82
#define ERROR(fmt, ...) MSG(KERN_ERR, fmt , ## __VA_ARGS__)
 
83
#define INFO(fmt, ...) MSG(KERN_INFO, fmt , ## __VA_ARGS__)
 
84
#define TODO() WARNING("not fully implemented (yet)")
 
85
 
 
86
#define TRACE(fmt, ...) do { } while (0)
 
87
#define TRACE1(fmt, ...) do { } while (0)
 
88
#define TRACE2(fmt, ...) do { } while (0)
 
89
#define TRACE3(fmt, ...) do { }  while (0)
 
90
#define TRACE4(fmt, ...) do { } while (0)
 
91
#define TRACE5(fmt, ...) do { } while (0)
 
92
#define TRACE6(fmt, ...) do { } while (0)
 
93
 
 
94
/* for a block of code */
 
95
#define DBG_BLOCK(level) while (0)
 
96
 
 
97
extern int debug;
 
98
 
 
99
#if defined DEBUG
 
100
#undef TRACE
 
101
#define TRACE(level, fmt, ...)                                 \
 
102
do {                                                                   \
 
103
        if (debug >= level)                                            \
 
104
                printk(KERN_INFO "%s (%s:%d): " fmt "\n", DRIVER_NAME, \
 
105
                       __func__, __LINE__ , ## __VA_ARGS__);       \
 
106
} while (0)
 
107
#undef DBG_BLOCK
 
108
#define DBG_BLOCK(level) if (debug >= level)
 
109
#endif
 
110
 
 
111
#if defined(DEBUG) && DEBUG >= 1
 
112
#undef TRACE1
 
113
#define TRACE1(fmt, ...) TRACE(1, fmt , ## __VA_ARGS__)
 
114
#endif
 
115
 
 
116
#if defined(DEBUG) && DEBUG >= 2
 
117
#undef TRACE2
 
118
#define TRACE2(fmt, ...) TRACE(2, fmt , ## __VA_ARGS__)
 
119
#endif
 
120
 
 
121
#if defined(DEBUG) && DEBUG >= 3
 
122
#undef TRACE3
 
123
#define TRACE3(fmt, ...) TRACE(3, fmt , ## __VA_ARGS__)
 
124
#endif
 
125
 
 
126
#if defined(DEBUG) && DEBUG >= 4
 
127
#undef TRACE4
 
128
#define TRACE4(fmt, ...) TRACE(4, fmt , ## __VA_ARGS__)
 
129
#endif
 
130
 
 
131
#if defined(DEBUG) && DEBUG >= 5
 
132
#undef TRACE5
 
133
#define TRACE5(fmt, ...) TRACE(5, fmt , ## __VA_ARGS__)
 
134
#endif
 
135
 
 
136
#if defined(DEBUG) && DEBUG >= 6
 
137
#undef TRACE6
 
138
#define TRACE6(fmt, ...) TRACE(6, fmt , ## __VA_ARGS__)
 
139
#endif
 
140
 
 
141
#define ENTER1(fmt, ...) TRACE1("Enter " fmt , ## __VA_ARGS__)
 
142
#define ENTER2(fmt, ...) TRACE2("Enter " fmt , ## __VA_ARGS__)
 
143
#define ENTER3(fmt, ...) TRACE3("Enter " fmt , ## __VA_ARGS__)
 
144
#define ENTER4(fmt, ...) TRACE4("Enter " fmt , ## __VA_ARGS__)
 
145
#define ENTER5(fmt, ...) TRACE5("Enter " fmt , ## __VA_ARGS__)
 
146
#define ENTER6(fmt, ...) TRACE6("Enter " fmt , ## __VA_ARGS__)
 
147
 
 
148
#define EXIT1(stmt) do { TRACE1("Exit"); stmt; } while(0)
 
149
#define EXIT2(stmt) do { TRACE2("Exit"); stmt; } while(0)
 
150
#define EXIT3(stmt) do { TRACE3("Exit"); stmt; } while(0)
 
151
#define EXIT4(stmt) do { TRACE4("Exit"); stmt; } while(0)
 
152
#define EXIT5(stmt) do { TRACE5("Exit"); stmt; } while(0)
 
153
#define EXIT6(stmt) do { TRACE6("Exit"); stmt; } while(0)
 
154
 
 
155
#if defined(USB_DEBUG)
 
156
#define USBTRACE TRACE1
 
157
#define USBENTER ENTER1
 
158
#define USBEXIT EXIT1
 
159
#else
 
160
#define USBTRACE(fmt, ...)
 
161
#define USBENTER(fmt, ...)
 
162
#define USBEXIT(stmt) stmt
 
163
#endif
 
164
 
 
165
#if defined(EVENT_DEBUG)
 
166
#define EVENTTRACE TRACE1
 
167
#define EVENTENTER ENTER1
 
168
#define EVENTEXIT EXIT1
 
169
#else
 
170
#define EVENTTRACE(fmt, ...)
 
171
#define EVENTENTER(fmt, ...)
 
172
#define EVENTEXIT(stmt) stmt
 
173
#endif
 
174
 
 
175
#if defined(TIMER_DEBUG)
 
176
#define TIMERTRACE TRACE1
 
177
#define TIMERENTER ENTER1
 
178
#define TIMEREXIT EXIT1
 
179
#else
 
180
#define TIMERTRACE(fmt, ...)
 
181
#define TIMERENTER(fmt, ...)
 
182
#define TIMEREXIT(stmt) stmt
 
183
#endif
 
184
 
 
185
#if defined(IO_DEBUG)
 
186
#define IOTRACE TRACE1
 
187
#define IOENTER ENTER1
 
188
#define IOEXIT EXIT1
 
189
#else
 
190
#define IOTRACE(fmt, ...)
 
191
#define IOENTER(fmt, ...)
 
192
#define IOEXIT(stmt) stmt
 
193
#endif
 
194
 
 
195
#if defined(WORK_DEBUG)
 
196
#define WORKTRACE TRACE1
 
197
#define WORKENTER ENTER1
 
198
#define WORKEXIT EXIT1
 
199
#else
 
200
#define WORKTRACE(fmt, ...)
 
201
#define WORKENTER(fmt, ...)
 
202
#define WORKEXIT(stmt) stmt
 
203
#endif
 
204
 
 
205
#ifdef DEBUG
 
206
#define assert(expr)                                                    \
 
207
do {                                                                    \
 
208
        if (!(expr)) {                                                  \
 
209
                ERROR("assertion '%s' failed", #expr);                  \
 
210
                dump_stack();                                           \
 
211
        }                                                               \
 
212
} while (0)
 
213
#else
 
214
#define assert(expr) do { } while (0)
 
215
#endif
 
216
 
 
217
#endif // __KERNEL__
 
218
 
 
219
#endif // NDISWRAPPER_H