3 * Types and macros to aid in portability
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
6 * --------------------------------------------------------------------
10 * The contents of this file are subject to the Mozilla Public
11 * License Version 1.1 (the "License"); you may not use this file
12 * except in compliance with the License. You may obtain a copy of
13 * the License at http://www.mozilla.org/MPL/
15 * Software distributed under the License is distributed on an "AS
16 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17 * implied. See the License for the specific language governing
18 * rights and limitations under the License.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU Public License version 2 (the "GPL"), in which
22 * case the provisions of the GPL are applicable instead of the
23 * above. If you wish to allow the use of your version of this file
24 * only under the terms of the GPL and not to allow others to use
25 * your version of this file under the MPL, indicate your decision
26 * by deleting the provisions above and replace them with the notice
27 * and other provisions required by the GPL. If you do not delete
28 * the provisions above, a recipient may use your version of this
29 * file under either the MPL or the GPL.
31 * --------------------------------------------------------------------
33 * Inquiries regarding the linux-wlan Open Source project can be
36 * AbsoluteValue Systems Inc.
38 * http://www.linux-wlan.com
40 * --------------------------------------------------------------------
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
45 * --------------------------------------------------------------------
48 #ifndef _WLAN_COMPAT_H
49 #define _WLAN_COMPAT_H
51 /*=============================================================*/
52 /*------ OS Portability Macros --------------------------------*/
53 /*=============================================================*/
56 #define WLAN_DBVAR wlan_debug
59 #include <linux/hardirq.h>
60 #include <linux/ctype.h>
62 #if defined(WLAN_INCLUDE_DEBUG)
63 #define WLAN_HEX_DUMP( l, x, p, n) if( WLAN_DBVAR >= (l) ){ \
65 printk(KERN_DEBUG x ":"); \
66 for( __i__=0; __i__ < (n); __i__++) \
67 printk( " %02x", ((u8*)(p))[__i__]); \
70 #define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s(%lu): " x , __func__, (preempt_count() & PREEMPT_MASK), ##args );
72 #define WLAN_HEX_DUMP( l, s, p, n)
74 #define WLAN_LOG_DEBUG(l, s, args...)
78 typedef struct net_device netdevice_t;
80 /*=============================================================*/
81 /*--- General Macros ------------------------------------------*/
82 /*=============================================================*/
84 #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
86 /* Create a string of printable chars from something that might not be */
87 /* It's recommended that the str be 4*len + 1 bytes long */
88 #define wlan_mkprintstr(buf, buflen, str, strlen) \
92 memset(str, 0, (strlen)); \
93 for (i = 0; i < (buflen); i++) { \
94 if ( isprint((buf)[i]) ) { \
95 (str)[j] = (buf)[i]; \
100 (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
101 (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
107 /*=============================================================*/
108 /*--- Variables -----------------------------------------------*/
109 /*=============================================================*/
111 #ifdef WLAN_INCLUDE_DEBUG
112 extern int wlan_debug;
115 #endif /* _WLAN_COMPAT_H */