23#include <sys/sockio.h>
24#include <sys/sysctl.h>
28#include <sys/kernel.h>
29#include <sys/socket.h>
31#include <sys/malloc.h>
32#include <sys/module.h>
34#include <sys/endian.h>
38#include <net/if_var.h>
39#include <net/if_arp.h>
40#include <net/ethernet.h>
42#include <net/if_media.h>
43#include <net/if_types.h>
46#include <netinet/in.h>
47#include <netinet/in_systm.h>
48#include <netinet/in_var.h>
49#include <netinet/if_ether.h>
50#include <netinet/ip.h>
53#include <net80211/ieee80211_var.h>
54#include <net80211/ieee80211_regdomain.h>
55#include <net80211/ieee80211_radiotap.h>
65#define URTW_RIDX_CCK5 2
66#define URTW_RIDX_CCK11 3
67#define URTW_RIDX_OFDM6 4
68#define URTW_RIDX_OFDM24 8
70static SYSCTL_NODE(_hw_usb, OID_AUTO, urtw, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
75 "control debugging printfs");
77 URTW_DEBUG_XMIT = 0x00000001,
78 URTW_DEBUG_RECV = 0x00000002,
79 URTW_DEBUG_RESET = 0x00000004,
80 URTW_DEBUG_TX_PROC = 0x00000008,
81 URTW_DEBUG_RX_PROC = 0x00000010,
82 URTW_DEBUG_STATE = 0x00000020,
83 URTW_DEBUG_STAT = 0x00000040,
84 URTW_DEBUG_INIT = 0x00000080,
85 URTW_DEBUG_TXSTATUS = 0x00000100,
86 URTW_DEBUG_ANY = 0xffffffff
88#define DPRINTF(sc, m, fmt, ...) do { \
89 if (sc->sc_debug & (m)) \
90 printf(fmt, __VA_ARGS__); \
93#define DPRINTF(sc, m, fmt, ...) do { \
98SYSCTL_INT(_hw_usb_urtw, OID_AUTO, preamble_mode, CTLFLAG_RWTUN,
102#define urtw_lookup(v, p) \
103 ((const struct urtw_type *)usb_lookup(urtw_devs, v, p))
104#define URTW_DEV_B(v,p) \
105 { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, URTW_REV_RTL8187B) }
106#define URTW_DEV_L(v,p) \
107 { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, URTW_REV_RTL8187L) }
108#define URTW_REV_RTL8187B 0
109#define URTW_REV_RTL8187L 1
134#define urtw_read8_m(sc, val, data) do { \
135 error = urtw_read8_c(sc, val, data); \
139#define urtw_write8_m(sc, val, data) do { \
140 error = urtw_write8_c(sc, val, data); \
144#define urtw_read16_m(sc, val, data) do { \
145 error = urtw_read16_c(sc, val, data); \
149#define urtw_write16_m(sc, val, data) do { \
150 error = urtw_write16_c(sc, val, data); \
154#define urtw_read32_m(sc, val, data) do { \
155 error = urtw_read32_c(sc, val, data); \
159#define urtw_write32_m(sc, val, data) do { \
160 error = urtw_write32_c(sc, val, data); \
164#define urtw_8187_write_phy_ofdm(sc, val, data) do { \
165 error = urtw_8187_write_phy_ofdm_c(sc, val, data); \
169#define urtw_8187_write_phy_cck(sc, val, data) do { \
170 error = urtw_8187_write_phy_cck_c(sc, val, data); \
174#define urtw_8225_write(sc, val, data) do { \
175 error = urtw_8225_write_c(sc, val, data); \
186 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d, 0x9c, 0x9b,
187 0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90,
188 0x8f, 0x8e, 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, 0x85,
189 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e, 0x3d, 0x3c, 0x3b, 0x3a,
190 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f,
191 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26, 0x25, 0x24,
192 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19,
193 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
194 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03,
195 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
196 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
197 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
201 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51,
202 0x4f, 0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b,
203 0x39, 0x37, 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25,
204 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f,
205 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01,
206 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0x19,
207 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23,
208 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a,
209 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d,
210 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31,
211 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
212 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31
234 0x23, 0x88, 0x7c, 0xa5,
235 0x23, 0x88, 0x7c, 0xb5,
236 0x23, 0x88, 0x7c, 0xc5,
237 0x33, 0x80, 0x79, 0xc5,
238 0x43, 0x78, 0x76, 0xc5,
239 0x53, 0x60, 0x73, 0xc5,
240 0x63, 0x58, 0x70, 0xc5,
244 { 0x00, 0x0067 }, { 0x01, 0x0fe0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
245 { 0x04, 0x0486 }, { 0x05, 0x0bc0 }, { 0x06, 0x0ae6 }, { 0x07, 0x082a },
246 { 0x08, 0x001f }, { 0x09, 0x0334 }, { 0x0a, 0x0fd4 }, { 0x0b, 0x0391 },
247 { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 },
251 { 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 },
252 { 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 },
253 { 0x08, 0x40 }, { 0x09, 0xfe }, { 0x0a, 0x09 }, { 0x0b, 0x80 },
254 { 0x0c, 0x01 }, { 0x0e, 0xd3 }, { 0x0f, 0x38 }, { 0x10, 0x84 },
255 { 0x11, 0x06 }, { 0x12, 0x20 }, { 0x13, 0x20 }, { 0x14, 0x00 },
256 { 0x15, 0x40 }, { 0x16, 0x00 }, { 0x17, 0x40 }, { 0x18, 0xef },
257 { 0x19, 0x19 }, { 0x1a, 0x20 }, { 0x1b, 0x76 }, { 0x1c, 0x04 },
258 { 0x1e, 0x95 }, { 0x1f, 0x75 }, { 0x20, 0x1f }, { 0x21, 0x27 },
259 { 0x22, 0x16 }, { 0x24, 0x46 }, { 0x25, 0x20 }, { 0x26, 0x90 },
264 { 0x00, 0x98 }, { 0x03, 0x20 }, { 0x04, 0x7e }, { 0x05, 0x12 },
265 { 0x06, 0xfc }, { 0x07, 0x78 }, { 0x08, 0x2e }, { 0x10, 0x9b },
266 { 0x11, 0x88 }, { 0x12, 0x47 }, { 0x13, 0xd0 }, { 0x19, 0x00 },
267 { 0x1a, 0xa0 }, { 0x1b, 0x08 }, { 0x40, 0x86 }, { 0x41, 0x8d },
268 { 0x42, 0x15 }, { 0x43, 0x18 }, { 0x44, 0x1f }, { 0x45, 0x1e },
269 { 0x46, 0x1a }, { 0x47, 0x15 }, { 0x48, 0x10 }, { 0x49, 0x0a },
270 { 0x4a, 0x05 }, { 0x4b, 0x02 }, { 0x4c, 0x05 }
274 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
275 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
276 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
277 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
278 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
279 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
280 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
281 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
282 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
283 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
284 0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
285 0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
289 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd,
293 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
297 0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
298 0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
299 0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
300 0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
301 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
302 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
306 0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
307 0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
308 0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
309 0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
310 0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
311 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
315 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
329 { 0x00, 0x02bf }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
330 { 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a },
331 { 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb },
332 { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 }
336 { 0x00, 0x00b7 }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
337 { 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a },
338 { 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb },
339 { 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 }
343 {0x0f0, 0x32}, {0x0f1, 0x32}, {0x0f2, 0x00},
344 {0x0f3, 0x00}, {0x0f4, 0x32}, {0x0f5, 0x43},
345 {0x0f6, 0x00}, {0x0f7, 0x00}, {0x0f8, 0x46},
346 {0x0f9, 0xa4}, {0x0fa, 0x00}, {0x0fb, 0x00},
347 {0x0fc, 0x96}, {0x0fd, 0xa4}, {0x0fe, 0x00},
348 {0x0ff, 0x00}, {0x158, 0x4b}, {0x159, 0x00},
349 {0x15a, 0x4b}, {0x15b, 0x00}, {0x160, 0x4b},
350 {0x161, 0x09}, {0x162, 0x4b}, {0x163, 0x09},
351 {0x1ce, 0x0f}, {0x1cf, 0x00}, {0x1e0, 0xff},
352 {0x1e1, 0x0f}, {0x1e2, 0x00}, {0x1f0, 0x4e},
353 {0x1f1, 0x01}, {0x1f2, 0x02}, {0x1f3, 0x03},
354 {0x1f4, 0x04}, {0x1f5, 0x05}, {0x1f6, 0x06},
355 {0x1f7, 0x07}, {0x1f8, 0x08}, {0x24e, 0x00},
356 {0x20c, 0x04}, {0x221, 0x61}, {0x222, 0x68},
357 {0x223, 0x6f}, {0x224, 0x76}, {0x225, 0x7d},
358 {0x226, 0x84}, {0x227, 0x8d}, {0x24d, 0x08},
359 {0x250, 0x05}, {0x251, 0xf5}, {0x252, 0x04},
360 {0x253, 0xa0}, {0x254, 0x1f}, {0x255, 0x23},
361 {0x256, 0x45}, {0x257, 0x67}, {0x258, 0x08},
362 {0x259, 0x08}, {0x25a, 0x08}, {0x25b, 0x08},
363 {0x260, 0x08}, {0x261, 0x08}, {0x262, 0x08},
364 {0x263, 0x08}, {0x264, 0xcf}, {0x272, 0x56},
365 {0x273, 0x9a}, {0x034, 0xf0}, {0x035, 0x0f},
366 {0x05b, 0x40}, {0x084, 0x88}, {0x085, 0x24},
367 {0x088, 0x54}, {0x08b, 0xb8}, {0x08c, 0x07},
368 {0x08d, 0x00}, {0x094, 0x1b}, {0x095, 0x12},
369 {0x096, 0x00}, {0x097, 0x06}, {0x09d, 0x1a},
370 {0x09f, 0x10}, {0x0b4, 0x22}, {0x0be, 0x80},
371 {0x0db, 0x00}, {0x0ee, 0x00}, {0x091, 0x03},
372 {0x24c, 0x00}, {0x39f, 0x00}, {0x08c, 0x01},
373 {0x08d, 0x10}, {0x08e, 0x08}, {0x08f, 0x00}
377 { 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 },
378 { 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 },
379 { 0x08, 0x40 }, { 0x09, 0xfe }, { 0x0a, 0x08 }, { 0x0b, 0x80 },
380 { 0x0c, 0x01 }, { 0x0d, 0x43 }, { 0x0e, 0xd3 }, { 0x0f, 0x38 },
381 { 0x10, 0x84 }, { 0x11, 0x07 }, { 0x12, 0x20 }, { 0x13, 0x20 },
382 { 0x14, 0x00 }, { 0x15, 0x40 }, { 0x16, 0x00 }, { 0x17, 0x40 },
383 { 0x18, 0xef }, { 0x19, 0x19 }, { 0x1a, 0x20 }, { 0x1b, 0x15 },
384 { 0x1c, 0x04 }, { 0x1d, 0xc5 }, { 0x1e, 0x95 }, { 0x1f, 0x75 },
385 { 0x20, 0x1f }, { 0x21, 0x17 }, { 0x22, 0x16 }, { 0x23, 0x80 },
386 { 0x24, 0x46 }, { 0x25, 0x00 }, { 0x26, 0x90 }, { 0x27, 0x88 }
390 { 0x00, 0x10 }, { 0x01, 0x0d }, { 0x02, 0x01 }, { 0x03, 0x00 },
391 { 0x04, 0x14 }, { 0x05, 0xfb }, { 0x06, 0xfb }, { 0x07, 0x60 },
392 { 0x08, 0x00 }, { 0x09, 0x60 }, { 0x0a, 0x00 }, { 0x0b, 0x00 },
393 { 0x0c, 0x00 }, { 0x0d, 0x5c }, { 0x0e, 0x00 }, { 0x0f, 0x00 },
394 { 0x10, 0x40 }, { 0x11, 0x00 }, { 0x12, 0x40 }, { 0x13, 0x00 },
395 { 0x14, 0x00 }, { 0x15, 0x00 }, { 0x16, 0xa8 }, { 0x17, 0x26 },
396 { 0x18, 0x32 }, { 0x19, 0x33 }, { 0x1a, 0x07 }, { 0x1b, 0xa5 },
397 { 0x1c, 0x6f }, { 0x1d, 0x55 }, { 0x1e, 0xc8 }, { 0x1f, 0xb3 },
398 { 0x20, 0x0a }, { 0x21, 0xe1 }, { 0x22, 0x2C }, { 0x23, 0x8a },
399 { 0x24, 0x86 }, { 0x25, 0x83 }, { 0x26, 0x34 }, { 0x27, 0x0f },
400 { 0x28, 0x4f }, { 0x29, 0x24 }, { 0x2a, 0x6f }, { 0x2b, 0xc2 },
401 { 0x2c, 0x6b }, { 0x2d, 0x40 }, { 0x2e, 0x80 }, { 0x2f, 0x00 },
402 { 0x30, 0xc0 }, { 0x31, 0xc1 }, { 0x32, 0x58 }, { 0x33, 0xf1 },
403 { 0x34, 0x00 }, { 0x35, 0xe4 }, { 0x36, 0x90 }, { 0x37, 0x3e },
404 { 0x38, 0x6d }, { 0x39, 0x3c }, { 0x3a, 0xfb }, { 0x3b, 0x07 }
408 { 0x00, 0x98 }, { 0x03, 0x20 }, { 0x04, 0x7e }, { 0x05, 0x12 },
409 { 0x06, 0xfc }, { 0x07, 0x78 }, { 0x08, 0x2e }, { 0x09, 0x11 },
410 { 0x0a, 0x17 }, { 0x0b, 0x11 }, { 0x10, 0x9b }, { 0x11, 0x88 },
411 { 0x12, 0x47 }, { 0x13, 0xd0 }, { 0x19, 0x00 }, { 0x1a, 0xa0 },
412 { 0x1b, 0x08 }, { 0x1d, 0x00 }, { 0x40, 0x86 }, { 0x41, 0x9d },
413 { 0x42, 0x15 }, { 0x43, 0x18 }, { 0x44, 0x36 }, { 0x45, 0x35 },
414 { 0x46, 0x2e }, { 0x47, 0x25 }, { 0x48, 0x1c }, { 0x49, 0x12 },
415 { 0x4a, 0x09 }, { 0x4b, 0x04 }, { 0x4c, 0x05 }
419 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0008, 0x0009,
420 0x000a, 0x000b, 0x0102, 0x0103, 0x0104, 0x0105, 0x0140, 0x0141,
421 0x0142, 0x0143, 0x0144, 0x0145, 0x0180, 0x0181, 0x0182, 0x0183,
422 0x0184, 0x0185, 0x0188, 0x0189, 0x018a, 0x018b, 0x0243, 0x0244,
423 0x0245, 0x0280, 0x0281, 0x0282, 0x0283, 0x0284, 0x0285, 0x0288,
424 0x0289, 0x028a, 0x028b, 0x028c, 0x0342, 0x0343, 0x0344, 0x0345,
425 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0388, 0x0389,
426 0x038a, 0x038b, 0x038c, 0x038d, 0x0390, 0x0391, 0x0392, 0x0393,
427 0x0394, 0x0395, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d,
428 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
429 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
430 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
434 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
435 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
436 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
437 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
438 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
439 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
440 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
441 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
442 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
443 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
444 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
445 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
449 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
450 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
451 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
452 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
453 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
454 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
458 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04
462 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00
466 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04,
467 0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03,
468 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03,
469 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
473 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00,
474 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
475 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
476 0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00
480 { 2, 0 }, { 4, 1 }, { 11, 2 }, { 12, 4 }, { 18, 5 },
481 { 22, 3 }, { 24, 6 }, { 36, 7 }, { 48, 8 }, { 72, 9 },
482 { 96, 10 }, { 108, 11 }
486static const uint8_t urtw_8187b_reg_table[][3] = {
487 { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 },
488 { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 },
489 { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 },
490 { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 },
491 { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 },
492 { 0xff, 0x00, 0 }, { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 },
493 { 0x5a, 0x4b, 1 }, { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 },
494 { 0x61, 0x09, 1 }, { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 },
495 { 0xce, 0x0f, 1 }, { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 },
496 { 0xe1, 0x0f, 1 }, { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 },
497 { 0xf1, 0x01, 1 }, { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 },
498 { 0xf4, 0x04, 1 }, { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 },
499 { 0xf7, 0x07, 1 }, { 0xf8, 0x08, 1 }, { 0x4e, 0x00, 2 },
500 { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, { 0x22, 0x68, 2 },
501 { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, { 0x25, 0x7d, 2 },
502 { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, { 0x4d, 0x08, 2 },
503 { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, { 0x52, 0x04, 2 },
504 { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, { 0x55, 0x23, 2 },
505 { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, { 0x58, 0x08, 2 },
506 { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, { 0x5b, 0x08, 2 },
507 { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, { 0x62, 0x08, 2 },
508 { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, { 0x72, 0x56, 2 },
509 { 0x73, 0x9a, 2 }, { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 },
510 { 0x5b, 0x40, 0 }, { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 },
511 { 0x88, 0x54, 0 }, { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 },
512 { 0x8d, 0x00, 0 }, { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 },
513 { 0x96, 0x00, 0 }, { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 },
514 { 0x9f, 0x10, 0 }, { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 },
515 { 0xdb, 0x00, 0 }, { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 },
516 { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 },
517 { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 }
542 .bufsize =
sizeof(uint64_t),
555 .force_short_xfer = 1,
568 .force_short_xfer = 1,
581 .force_short_xfer = 1,
594 .force_short_xfer = 1,
607 .force_short_xfer = 1,
634 .force_short_xfer = 1,
647 .force_short_xfer = 1,
656 const char [IFNAMSIZ],
int,
enum ieee80211_opmode,
657 int,
const uint8_t [IEEE80211_ADDR_LEN],
658 const uint8_t [IEEE80211_ADDR_LEN]);
663static int urtw_transmit(
struct ieee80211com *,
struct mbuf *);
667static int urtw_raw_xmit(
struct ieee80211_node *,
struct mbuf *,
668 const struct ieee80211_bpf_params *);
672 struct ieee80211_channel[]);
677 struct ieee80211_node *,
struct mbuf *,
680 enum ieee80211_state,
int);
796 struct ieee80211com *ic = &sc->
sc_ic;
812 mtx_init(&sc->
sc_mtx, device_get_nameunit(sc->
sc_dev), MTX_NETWORK_LOCK,
818 mbufq_init(&sc->
sc_snd, ifqmaxlen);
829 setup_start, n_setup, sc, &sc->
sc_mtx);
831 device_printf(
dev,
"could not allocate USB transfers, "
874 ic->ic_name = device_get_nameunit(
dev);
875 ic->ic_phytype = IEEE80211_T_OFDM;
876 ic->ic_opmode = IEEE80211_M_STA;
881 IEEE80211_C_MONITOR |
883 IEEE80211_C_SHPREAMBLE |
893 ieee80211_ifattach(ic);
907 ieee80211_radiotap_attach(ic,
916 ieee80211_announce(ic);
931 struct ieee80211com *ic = &sc->
sc_ic;
933 unsigned int n_xfers;
961 for (x = 0; x != n_xfers; x++)
973 ieee80211_ifdetach(ic);
997 for (i = 0; i < ndata; i++) {
1000 if (fillmbuf == 1) {
1001 if (dp->
m != NULL) {
1009 if (dp->
ni != NULL) {
1010 ieee80211_free_node(dp->
ni);
1016static struct ieee80211vap *
1018 enum ieee80211_opmode opmode,
int flags,
1019 const uint8_t bssid[IEEE80211_ADDR_LEN],
1020 const uint8_t mac[IEEE80211_ADDR_LEN])
1023 struct ieee80211vap *vap;
1025 if (!TAILQ_EMPTY(&ic->ic_vaps))
1027 uvp = malloc(
sizeof(
struct urtw_vap), M_80211_VAP, M_WAITOK | M_ZERO);
1031 if (ieee80211_vap_setup(ic, vap,
name, unit, opmode,
1032 flags | IEEE80211_CLONE_NOBEACONS, bssid) != 0) {
1034 free(uvp, M_80211_VAP);
1043 ieee80211_vap_attach(vap, ieee80211_media_change,
1044 ieee80211_media_status, mac);
1045 ic->ic_opmode = opmode;
1054 ieee80211_vap_detach(
vap);
1055 free(uvp, M_80211_VAP);
1127 data8 &= ~URTW_CONFIG3_ANAPARAM_WRITE;
1206 struct ieee80211com *ic = &sc->
sc_ic;
1207 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
1208 const uint8_t *macaddr;
1228 macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr;
1297 for (i = 0; i < 20; i++) {
1304 device_printf(sc->
sc_dev,
"reset timeout\n");
1327 "Control request failed, %s (retrying)\n",
1365 device_printf(sc->
sc_dev,
"failed to stop (%s)\n",
1385 for (i = 0; i < max; i++)
1401 if (ic->ic_nrunning > 0) {
1403 if (ic->ic_promisc > 0 || ic->ic_allmulti > 0)
1413 ieee80211_start_all(ic);
1442 struct ieee80211_node *ni;
1450 while ((m = mbufq_dequeue(&sc->
sc_snd)) != NULL) {
1453 mbufq_prepend(&sc->
sc_snd, m);
1457 ni = (
struct ieee80211_node *)m->m_pkthdr.rcvif;
1458 m->m_pkthdr.rcvif = NULL;
1461 if_inc_counter(ni->ni_vap->iv_ifp,
1462 IFCOUNTER_OERRORS, 1);
1464 ieee80211_free_node(ni);
1475 int ndata,
int maxsz,
void *dma_buf)
1479 for (i = 0; i < ndata; i++) {
1483 if (dma_buf == NULL) {
1484 dp->
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
1485 if (dp->
m == NULL) {
1487 "could not allocate rx mbuf\n");
1491 dp->
buf = mtod(dp->
m, uint8_t *);
1494 dp->
buf = ((uint8_t *)dma_buf) +
1549 const struct ieee80211_bpf_params *params)
1551 struct ieee80211com *ic = ni->ni_ic;
1595 int maxchans,
int *nchans,
struct ieee80211_channel chans[])
1597 uint8_t bands[IEEE80211_MODE_BYTES];
1599 memset(bands, 0,
sizeof(bands));
1600 setbit(bands, IEEE80211_MODE_11B);
1601 setbit(bands, IEEE80211_MODE_11G);
1602 ieee80211_add_channels_default_2ghz(chans, maxchans, nchans, bands, 0);
1609 uint32_t
data, orig;
1631 data = orig & ~URTW_TX_LOOPBACK_MASK;
1651 device_printf(sc->
sc_dev,
"could not change the channel\n");
1676 struct ieee80211_frame *wh = mtod(m0,
struct ieee80211_frame *);
1677 struct ieee80211_key *
k;
1678 const struct ieee80211_txparam *tp = ni->ni_txparms;
1679 struct ieee80211com *ic = &sc->
sc_ic;
1680 struct ieee80211vap *vap = ni->ni_vap;
1688 int dur = 0, rtsdur = 0, rtsenable = 0, ctsenable = 0, rate,
type,
1689 pkttime = 0, txdur = 0, isshort = 0, xferlen, ismcast;
1690 uint16_t acktime, rtstime, ctstime;
1696 ismcast = IEEE80211_IS_MULTICAST(wh->i_addr1);
1697 type = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
1702 if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) {
1703 k = ieee80211_crypto_encap(ni, m0);
1705 device_printf(sc->
sc_dev,
1706 "ieee80211_crypto_encap returns NULL.\n");
1713 wh = mtod(m0,
struct ieee80211_frame *);
1716 if (ieee80211_radiotap_active_vap(vap)) {
1720 ieee80211_radiotap_tx(vap, m0);
1723 if (
type == IEEE80211_FC0_TYPE_MGT ||
1724 type == IEEE80211_FC0_TYPE_CTL ||
1725 (m0->m_flags & M_EAPOL) != 0) {
1726 rate = tp->mgmtrate;
1730 rate = tp->mcastrate;
1731 else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
1732 rate = tp->ucastrate;
1741 IEEE80211_CRC_LEN, rate, 0, 0);
1744 if ((m0->m_pkthdr.len + 4) > vap->iv_rtsthreshold) {
1750 IEEE80211_CRC_LEN, rate, 0, isshort);
1751 rtsdur = ctstime + pkttime + acktime +
1753 txdur = rtstime + rtsdur;
1755 rtsenable = ctsenable = rtsdur = 0;
1757 IEEE80211_CRC_LEN, rate, 0, isshort);
1761 if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG)
1763 IEEE80211_CRC_LEN, rate, 0, isshort) +
1769 USETW(wh->i_dur, dur);
1771 xferlen = m0->m_pkthdr.len;
1773 if ((0 == xferlen % 64) || (0 == xferlen % 512))
1777 flags = m0->m_pkthdr.len & 0xfff;
1779 if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&
1780 (ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) &&
1784 if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG)
1800 tx->flag = htole32(flags);
1802 if (
type == IEEE80211_FC0_TYPE_MGT &&
1803 (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
1804 IEEE80211_FC0_SUBTYPE_PROBE_RESP)
1808 m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(
tx + 1));
1818 tx->flag = htole32(flags);
1820 tx->retry |= 7 << 4;
1822 m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(
tx + 1));
1825 data->buflen = xferlen;
1831 case IEEE80211_FC0_TYPE_CTL:
1832 case IEEE80211_FC0_TYPE_MGT:
1837 (
"unsupported WME pipe %d", M_WME_GETAC(m0)));
1838 xfer = rtl8187b_pipes[M_WME_GETAC(m0)];
1851 device_printf(sc->
sc_dev,
"could not control LED (%d)\n",
1859 struct ieee80211com *ic = vap->iv_ic;
1862 struct ieee80211_node *ni;
1865 DPRINTF(sc, URTW_DEBUG_STATE,
"%s: %s -> %s\n", __func__,
1866 ieee80211_state_name[vap->iv_state],
1867 ieee80211_state_name[nstate]);
1871 IEEE80211_UNLOCK(ic);
1877 case IEEE80211_S_INIT:
1878 case IEEE80211_S_SCAN:
1879 case IEEE80211_S_AUTH:
1880 case IEEE80211_S_ASSOC:
1882 case IEEE80211_S_RUN:
1883 ni = ieee80211_ref_node(vap->iv_bss);
1887 ((uint16_t *)ni->ni_bssid)[2]);
1896 device_printf(sc->
sc_dev,
1897 "could not control LED (%d)\n",
error);
1898 ieee80211_free_node(ni);
1906 return (uvp->
newstate(vap, nstate, arg));
1913 struct ieee80211com *ic = &sc->
sc_ic;
1917 device_printf(sc->
sc_dev,
"device timeout\n");
1918 counter_u64_add(ic->ic_oerrors, 1);
1919 ieee80211_restart_all(ic);
1935 int i, basic_rate, min_rr_rate, max_rr_rate;
1948 data &= ~URTW_BRSR_MBR_8185;
1950 for (i = 0; i <= basic_rate; i++)
1974 struct ieee80211com *ic = &sc->
sc_ic;
1979 data &= ~URTW_MSR_LINK_MASK;
1981 if (sc->
sc_state == IEEE80211_S_RUN) {
1982 switch (ic->ic_opmode) {
1983 case IEEE80211_M_STA:
1984 case IEEE80211_M_MONITOR:
1989 case IEEE80211_M_IBSS:
1992 case IEEE80211_M_HOSTAP:
1997 "unsupported operation mode 0x%x\n",
2022 USETW(
req.wLength,
sizeof(uint8_t));
2040 USETW(
req.wLength,
sizeof(uint16_t));
2058 USETW(
req.wLength,
sizeof(uint32_t));
2075 USETW(
req.wLength,
sizeof(uint8_t));
2091 USETW(
req.wLength,
sizeof(uint16_t));
2107 USETW(
req.wLength,
sizeof(uint32_t));
2115 struct ieee80211com *ic = &sc->
sc_ic;
2122 ic->ic_macaddr[0] =
data & 0xff;
2123 ic->ic_macaddr[1] = (
data & 0xff00) >> 8;
2127 ic->ic_macaddr[2] =
data & 0xff;
2128 ic->ic_macaddr[3] = (
data & 0xff00) >> 8;
2132 ic->ic_macaddr[4] =
data & 0xff;
2133 ic->ic_macaddr[5] = (
data & 0xff00) >> 8;
2141#define URTW_READCMD_LEN 3
2143 int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 };
2164 addrstr[0] =
addr & (1 << 7);
2165 addrstr[1] =
addr & (1 << 6);
2166 addrstr[2] =
addr & (1 << 5);
2167 addrstr[3] =
addr & (1 << 4);
2168 addrstr[4] =
addr & (1 << 3);
2169 addrstr[5] =
addr & (1 << 2);
2170 addrstr[6] =
addr & (1 << 1);
2171 addrstr[7] =
addr & (1 << 0);
2174 addrstr[0] =
addr & (1 << 5);
2175 addrstr[1] =
addr & (1 << 4);
2176 addrstr[2] =
addr & (1 << 3);
2177 addrstr[3] =
addr & (1 << 2);
2178 addrstr[4] =
addr & (1 << 1);
2179 addrstr[5] =
addr & (1 << 0);
2189 for (i = 0; i < 16; i++) {
2197 (*data) |= (data16 << (15 - i));
2211#undef URTW_READCMD_LEN
2284 for (i = 0; i < buflen; i++) {
2309 for (i = 1, j = 0; i < 6; i += 2, j++) {
2318 for (i = 1, j = 0; i < 4; i += 2, j++) {
2346 for (i = 1, j = 0; i < 4; i += 2, j++) {
2382 device_printf(sc->
sc_dev,
"unknown type: %#x\n", data8);
2395 device_printf(sc->
sc_dev,
"unknown RTL8187L type: %#x\n",
2404 switch (
data & 0xff) {
2431 "unsupported RF chip %d\n",
data & 0xff);
2436 device_printf(sc->
sc_dev,
"%s rf %s hwrev %s\n",
2441 (data8 == 1) ?
"d" :
"e") :
"none");
2529 for (i = 0; i < 95; i++) {
2539 for (i = 0; i < 128; i++) {
2627 phyw = ((
data << 8) | (
addr | 0x80));
2680 uint16_t d80, d82, d84;
2725 USETW(
req.wLength,
sizeof(uint16_t));
2726 buf[0] = (data16 & 0x00ff);
2727 buf[1] = (data16 & 0xff00) >> 8;
2753 if (sens < 0 || sens > 6)
2778 uint8_t *cck_pwltable;
2779 uint8_t cck_pwrlvl_max, ofdm_pwrlvl_min, ofdm_pwrlvl_max;
2784 cck_pwrlvl_max = 11;
2785 ofdm_pwrlvl_max = 25;
2786 ofdm_pwrlvl_min = 10;
2789 cck_pwrlvl = (cck_pwrlvl > cck_pwrlvl_max) ? cck_pwrlvl_max : cck_pwrlvl;
2790 idx = cck_pwrlvl % 6;
2791 set = cck_pwrlvl / 6;
2797 for (i = 0; i < 8; i++) {
2799 cck_pwltable[idx * 8 + i]);
2804 ofdm_pwrlvl = (ofdm_pwrlvl > (ofdm_pwrlvl_max - ofdm_pwrlvl_min)) ?
2805 ofdm_pwrlvl_max : ofdm_pwrlvl + ofdm_pwrlvl_min;
2806 ofdm_pwrlvl = (ofdm_pwrlvl > 35) ? 35 : ofdm_pwrlvl;
2808 idx = ofdm_pwrlvl % 6;
2809 set = ofdm_pwrlvl / 6;
2905 for (i = 0; i < 95; i++) {
2928 device_printf(sc->
sc_dev,
"expect 0xe6!! (0x%x)\n", data32);
2940 device_printf(sc->
sc_dev,
"RF calibration failed\n");
2946 for (i = 0; i < 128; i++) {
3005 uint8_t rlen = 12, wlen = 6;
3006 uint16_t o1, o2, o3, tmp;
3007 uint32_t d2w = ((uint32_t)(
addr & 0x1f)) << 27;
3008 uint32_t mask = 0x80000000,
value = 0;
3016 o1 &= ~URTW_RF_PINS_MAGIC4;
3022 for (i = 0; i < (wlen / 2); i++, mask = mask >> 1) {
3023 bit = ((d2w & mask) != 0) ? 1 : 0;
3036 bit = ((d2w & mask) != 0) ? 1 : 0;
3055 for (i = 0; i < rlen; i++, mask = mask >> 1) {
3094 uint8_t *cck_pwrtable;
3095 uint8_t cck_pwrlvl_max = 15, ofdm_pwrlvl_max = 25, ofdm_pwrlvl_min = 10;
3101 cck_pwrlvl = (cck_pwrlvl > cck_pwrlvl_max) ? cck_pwrlvl_max : cck_pwrlvl;
3103 cck_pwrlvl = (cck_pwrlvl > 35) ? 35 : cck_pwrlvl;
3107 for (i = 0; i < 8; i++)
3115 ofdm_pwrlvl = (ofdm_pwrlvl > (ofdm_pwrlvl_max - ofdm_pwrlvl_min)) ?
3116 ofdm_pwrlvl_max : ofdm_pwrlvl + ofdm_pwrlvl_min;
3118 ofdm_pwrlvl = (ofdm_pwrlvl > 35) ? 35 : ofdm_pwrlvl;
3195 struct ieee80211com *ic = &sc->
sc_ic;
3196 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
3197 const uint8_t *macaddr;
3222#define URTW_ARFR 0x1e0
3236#define URTW_FEMR_FOR_8187B 0x1d4
3241 data8 = (data8 & 0x3f) | 0x80;
3245 macaddr = vap ? vap->iv_myaddr : ic->ic_macaddr;
3269#define URTW_RFSW_CTRL 0x272
3299 for (i = 0; i < 95; i++) {
3326 for (i = 0; i < 128; i++) {
3330 addr = ((i + 0x80) << 8) | 0x0000008e;
3374 uint8_t *cck_pwrtable;
3375 uint8_t cck_pwrlvl_max = 15;
3381 cck_pwrlvl = (cck_pwrlvl > cck_pwrlvl_max) ?
3385 cck_pwrlvl = (cck_pwrlvl > 35) ? 35 : cck_pwrlvl;
3390 cck_pwrtable += (cck_pwrlvl <= 6) ? 0 :
3391 ((cck_pwrlvl <= 11) ? 8 : 16);
3393 cck_pwrtable += (cck_pwrlvl <= 5) ? 0 :
3394 ((cck_pwrlvl <= 11) ? 8 : ((cck_pwrlvl <= 17) ? 16 : 24));
3396 for (i = 0; i < 8; i++)
3404 ofdm_pwrlvl = (ofdm_pwrlvl > 15) ?
3408 ofdm_pwrlvl = (ofdm_pwrlvl > 35) ? 35 : ofdm_pwrlvl;
3414 if (ofdm_pwrlvl <= 11) {
3422 if (ofdm_pwrlvl <= 11) {
3425 }
else if (ofdm_pwrlvl <= 17) {
3448 USETW(
req.wLength,
sizeof(uint8_t));
3463 USETW(
req.wLength,
sizeof(uint8_t));
3570 device_printf(sc->
sc_dev,
"reset timeout\n");
3637 "unsupported LED mode 0x%x", mode);
3699 "unsupported LED PIN type 0x%x",
3706 "unsupported LED type 0x%x",
type);
3730 "unsupported LED PIN type 0x%x",
3737 "unsupported LED type 0x%x",
type);
3752 struct ieee80211com *ic = &sc->
sc_ic;
3764 "could not process a LED strategy 0x%x",
3815 "unknown LED status 0x%x",
3852 data &= ~URTW_TX_LOOPBACK_MASK;
3855 data &= ~URTW_TX_SWPLCPLEN;
3873 data8 &= ~URTW_TX_AGC_CTL_PERPACKET_GAIN;
3874 data8 &= ~URTW_TX_AGC_CTL_PERPACKET_ANTSEL;
3875 data8 &= ~URTW_TX_AGC_CTL_FEEDBACK_ANT;
3879 data &= ~URTW_TX_LOOPBACK_MASK;
3886 data &= ~URTW_TX_SWPLCPLEN;
3899 struct ieee80211com *ic = &sc->
sc_ic;
3904 data =
data &~ URTW_RX_FILTER_MASK;
3915 if (ic->ic_opmode == IEEE80211_M_MONITOR) {
3919 if (sc->
sc_crcmon == 1 && ic->ic_opmode == IEEE80211_M_MONITOR)
3922 data =
data &~ URTW_RX_FIFO_THRESHOLD_MASK;
3925 data =
data &~ URTW_MAX_RX_DMA_MASK;
3930 if (ic->ic_opmode == IEEE80211_M_MONITOR ||
3931 ic->ic_promisc > 0 || ic->ic_allmulti > 0) {
3948 int actlen, flen, rssi;
3949 struct ieee80211_frame *wh;
3950 struct mbuf *m, *mnew;
3952 struct ieee80211com *ic = &sc->
sc_ic;
3953 uint8_t noise = 0, rate;
3961 if (actlen <
sizeof(*rx) + IEEE80211_ACK_LEN)
3966 flen = le32toh(rx->
flag) & 0xfff;
3967 if (flen > actlen -
sizeof(*rx))
3975 if (ieee80211_radiotap_active(ic))
3980 if (actlen <
sizeof(*rx) + IEEE80211_ACK_LEN)
3985 flen = le32toh(rx->
flag) & 0xfff;
3986 if (flen > actlen -
sizeof(*rx))
3994 if (ieee80211_radiotap_active(ic))
3998 if (flen < IEEE80211_ACK_LEN)
4001 mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
4007 data->buf = mtod(mnew, uint8_t *);
4010 m->m_pkthdr.len = m->m_len = flen - IEEE80211_CRC_LEN;
4012 if (ieee80211_radiotap_active(ic)) {
4020 wh = mtod(m,
struct ieee80211_frame *);
4021 if (IEEE80211_IS_DATA(wh))
4030 counter_u64_add(ic->ic_ierrors, 1);
4038 struct ieee80211com *ic = &sc->
sc_ic;
4039 struct ieee80211_node *ni;
4040 struct epoch_tracker et;
4041 struct mbuf *m = NULL;
4061 KASSERT(
m == NULL, (
"mbuf isn't NULL"));
4077 if (
m->m_pkthdr.len >=
4078 sizeof(
struct ieee80211_frame_min)) {
4079 ni = ieee80211_find_rxnode(ic,
4080 mtod(
m,
struct ieee80211_frame_min *));
4084 NET_EPOCH_ENTER(et);
4086 (void) ieee80211_input(
ni,
m, rssi, nf);
4088 ieee80211_free_node(
ni);
4090 (
void) ieee80211_input_all(ic,
m, rssi, nf);
4105 counter_u64_add(ic->ic_ierrors, 1);
4112#define URTW_STATUS_TYPE_TXCLOSE 1
4113#define URTW_STATUS_TYPE_BEACON_INTR 0
4119 struct ieee80211com *ic = &sc->
sc_ic;
4120 int actlen,
type, pktretry, seq;
4125 if (actlen !=
sizeof(uint64_t))
4131 pktretry =
val & 0xff;
4132 seq = (
val >> 16) & 0xff;
4134 counter_u64_add(ic->ic_oerrors, 1);
4135 DPRINTF(sc, URTW_DEBUG_TXSTATUS,
"pktretry %d seq %#x\n",
4144 struct ieee80211com *ic = &sc->
sc_ic;
4155 memcpy(dma_buf, &sc->
sc_txstatus,
sizeof(uint64_t));
4162 counter_u64_add(ic->ic_ierrors, 1);
4178 ieee80211_tx_complete(
data->ni,
data->m, 0);
4207 "%s: empty pending queue\n", __func__);
4222 if (
data->ni != NULL) {
4223 if_inc_counter(
data->ni->ni_vap->iv_ifp,
4224 IFCOUNTER_OERRORS, 1);
4225 ieee80211_free_node(
data->ni);
4247 DPRINTF(
sc, URTW_DEBUG_XMIT,
"%s: %s\n", __func__,
4248 "out of xmit buffers");
4261 DPRINTF(
sc, URTW_DEBUG_XMIT,
"%s: stop queue\n", __func__);
4269 return ((rate <= 22 && rate != 12 && rate != 18) ||
4270 rate == 44) ? (1) : (0);
4295 uint8_t ismgt, uint8_t isshort)
4297 uint16_t ceiling, frametime, n_dbps;
4300 if (ismgt || !isshort || rate == 2)
4301 frametime = (uint16_t)(144 + 48 +
4302 (framelen * 8 / (rate / 2)));
4304 frametime = (uint16_t)(72 + 24 +
4305 (framelen * 8 / (rate / 2)));
4306 if ((framelen * 8 % (rate / 2)) != 0)
4310 ceiling = (16 + 8 * framelen + 6) / n_dbps
4311 + (((16 + 8 * framelen + 6) % n_dbps) ? 1 : 0);
4312 frametime = (uint16_t)(16 + 4 + 4 * ceiling + 6);
4333 struct ieee80211com *ic = &sc->
sc_ic;
4343 if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan))
4351 if (sc->
sc_state == IEEE80211_S_ASSOC &&
4352 ic->ic_flags & IEEE80211_F_SHSLOT)
4356 if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
4373#define URTW_SYSCTL_STAT_ADD32(c, h, n, p, d) \
4374 SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d)
4375 struct sysctl_ctx_list *ctx;
4376 struct sysctl_oid_list *
child, *parent;
4377 struct sysctl_oid *tree;
4380 ctx = device_get_sysctl_ctx(sc->
sc_dev);
4381 child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->
sc_dev));
4383 tree = SYSCTL_ADD_NODE(ctx,
child, OID_AUTO,
"stats",
4384 CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
"URTW statistics");
4385 parent = SYSCTL_CHILDREN(tree);
4388 tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO,
"tx",
4389 CTLFLAG_RD | CTLFLAG_MPSAFE, NULL,
"Tx MAC statistics");
4390 child = SYSCTL_CHILDREN(tree);
4415#undef URTW_SYSCTL_STAT_ADD32
static void urtw_ledtask(void *, int)
static void urtw_txeof(struct usb_xfer *xfer, struct urtw_data *data)
static usb_error_t urtw_do_request(struct urtw_softc *, struct usb_device_request *, void *)
static usb_error_t urtw_get_rfchip(struct urtw_softc *)
static usb_callback_t urtw_bulk_rx_callback
static usb_error_t urtw_eprom_cs(struct urtw_softc *, int)
static usb_error_t urtw_read8e(struct urtw_softc *, int, uint8_t *)
static uint8_t urtw_8225_txpwr_ofdm[]
static int urtw_newstate(struct ieee80211vap *, enum ieee80211_state, int)
#define urtw_read16_m(sc, val, data)
static usb_error_t urtw_8225_rf_stop(struct urtw_softc *)
static void urtw_set_multi(void *)
static usb_error_t urtw_8225_rf_set_sens(struct urtw_softc *, int)
static usb_error_t urtw_get_txpwr(struct urtw_softc *)
static usb_error_t urtw_read16_c(struct urtw_softc *, int, uint16_t *)
static int urtw_detach(device_t dev)
static usb_error_t urtw_led_init(struct urtw_softc *)
static usb_error_t urtw_8225_set_txpwrlvl(struct urtw_softc *, int)
static usb_error_t urtw_8225_read(struct urtw_softc *, uint8_t, uint32_t *)
static int urtw_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *)
static usb_error_t urtw_set_macaddr(struct urtw_softc *, const uint8_t *)
static usb_error_t urtw_intr_disable(struct urtw_softc *)
static usb_error_t urtw_8225_write_c(struct urtw_softc *, uint8_t, uint16_t)
static usb_error_t urtw_8185_rf_pins_enable(struct urtw_softc *)
#define URTW_STATUS_TYPE_TXCLOSE
static uint8_t urtw_8225_gain[]
static usb_error_t urtw_eprom_read32(struct urtw_softc *, uint32_t, uint32_t *)
static usb_error_t urtw_intr_enable(struct urtw_softc *)
static usb_error_t urtw_led_ctl(struct urtw_softc *, int)
static uint8_t urtw_8225_agc[]
static void urtw_vap_delete(struct ieee80211vap *)
static void urtw_update_mcast(struct ieee80211com *)
DRIVER_MODULE(urtw, uhub, urtw_driver, urtw_devclass, NULL, 0)
static usb_error_t urtw_eprom_readbit(struct urtw_softc *, int16_t *)
#define urtw_8187_write_phy_cck(sc, val, data)
static devclass_t urtw_devclass
static usb_error_t urtw_adapter_start(struct urtw_softc *)
static int urtw_transmit(struct ieee80211com *, struct mbuf *)
static usb_error_t urtw_update_msr(struct urtw_softc *)
static usb_callback_t urtw_bulk_tx_status_callback
static struct urtw_pair urtw_8225v2_rf_part1[]
static struct urtw_pair urtw_8225v2_rf_part2[]
static uint8_t urtw_8225_tx_gain_cck_ofdm[]
static usb_error_t urtw_reset(struct urtw_softc *)
static const struct usb_config urtw_8187l_usbconfig[URTW_8187L_N_XFERS]
static void urtw_scan_end(struct ieee80211com *)
static uint16_t urtw_8225_rxgain[]
static int urtw_isbmode(uint16_t)
static uint8_t urtw_8225v2b_txpwr_cck[]
static int urtw_alloc_tx_data_list(struct urtw_softc *)
static uint8_t urtw_8225_txpwr_cck[]
static usb_error_t urtw_8187_write_phy_ofdm_c(struct urtw_softc *, uint8_t, uint32_t)
static uint8_t urtw_8225_threshold[]
static void urtw_scan_start(struct ieee80211com *)
static usb_error_t urtw_rx_enable(struct urtw_softc *)
static usb_error_t urtw_8187_write_phy_cck_c(struct urtw_softc *, uint8_t, uint32_t)
#define urtw_write16_m(sc, val, data)
static usb_error_t urtw_led_mode2(struct urtw_softc *, int)
static usb_error_t urtw_led_mode3(struct urtw_softc *, int)
static usb_error_t urtw_8225v2_rf_init(struct urtw_softc *)
static void urtw_sysctl_node(struct urtw_softc *)
static usb_error_t urtw_8187_write_phy(struct urtw_softc *, uint8_t, uint32_t)
static usb_error_t urtw_eprom_sendbits(struct urtw_softc *, int16_t *, int)
#define urtw_8225_write(sc, val, data)
static struct ieee80211vap * urtw_vap_create(struct ieee80211com *, const char[IFNAMSIZ], int, enum ieee80211_opmode, int, const uint8_t[IEEE80211_ADDR_LEN], const uint8_t[IEEE80211_ADDR_LEN])
static usb_error_t urtw_eprom_writebit(struct urtw_softc *, int16_t)
static usb_error_t urtw_get_macaddr(struct urtw_softc *)
static usb_error_t urtw_tx_enable(struct urtw_softc *sc)
static const STRUCT_USB_HOST_ID urtw_devs[]
static usb_error_t urtw_write8_c(struct urtw_softc *, int, uint8_t)
static usb_error_t urtw_rx_setconf(struct urtw_softc *)
static usb_error_t urtw_8180_set_anaparam(struct urtw_softc *, uint32_t)
static device_method_t urtw_methods[]
static usb_error_t urtw_8225v2b_rf_set_chan(struct urtw_softc *, int)
static uint16_t urtw_8225v2b_rxgain[]
static uint16_t urtw_rtl2rate(uint32_t)
static usb_error_t urtw_led_off(struct urtw_softc *, int)
SYSCTL_INT(_hw_usb_urtw, OID_AUTO, preamble_mode, CTLFLAG_RWTUN, &urtw_preamble_mode, 0, "set the preable mode (long or short)")
static usb_error_t urtw_read32_c(struct urtw_softc *, int, uint32_t *)
static uint32_t urtw_8225_channel[]
static usb_error_t urtw_8225_usb_init(struct urtw_softc *)
static usb_error_t urtw_read8_c(struct urtw_softc *, int, uint8_t *)
static usb_error_t urtw_8185_tx_antenna(struct urtw_softc *, uint8_t)
#define urtw_read32_m(sc, val, data)
#define DPRINTF(sc, m, fmt,...)
MODULE_DEPEND(urtw, wlan, 1, 1, 1)
static void urtw_update_promisc(struct ieee80211com *)
static struct mbuf * urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *data, int *rssi_p, int8_t *nf_p)
static uint8_t urtw_8225v2_txpwr_cck_ch14[]
static usb_error_t urtw_write8e(struct urtw_softc *, int, uint8_t)
static int urtw_tx_start(struct urtw_softc *, struct ieee80211_node *, struct mbuf *, struct urtw_data *, int)
static usb_error_t urtw_8225v2b_rf_init(struct urtw_softc *)
static usb_error_t urtw_write32_c(struct urtw_softc *, int, uint32_t)
static void urtw_updateslot(struct ieee80211com *)
static void urtw_free_rx_data_list(struct urtw_softc *)
static struct urtw_data * urtw_getbuf(struct urtw_softc *sc)
static struct urtw_pair urtw_8225v2b_rf_part2[]
static uint16_t urtw_8225v2_rxgain[]
#define URTW_REV_RTL8187L
static usb_error_t urtw_write16_c(struct urtw_softc *, int, uint16_t)
static void urtw_init(struct urtw_softc *)
static usb_callback_t urtw_bulk_tx_callback
static uint8_t urtw_8225v2_tx_gain_cck_ofdm[]
static void urtw_txstatus_eof(struct usb_xfer *xfer)
static usb_error_t urtw_set_rate(struct urtw_softc *)
static usb_error_t urtw_8225v2b_set_txpwrlvl(struct urtw_softc *, int)
static void urtw_free_tx_data_list(struct urtw_softc *)
static usb_error_t urtw_8225_rf_init(struct urtw_softc *)
static void urtw_getradiocaps(struct ieee80211com *, int, int *, struct ieee80211_channel[])
static void urtw_parent(struct ieee80211com *)
static struct urtw_pair urtw_8225v2b_rf_part0[]
static usb_error_t urtw_led_mode1(struct urtw_softc *, int)
static struct urtw_data * _urtw_getbuf(struct urtw_softc *sc)
static int urtw_preamble_mode
#define URTW_SYSCTL_STAT_ADD32(c, h, n, p, d)
#define urtw_read8_m(sc, val, data)
#define urtw_8187_write_phy_ofdm(sc, val, data)
static usb_error_t urtw_led_mode0(struct urtw_softc *, int)
static int urtw_alloc_data_list(struct urtw_softc *sc, struct urtw_data data[], int ndata, int maxsz, void *dma_buf)
static usb_error_t urtw_8225v2_setgain(struct urtw_softc *, int16_t)
static struct urtw_pair urtw_8225_rf_part1[]
static usb_error_t urtw_8225_setgain(struct urtw_softc *, int16_t)
static int urtw_compute_txtime(uint16_t, uint16_t, uint8_t, uint8_t)
static SYSCTL_NODE(_hw_usb, OID_AUTO, urtw, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB Realtek 8187L")
static void urtw_abort_xfers(struct urtw_softc *)
static usb_error_t urtw_8225v2_set_txpwrlvl(struct urtw_softc *, int)
#define urtw_write32_m(sc, val, data)
static struct urtw_pair urtw_8225v2_rf_part3[]
static void urtw_stop(struct urtw_softc *)
static uint8_t urtw_8225v2b_txpwr_cck_ch14[]
static const struct usb_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS]
static usb_error_t urtw_led_on(struct urtw_softc *, int)
static void urtw_set_channel(struct ieee80211com *)
static uint16_t urtw_rate2dbps(uint16_t rate)
static void urtw_watchdog(void *)
static usb_error_t urtw_8225v2_rf_set_chan(struct urtw_softc *, int)
static void urtw_free_data_list(struct urtw_softc *, struct urtw_data data[], int, int)
static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t)
static void urtw_start(struct urtw_softc *)
static uint8_t urtw_8225v2_gain_bg[]
static usb_error_t urtw_8185_set_anaparam2(struct urtw_softc *, uint32_t)
static usb_error_t urtw_8225_write_s16(struct urtw_softc *, uint8_t, int, uint16_t *)
static void urtw_led_ch(void *)
static usb_error_t urtw_8187b_cmd_reset(struct urtw_softc *)
static struct urtw_pair urtw_8225_rf_part3[]
static int urtw_alloc_rx_data_list(struct urtw_softc *)
USB_PNP_HOST_INFO(urtw_devs)
#define URTW_REV_RTL8187B
static usb_error_t urtw_8225_isv2(struct urtw_softc *, int *)
static usb_error_t urtw_adapter_start_b(struct urtw_softc *)
#define urtw_write8_m(sc, val, data)
static void urtw_updateslottask(void *, int)
static int urtw_attach(device_t dev)
static uint8_t urtw_8225_txpwr_cck_ch14[]
static int urtw_match(device_t dev)
static struct urtw_pair urtw_8225v2b_rf_part1[]
static uint8_t urtw_8225v2_txpwr_cck[]
static uint8_t urtw_8225z2_agc[]
static usb_error_t urtw_8225_rf_set_chan(struct urtw_softc *, int)
static usb_error_t urtw_eprom_ck(struct urtw_softc *)
static usb_error_t urtw_led_blink(struct urtw_softc *)
static struct urtw_pair urtw_8225_rf_part2[]
static struct urtw_pair urtw_ratetable[]
static driver_t urtw_driver
#define URTW_FEMR_FOR_8187B
#define URTW_TX_FLAG_MOREFRAG
#define URTW_8225_ANAPARAM_ON
#define URTW_EPROM_RFCHIPID_RTL8225Z2
#define URTW_8225_ADDR_5_MAGIC
#define URTW_RESP_MAX_RATE_SHIFT
#define URTW_8225_ADDR_2_DATA_MAGIC1
#define URTW_DEFAULT_TX_RETRY
#define URTW_BB_HOST_BANG_CLK
#define URTW_CW_CONF_PERPACKET_CW
#define URTW_RX_FILTER_PWR
#define URTW_8187_GETREGS_REQ
#define URTW_TX_LOOPBACK_MAC
#define URTW_MSR_LINK_ENEDCA
#define URTW_TX_RTSRETRY_MASK
#define URTW_MSR_LINK_NONE
#define URTW_CARRIER_SCOUNT
#define URTW_8225_ADDR_C_MAGIC
#define URTW_MAX_RX_DMA_2048
#define URTW_CONFIG3_GNT_SELECT
#define URTW_EPROM_MACADDR
#define URTW_LED_PIN_GPIO0
#define URTW_LED_BLINK_SLOWLY
#define URTW_MSR_LINK_HOSTAP
#define URTW_RATE_FALLBACK
#define URTW_EPROM_RFCHIPID_RTL8225U
#define URTW_8225_ADDR_0_MAGIC
#define URTW_8225_ADDR_1_MAGIC
#define URTW_RATE_FALLBACK_ENABLE
#define URTW_8225_ADDR_0_DATA_MAGIC5
#define URTW_BB_HOST_BANG_RW
#define URTW_8225_ADDR_6_MAGIC
#define URTW_CMD_TX_ENABLE
#define URTW_RF_PINS_MAGIC1
#define URTW_8225_ANAPARAM2_ON
#define URTW_8225_ADDR_2_MAGIC
#define URTW_8187_SETREGS_REQ
#define URTW_MSR_LINK_STA
#define URTW_MSR_LINK_ADHOC
#define URTW_RX_FILTER_CRCERR
#define URTW_EPROM_CMD_PROGRAM_MODE
#define URTW_EPROM_CID_HW_LED
#define URTW_SW_LED_MODE0
#define URTW_RX_FILTER_MCAST
#define URTW_EPROM_CMD_NORMAL
#define URTW_8187B_8225_ANAPARAM3_OFF
#define URTW_TX_FLAG_RTSRATE_SHIFT
#define URTW_RF_PINS_INPUT
#define URTW_EPROM_TXPW_BASE
#define URTW_RX_AUTORESETPHY
#define URTW_8225_ADDR_7_MAGIC
#define URTW_TX_RTSRETRY_SHIFT
#define URTW_BEACON_INTERVAL_TIME
#define URTW_RF_PINS_MAGIC2
#define URTW_BEACON_INTERVAL
#define URTW_8187B_8225_ANAPARAM3_ON
#define URTW_8225_ADDR_3_DATA_MAGIC1
#define URTW_TX_LOOPBACK_NONE
#define URTW_8225_ADDR_3_MAGIC
#define URTW_CMD_RX_ENABLE
#define URTW_8225_ADDR_8_MAGIC
#define URTW_8225_ADDR_0_DATA_MAGIC2
#define URTW_EPROM_CID_SERCOMM_PS
#define URTW_LED_POWER_ON_BLINK
#define URTW_LED_CTL_LINK
#define URTW_RF_PINS_MAGIC3
#define URTW_LED_BLINK_NORMAL
#define URTW_TX_AGC_CTL_PERPACKET_GAIN
#define URTW_8225_ADDR_0_DATA_MAGIC3
#define URTW_8225_RF_DEF_SENS
#define URTW_8225_RF_MAX_SENS
#define URTW_EPROM_ENABLE
#define URTW_8225_ADDR_0_DATA_MAGIC1
#define URTW_TX_R8187vD_B
#define URTW_EPROM_WRITEBIT
#define URTW_RF_PINS_MAGIC5
#define URTW_EPROM_CMD_SHIFT
#define URTW_8225_ADDR_9_MAGIC
#define URTW_EPROM_CID_MASK
#define URTW_GPIO_DATA_MAGIC1
#define URTW_RX_FILTER_CTL
#define URTW_EPROM_CMD_LOAD
#define URTW_TX_MXDMA_MASK
#define URTW_8225_ADDR_5_DATA_MAGIC1
#define URTW_EPROM_CID_ALPHA0
#define URTW_TX_GAIN_OFDM
#define URTW_RF_PINS_OUTPUT
#define URTW_8225_ADDR_8_DATA_MAGIC1
#define URTW_TX_DPRETRY_MASK
#define URTW_CONFIG3_ANAPARAM_WRITE
#define URTW_RX_FILTER_ICVERR
#define URTW_8225_ADDR_9_DATA_MAGIC1
#define URTW_SW_LED_MODE2
#define URTW_DEFAULT_RTS_RETRY
#define URTW_TX_FLAG_SPLCP
#define URTW_8225_ANAPARAM2_OFF
#define URTW_CONFIG_INDEX
#define URTW_EPROM_CID_RSVD1
#define URTW_SW_LED_MODE3
#define URTW_EPROM_DISABLE
#define URTW_8225_ADDR_0_DATA_MAGIC6
#define URTW_8187B_8225_ANAPARAM2_OFF
#define URTW_TX_DISREQQSIZE
#define URTW_8225_ADDR_6_DATA_MAGIC1
#define URTW_GP_ENABLE_DATA_MAGIC1
#define URTW_8225_ADDR_C_DATA_MAGIC2
#define URTW_8225_ANAPARAM_OFF
#define URTW_RX_FLAG_RXRATE_SHIFT
#define URTW_TX_MXDMA_2048
#define URTW_RX_8187L_RSSI_MASK
#define URTW_RF_PINS_ENABLE
#define URTW_LED_CTL_POWER_ON
#define URTW_CONFIG4_VCOOFF
#define URTW_TX_HW_SEQNUM
#define URTW_EPROM_CID_RSVD0
#define URTW_RX_CHECK_BSSID
#define URTW_EPROM_READBIT
#define URTW_RX_FILTER_MNG
#define URTW_RF_PINS_SELECT
#define URTW_8225_ADDR_2_DATA_MAGIC2
#define URTW_CW_CONF_PERPACKET_RETRY
#define URTW_8225_ADDR_0_DATA_MAGIC4
#define URTW_8187B_8225_ANAPARAM_OFF
#define URTW_8225_ADDR_6_DATA_MAGIC2
#define URTW_RX_FILTER_NICMAC
#define URTW_TX_FLAG_TXRATE_SHIFT
#define URTW_LED_BLINK_CM3
#define URTW_RX_RSSI_MASK
#define URTW_TX_FLAG_NO_ENC
#define URTW_EPROM_RFCHIPID
#define URTW_RESP_MIN_RATE_SHIFT
#define URTW_RCR_ONLYERLPKT
#define URTW_BB_HOST_BANG_EN
#define URTW_TX_DPRETRY_SHIFT
#define URTW_8187B_8225_ANAPARAM2_ON
#define URTW_EPROM_CMD_NORMAL_MODE
#define URTW_RX_FILTER_BCAST
#define URTW_RF_PINS_MAGIC4
#define URTW_RX_FILTER_DATA
#define URTW_8225_ADDR_C_DATA_MAGIC1
#define URTW_RX_FIFO_THRESHOLD_NONE
#define URTW_SW_LED_MODE1
#define URTW_8187B_8225_ANAPARAM_ON
#define URTW_EPROM_CMD_CONFIG
#define URTW_RF_PINS_OUTPUT_MAGIC1
#define URTW_RX_FILTER_ALLMAC
#define URTW_TX_DATA_LIST_COUNT
#define URTW_TX_RADIOTAP_PRESENT
#define URTW_PRIORITY_LOW
#define URTW_RTL8187B_REV_E
#define URTW_8187B_TXPIPE_BK
@ URTW_8187B_BULK_TX_EP12
@ URTW_8187B_BULK_TX_STATUS
#define URTW_8187B_TXPIPE_VI
@ URTW_8187L_BULK_TX_NORMAL
#define URTW_8187B_TXPIPE_BE
#define URTW_8187B_TXPIPE_MAX
#define URTW_RTL8187B_REV_B
#define URTW_PREAMBLE_MODE_SHORT
#define URTW_RX_RADIOTAP_PRESENT
#define URTW_DATA_TIMEOUT
#define URTW_EEPROM_93C56
#define URTW_EEPROM_93C46
#define URTW_RX_DATA_LIST_COUNT
#define URTW_PRIORITY_NORMAL
#define URTW_ASSERT_LOCKED(sc)
#define URTW_8187B_TXPIPE_VO
#define URTW_PREAMBLE_MODE_LONG
#define URTW_RTL8187B_REV_D
struct ieee80211_node * ni
struct urtw_rx_radiotap_header sc_rxtap
struct ieee80211_channel * sc_curchan
uint8_t sc_gpio_blinktime
usb_error_t(* sc_rf_init)(struct urtw_softc *)
struct task sc_updateslot_task
urtw_datahead sc_rx_active
struct usb_callout sc_led_ch
struct usb_device * sc_udev
urtw_datahead sc_rx_inactive
uint8_t sc_txpwr_ofdm_base
urtw_datahead sc_tx_inactive
uint8_t sc_txpwr_ofdm[URTW_MAX_CHANNELS]
struct urtw_data sc_tx[URTW_TX_DATA_LIST_COUNT]
usb_error_t(* sc_rf_set_chan)(struct urtw_softc *, int)
urtw_datahead sc_tx_pending
struct callout sc_watchdog_ch
struct urtw_tx_radiotap_header sc_txtap
uint8_t sc_gpio_ledinprogress
uint8_t sc_txpwr_cck[URTW_MAX_CHANNELS]
struct urtw_stats sc_stats
usb_error_t(* sc_rf_set_sens)(struct urtw_softc *, int)
struct urtw_data sc_rx[URTW_RX_DATA_LIST_COUNT]
struct ieee80211com sc_ic
urtw_datahead sc_tx_active
usb_error_t(* sc_rf_stop)(struct urtw_softc *)
enum ieee80211_state sc_state
uint8_t sc_txpwr_cck_base
struct usb_xfer * sc_xfer[URTW_8187B_N_XFERS]
uint8_t sc_gpio_blinkstate
int(* newstate)(struct ieee80211vap *, enum ieee80211_state, int)
enum usb_hc_mode usb_mode
struct usbd_lookup_info info
struct usb_device * device
struct usb_xfer_flags flags
struct usb_xfer_flags flags
#define UT_WRITE_VENDOR_DEVICE
#define UT_READ_VENDOR_DEVICE
const char * usbd_errstr(usb_error_t err)
int usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id, struct usb_attach_arg *uaa)
usb_error_t usbd_do_request_flags(struct usb_device *udev, struct mtx *mtx, struct usb_device_request *req, void *data, uint16_t flags, uint16_t *actlen, usb_timeout_t timeout)
void usbd_transfer_submit(struct usb_xfer *xfer)
void usbd_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup)
void usbd_xfer_set_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex, void *ptr, usb_frlength_t len)
void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, usb_frlength_t len)
void * usbd_xfer_get_frame_buffer(struct usb_xfer *xfer, usb_frcount_t frindex)
usb_error_t usbd_transfer_setup(struct usb_device *udev, const uint8_t *ifaces, struct usb_xfer **ppxfer, const struct usb_config *setup_start, uint16_t n_setup, void *priv_sc, struct mtx *xfer_mtx)
void usbd_transfer_start(struct usb_xfer *xfer)
void usbd_transfer_drain(struct usb_xfer *xfer)
void * usbd_xfer_softc(struct usb_xfer *xfer)
void usbd_xfer_set_stall(struct usb_xfer *xfer)
void usbd_transfer_stop(struct usb_xfer *xfer)
void usbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen, int *aframes, int *nframes)
usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer)
void device_set_usb_desc(device_t dev)
void usb_pause_mtx(struct mtx *mtx, int timo)
#define usb_callout_init_mtx(c, m, f)
#define usb_callout_reset(c,...)
#define usb_callout_drain(c)
#define USB_ST_TRANSFERRED
void() usb_callback_t(struct usb_xfer *, usb_error_t)
#define USB_VPI(vend, prod, info)
#define STRUCT_USB_HOST_ID
#define USB_GET_DRIVER_INFO(did)
#define usb_callout_stop(c)
#define USB_GET_STATE(xfer)