X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fcommon.h;h=d1dd65a851ea3f27786da1102a11d94cd66ba7f0;hb=cc4b5a34d294ba9fd8dad5a51bf84621310e685d;hp=74d97046a0e5242c330dd9fd923e492dde2b8349;hpb=7cb30b13f12077c7eec8ce2419cd96cd65ace8e2;p=oweals%2Fu-boot.git diff --git a/include/common.h b/include/common.h index 74d97046a0..d1dd65a851 100644 --- a/include/common.h +++ b/include/common.h @@ -206,13 +206,6 @@ typedef void (interrupt_handler_t)(void *); #endif /* CONFIG_SERIAL_MULTI */ -/* - * Return the time since boot in microseconds, This is needed for bootstage - * and should be defined in CPU- or board-specific code. If undefined then - * millisecond resolution will be used (the standard get_timer()). - */ -ulong timer_get_boot_us(void); - /* * General Purpose Utilities */ @@ -229,6 +222,31 @@ ulong timer_get_boot_us(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) || \ @@ -307,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); @@ -337,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); @@ -711,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 *)); @@ -740,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 */ @@ -786,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. */ @@ -801,6 +838,10 @@ int pcmcia_init (void); #include +#ifdef CONFIG_SHOW_ACTIVITY +void show_activity(int arg); +#endif + /* Multicore arch functions */ #ifdef CONFIG_MP int cpu_status(int nr);