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