X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fcommon.h;h=a8d833b9891fe09c7121c637a7f1f84a8b764d2b;hb=021abf696fca37963db1f72e7e35d2ccdbe285ef;hp=1bb8a7956bf96a7d6547a553223f5622c6129478;hpb=5e7f74332465f0addc05634d351df8eeaa2015d2;p=u-boot diff --git a/include/common.h b/include/common.h index 1bb8a7956b..a8d833b989 100644 --- a/include/common.h +++ b/include/common.h @@ -101,6 +101,12 @@ typedef volatile unsigned char vu_char; #define _DEBUG 0 #endif +#ifdef CONFIG_SPL_BUILD +#define _SPL_BUILD 1 +#else +#define _SPL_BUILD 0 +#endif + /* Define this at the top of a file to add a prefix to debug messages */ #ifndef pr_fmt #define pr_fmt(fmt) fmt @@ -121,6 +127,10 @@ typedef volatile unsigned char vu_char; #define debug(fmt, args...) \ debug_cond(_DEBUG, fmt, ##args) +/* Show a message if not in SPL */ +#define warn_non_spl(fmt, args...) \ + debug_cond(!_SPL_BUILD, fmt, ##args) + /* * An assertion is run-time check done in debug mode only. If DEBUG is not * defined then it is skipped. If DEBUG is defined and the assertion fails, @@ -856,17 +866,20 @@ int getc(void); int tstc(void); /* stdout */ -#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT) -#define putc(...) do { } while (0) -#define puts(...) do { } while (0) -#define printf(...) do { } while (0) -#define vprintf(...) do { } while (0) -#else +#if !defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \ + (defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \ + defined(CONFIG_SPL_SERIAL_SUPPORT)) void putc(const char c); void puts(const char *s); int printf(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); int vprintf(const char *fmt, va_list args); +#else +#define putc(...) do { } while (0) +#define puts(...) do { } while (0) +#define printf(...) do { } while (0) +#define vprintf(...) do { } while (0) #endif /* stderr */