diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2008-11-19 16:32:36 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2008-11-19 20:34:39 +0100 |
commit | 7e6ee7ad27de5216db1baef76f38c3429c8f4a2a (patch) | |
tree | fe2108d4ddfea1d8054eefe57740b68036f70644 /lib_generic | |
parent | c91a719daa331b5856109313371e4ece5ec06d96 (diff) | |
download | u-boot-imx-7e6ee7ad27de5216db1baef76f38c3429c8f4a2a.zip u-boot-imx-7e6ee7ad27de5216db1baef76f38c3429c8f4a2a.tar.gz u-boot-imx-7e6ee7ad27de5216db1baef76f38c3429c8f4a2a.tar.bz2 |
UBI: Add basic UBI support to U-Boot (Part 6/8)
This patch adds basic UBI (Unsorted Block Image) support to U-Boot.
It's based on the Linux UBI version and basically has a "OS"
translation wrapper that defines most Linux specific calls
(spin_lock() etc.) into no-ops. Some source code parts have been
uncommented by "#ifdef UBI_LINUX". This makes it easier to compare
this version with the Linux version and simplifies future UBI
ports/bug-fixes from the Linux version.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'lib_generic')
-rw-r--r-- | lib_generic/vsprintf.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib_generic/vsprintf.c b/lib_generic/vsprintf.c index 6e903db..767dde1 100644 --- a/lib_generic/vsprintf.c +++ b/lib_generic/vsprintf.c @@ -55,6 +55,29 @@ long simple_strtol(const char *cp,char **endp,unsigned int base) return simple_strtoul(cp,endp,base); } +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) { |