iPXE
wlan_compat.h
Go to the documentation of this file.
00001 /* src/include/wlan/wlan_compat.h
00002 *
00003 * Types and macros to aid in portability
00004 *
00005 * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
00006 * --------------------------------------------------------------------
00007 *
00008 * linux-wlan
00009 *
00010 *   The contents of this file are subject to the Mozilla Public
00011 *   License Version 1.1 (the "License"); you may not use this file
00012 *   except in compliance with the License. You may obtain a copy of
00013 *   the License at http://www.mozilla.org/MPL/
00014 *
00015 *   Software distributed under the License is distributed on an "AS
00016 *   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
00017 *   implied. See the License for the specific language governing
00018 *   rights and limitations under the License.
00019 *
00020 *   Alternatively, the contents of this file may be used under the
00021 *   terms of the GNU Public License version 2 (the "GPL"), in which
00022 *   case the provisions of the GPL are applicable instead of the
00023 *   above.  If you wish to allow the use of your version of this file
00024 *   only under the terms of the GPL and not to allow others to use
00025 *   your version of this file under the MPL, indicate your decision
00026 *   by deleting the provisions above and replace them with the notice
00027 *   and other provisions required by the GPL.  If you do not delete
00028 *   the provisions above, a recipient may use your version of this
00029 *   file under either the MPL or the GPL.
00030 *
00031 * --------------------------------------------------------------------
00032 *
00033 * Inquiries regarding the linux-wlan Open Source project can be
00034 * made directly to:
00035 *
00036 * AbsoluteValue Systems Inc.
00037 * info@linux-wlan.com
00038 * http://www.linux-wlan.com
00039 *
00040 * --------------------------------------------------------------------
00041 *
00042 * Portions of the development of this software were funded by
00043 * Intersil Corporation as part of PRISM(R) chipset product development.
00044 *
00045 * --------------------------------------------------------------------
00046 */
00047 
00048 FILE_LICENCE ( GPL2_ONLY );
00049 
00050 #ifndef _WLAN_COMPAT_H
00051 #define _WLAN_COMPAT_H
00052 
00053 /*=============================================================*/
00054 /*------ Establish Platform Identity --------------------------*/
00055 /*=============================================================*/
00056 /* Key macros: */
00057 /* WLAN_CPU_FAMILY */
00058         #define WLAN_Ix86                       1
00059         #define WLAN_PPC                        2
00060         #define WLAN_Ix96                       3
00061         #define WLAN_ARM                        4
00062         #define WLAN_ALPHA                      5
00063         #define WLAN_MIPS                       6
00064         #define WLAN_HPPA                       7
00065 /* WLAN_CPU_CORE */
00066         #define WLAN_I386CORE                   1
00067         #define WLAN_PPCCORE                    2
00068         #define WLAN_I296                       3
00069         #define WLAN_ARMCORE                    4
00070         #define WLAN_ALPHACORE                  5
00071         #define WLAN_MIPSCORE                   6
00072         #define WLAN_HPPACORE                   7
00073 /* WLAN_CPU_PART */
00074         #define WLAN_I386PART                   1
00075         #define WLAN_MPC860                     2
00076         #define WLAN_MPC823                     3
00077         #define WLAN_I296SA                     4
00078         #define WLAN_PPCPART                    5
00079         #define WLAN_ARMPART                    6
00080         #define WLAN_ALPHAPART                  7
00081         #define WLAN_MIPSPART                   8
00082         #define WLAN_HPPAPART                   9
00083 /* WLAN_SYSARCH */
00084         #define WLAN_PCAT                       1
00085         #define WLAN_MBX                        2
00086         #define WLAN_RPX                        3
00087         #define WLAN_LWARCH                     4
00088         #define WLAN_PMAC                       5
00089         #define WLAN_SKIFF                      6
00090         #define WLAN_BITSY                      7
00091         #define WLAN_ALPHAARCH                  7
00092         #define WLAN_MIPSARCH                   9
00093         #define WLAN_HPPAARCH                   10
00094 /* WLAN_OS */
00095         #define WLAN_LINUX_KERNEL               1
00096         #define WLAN_LINUX_USER                 2
00097 /* WLAN_HOSTIF (generally set on the command line, not detected) */
00098         #define WLAN_PCMCIA                     1
00099         #define WLAN_ISA                        2
00100         #define WLAN_PCI                        3
00101         #define WLAN_USB                        4
00102         #define WLAN_PLX                        5
00103 
00104 /* Note: the PLX HOSTIF above refers to some vendors implementations for */
00105 /*       PCI.  It's a PLX chip that is a PCI to PCMCIA adapter, but it   */
00106 /*       isn't a real PCMCIA host interface adapter providing all the    */
00107 /*       card&socket services.                                           */
00108 
00109 /* Lets try to figure out what we've got.  Kernel mode or User mode? */
00110 #if defined(__KERNEL__)
00111         #define WLAN_OS                         WLAN_LINUX_KERNEL
00112 #else
00113         #define WLAN_OS                         WLAN_LINUX_USER
00114 #endif
00115 
00116 #ifdef __powerpc__
00117 #ifndef __ppc__
00118 #define __ppc__
00119 #endif
00120 #endif
00121 
00122 #if (defined(CONFIG_PPC) || defined(CONFIG_8xx))
00123 #ifndef __ppc__
00124 #define __ppc__
00125 #endif
00126 #endif
00127 
00128 #if defined(__KERNEL__)
00129 #if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
00130         #define WLAN_CPU_FAMILY         WLAN_Ix86
00131         #define WLAN_CPU_CORE           WLAN_I386CORE
00132         #define WLAN_CPU_PART           WLAN_I386PART
00133         #define WLAN_SYSARCH            WLAN_PCAT
00134 #elif defined(__ppc__)
00135         #define WLAN_CPU_FAMILY         WLAN_PPC
00136         #define WLAN_CPU_CORE           WLAN_PPCCORE
00137         #if defined(CONFIG_MBX)
00138                 #define WLAN_CPU_PART   WLAN_MPC860
00139                 #define WLAN_SYSARCH    WLAN_MBX
00140         #elif defined(CONFIG_RPXLITE)
00141                 #define WLAN_CPU_PART   WLAN_MPC823
00142                 #define WLAN_SYSARCH    WLAN_RPX
00143         #elif defined(CONFIG_RPXCLASSIC)
00144                 #define WLAN_CPU_PART   WLAN_MPC860
00145                 #define WLAN_SYSARCH    WLAN_RPX
00146         #else
00147                 #define WLAN_CPU_PART   WLAN_PPCPART
00148                 #define WLAN_SYSARCH    WLAN_PMAC
00149         #endif
00150 #elif defined(__arm__)
00151         #define WLAN_CPU_FAMILY         WLAN_ARM
00152         #define WLAN_CPU_CORE           WLAN_ARMCORE
00153         #define WLAN_CPU_PART           WLAN_ARM_PART
00154         #define WLAN_SYSARCH            WLAN_SKIFF
00155 #elif defined(__alpha__)
00156         #define WLAN_CPU_FAMILY         WLAN_ALPHA
00157         #define WLAN_CPU_CORE           WLAN_ALPHACORE
00158         #define WLAN_CPU_PART           WLAN_ALPHAPART
00159         #define WLAN_SYSARCH            WLAN_ALPHAARCH
00160 #elif defined(__mips__)
00161         #define WLAN_CPU_FAMILY         WLAN_MIPS
00162         #define WLAN_CPU_CORE           WLAN_MIPSCORE
00163         #define WLAN_CPU_PART           WLAN_MIPSPART
00164         #define WLAN_SYSARCH            WLAN_MIPSARCH
00165 #elif defined(__hppa__)
00166         #define WLAN_CPU_FAMILY         WLAN_HPPA
00167         #define WLAN_CPU_CORE           WLAN_HPPACORE
00168         #define WLAN_CPU_PART           WLAN_HPPAPART
00169         #define WLAN_SYSARCH            WLAN_HPPAARCH
00170 #else
00171         #error "No CPU identified!"
00172 #endif
00173 #endif /* __KERNEL__ */
00174 
00175 /*
00176    Some big endian machines implicitly do all I/O in little endian mode.
00177 
00178    In particular:
00179           Linux/PPC on PowerMacs (PCI)
00180           Arm/Intel Xscale (PCI)
00181 
00182    This may also affect PLX boards and other BE &| PPC platforms;
00183    as new ones are discovered, add them below.
00184 */
00185 
00186 #if (WLAN_HOSTIF == WLAN_PCI)
00187 #if ((WLAN_SYSARCH == WLAN_SKIFF) || (WLAN_SYSARCH == WLAN_PMAC))
00188 #define REVERSE_ENDIAN
00189 #endif
00190 #endif
00191 
00192 /*=============================================================*/
00193 /*------ Bit settings -----------------------------------------*/
00194 /*=============================================================*/
00195 
00196 #define BIT0    0x00000001
00197 #define BIT1    0x00000002
00198 #define BIT2    0x00000004
00199 #define BIT3    0x00000008
00200 #define BIT4    0x00000010
00201 #define BIT5    0x00000020
00202 #define BIT6    0x00000040
00203 #define BIT7    0x00000080
00204 #define BIT8    0x00000100
00205 #define BIT9    0x00000200
00206 #define BIT10   0x00000400
00207 #define BIT11   0x00000800
00208 #define BIT12   0x00001000
00209 #define BIT13   0x00002000
00210 #define BIT14   0x00004000
00211 #define BIT15   0x00008000
00212 #define BIT16   0x00010000
00213 #define BIT17   0x00020000
00214 #define BIT18   0x00040000
00215 #define BIT19   0x00080000
00216 #define BIT20   0x00100000
00217 #define BIT21   0x00200000
00218 #define BIT22   0x00400000
00219 #define BIT23   0x00800000
00220 #define BIT24   0x01000000
00221 #define BIT25   0x02000000
00222 #define BIT26   0x04000000
00223 #define BIT27   0x08000000
00224 #define BIT28   0x10000000
00225 #define BIT29   0x20000000
00226 #define BIT30   0x40000000
00227 #define BIT31   0x80000000
00228 
00229 /*=============================================================*/
00230 /*------ Compiler Portability Macros --------------------------*/
00231 /*=============================================================*/
00232 #define __WLAN_ATTRIB_PACK__            __attribute__ ((packed))
00233 #define __WLAN_PRAGMA_PACK1__
00234 #define __WLAN_PRAGMA_PACKDFLT__
00235 #define __WLAN_INLINE__                 inline
00236 #define WLAN_MIN_ARRAY                  0
00237 
00238 /*=============================================================*/
00239 /*------ OS Portability Macros --------------------------------*/
00240 /*=============================================================*/
00241 
00242 #ifndef WLAN_DBVAR
00243 #define WLAN_DBVAR      wlan_debug
00244 #endif
00245 
00246 #if (WLAN_OS == WLAN_LINUX_KERNEL)
00247         #define WLAN_LOG_ERROR0(x) printk(KERN_ERR "%s: " x , __FUNCTION__ );
00248         #define WLAN_LOG_ERROR1(x,n) printk(KERN_ERR "%s: " x , __FUNCTION__ , (n));
00249         #define WLAN_LOG_ERROR2(x,n1,n2) printk(KERN_ERR "%s: " x , __FUNCTION__ , (n1), (n2));
00250         #define WLAN_LOG_ERROR3(x,n1,n2,n3) printk(KERN_ERR "%s: " x , __FUNCTION__, (n1), (n2), (n3));
00251         #define WLAN_LOG_ERROR4(x,n1,n2,n3,n4) printk(KERN_ERR "%s: " x , __FUNCTION__, (n1), (n2), (n3), (n4));
00252 
00253         #define WLAN_LOG_WARNING0(x) printk(KERN_WARNING "%s: " x , __FUNCTION__);
00254         #define WLAN_LOG_WARNING1(x,n) printk(KERN_WARNING "%s: " x , __FUNCTION__, (n));
00255         #define WLAN_LOG_WARNING2(x,n1,n2) printk(KERN_WARNING "%s: " x , __FUNCTION__, (n1), (n2));
00256         #define WLAN_LOG_WARNING3(x,n1,n2,n3) printk(KERN_WARNING "%s: " x , __FUNCTION__, (n1), (n2), (n3));
00257         #define WLAN_LOG_WARNING4(x,n1,n2,n3,n4) printk(KERN_WARNING "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4));
00258 
00259         #define WLAN_LOG_NOTICE0(x) printk(KERN_NOTICE "%s: " x , __FUNCTION__);
00260         #define WLAN_LOG_NOTICE1(x,n) printk(KERN_NOTICE "%s: " x , __FUNCTION__, (n));
00261         #define WLAN_LOG_NOTICE2(x,n1,n2) printk(KERN_NOTICE "%s: " x , __FUNCTION__, (n1), (n2));
00262         #define WLAN_LOG_NOTICE3(x,n1,n2,n3) printk(KERN_NOTICE "%s: " x , __FUNCTION__, (n1), (n2), (n3));
00263         #define WLAN_LOG_NOTICE4(x,n1,n2,n3,n4) printk(KERN_NOTICE "%s: " x , __FUNCTION__, (n1), (n2), (n3), (n4));
00264 
00265         #define WLAN_LOG_INFO0(x) printk(KERN_INFO x);
00266         #define WLAN_LOG_INFO1(x,n) printk(KERN_INFO x, (n));
00267         #define WLAN_LOG_INFO2(x,n1,n2) printk(KERN_INFO x, (n1), (n2));
00268         #define WLAN_LOG_INFO3(x,n1,n2,n3) printk(KERN_INFO x, (n1), (n2), (n3));
00269         #define WLAN_LOG_INFO4(x,n1,n2,n3,n4) printk(KERN_INFO x, (n1), (n2), (n3), (n4));
00270         #define WLAN_LOG_INFO5(x,n1,n2,n3,n4,n5) printk(KERN_INFO x, (n1), (n2), (n3), (n4), (n5));
00271 
00272         #if defined(WLAN_INCLUDE_DEBUG)
00273                 #define WLAN_ASSERT(c) if ((!(c)) && WLAN_DBVAR >= 1) { \
00274                         WLAN_LOG_DEBUG0(1, "Assertion failure!\n"); }
00275                 #define WLAN_HEX_DUMP( l, x, p, n)      if( WLAN_DBVAR >= (l) ){ \
00276                         int __i__; \
00277                         printk(KERN_DEBUG x ":"); \
00278                         for( __i__=0; __i__ < (n); __i__++) \
00279                                 printk( " %02x", ((uint8_t*)(p))[__i__]); \
00280                         printk("\n"); }
00281 
00282                 #define DBFENTER { if ( WLAN_DBVAR >= 4 ){ WLAN_LOG_DEBUG0(3,"Enter\n"); } }
00283                 #define DBFEXIT  { if ( WLAN_DBVAR >= 4 ){ WLAN_LOG_DEBUG0(3,"Exit\n"); } }
00284 
00285                 #define WLAN_LOG_DEBUG0(l,x) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x ,  __FUNCTION__ );
00286                 #define WLAN_LOG_DEBUG1(l,x,n) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n));
00287                 #define WLAN_LOG_DEBUG2(l,x,n1,n2) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2));
00288                 #define WLAN_LOG_DEBUG3(l,x,n1,n2,n3) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3));
00289                 #define WLAN_LOG_DEBUG4(l,x,n1,n2,n3,n4) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4));
00290                 #define WLAN_LOG_DEBUG5(l,x,n1,n2,n3,n4,n5) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4), (n5));
00291                 #define WLAN_LOG_DEBUG6(l,x,n1,n2,n3,n4,n5,n6) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s: " x , __FUNCTION__ , (n1), (n2), (n3), (n4), (n5), (n6));
00292         #else
00293                 #define WLAN_ASSERT(c)
00294                 #define WLAN_HEX_DUMP( l, s, p, n)
00295 
00296                 #define DBFENTER
00297                 #define DBFEXIT
00298 
00299                 #define WLAN_LOG_DEBUG0(l, s)
00300                 #define WLAN_LOG_DEBUG1(l, s,n)
00301                 #define WLAN_LOG_DEBUG2(l, s,n1,n2)
00302                 #define WLAN_LOG_DEBUG3(l, s,n1,n2,n3)
00303                 #define WLAN_LOG_DEBUG4(l, s,n1,n2,n3,n4)
00304                 #define WLAN_LOG_DEBUG5(l, s,n1,n2,n3,n4,n5)
00305         #endif
00306 #else
00307         #define WLAN_LOG_ERROR0(s)
00308         #define WLAN_LOG_ERROR1(s,n)
00309         #define WLAN_LOG_ERROR2(s,n1,n2)
00310         #define WLAN_LOG_ERROR3(s,n1,n2,n3)
00311         #define WLAN_LOG_ERROR4(s,n1,n2,n3,n4)
00312 
00313         #define WLAN_LOG_WARNING0(s)
00314         #define WLAN_LOG_WARNING1(s,n)
00315         #define WLAN_LOG_WARNING2(s,n1,n2)
00316         #define WLAN_LOG_WARNING3(s,n1,n2,n3)
00317         #define WLAN_LOG_WARNING4(s,n1,n2,n3,n4)
00318 
00319         #define WLAN_LOG_NOTICE0(s)
00320         #define WLAN_LOG_NOTICE1(s,n)
00321         #define WLAN_LOG_NOTICE2(s,n1,n2)
00322         #define WLAN_LOG_NOTICE3(s,n1,n2,n3)
00323         #define WLAN_LOG_NOTICE4(s,n1,n2,n3,n4)
00324 
00325                 #define WLAN_ASSERT(c)
00326                 #define WLAN_HEX_DUMP( l, s, p, n)
00327 
00328                 #define DBFENTER
00329                 #define DBFEXIT
00330 
00331                 #define WLAN_LOG_INFO0(s)
00332                 #define WLAN_LOG_INFO1(s,n)
00333                 #define WLAN_LOG_INFO2(s,n1,n2)
00334                 #define WLAN_LOG_INFO3(s,n1,n2,n3)
00335                 #define WLAN_LOG_INFO4(s,n1,n2,n3,n4)
00336                 #define WLAN_LOG_INFO5(s,n1,n2,n3,n4,n5)
00337 
00338                 #define WLAN_LOG_DEBUG0(l, s)
00339                 #define WLAN_LOG_DEBUG1(l, s,n)
00340                 #define WLAN_LOG_DEBUG2(l, s,n1,n2)
00341                 #define WLAN_LOG_DEBUG3(l, s,n1,n2,n3)
00342                 #define WLAN_LOG_DEBUG4(l, s,n1,n2,n3,n4)
00343                 #define WLAN_LOG_DEBUG5(l, s,n1,n2,n3,n4,n5)
00344 #endif
00345 
00346 #define wlan_ms_per_tick                (1000UL / (wlan_ticks_per_sec))
00347 #define wlan_ms_to_ticks(n)             ( (n) / (wlan_ms_per_tick))
00348 #define wlan_tu2ticks(n)                ( (n) / (wlan_ms_per_tick))
00349 #define WLAN_INT_DISABLE(n)             { save_flags((n)); cli(); }
00350 #define WLAN_INT_ENABLE(n)              { sti(); restore_flags((n)); }
00351 
00352 #ifdef CONFIG_MODVERSIONS
00353 #define MODVERSIONS             1
00354 #include <linux/modversions.h>
00355 #endif
00356 
00357 #ifdef CONFIG_SMP
00358 #define __SMP__                 1
00359 #endif
00360 
00361 #ifndef KERNEL_VERSION
00362 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
00363 #endif
00364 
00365 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,17))
00366 #define CONFIG_NETLINK          1
00367 #endif
00368 
00369 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0))
00370 #define kfree_s(a, b)   kfree((a))
00371 #endif
00372 
00373 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18))
00374 #ifndef init_waitqueue_head
00375 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,16))
00376 #define init_waitqueue_head(p)  (*(p) = NULL)
00377 #else
00378 #define init_waitqueue_head(p)  init_waitqueue(p)
00379 #endif
00380 typedef struct wait_queue *wait_queue_head_t;
00381 typedef struct wait_queue wait_queue_t;
00382 #define set_current_state(b)  { current->state = (b); mb(); }
00383 #define init_waitqueue_entry(a, b) { (a)->task = current; }
00384 #endif
00385 #endif
00386 
00387 #ifndef wait_event_interruptible_timeout
00388 // retval == 0; signal met; we're good.
00389 // retval < 0; interrupted by signal.
00390 // retval > 0; timed out.
00391 #define __wait_event_interruptible_timeout(wq, condition, timeout, ret)   \
00392 do {                                                                      \
00393         int __ret = 0;                                                    \
00394         if (!(condition)) {                                               \
00395           wait_queue_t __wait;                                            \
00396           unsigned long expire;                                           \
00397           init_waitqueue_entry(&__wait, current);                         \
00398                                                                           \
00399           expire = timeout + jiffies;                                     \
00400           add_wait_queue(&wq, &__wait);                                   \
00401           for (;;) {                                                      \
00402                   set_current_state(TASK_INTERRUPTIBLE);                  \
00403                   if (condition)                                          \
00404                           break;                                          \
00405                   if (jiffies > expire) {                                 \
00406                           ret = jiffies - expire;                         \
00407                           break;                                          \
00408                   }                                                       \
00409                   if (!signal_pending(current)) {                         \
00410                           schedule_timeout(timeout);                      \
00411                           continue;                                       \
00412                   }                                                       \
00413                   ret = -ERESTARTSYS;                                     \
00414                   break;                                                  \
00415           }                                                               \
00416           set_current_state(TASK_RUNNING);                                \
00417           remove_wait_queue(&wq, &__wait);                                \
00418         }                                                                 \
00419 } while (0)
00420 
00421 #define wait_event_interruptible_timeout(wq, condition, timeout)        \
00422 ({                                                                      \
00423         int __ret = 0;                                                  \
00424         if (!(condition))                                               \
00425                 __wait_event_interruptible_timeout(wq, condition,       \
00426                                                 timeout, __ret);        \
00427         __ret;                                                          \
00428 })
00429 
00430 #endif
00431 
00432 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,90))
00433 #define spin_lock(l)            do { } while (0)
00434 #define spin_unlock(l)          do { } while (0)
00435 #define spin_lock_irqsave(l,f)  do { save_flags(f); cli(); } while (0)
00436 #define spin_unlock_irqrestore(l,f) do { restore_flags(f); } while (0)
00437 #define spin_lock_init(s)       do { } while (0)
00438 #define spin_trylock(l)         (1)
00439 typedef int spinlock_t;
00440 #endif
00441 
00442 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
00443 #ifdef CONFIG_SMP
00444 #define spin_is_locked(x)       (*(volatile char *)(&(x)->lock) <= 0)
00445 #else
00446 #define spin_is_locked(l)       (0)
00447 #endif
00448 #endif
00449 
00450 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38))
00451 typedef struct device netdevice_t;
00452 #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4))
00453 typedef struct net_device netdevice_t;
00454 #else
00455 #undef netdevice_t
00456 typedef struct net_device netdevice_t;
00457 #endif
00458 
00459 #ifdef WIRELESS_EXT
00460 #if (WIRELESS_EXT < 13)
00461 struct iw_request_info
00462 {
00463         __u16           cmd;            /* Wireless Extension command */
00464         __u16           flags;          /* More to come ;-) */
00465 };
00466 #endif
00467 #endif
00468 
00469 
00470 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,18))
00471 #define MODULE_PARM(a,b)        extern int __bogus_decl
00472 #define MODULE_AUTHOR(a)        extern int __bogus_decl
00473 #define MODULE_DESCRIPTION(a)   extern int __bogus_decl
00474 #define MODULE_SUPPORTED_DEVICE(a) extern int __bogus_decl
00475 #undef  GET_USE_COUNT
00476 #define GET_USE_COUNT(m)        mod_use_count_
00477 #endif
00478 
00479 #ifndef MODULE_LICENSE
00480 #define MODULE_LICENSE(m)       extern int __bogus_decl
00481 #endif
00482 
00483 /* TODO:  Do we care about this? */
00484 #ifndef MODULE_DEVICE_TABLE
00485 #define MODULE_DEVICE_TABLE(foo,bar)
00486 #endif
00487 
00488 #define wlan_minutes2ticks(a) ((a)*(wlan_ticks_per_sec *  60))
00489 #define wlan_seconds2ticks(a) ((a)*(wlan_ticks_per_sec))
00490 
00491 /*=============================================================*/
00492 /*------ Hardware Portability Macros --------------------------*/
00493 /*=============================================================*/
00494 
00495 #define ieee2host16(n)  __le16_to_cpu(n)
00496 #define ieee2host32(n)  __le32_to_cpu(n)
00497 #define host2ieee16(n)  __cpu_to_le16(n)
00498 #define host2ieee32(n)  __cpu_to_le32(n)
00499 
00500 #if (WLAN_CPU_FAMILY == WLAN_PPC)
00501        #define wlan_inw(a)                     in_be16((unsigned short *)((a)+_IO_BASE))
00502        #define wlan_inw_le16_to_cpu(a)         inw((a))
00503        #define wlan_outw(v,a)                  out_be16((unsigned short *)((a)+_IO_BASE), (v))
00504        #define wlan_outw_cpu_to_le16(v,a)      outw((v),(a))
00505 #else
00506        #define wlan_inw(a)                     inw((a))
00507        #define wlan_inw_le16_to_cpu(a)         __cpu_to_le16(inw((a)))
00508        #define wlan_outw(v,a)                  outw((v),(a))
00509        #define wlan_outw_cpu_to_le16(v,a)      outw(__cpu_to_le16((v)),(a))
00510 #endif
00511 
00512 /*=============================================================*/
00513 /*--- General Macros ------------------------------------------*/
00514 /*=============================================================*/
00515 
00516 #define wlan_max(a, b) (((a) > (b)) ? (a) : (b))
00517 #define wlan_min(a, b) (((a) < (b)) ? (a) : (b))
00518 
00519 #define wlan_isprint(c) (((c) > (0x19)) && ((c) < (0x7f)))
00520 
00521 #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
00522 
00523 /* Create a string of printable chars from something that might not be */
00524 /* It's recommended that the str be 4*len + 1 bytes long */
00525 #define wlan_mkprintstr(buf, buflen, str, strlen) \
00526 { \
00527         int i = 0; \
00528         int j = 0; \
00529         memset(str, 0, (strlen)); \
00530         for (i = 0; i < (buflen); i++) { \
00531                 if ( wlan_isprint((buf)[i]) ) { \
00532                         (str)[j] = (buf)[i]; \
00533                         j++; \
00534                 } else { \
00535                         (str)[j] = '\\'; \
00536                         (str)[j+1] = 'x'; \
00537                         (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
00538                         (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
00539                         j += 4; \
00540                 } \
00541         } \
00542 }
00543 
00544 /*=============================================================*/
00545 /*--- Variables -----------------------------------------------*/
00546 /*=============================================================*/
00547 
00548 extern int wlan_debug;
00549 extern int wlan_ethconv;                /* What's the default ethconv? */
00550 
00551 /*=============================================================*/
00552 /*--- Functions -----------------------------------------------*/
00553 /*=============================================================*/
00554 #endif /* _WLAN_COMPAT_H */
00555