00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef _WLAN_COMPAT_H
00049 #define _WLAN_COMPAT_H
00050
00051
00052
00053
00054
00055
00056 #define WLAN_Ix86 1
00057 #define WLAN_PPC 2
00058 #define WLAN_Ix96 3
00059 #define WLAN_ARM 4
00060 #define WLAN_ALPHA 5
00061 #define WLAN_MIPS 6
00062 #define WLAN_HPPA 7
00063 #define WLAN_SPARC 8
00064 #define WLAN_SH 9
00065 #define WLAN_x86_64 10
00066
00067 #define WLAN_PCAT 1
00068 #define WLAN_MBX 2
00069 #define WLAN_RPX 3
00070 #define WLAN_LWARCH 4
00071 #define WLAN_PMAC 5
00072 #define WLAN_SKIFF 6
00073 #define WLAN_BITSY 7
00074 #define WLAN_ALPHAARCH 7
00075 #define WLAN_MIPSARCH 9
00076 #define WLAN_HPPAARCH 10
00077 #define WLAN_SPARCARCH 11
00078 #define WLAN_SHARCH 12
00079
00080
00081
00082
00083
00084
00085 #if (defined(CONFIG_PPC) || defined(CONFIG_8xx) || defined(__powerpc__))
00086 #ifndef __ppc__
00087 #define __ppc__
00088 #endif
00089 #endif
00090
00091 #if defined(__KERNEL__)
00092 #if defined(__x86_64__)
00093 #define WLAN_CPU_FAMILY WLAN_x86_64
00094 #define WLAN_SYSARCH WLAN_PCAT
00095 #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
00096 #define WLAN_CPU_FAMILY WLAN_Ix86
00097 #define WLAN_SYSARCH WLAN_PCAT
00098 #elif defined(__ppc__)
00099 #define WLAN_CPU_FAMILY WLAN_PPC
00100 #if defined(CONFIG_MBX)
00101 #define WLAN_SYSARCH WLAN_MBX
00102 #elif defined(CONFIG_RPXLITE)
00103 #define WLAN_SYSARCH WLAN_RPX
00104 #elif defined(CONFIG_RPXCLASSIC)
00105 #define WLAN_SYSARCH WLAN_RPX
00106 #else
00107 #define WLAN_SYSARCH WLAN_PMAC
00108 #endif
00109 #elif defined(__arm__)
00110 #define WLAN_CPU_FAMILY WLAN_ARM
00111 #define WLAN_SYSARCH WLAN_SKIFF
00112 #elif defined(__alpha__)
00113 #define WLAN_CPU_FAMILY WLAN_ALPHA
00114 #define WLAN_SYSARCH WLAN_ALPHAARCH
00115 #elif defined(__mips__)
00116 #define WLAN_CPU_FAMILY WLAN_MIPS
00117 #define WLAN_SYSARCH WLAN_MIPSARCH
00118 #elif defined(__hppa__)
00119 #define WLAN_CPU_FAMILY WLAN_HPPA
00120 #define WLAN_SYSARCH WLAN_HPPAARCH
00121 #elif defined(__sparc__)
00122 #define WLAN_CPU_FAMILY WLAN_SPARC
00123 #define WLAN_SYSARCH WLAN_SPARC
00124 #elif defined(__sh__)
00125 #define WLAN_CPU_FAMILY WLAN_SH
00126 #define WLAN_SYSARCH WLAN_SHARCH
00127 #ifndef __LITTLE_ENDIAN__
00128 #define __LITTLE_ENDIAN__
00129 #endif
00130 #else
00131 #error "No CPU identified!"
00132 #endif
00133 #endif
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 #if ((WLAN_HOSTIF == WLAN_PCI) || (WLAN_HOSTIF == WLAN_PLX))
00147 #if ((WLAN_SYSARCH == WLAN_SKIFF) || (WLAN_SYSARCH == WLAN_PMAC) || (WLAN_SYSARCH == WLAN_SPARC))
00148 #define REVERSE_ENDIAN
00149 #endif
00150 #endif
00151
00152
00153
00154
00155
00156 #define BIT0 0x00000001
00157 #define BIT1 0x00000002
00158 #define BIT2 0x00000004
00159 #define BIT3 0x00000008
00160 #define BIT4 0x00000010
00161 #define BIT5 0x00000020
00162 #define BIT6 0x00000040
00163 #define BIT7 0x00000080
00164 #define BIT8 0x00000100
00165 #define BIT9 0x00000200
00166 #define BIT10 0x00000400
00167 #define BIT11 0x00000800
00168 #define BIT12 0x00001000
00169 #define BIT13 0x00002000
00170 #define BIT14 0x00004000
00171 #define BIT15 0x00008000
00172 #define BIT16 0x00010000
00173 #define BIT17 0x00020000
00174 #define BIT18 0x00040000
00175 #define BIT19 0x00080000
00176 #define BIT20 0x00100000
00177 #define BIT21 0x00200000
00178 #define BIT22 0x00400000
00179 #define BIT23 0x00800000
00180 #define BIT24 0x01000000
00181 #define BIT25 0x02000000
00182 #define BIT26 0x04000000
00183 #define BIT27 0x08000000
00184 #define BIT28 0x10000000
00185 #define BIT29 0x20000000
00186 #define BIT30 0x40000000
00187 #define BIT31 0x80000000
00188
00189 #include <linux/types.h>
00190
00191 typedef u_int8_t UINT8;
00192 typedef u_int16_t UINT16;
00193 typedef u_int32_t UINT32;
00194
00195 typedef int8_t INT8;
00196 typedef int16_t INT16;
00197 typedef int32_t INT32;
00198
00199 typedef unsigned int UINT;
00200 typedef signed int INT;
00201
00202 typedef u_int64_t UINT64;
00203 typedef int64_t INT64;
00204
00205 #define UINT8_MAX (0xffUL)
00206 #define UINT16_MAX (0xffffUL)
00207 #define UINT32_MAX (0xffffffffUL)
00208
00209 #define INT8_MAX (0x7fL)
00210 #define INT16_MAX (0x7fffL)
00211 #define INT32_MAX (0x7fffffffL)
00212
00213
00214
00215
00216 #define __WLAN_ATTRIB_PACK__ __attribute__ ((packed))
00217
00218
00219
00220
00221
00222 #ifndef WLAN_DBVAR
00223 #define WLAN_DBVAR wlan_debug
00224 #endif
00225
00226 #define WLAN_LOG_ERROR(x,args...) printk(KERN_ERR "%s: " x , __FUNCTION__ , ##args);
00227
00228 #define WLAN_LOG_WARNING(x,args...) printk(KERN_WARNING "%s: " x , __FUNCTION__ , ##args);
00229
00230 #define WLAN_LOG_NOTICE(x,args...) printk(KERN_NOTICE "%s: " x , __FUNCTION__ , ##args);
00231
00232 #define WLAN_LOG_INFO(args... ) printk(KERN_INFO args)
00233
00234 #if defined(WLAN_INCLUDE_DEBUG)
00235 #define WLAN_ASSERT(c) if ((!(c)) && WLAN_DBVAR >= 1) { \
00236 WLAN_LOG_DEBUG(1, "Assertion failure!\n"); }
00237 #define WLAN_HEX_DUMP( l, x, p, n) if( WLAN_DBVAR >= (l) ){ \
00238 int __i__; \
00239 printk(KERN_DEBUG x ":"); \
00240 for( __i__=0; __i__ < (n); __i__++) \
00241 printk( " %02x", ((UINT8*)(p))[__i__]); \
00242 printk("\n"); }
00243 #define DBFENTER { if ( WLAN_DBVAR >= 5 ){ WLAN_LOG_DEBUG(3,"---->\n"); } }
00244 #define DBFEXIT { if ( WLAN_DBVAR >= 5 ){ WLAN_LOG_DEBUG(3,"<----\n"); } }
00245
00246 #define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , ##args );
00247 #else
00248 #define WLAN_ASSERT(c)
00249 #define WLAN_HEX_DUMP( l, s, p, n)
00250 #define DBFENTER
00251 #define DBFEXIT
00252
00253 #define WLAN_LOG_DEBUG(l, s, args...)
00254 #endif
00255
00256 #ifdef CONFIG_SMP
00257 #define __SMP__ 1
00258 #endif
00259
00260 #ifndef KERNEL_VERSION
00261 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
00262 #endif
00263
00264 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,17))
00265 #define CONFIG_NETLINK 1
00266 #endif
00267
00268 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0))
00269 #define kfree_s(a, b) kfree((a))
00270 #endif
00271
00272 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18))
00273 #ifndef init_waitqueue_head
00274 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,16))
00275 #define init_waitqueue_head(p) (*(p) = NULL)
00276 #else
00277 #define init_waitqueue_head(p) init_waitqueue(p)
00278 #endif
00279 typedef struct wait_queue *wait_queue_head_t;
00280 typedef struct wait_queue wait_queue_t;
00281 #define set_current_state(b) { current->state = (b); mb(); }
00282 #define init_waitqueue_entry(a, b) { (a)->task = current; }
00283 #endif
00284 #endif
00285
00286 #ifndef wait_event_interruptible_timeout
00287
00288
00289
00290
00291 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)) // fixme?
00292
00293 #define __wait_event_interruptible_timeout(wq, condition, ret) \
00294 do { \
00295 wait_queue_t __wait; \
00296 init_waitqueue_entry(&__wait, current); \
00297 \
00298 add_wait_queue(&wq, &__wait); \
00299 for (;;) { \
00300 set_current_state(TASK_INTERRUPTIBLE); \
00301 if (condition) \
00302 break; \
00303 if (!signal_pending(current)) { \
00304 ret = schedule_timeout(ret) ; \
00305 if (!ret) \
00306 break; \
00307 continue; \
00308 } \
00309 ret = -ERESTARTSYS; \
00310 break; \
00311 } \
00312 set_current_state(TASK_RUNNING); \
00313 remove_wait_queue(&wq, &__wait); \
00314 } while (0)
00315
00316 #else // 2.2
00317
00318
00319 #define __wait_event_interruptible_timeout(wq, condition, ret) \
00320 do { \
00321 struct wait_queue __wait; \
00322 \
00323 __wait.task = current; \
00324 add_wait_queue(&wq, &__wait); \
00325 for (;;) { \
00326 current->state = TASK_INTERRUPTIBLE; \
00327 if (condition) \
00328 break; \
00329 if (!signal_pending(current)) { \
00330 ret = schedule_timeout(ret); \
00331 if (!ret) \
00332 break; \
00333 continue; \
00334 } \
00335 ret = -ERESTARTSYS; \
00336 break; \
00337 } \
00338 current->state = TASK_RUNNING; \
00339 remove_wait_queue(&wq, &__wait); \
00340 } while (0)
00341
00342 #endif // version >= 2.4
00343
00344 #define wait_event_interruptible_timeout(wq, condition, timeout) \
00345 ({ \
00346 long __ret = timeout; \
00347 if (!(condition)) \
00348 __wait_event_interruptible_timeout(wq, condition, __ret); \
00349 __ret; \
00350 })
00351
00352 #endif
00353
00354 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
00355 #ifdef _LINUX_LIST_H
00356
00357 static inline void list_move_tail(struct list_head *list,
00358 struct list_head *head)
00359 {
00360 __list_del(list->prev, list->next);
00361 list_add_tail(list, head);
00362 }
00363
00364 static inline void __list_splice(struct list_head *list,
00365 struct list_head *head)
00366 {
00367 struct list_head *first = list->next;
00368 struct list_head *last = list->prev;
00369 struct list_head *at = head->next;
00370
00371 first->prev = head;
00372 head->next = first;
00373
00374 last->next = at;
00375 at->prev = last;
00376 }
00377
00378 static inline void list_move(struct list_head *list, struct list_head *head)
00379 {
00380 __list_del(list->prev, list->next);
00381 list_add(list, head);
00382 }
00383
00384 static inline void list_splice_init(struct list_head *list,
00385 struct list_head *head)
00386 {
00387 if (!list_empty(list)) {
00388 __list_splice(list, head);
00389 INIT_LIST_HEAD(list);
00390 }
00391 }
00392
00393
00394 #endif // LIST_H
00395 #endif
00396
00397 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,90))
00398 #define spin_lock(l) do { } while (0)
00399 #define spin_unlock(l) do { } while (0)
00400 #define spin_lock_irqsave(l,f) do { save_flags(f); cli(); } while (0)
00401 #define spin_unlock_irqrestore(l,f) do { restore_flags(f); } while (0)
00402 #define spin_lock_init(s) do { } while (0)
00403 #define spin_trylock(l) (1)
00404 typedef int spinlock_t;
00405 #endif
00406
00407 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) // XXX ???
00408 #define spin_lock_bh spin_lock
00409 #endif
00410
00411 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
00412 #ifdef CONFIG_SMP
00413 #define spin_is_locked(x) (*(volatile char *)(&(x)->lock) <= 0)
00414 #else
00415 #define spin_is_locked(l) (0)
00416 #endif
00417 #endif
00418
00419 #ifdef _LINUX_PROC_FS_H
00420 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,25))
00421
00422 extern inline struct proc_dir_entry *
00423 create_proc_read_entry(const char *name, mode_t mode,
00424 struct proc_dir_entry *base,
00425 read_proc_t *read_proc, void *data)
00426 {
00427 struct proc_dir_entry *res = create_proc_entry(name, mode, base);
00428 if (res) {
00429 res->read_proc = read_proc;
00430 res->data = data;
00431 }
00432 return res;
00433 }
00434 #endif
00435
00436 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,29))
00437 #ifndef proc_mkdir
00438 #define proc_mkdir(name, root) create_proc_entry(name, S_IFDIR, root)
00439 #endif
00440 #endif
00441 #endif
00442
00443 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
00444 #ifndef INIT_TQUEUE
00445 #define INIT_TQUEUE(_tq, _routine, _data) \
00446 do { \
00447 (_tq)->next = NULL; \
00448 (_tq)->sync = 0; \
00449 PREPARE_TQUEUE((_tq), (_routine), (_data)); \
00450 } while (0)
00451 #define PREPARE_TQUEUE(_tq, _routine, _data) \
00452 do { \
00453 (_tq)->routine = _routine; \
00454 (_tq)->data = _data; \
00455 } while (0)
00456 #endif
00457
00458 #ifndef INIT_WORK
00459 #define work_struct tq_struct
00460
00461 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
00462 #define schedule_work(a) queue_task(a, &tq_scheduler)
00463 #else
00464 #define schedule_work(a) schedule_task(a)
00465 #endif
00466
00467 #define flush_scheduled_work flush_scheduled_tasks
00468 #define INIT_WORK(_wq, _routine, _data) INIT_TQUEUE(_wq, _routine, _data)
00469 #define PREPARE_WORK(_wq, _routine, _data) PREPARE_TQUEUE(_wq, _routine, _data)
00470 #endif
00471 #endif // < 2.5 kernel
00472
00473
00474 #ifndef DECLARE_TASKLET
00475 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
00476 #define tasklet_schedule(a) queue_task(a, &tq_scheduler)
00477 #else
00478 #define tasklet_schedule(a) schedule_task(a)
00479 #endif
00480 #endif
00481
00482
00483 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38))
00484 typedef struct device netdevice_t;
00485 #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4))
00486 typedef struct net_device netdevice_t;
00487 #else
00488 #undef netdevice_t
00489 typedef struct net_device netdevice_t;
00490 #endif
00491
00492 #ifdef WIRELESS_EXT
00493 #if (WIRELESS_EXT < 13)
00494 struct iw_request_info
00495 {
00496 __u16 cmd;
00497 __u16 flags;
00498 };
00499 #endif
00500 #endif
00501
00502
00503 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,18))
00504 #define MODULE_PARM(a,b) extern int __bogus_decl
00505 #define MODULE_AUTHOR(a) extern int __bogus_decl
00506 #define MODULE_DESCRIPTION(a) extern int __bogus_decl
00507 #define MODULE_SUPPORTED_DEVICE(a) extern int __bogus_decl
00508 #undef GET_USE_COUNT
00509 #define GET_USE_COUNT(m) mod_use_count_
00510 #endif
00511
00512 #ifndef MODULE_OWNER
00513 #define MODULE_OWNER(a) extern int __bogus_decl
00514 #define ANCIENT_MODULE_CODE
00515 #endif
00516
00517 #ifndef MODULE_LICENSE
00518 #define MODULE_LICENSE(m) extern int __bogus_decl
00519 #endif
00520
00521
00522 #ifndef MODULE_DEVICE_TABLE
00523 #define MODULE_DEVICE_TABLE(foo,bar)
00524 #endif
00525
00526 #define wlan_minutes2ticks(a) ((a)*(wlan_ticks_per_sec * 60))
00527 #define wlan_seconds2ticks(a) ((a)*(wlan_ticks_per_sec))
00528
00529 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,47))
00530 #define NEW_MODULE_CODE
00531 #ifdef ANCIENT_MODULE_CODE
00532 #undef ANCIENT_MODULE_CODE
00533 #endif
00534 #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25))
00535 #define module_param(name, type, perm) \
00536 static inline void *__check_existence_##name(void) { return &name; } \
00537 MODULE_PARM(name, _MODULE_PARM_STRING_ ## type)
00538
00539 #define _MODULE_PARM_STRING_byte "b"
00540 #define _MODULE_PARM_STRING_short "h"
00541 #define _MODULE_PARM_STRING_ushort "h"
00542 #define _MODULE_PARM_STRING_int "i"
00543 #define _MODULE_PARM_STRING_uint "i"
00544 #define _MODULE_PARM_STRING_long "l"
00545 #define _MODULE_PARM_STRING_ulong "l"
00546 #define _MODULE_PARM_STRING_bool "i"
00547 #endif
00548
00549
00550 #ifndef IRQ_NONE
00551 typedef void irqreturn_t;
00552 #define IRQ_NONE
00553 #define IRQ_HANDLED
00554 #define IRQ_RETVAL(x)
00555 #endif
00556
00557 #ifndef in_atomic
00558 #define in_atomic() 0
00559 #endif
00560
00561 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) // fixme
00562 #define URB_ASYNC_UNLINK USB_ASYNC_UNLINK
00563 #define usb_fill_bulk_urb FILL_BULK_URB
00564 #define usb_kill_urb usb_unlink_urb
00565 #else
00566 #define USB_QUEUE_BULK 0
00567 #endif
00568
00569 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
00570 #define free_netdev(x) kfree(x)
00571 #endif
00572
00573 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
00574 #define eth_hdr(x) (x)->mac.ethernet
00575 #endif
00576
00577 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
00578 #define del_timer_sync(a) del_timer(a)
00579 #endif
00580
00581
00582 #if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) && \
00583 !defined(pcmcia_access_configuration_register))
00584 #define pcmcia_access_configuration_register(handle, reg) \
00585 CardServices(AccessConfigurationRegister, handle, reg)
00586 #define pcmcia_register_client(handle, reg) \
00587 CardServices(RegisterClient, handle, reg)
00588 #define pcmcia_deregister_client(handle) \
00589 CardServices(DeregisterClient, handle)
00590 #define pcmcia_get_first_tuple(handle, tuple) \
00591 CardServices(GetFirstTuple, handle, tuple)
00592 #define pcmcia_get_next_tuple(handle, tuple) \
00593 CardServices(GetNextTuple, handle, tuple)
00594 #define pcmcia_get_tuple_data(handle, tuple) \
00595 CardServices(GetTupleData, handle, tuple)
00596 #define pcmcia_parse_tuple(handle, tuple, parse) \
00597 CardServices(ParseTuple, handle, tuple, parse)
00598 #define pcmcia_get_configuration_info(handle, config) \
00599 CardServices(GetConfigurationInfo, handle, config)
00600 #define pcmcia_request_io(handle, req) \
00601 CardServices(RequestIO, handle, req)
00602 #define pcmcia_request_irq(handle, req) \
00603 CardServices(RequestIRQ, handle, req)
00604 #define pcmcia_request_configuration(handle, req) \
00605 CardServices(RequestConfiguration, handle, req)
00606 #define pcmcia_release_configuration(handle) \
00607 CardServices(ReleaseConfiguration, handle)
00608 #define pcmcia_release_io(handle, req) \
00609 CardServices(ReleaseIO, handle, req)
00610 #define pcmcia_release_irq(handle, req) \
00611 CardServices(ReleaseIRQ, handle, req)
00612 #define pcmcia_release_window(win) \
00613 CardServices(ReleaseWindow, win)
00614 #define pcmcia_get_card_services_info(info) \
00615 CardServices(GetCardServicesInfo, info)
00616 #define pcmcia_report_error(handle, err) \
00617 CardServices(ReportError, handle, err)
00618 #endif
00619
00620
00621
00622
00623
00624 #define ieee2host16(n) __le16_to_cpu(n)
00625 #define ieee2host32(n) __le32_to_cpu(n)
00626 #define host2ieee16(n) __cpu_to_le16(n)
00627 #define host2ieee32(n) __cpu_to_le32(n)
00628
00629 #if (WLAN_CPU_FAMILY != WLAN_MIPS)
00630 typedef UINT32 phys_t;
00631 #endif
00632
00633 #if (WLAN_CPU_FAMILY == WLAN_PPC)
00634 #define wlan_inw(a) in_be16((unsigned short *)((a)+_IO_BASE))
00635 #define wlan_inw_le16_to_cpu(a) inw((a))
00636 #define wlan_outw(v,a) out_be16((unsigned short *)((a)+_IO_BASE), (v))
00637 #define wlan_outw_cpu_to_le16(v,a) outw((v),(a))
00638 #else
00639 #define wlan_inw(a) inw((a))
00640 #define wlan_inw_le16_to_cpu(a) __cpu_to_le16(inw((a)))
00641 #define wlan_outw(v,a) outw((v),(a))
00642 #define wlan_outw_cpu_to_le16(v,a) outw(__cpu_to_le16((v)),(a))
00643 #endif
00644
00645
00646
00647
00648
00649 #define wlan_max(a, b) (((a) > (b)) ? (a) : (b))
00650 #define wlan_min(a, b) (((a) < (b)) ? (a) : (b))
00651
00652 #define wlan_isprint(c) (((c) > (0x19)) && ((c) < (0x7f)))
00653
00654 #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
00655
00656
00657
00658 #define wlan_mkprintstr(buf, buflen, str, strlen) \
00659 { \
00660 int i = 0; \
00661 int j = 0; \
00662 memset(str, 0, (strlen)); \
00663 for (i = 0; i < (buflen); i++) { \
00664 if ( wlan_isprint((buf)[i]) ) { \
00665 (str)[j] = (buf)[i]; \
00666 j++; \
00667 } else { \
00668 (str)[j] = '\\'; \
00669 (str)[j+1] = 'x'; \
00670 (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
00671 (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
00672 j += 4; \
00673 } \
00674 } \
00675 }
00676
00677
00678
00679
00680
00681 #ifdef WLAN_INCLUDE_DEBUG
00682 extern int wlan_debug;
00683 #endif
00684
00685 extern int wlan_ethconv;
00686
00687
00688
00689
00690 #endif
00691