4 // This file contains the OS dependant definition and function.
5 // Every OS has this file individual.
8 #define DebugUsbdStatusInformation( _A )
13 #include <linux/version.h>
14 #include <linux/usb.h>
15 #include <linux/kernel.h> //need for kernel alert
16 #include <linux/autoconf.h>
17 #include <linux/sched.h>
18 #include <linux/signal.h>
19 #include <linux/slab.h> //memory allocate
20 #include <linux/module.h>
21 #include <linux/netdevice.h>
22 #include <linux/etherdevice.h>
23 #include <linux/init.h>//need for init and exit modules marco
24 #include <linux/ctype.h>
25 #include <linux/wait.h>
26 #include <linux/list.h>
27 #include <linux/wireless.h>
28 #include <linux/if_arp.h>
29 #include <asm/uaccess.h>
30 #include <net/iw_handler.h>
31 #include <linux/skbuff.h>
34 //#define DEBUG_ENABLED 1
38 //===============================================================
39 // Common type definition
40 //===============================================================
42 //===========================================
65 #define STATUS_MEDIA_CONNECT 1
66 #define STATUS_MEDIA_DISCONNECT 0
69 #define BIT(x) (1 << (x))
72 typedef struct urb * PURB;
76 //==================================================================================================
77 // Common function definition
78 //==================================================================================================
80 #define abs(_T) ((_T) < 0 ? -_T : _T)
83 #define ETH_LENGTH_OF_ADDRESS 6
85 #define WBDEBUG( _M ) printk _M
87 #define WBDEBUG( _M ) 0
90 #define OS_DISCONNECTED 0
91 #define OS_CONNECTED 1
94 #define OS_EVENT_INDICATE( _A, _B, _F )
95 #define OS_PMKID_STATUS_EVENT( _A )
98 /* Uff, no, longs are not atomic on all architectures Linux
99 * supports. This should really use atomic_t */
101 #define OS_ATOMIC u32
102 #define OS_ATOMIC_READ( _A, _V ) _V
103 #define OS_ATOMIC_INC( _A, _V ) EncapAtomicInc( _A, (void*)_V )
104 #define OS_ATOMIC_DEC( _A, _V ) EncapAtomicDec( _A, (void*)_V )
105 #define OS_MEMORY_CLEAR( _A, _S ) memset( (u8 *)_A,0,_S)
106 #define OS_MEMORY_COMPARE( _A, _B, _S ) (memcmp(_A,_B,_S)? 0 : 1) // Definition is reverse with Ndis 1: the same 0: different
108 #define OS_TIMER struct timer_list
109 #define OS_TIMER_INITIAL( _T, _F, _P ) \
112 (_T)->function = (void *)_F##_1a; \
113 (_T)->data = (unsigned long)_P; \
117 // 20060420 At least 1 large than jiffies
118 #define OS_TIMER_SET( _T, _S ) \
120 (_T)->expires = jiffies + ((_S*HZ+999)/1000);\
123 #define OS_TIMER_CANCEL( _T, _B ) del_timer_sync( _T )
124 #define OS_TIMER_GET_SYS_TIME( _T ) (*_T=jiffies)