diff options
| author | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-12-17 16:53:07 +0100 | 
|---|---|---|
| committer | Haavard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-12-17 16:53:07 +0100 | 
| commit | cb5473205206c7f14cbb1e747f28ec75b48826e2 (patch) | |
| tree | 8f4808d60917100b18a10b05230f7638a0a9bbcc /lib_generic/vsprintf.c | |
| parent | baf449fc5ff96f071bb0e3789fd3265f6d4fd9a0 (diff) | |
| parent | 92c78a3bbcb2ce508b4bf1c4a1e0940406a024bb (diff) | |
| download | olio-uboot-2014.01-cb5473205206c7f14cbb1e747f28ec75b48826e2.tar.xz olio-uboot-2014.01-cb5473205206c7f14cbb1e747f28ec75b48826e2.zip | |
Merge branch 'fixes' into cleanups
Conflicts:
	board/atmel/atngw100/atngw100.c
	board/atmel/atstk1000/atstk1000.c
	cpu/at32ap/at32ap700x/gpio.c
	include/asm-avr32/arch-at32ap700x/clk.h
	include/configs/atngw100.h
	include/configs/atstk1002.h
	include/configs/atstk1003.h
	include/configs/atstk1004.h
	include/configs/atstk1006.h
	include/configs/favr-32-ezkit.h
	include/configs/hammerhead.h
	include/configs/mimc200.h
Diffstat (limited to 'lib_generic/vsprintf.c')
| -rw-r--r-- | lib_generic/vsprintf.c | 35 | 
1 files changed, 29 insertions, 6 deletions
| diff --git a/lib_generic/vsprintf.c b/lib_generic/vsprintf.c index 7c9cfe16c..767dde1ba 100644 --- a/lib_generic/vsprintf.c +++ b/lib_generic/vsprintf.c @@ -55,7 +55,30 @@ long simple_strtol(const char *cp,char **endp,unsigned int base)  	return simple_strtoul(cp,endp,base);  } -#ifdef CFG_64BIT_STRTOUL +int ustrtoul(const char *cp, char **endp, unsigned int base) +{ +	unsigned long result = simple_strtoul(cp, endp, base); +	switch (**endp) { +	case 'G' : +		result *= 1024; +		/* fall through */ +	case 'M': +		result *= 1024; +		/* fall through */ +	case 'K': +	case 'k': +		result *= 1024; +		if ((*endp)[1] == 'i') { +			if ((*endp)[2] == 'B') +				(*endp) += 3; +			else +				(*endp) += 2; +		} +	} +	return result; +} + +#ifdef CONFIG_SYS_64BIT_STRTOUL  unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int base)  {  	unsigned long long result = 0, value; @@ -83,7 +106,7 @@ unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int ba  		*endp = (char *) cp;  	return result;  } -#endif /* CFG_64BIT_STRTOUL */ +#endif /* CONFIG_SYS_64BIT_STRTOUL */  /* we use this so that we can do without the ctype library */  #define is_digit(c)	((c) >= '0' && (c) <= '9') @@ -105,7 +128,7 @@ static int skip_atoi(const char **s)  #define SPECIAL	32		/* 0x */  #define LARGE	64		/* use 'ABCDEF' instead of 'abcdef' */ -#ifdef CFG_64BIT_VSPRINTF +#ifdef CONFIG_SYS_64BIT_VSPRINTF  #define do_div(n,base) ({ \  	unsigned int __res; \  	__res = ((unsigned long long) n) % base; \ @@ -121,7 +144,7 @@ static int skip_atoi(const char **s)  })  #endif -#ifdef CFG_64BIT_VSPRINTF +#ifdef CONFIG_SYS_64BIT_VSPRINTF  static char * number(char * str, long long num, unsigned int base, int size, int precision ,int type)  #else  static char * number(char * str, long num, unsigned int base, int size, int precision ,int type) @@ -197,7 +220,7 @@ int sprintf(char * buf, const char *fmt, ...);  int vsprintf(char *buf, const char *fmt, va_list args)  {  	int len; -#ifdef CFG_64BIT_VSPRINTF +#ifdef CONFIG_SYS_64BIT_VSPRINTF  	unsigned long long num;  #else  	unsigned long num; @@ -352,7 +375,7 @@ int vsprintf(char *buf, const char *fmt, va_list args)  				--fmt;  			continue;  		} -#ifdef CFG_64BIT_VSPRINTF +#ifdef CONFIG_SYS_64BIT_VSPRINTF  		if (qualifier == 'q')  /* "quad" for 64 bit variables */  			num = va_arg(args, unsigned long long);  		else |