Staging: wlan-ng: Move URB_ASYNC_UNLINK and USB_QUEUE_BULK out of wlan_compat.h
[safe/jmp/linux-2.6] / 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
61 #define WLAN_LOG_ERROR(x,args...) printk(KERN_ERR "%s: " x , __func__ , ##args);
62
63 #define WLAN_LOG_WARNING(x,args...) printk(KERN_WARNING "%s: " x , __func__ , ##args);
64
65 #define WLAN_LOG_NOTICE(x,args...) printk(KERN_NOTICE "%s: " x , __func__ , ##args);
66
67 #define WLAN_LOG_INFO(args... ) printk(KERN_INFO args)
68
69 #if defined(WLAN_INCLUDE_DEBUG)
70         #define WLAN_HEX_DUMP( l, x, p, n)      if( WLAN_DBVAR >= (l) ){ \
71                 int __i__; \
72                 printk(KERN_DEBUG x ":"); \
73                 for( __i__=0; __i__ < (n); __i__++) \
74                         printk( " %02x", ((u8*)(p))[__i__]); \
75                 printk("\n"); }
76
77         #define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s(%lu): " x ,  __func__, (preempt_count() & PREEMPT_MASK), ##args );
78 #else
79         #define WLAN_HEX_DUMP( l, s, p, n)
80
81         #define WLAN_LOG_DEBUG(l, s, args...)
82 #endif
83
84 #undef netdevice_t
85 typedef struct net_device netdevice_t;
86
87 /*=============================================================*/
88 /*--- General Macros ------------------------------------------*/
89 /*=============================================================*/
90
91 #define wlan_max(a, b) (((a) > (b)) ? (a) : (b))
92 #define wlan_min(a, b) (((a) < (b)) ? (a) : (b))
93
94 #define wlan_isprint(c) (((c) > (0x19)) && ((c) < (0x7f)))
95
96 #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))
97
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) \
101 { \
102         int i = 0; \
103         int j = 0; \
104         memset(str, 0, (strlen)); \
105         for (i = 0; i < (buflen); i++) { \
106                 if ( wlan_isprint((buf)[i]) ) { \
107                         (str)[j] = (buf)[i]; \
108                         j++; \
109                 } else { \
110                         (str)[j] = '\\'; \
111                         (str)[j+1] = 'x'; \
112                         (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \
113                         (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \
114                         j += 4; \
115                 } \
116         } \
117 }
118
119 /*=============================================================*/
120 /*--- Variables -----------------------------------------------*/
121 /*=============================================================*/
122
123 #ifdef WLAN_INCLUDE_DEBUG
124 extern int wlan_debug;
125 #endif
126
127 #endif /* _WLAN_COMPAT_H */