X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=include%2Fcommon.h;h=a2c6b27d43cce33d1a00a033e4b33c895c4e1d8d;hb=c8a7cfebd87a13c23396ffa238b28ae46d4d476b;hp=13575272b4baa6edaae8aa1418085199662a39a5;hpb=46a6d51c827a12723e7191128fb7aab42c8f5c09;p=karo-tx-uboot.git diff --git a/include/common.h b/include/common.h index 13575272b4..a2c6b27d43 100644 --- a/include/common.h +++ b/include/common.h @@ -116,20 +116,26 @@ typedef volatile unsigned char vu_char; #include #include -#ifdef DEBUG -#define debug(fmt,args...) printf (fmt ,##args) -#define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args); -#else -#define debug(fmt,args...) -#define debugX(level,fmt,args...) -#endif /* DEBUG */ - #ifdef DEBUG -# define _DEBUG 1 +#define _DEBUG 1 #else -# define _DEBUG 0 +#define _DEBUG 0 #endif +/* + * Output a debug text when condition "cond" is met. The "cond" should be + * computed by a preprocessor in the best case, allowing for the best + * optimization. + */ +#define debug_cond(cond, fmt, args...) \ + do { \ + if (cond) \ + printf(fmt, ##args); \ + } while (0) + +#define debug(fmt, args...) \ + debug_cond(_DEBUG, 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, @@ -259,13 +265,15 @@ int run_command (const char *cmd, int flag); int run_command2(const char *cmd, int flag); #endif int readline (const char *const prompt); -int readline_into_buffer (const char *const prompt, char * buffer); +int readline_into_buffer(const char *const prompt, char *buffer, + int timeout); int parse_line (char *, char *[]); void init_cmd_timeout(void); void reset_cmd_timeout(void); #ifdef CONFIG_MENU int abortboot(int bootdelay); #endif +extern char console_buffer[]; /* arch/$(ARCH)/lib/board.c */ void board_init_f (ulong) __attribute__ ((noreturn)); @@ -276,6 +284,15 @@ int checkdram (void); int last_stage_init(void); extern ulong monitor_flash_len; int mac_read_from_eeprom(void); +extern u8 _binary_dt_dtb_start[]; /* embedded device tree blob */ +int set_cpu_clk_info(void); + +/* + * Called when console output is requested before the console is available. + * The board should do its best to get the character out to the user any way + * it can. + */ +void board_pre_console_putc(int ch); /* common/flash.c */ void flash_perror (int); @@ -284,6 +301,8 @@ void flash_perror (int); int source (ulong addr, const char *fit_uname); extern ulong load_addr; /* Default Load Address */ +extern ulong save_addr; /* Default Save Address */ +extern ulong save_size; /* Default Save Size */ /* common/cmd_doc.c */ void doc_probe(unsigned long physadr); @@ -303,6 +322,8 @@ int saveenv (void); int inline setenv (const char *, const char *); #else int setenv (const char *, const char *); +int setenv_ulong(const char *varname, ulong value); +int setenv_addr(const char *varname, const void *addr); #endif /* CONFIG_PPC */ #ifdef CONFIG_ARM # include @@ -714,15 +735,7 @@ void uuid_str_to_bin(const char *uuid, unsigned char *out); int uuid_str_valid(const char *uuid); /* lib/vsprintf.c */ -ulong simple_strtoul(const char *cp,char **endp,unsigned int base); -int strict_strtoul(const char *cp, unsigned int base, unsigned long *res); -unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base); -long simple_strtol(const char *cp,char **endp,unsigned int base); -void panic(const char *fmt, ...) - __attribute__ ((format (__printf__, 1, 2), noreturn)); -int sprintf(char * buf, const char *fmt, ...) - __attribute__ ((format (__printf__, 2, 3))); -int vsprintf(char *buf, const char *fmt, va_list args); +#include /* lib/strmhz.c */ char * strmhz(char *buf, unsigned long hz);