1 /* $NetBSD: debug.h,v 1.8 2007/12/15 00:39:17 perry Exp $ */
4 * Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * debug version exports all symbols.
45 * #define DPRINTF_ENABLE
46 * #define DPRINTF_DEBUG foo_debug
47 * #define DPRINTF_LEVEL 2
50 #ifdef USE_HPC_DPRINTF
53 * debug printf with Function name
55 #define PRINTF(fmt, args...) printf("%s: " fmt, __func__ , ##args)
58 #error "specify unique debug symbol"
61 #define DPRINTF_LEVEL 1
63 int DPRINTF_DEBUG
= DPRINTF_LEVEL
;
64 #define DPRINTF(fmt, args...) if (DPRINTF_DEBUG) PRINTF(fmt, ##args)
65 #define _DPRINTF(fmt, args...) if (DPRINTF_DEBUG) printf(fmt, ##args)
66 #define DPRINTFN(n, fmt, args...) \
67 if (DPRINTF_DEBUG > (n)) PRINTF(fmt, ##args)
68 #define _DPRINTFN(n, fmt, args...) \
69 if (DPRINTF_DEBUG > (n)) printf(fmt, ##args)
70 #else /* DPRINTF_ENABLE */
71 #define DPRINTF(args...) ((void)0)
72 #define _DPRINTF(args...) ((void)0)
73 #define DPRINTFN(n, args...) ((void)0)
74 #define _DPRINTFN(n, args...) ((void)0)
75 #endif /* DPRINTF_ENABLE */
77 #else /* __DPRINTF_EXT */
83 #error "specify unique debug symbol"
86 #define DPRINTF_LEVEL 1
88 int DPRINTF_DEBUG
= DPRINTF_LEVEL
;
89 #define DPRINTF(arg) if (DPRINTF_DEBUG) printf arg
90 #define DPRINTFN(n, arg) if (DPRINTF_DEBUG > (n)) printf arg
91 #else /* DPRINTF_ENABLE */
92 #define DPRINTF(arg) ((void)0)
93 #define DPRINTFN(n, arg) ((void)0)
94 #endif /* DPRINTF_ENABLE */
96 #endif /* __DPRINT_EXT */
97 #endif /* USE_HPC_DPRINTF */
100 * debug print utility
102 #define DBG_BIT_PRINT_COUNT (1 << 0)
103 #define DBG_BIT_PRINT_QUIET (1 << 1)
104 #define dbg_bit_print(a) \
105 __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, DBG_BIT_PRINT_COUNT)
106 #define dbg_bit_print_msg(a, m) \
107 __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, (m), DBG_BIT_PRINT_COUNT)
108 #define dbg_bit_display(a) \
109 __dbg_bit_print((a), sizeof(typeof(a)), 0, 0, 0, DBG_BIT_PRINT_QUIET)
110 void __dbg_bit_print(u_int32_t
, int, int, int, const char *, int);
111 void dbg_bitmask_print(u_int32_t
, u_int32_t
, const char *);
112 void dbg_draw_line(int);
113 void dbg_banner_title(const char *, size_t);
114 void dbg_banner_line(void);
115 #define dbg_banner_function() \
117 const char funcname[] = __func__; \
118 dbg_banner_title(funcname, sizeof funcname); \
122 #define RGB565_BLACK 0x0000
123 #define RGB565_RED 0xf800
124 #define RGB565_GREEN 0x07e0
125 #define RGB565_YELLOW 0xffe0
126 #define RGB565_BLUE 0x001f
127 #define RGB565_MAGENTA 0xf81f
128 #define RGB565_CYAN 0x07ff
129 #define RGB565_WHITE 0xffff
131 void dbg_lcd_test(void);