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>
61 #define WLAN_LOG_ERROR(x,args...) printk(KERN_ERR "%s: " x , __func__ , ##args);
63 #define WLAN_LOG_WARNING(x,args...) printk(KERN_WARNING "%s: " x , __func__ , ##args);
65 #define WLAN_LOG_NOTICE(x,args...) printk(KERN_NOTICE "%s: " x , __func__ , ##args);
67 #define WLAN_LOG_INFO(args... ) printk(KERN_INFO args)
69 #if defined(WLAN_INCLUDE_DEBUG)
70 #define WLAN_HEX_DUMP( l, x, p, n) if( WLAN_DBVAR >= (l) ){ \
72 printk(KERN_DEBUG x ":"); \
73 for( __i__=0; __i__ < (n); __i__++) \
74 printk( " %02x", ((u8*)(p))[__i__]); \
77 #define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s(%lu): " x , __func__, (preempt_count() & PREEMPT_MASK), ##args );
79 #define WLAN_HEX_DUMP( l, s, p, n)
81 #define WLAN_LOG_DEBUG(l, s, args...)
85 typedef struct net_device netdevice_t;
87 /*=============================================================*/
88 /*--- General Macros ------------------------------------------*/
89 /*=============================================================*/
91 #define wlan_max(a, b) (((a) > (b)) ? (a) : (b))
92 #define wlan_min(a, b) (((a) < (b)) ? (a) : (b))
94 #define wlan_isprint(c) (((c) > (0x19)) && ((c) < (0x7f)))
96 #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
98 /* Create a string of printable chars from something that might not be */
99 /* It's recommended that the str be 4*len + 1 bytes long */
100 #define wlan_mkprintstr(buf, buflen, str, strlen) \
104 memset(str, 0, (strlen)); \
105 for (i = 0; i < (buflen); i++) { \
106 if ( wlan_isprint((buf)[i]) ) { \
107 (str)[j] = (buf)[i]; \
112 (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
113 (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
119 /*=============================================================*/
120 /*--- Variables -----------------------------------------------*/
121 /*=============================================================*/
123 #ifdef WLAN_INCLUDE_DEBUG
124 extern int wlan_debug;
127 #endif /* _WLAN_COMPAT_H */