Remove obsolete file.
[bertos.git] / cfg / debug.h
index 36085ea382002382996358bfc0b676ce34616917..38029081aa5ae942f1f5c918223b1a34fae5d3e0 100755 (executable)
 
 /*#*
  *#* $Log$
+ *#* Revision 1.7  2006/02/20 02:01:56  bernie
+ *#* Depend on cfg/os.h.
+ *#*
+ *#* Revision 1.6  2006/02/17 22:28:37  bernie
+ *#* Support TRACE() and TRACEMSG() on hosted targets.
+ *#*
+ *#* Revision 1.5  2005/11/04 16:09:03  bernie
+ *#* Doxygen workaround.
+ *#*
  *#* Revision 1.4  2005/07/03 15:18:52  bernie
  *#* Typo.
  *#*
 #ifndef DEVLIB_DEBUG_H
 #define DEVLIB_DEBUG_H
 
-/*
- * Try to guess whether we're running in a hosted or embedded environment.
- */
-#ifndef OS_HOSTED
-       #if defined(__unix__) || defined(_WIN32)
-               #define OS_HOSTED  1
-       #else
-               #define OS_HOSTED  0
-       #endif
-#endif /* !OS_HOSTED */
+#include <cfg/os.h>
 
 #if OS_HOSTED
        /*
        /*!
         * This macro can be used to conditionally exclude one or more
         * statements conditioned on \c _DEBUG, avoiding the clutter
-        * of #ifdef/#endif pairs.
+        * of ifdef/endif pairs.
         *
         * \code
         *     struct FooBar
                }
                /* G++ can't inline functions with variable arguments... */
                #define kprintf(fmt, ...) fprintf(stderr, fmt, ## __VA_ARGS__)
+               #define kvprintf(fmt, ap) vfprintf(stderr, fmt, ap)
                void kdump(const void *buf, size_t len); /* UNIMPLEMENTED */
 
                #ifndef ASSERT
                        #include <assert.h>
                        #define ASSERT(x) assert(x)
                #endif /* ASSERT */
+               #define ASSERT2(x, help)  ASSERT(help && x)
 
                /*!
                 * Check that the given pointer is not NULL or pointing to raw memory.
                #define ASSERT_VALID_PTR(p)  ASSERT((unsigned long)(p) > 0x200)
 
                #define ASSERT_VALID_PTR_OR_NULL(p)  ASSERT((((p) == NULL) || ((unsigned long)(p) >= 0x200)))
+
+               #if !CONFIG_KDEBUG_DISABLE_TRACE
+                       #define TRACE  kporintf("%s()\n", __func__)
+                       #define TRACEMSG(msg,...) kprintf("%s(): " msg, __func__, ## __VA_ARGS__)
+               #else
+                       #define TRACE  do {} while(0)
+                       #define TRACEMSG(...)  do {} while(0)
+               #endif
+
        #else /* !OS_HOSTED */
 
                #include <appconfig.h>  /* CONFIG_KDEBUG_ASSERT_NO_TEXT */