X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fcommon.h;h=d1dd65a851ea3f27786da1102a11d94cd66ba7f0;hb=0a7bec7f991950da90c6ee6bc59f322abebccbb7;hp=8f5331eb7afd761e0230153e498c68d7c73ef22f;hpb=79714c1e26229985c2ed9dd5853b55732cb21f2c;p=u-boot diff --git a/include/common.h b/include/common.h index 8f5331eb7a..d1dd65a851 100644 --- a/include/common.h +++ b/include/common.h @@ -222,6 +222,31 @@ typedef void (interrupt_handler_t)(void *); #define MIN(x, y) min(x, y) #define MAX(x, y) max(x, y) +/* + * Return the absolute value of a number. + * + * This handles unsigned and signed longs, ints, shorts and chars. For all + * input types abs() returns a signed long. + * + * For 64-bit types, use abs64() + */ +#define abs(x) ({ \ + long ret; \ + if (sizeof(x) == sizeof(long)) { \ + long __x = (x); \ + ret = (__x < 0) ? -__x : __x; \ + } else { \ + int __x = (x); \ + ret = (__x < 0) ? -__x : __x; \ + } \ + ret; \ + }) + +#define abs64(x) ({ \ + s64 __x = (x); \ + (__x < 0) ? -__x : __x; \ + }) + #if defined(CONFIG_ENV_IS_EMBEDDED) #define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN #elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \ @@ -260,8 +285,7 @@ int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen); /* common/main.c */ void main_loop (void); -int run_command (const char *cmd, int flag); -int run_command2(const char *cmd, int flag); +int run_command(const char *cmd, int flag); int readline (const char *const prompt); int readline_into_buffer(const char *const prompt, char *buffer, int timeout); @@ -285,13 +309,6 @@ 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); @@ -308,6 +325,12 @@ void doc_probe(unsigned long physadr); /* common/cmd_net.c */ int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); +/* common/cmd_fat.c */ +int do_fat_fsload(cmd_tbl_t *, int, int, char * const []); + +/* common/cmd_ext2.c */ +int do_ext2load(cmd_tbl_t *, int, int, char * const []); + /* common/cmd_nvedit.c */ int env_init (void); void env_relocate (void); @@ -338,6 +361,9 @@ int setenv_addr(const char *varname, const void *addr); # include # include #endif /* CONFIG_NDS32 */ +#ifdef CONFIG_MIPS +# include +#endif /* CONFIG_MIPS */ #ifdef CONFIG_AUTO_COMPLETE int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf); @@ -712,13 +738,6 @@ int gunzip(void *, int, unsigned char *, unsigned long *); int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp, int stoponerr, int offset); -/* lib/net_utils.c */ -#include -static inline IPaddr_t getenv_IPaddr (char *var) -{ - return (string_to_ip(getenv(var))); -} - /* lib/qsort.c */ void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); @@ -741,6 +760,16 @@ char * strmhz(char *buf, unsigned long hz); /* lib/crc32.c */ #include +/* lib/rand.c */ +#if defined(CONFIG_RANDOM_MACADDR) || \ + defined(CONFIG_BOOTP_RANDOM_DELAY) || \ + defined(CONFIG_CMD_LINK_LOCAL) +#define RAND_MAX -1U +void srand(unsigned int seed); +unsigned int rand(void); +unsigned int rand_r(unsigned int *seedp); +#endif + /* common/console.c */ int console_init_f(void); /* Before relocation; uses the serial stuff */ int console_init_r(void); /* After relocation; uses the console stuff */ @@ -787,6 +816,13 @@ void fputc(int file, const char c); int ftstc(int file); int fgetc(int file); +/* lib/net_utils.c */ +#include +static inline IPaddr_t getenv_IPaddr(char *var) +{ + return string_to_ip(getenv(var)); +} + /* * CONSOLE multiplexing. */ @@ -799,10 +835,12 @@ int pcmcia_init (void); #ifdef CONFIG_STATUS_LED # include #endif -/* - * Board-specific Platform code can reimplement show_boot_progress () if needed - */ -void show_boot_progress(int val); + +#include + +#ifdef CONFIG_SHOW_ACTIVITY +void show_activity(int arg); +#endif /* Multicore arch functions */ #ifdef CONFIG_MP