]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/staging/wlan-ng/wlan_compat.h
Staging: wlan-ng: Remove dead/unused code from p80211req.c
[linux-2.6-omap-h63xx.git] / drivers / staging / wlan-ng / wlan_compat.h
1 /* wlan_compat.h
2 *
3 * Types and macros to aid in portability
4 *
5 * Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
6 * --------------------------------------------------------------------
7 *
8 * linux-wlan
9 *
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/
14 *
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.
19 *
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.
30 *
31 * --------------------------------------------------------------------
32 *
33 * Inquiries regarding the linux-wlan Open Source project can be
34 * made directly to:
35 *
36 * AbsoluteValue Systems Inc.
37 * info@linux-wlan.com
38 * http://www.linux-wlan.com
39 *
40 * --------------------------------------------------------------------
41 *
42 * Portions of the development of this software were funded by
43 * Intersil Corporation as part of PRISM(R) chipset product development.
44 *
45 * --------------------------------------------------------------------
46 */
47
48 #ifndef _WLAN_COMPAT_H
49 #define _WLAN_COMPAT_H
50
51 /*=============================================================*/
52 /*------ OS Portability Macros --------------------------------*/
53 /*=============================================================*/
54
55 #ifndef WLAN_DBVAR
56 #define WLAN_DBVAR      wlan_debug
57 #endif
58
59 #include <linux/hardirq.h>
60 #include <linux/ctype.h>
61
62 #if defined(WLAN_INCLUDE_DEBUG)
63         #define WLAN_HEX_DUMP( l, x, p, n)      if( WLAN_DBVAR >= (l) ){ \
64                 int __i__; \
65                 printk(KERN_DEBUG x ":"); \
66                 for( __i__=0; __i__ < (n); __i__++) \
67                         printk( " %02x", ((u8*)(p))[__i__]); \
68                 printk("\n"); }
69
70         #define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s(%lu): " x ,  __func__, (preempt_count() & PREEMPT_MASK), ##args );
71 #else
72         #define WLAN_HEX_DUMP( l, s, p, n)
73
74         #define WLAN_LOG_DEBUG(l, s, args...)
75 #endif
76
77 #undef netdevice_t
78 typedef struct net_device netdevice_t;
79
80 /*=============================================================*/
81 /*--- General Macros ------------------------------------------*/
82 /*=============================================================*/
83
84 #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
85
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) \
89 { \
90         int i = 0; \
91         int j = 0; \
92         memset(str, 0, (strlen)); \
93         for (i = 0; i < (buflen); i++) { \
94                 if ( isprint((buf)[i]) ) { \
95                         (str)[j] = (buf)[i]; \
96                         j++; \
97                 } else { \
98                         (str)[j] = '\\'; \
99                         (str)[j+1] = 'x'; \
100                         (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
101                         (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
102                         j += 4; \
103                 } \
104         } \
105 }
106
107 /*=============================================================*/
108 /*--- Variables -----------------------------------------------*/
109 /*=============================================================*/
110
111 #ifdef WLAN_INCLUDE_DEBUG
112 extern int wlan_debug;
113 #endif
114
115 #endif /* _WLAN_COMPAT_H */