Linux 2.6.28-rc7
[linux-2.6/zen-sources.git] / drivers / staging / slicoss / slicdbg.h
blobc54e44fb1f635d291fcdca8a8a8de813501daade
1 /**************************************************************************
3 * Copyright (c) 2000-2002 Alacritech, Inc. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided
15 * with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY ALACRITECH, INC. ``AS IS'' AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ALACRITECH, INC. OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
30 * The views and conclusions contained in the software and documentation
31 * are those of the authors and should not be interpreted as representing
32 * official policies, either expressed or implied, of Alacritech, Inc.
34 **************************************************************************/
37 * FILENAME: slicdbg.h
39 * All debug and assertion-based definitions and macros are included
40 * in this file for the SLICOSS driver.
42 #ifndef _SLIC_DEBUG_H_
43 #define _SLIC_DEBUG_H_
45 #ifdef SLIC_DEFAULT_LOG_LEVEL
46 #else
47 #define SLICLEVEL KERN_DEBUG
48 #endif
49 #define SLIC_DISPLAY printk
50 #define DBG_ERROR(n, args...) SLIC_DISPLAY(KERN_EMERG n, ##args)
52 #define SLIC_DEBUG_MESSAGE 1
53 #if SLIC_DEBUG_MESSAGE
54 /*#define DBG_MSG(n, args...) SLIC_DISPLAY(SLICLEVEL n, ##args)*/
55 #define DBG_MSG(n, args...)
56 #else
57 #define DBG_MSG(n, args...)
58 #endif
60 #ifdef ASSERT
61 #undef ASSERT
62 #endif
64 #if SLIC_ASSERT_ENABLED
65 #ifdef CONFIG_X86_64
66 #define VALID_ADDRESS(p) (1)
67 #else
68 #define VALID_ADDRESS(p) (((u32)(p) & 0x80000000) || ((u32)(p) == 0))
69 #endif
70 #ifndef ASSERT
71 #define ASSERT(a) \
72 { \
73 if (!(a)) { \
74 DBG_ERROR("ASSERT() Failure: file %s, function %s line %d\n",\
75 __FILE__, __func__, __LINE__); \
76 slic_assert_fail(); \
77 } \
79 #endif
80 #ifndef ASSERTMSG
81 #define ASSERTMSG(a,msg) \
82 { \
83 if (!(a)) { \
84 DBG_ERROR("ASSERT() Failure: file %s, function %s"\
85 "line %d: %s\n",\
86 __FILE__, __func__, __LINE__, (msg)); \
87 slic_assert_fail(); \
88 } \
90 #endif
91 #else
92 #ifndef ASSERT
93 #define ASSERT(a)
94 #endif
95 #ifndef ASSERTMSG
96 #define ASSERTMSG(a, msg)
97 #endif
98 #endif /* SLIC_ASSERT_ENABLED */
100 #endif /* _SLIC_DEBUG_H_ */