aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Geiselbrecht <geist@foobox.com>2013-06-07 22:14:07 -0700
committerTravis Geiselbrecht <geist@foobox.com>2013-06-07 22:27:00 -0700
commit98b4e0938e67ad4f665042751fa9f8d4ff687a4b (patch)
tree28756d34a66f47b772dca74b236c74dadb7dfab8
parentd5cf22f40daac9e9ef118bc5822dc43058386b59 (diff)
downloadlk-98b4e0938e67ad4f665042751fa9f8d4ff687a4b.tar.gz
[make] rename DEBUGLEVEL -> LK_DEBUGLEVEL, remove DEBUG define
-Remove top level DEBUG=<N> define -Rename DEBUGLEVEL to LK_DEBUGLEVEL to be clear. -Fix the places that used DEBUGLEVEL and the few spots that #ifdef on DEBUG.
-rw-r--r--engine.mk2
-rw-r--r--include/assert.h2
-rw-r--r--include/debug.h14
-rw-r--r--include/kernel/thread.h3
-rw-r--r--kernel/debug.c4
-rw-r--r--kernel/mutex.c6
-rw-r--r--kernel/thread.c2
-rw-r--r--lib/bio/debug.c2
-rw-r--r--lib/cksum/debug.c4
-rw-r--r--lib/console/console.c4
-rw-r--r--lib/debugcommands/debugcommands.c4
-rw-r--r--lib/fs/debug.c2
-rw-r--r--lib/gfx/gfx.c2
-rw-r--r--lib/heap/heap.c4
-rw-r--r--lib/partition/partition.c2
-rw-r--r--platform/pc/keyboard.c4
-rw-r--r--platform/pc/platform.c4
-rw-r--r--platform/stellaris/ti/driverlib/debug.h4
18 files changed, 36 insertions, 33 deletions
diff --git a/engine.mk b/engine.mk
index ce07ce21..3ad594b4 100644
--- a/engine.mk
+++ b/engine.mk
@@ -143,7 +143,7 @@ GLOBAL_DEFINES += \
# debug build?
ifneq ($(DEBUG),)
GLOBAL_DEFINES += \
- DEBUG=$(DEBUG)
+ LK_DEBUGLEVEL=$(DEBUG)
endif
# allow additional defines from outside the build system
diff --git a/include/assert.h b/include/assert.h
index 3200c132..db77da73 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -29,7 +29,7 @@
#define ASSERT(x) \
do { if (unlikely(!(x))) { panic("ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); } } while (0)
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
#define DEBUG_ASSERT(x) \
do { if (unlikely(!(x))) { panic("DEBUG ASSERT FAILED at (%s:%d): %s\n", __FILE__, __LINE__, #x); } } while (0)
#else
diff --git a/include/debug.h b/include/debug.h
index a2d99052..ceb37a0e 100644
--- a/include/debug.h
+++ b/include/debug.h
@@ -31,10 +31,8 @@
__BEGIN_CDECLS
-#if defined(DEBUG)
-#define DEBUGLEVEL DEBUG
-#else
-#define DEBUGLEVEL 2
+#if !defined(LK_DEBUGLEVEL)
+#define LK_DEBUGLEVEL 0
#endif
/* debug levels */
@@ -69,10 +67,10 @@ static inline void hexdump8(const void *ptr, size_t len) { }
#endif /* DISABLE_DEBUG_OUTPUT */
-#define dputc(level, str) do { if ((level) <= DEBUGLEVEL) { _dputc(str); } } while (0)
-#define dputs(level, str) do { if ((level) <= DEBUGLEVEL) { _dputs(str); } } while (0)
-#define dprintf(level, x...) do { if ((level) <= DEBUGLEVEL) { _dprintf(x); } } while (0)
-#define dvprintf(level, x...) do { if ((level) <= DEBUGLEVEL) { _dvprintf(x); } } while (0)
+#define dputc(level, str) do { if ((level) <= LK_DEBUGLEVEL) { _dputc(str); } } while (0)
+#define dputs(level, str) do { if ((level) <= LK_DEBUGLEVEL) { _dputs(str); } } while (0)
+#define dprintf(level, x...) do { if ((level) <= LK_DEBUGLEVEL) { _dprintf(x); } } while (0)
+#define dvprintf(level, x...) do { if ((level) <= LK_DEBUGLEVEL) { _dvprintf(x); } } while (0)
/* trace routines */
#define TRACE_ENTRY printf("%s: entry\n", __PRETTY_FUNCTION__)
diff --git a/include/kernel/thread.h b/include/kernel/thread.h
index 5ac90814..b21a0f83 100644
--- a/include/kernel/thread.h
+++ b/include/kernel/thread.h
@@ -30,6 +30,7 @@
#include <arch/ops.h>
#include <arch/thread.h>
#include <kernel/wait.h>
+#include <debug.h>
enum thread_state {
THREAD_SUSPENDED = 0,
@@ -184,7 +185,7 @@ static inline __ALWAYS_INLINE uint32_t tls_set(uint entry, uint32_t val)
}
/* thread level statistics */
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
#define THREAD_STATS 1
#else
#define THREAD_STATS 0
diff --git a/kernel/debug.c b/kernel/debug.c
index ec7008a6..706fceb8 100644
--- a/kernel/debug.c
+++ b/kernel/debug.c
@@ -47,7 +47,7 @@ static int cmd_threadload(int argc, const cmd_args *argv);
static int cmd_kevlog(int argc, const cmd_args *argv);
STATIC_COMMAND_START
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
STATIC_COMMAND("threads", "list kernel threads", &cmd_threads)
#endif
#if THREAD_STATS
@@ -59,7 +59,7 @@ STATIC_COMMAND("kevlog", "dump kernel event log", &cmd_kevlog)
#endif
STATIC_COMMAND_END(kernel);
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
static int cmd_threads(int argc, const cmd_args *argv)
{
printf("thread list:\n");
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 9feb7d93..979db732 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -54,7 +54,7 @@ void mutex_destroy(mutex_t *m)
{
DEBUG_ASSERT(m->magic == MUTEX_MAGIC);
-#if DEBUGLEVEL > 0
+#if LK_DEBUGLEVEL > 0
if (unlikely(m->holder != 0 && current_thread != m->holder))
panic("mutex_destroy: thread %p (%s) tried to release mutex %p it doesn't own. owned by %p (%s)\n",
current_thread, current_thread->name, m, m->holder, m->holder->name);
@@ -81,7 +81,7 @@ status_t mutex_acquire_timeout(mutex_t *m, lk_time_t timeout)
{
DEBUG_ASSERT(m->magic == MUTEX_MAGIC);
-#if DEBUGLEVEL > 0
+#if LK_DEBUGLEVEL > 0
if (unlikely(current_thread == m->holder))
panic("mutex_acquire_timeout: thread %p (%s) tried to acquire mutex %p it already owns.\n",
current_thread, current_thread->name, m);
@@ -123,7 +123,7 @@ status_t mutex_release(mutex_t *m)
{
DEBUG_ASSERT(m->magic == MUTEX_MAGIC);
-#if DEBUGLEVEL > 0
+#if LK_DEBUGLEVEL > 0
if (unlikely(current_thread != m->holder)) {
panic("mutex_release: thread %p (%s) tried to release mutex %p it doesn't own. owned by %p (%s)\n",
current_thread, current_thread->name, m, m->holder, m->holder ? m->holder->name : "none");
diff --git a/kernel/thread.c b/kernel/thread.c
index f46ce20b..4be836ff 100644
--- a/kernel/thread.c
+++ b/kernel/thread.c
@@ -44,7 +44,7 @@
#include <target.h>
#include <lib/heap.h>
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
#define THREAD_CHECKS 1
#endif
diff --git a/lib/bio/debug.c b/lib/bio/debug.c
index af25fcfc..54611e56 100644
--- a/lib/bio/debug.c
+++ b/lib/bio/debug.c
@@ -30,7 +30,7 @@
#if defined(WITH_LIB_CONSOLE)
-#if DEBUGLEVEL > 0
+#if LK_DEBUGLEVEL > 0
static int cmd_bio(int argc, const cmd_args *argv);
STATIC_COMMAND_START
diff --git a/lib/cksum/debug.c b/lib/cksum/debug.c
index 6b8f113b..f335b514 100644
--- a/lib/cksum/debug.c
+++ b/lib/cksum/debug.c
@@ -37,11 +37,11 @@ static int cmd_adler32(int argc, const cmd_args *argv);
static int cmd_cksum_bench(int argc, const cmd_args *argv);
STATIC_COMMAND_START
-#if DEBUGLEVEL > 0
+#if LK_DEBUGLEVEL > 0
{ "crc32", "crc32", &cmd_crc32 },
{ "adler32", "adler32", &cmd_adler32 },
#endif
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
{ "bench_cksum", "benchmark the checksum routines", &cmd_cksum_bench },
#endif
STATIC_COMMAND_END(crc);
diff --git a/lib/console/console.c b/lib/console/console.c
index be274b41..c8e575f1 100644
--- a/lib/console/console.c
+++ b/lib/console/console.c
@@ -81,7 +81,7 @@ static int cmd_history(int argc, const cmd_args *argv);
STATIC_COMMAND_START
STATIC_COMMAND("help", "this list", &cmd_help)
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
STATIC_COMMAND("test", "test the command processor", &cmd_test)
#if CONSOLE_ENABLE_HISTORY
STATIC_COMMAND("history", "command history", &cmd_history)
@@ -725,7 +725,7 @@ static int cmd_help(int argc, const cmd_args *argv)
return 0;
}
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
static int cmd_test(int argc, const cmd_args *argv)
{
int i;
diff --git a/lib/debugcommands/debugcommands.c b/lib/debugcommands/debugcommands.c
index ac8c59c0..275f5bc5 100644
--- a/lib/debugcommands/debugcommands.c
+++ b/lib/debugcommands/debugcommands.c
@@ -42,7 +42,7 @@ static int cmd_memtest(int argc, const cmd_args *argv);
static int cmd_copy_mem(int argc, const cmd_args *argv);
STATIC_COMMAND_START
-#if DEBUGLEVEL > 0
+#if LK_DEBUGLEVEL > 0
{ "dw", "display memory in words", &cmd_display_mem },
{ "dh", "display memory in halfwords", &cmd_display_mem },
{ "db", "display memory in bytes", &cmd_display_mem },
@@ -54,7 +54,7 @@ STATIC_COMMAND_START
{ "fb", "fill range of memory by byte", &cmd_fill_mem },
{ "mc", "copy a range of memory", &cmd_copy_mem },
#endif
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
{ "mtest", "simple memory test", &cmd_memtest },
#endif
STATIC_COMMAND_END(mem);
diff --git a/lib/fs/debug.c b/lib/fs/debug.c
index 09b778d8..657ba792 100644
--- a/lib/fs/debug.c
+++ b/lib/fs/debug.c
@@ -29,7 +29,7 @@
#if defined(WITH_LIB_CONSOLE)
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
static int cmd_fs(int argc, const cmd_args *argv);
STATIC_COMMAND_START
diff --git a/lib/gfx/gfx.c b/lib/gfx/gfx.c
index 694444cd..43ccd60d 100644
--- a/lib/gfx/gfx.c
+++ b/lib/gfx/gfx.c
@@ -537,7 +537,7 @@ void gfx_draw_pattern_white(void)
#if defined(WITH_LIB_CONSOLE)
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
#include <lib/console.h>
static int cmd_gfx(int argc, const cmd_args *argv);
diff --git a/lib/heap/heap.c b/lib/heap/heap.c
index 9135d1c2..af2aa3b6 100644
--- a/lib/heap/heap.c
+++ b/lib/heap/heap.c
@@ -168,7 +168,7 @@ static void heap_test(void)
// nearby ones if possible. Returns base of whatever chunk it became in the list.
static struct free_heap_chunk *heap_insert_free_chunk(struct free_heap_chunk *chunk)
{
-#if DEBUGLEVEL > INFO
+#if LK_DEBUGLEVEL > INFO
vaddr_t chunk_end = (vaddr_t)chunk + chunk->len;
#endif
@@ -449,7 +449,7 @@ void heap_init(void)
// heap_test();
}
-#if DEBUGLEVEL > 1
+#if LK_DEBUGLEVEL > 1
#if WITH_LIB_CONSOLE
#include <lib/console.h>
diff --git a/lib/partition/partition.c b/lib/partition/partition.c
index 163e930f..24200a4e 100644
--- a/lib/partition/partition.c
+++ b/lib/partition/partition.c
@@ -97,7 +97,7 @@ int partition_publish(const char *device, off_t offset)
struct mbr_part part[4];
memcpy(part, buf + 446, sizeof(part));
-#if DEBUGLEVEL >= INFO
+#if LK_DEBUGLEVEL >= INFO
dprintf(INFO, "mbr partition table dump:\n");
for (i=0; i < 4; i++) {
dprintf(INFO, "\t%i: status 0x%hhx, type 0x%hhx, start 0x%x, len 0x%x\n", i, part[i].status, part[i].type, part[i].lba_start, part[i].lba_length);
diff --git a/platform/pc/keyboard.c b/platform/pc/keyboard.c
index fe21429b..2e9a8119 100644
--- a/platform/pc/keyboard.c
+++ b/platform/pc/keyboard.c
@@ -319,7 +319,7 @@ void platform_init_keyboard(void)
i8042_flush();
if (i8042_command(&ctr, I8042_CMD_CTL_RCTR)) {
- dprintf(DEBUG, "Failed to read CTR while initializing i8042\n");
+ dprintf(SPEW, "Failed to read CTR while initializing i8042\n");
return;
}
@@ -331,7 +331,7 @@ void platform_init_keyboard(void)
ctr |= I8042_CTR_KBDINT;
if (i8042_command(&ctr, I8042_CMD_CTL_WCTR)) {
- dprintf(DEBUG, "Failed to write CTR while initializing i8042\n");
+ dprintf(SPEW, "Failed to write CTR while initializing i8042\n");
return;
}
diff --git a/platform/pc/platform.c b/platform/pc/platform.c
index f2a06135..7e40ca76 100644
--- a/platform/pc/platform.c
+++ b/platform/pc/platform.c
@@ -53,10 +53,10 @@ void platform_init_multiboot_info(void)
if (_multiboot_info->flags & MB_INFO_MMAP) {
memory_map_t *mmap = (memory_map_t *) (_multiboot_info->mmap_addr - 4);
- dprintf(DEBUG, "mmap length: %u\n", _multiboot_info->mmap_length);
+ dprintf(SPEW, "mmap length: %u\n", _multiboot_info->mmap_length);
for (i=0; i < _multiboot_info->mmap_length / sizeof(memory_map_t); i++) {
- dprintf(DEBUG, "base=%08x, length=%08x, type=%02x\n",
+ dprintf(SPEW, "base=%08x, length=%08x, type=%02x\n",
mmap[i].base_addr_low, mmap[i].length_low, mmap[i].type);
if (mmap[i].type == MB_MMAP_TYPE_AVAILABLE && mmap[i].base_addr_low >= _heap_end) {
diff --git a/platform/stellaris/ti/driverlib/debug.h b/platform/stellaris/ti/driverlib/debug.h
index ed71aefe..d7b524c7 100644
--- a/platform/stellaris/ti/driverlib/debug.h
+++ b/platform/stellaris/ti/driverlib/debug.h
@@ -73,6 +73,10 @@ extern void __error__(char *pcFilename, unsigned long ulLine);
#undef ASSERT
#define ASSERT(e) DEBUG_ASSERT(e)
+#if LK_DEBUGLEVEL > 0
+#define DEBUG
+#endif
+
#endif
#endif // __DEBUG_H__