mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-22 18:54:39 +02:00
add-print-decimal.patch
Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
parent
c7a4e4dc0d
commit
1b043e0fe5
@ -82,6 +82,7 @@ int puts(const char *string);
|
||||
void printhex(unsigned char v);
|
||||
void print8(unsigned char u);
|
||||
void print32(unsigned int u);
|
||||
void printdec(int n);
|
||||
void hexdump(unsigned char *start, int len);
|
||||
unsigned int _ntohl(unsigned int n);
|
||||
unsigned long crc32(unsigned long crc, const unsigned char *buf,
|
||||
|
@ -93,8 +93,9 @@ void bootloader_second_phase(void)
|
||||
|
||||
puts(" Found: ");
|
||||
puts((const char *)hdr->ih_name);
|
||||
puts("\n Size: 0x");
|
||||
print32(_ntohl(hdr->ih_size));
|
||||
puts("\n Size: ");
|
||||
printdec(_ntohl(hdr->ih_size) >> 10);
|
||||
puts(" KiB\n");
|
||||
|
||||
if (nand_read_ll(kernel_dram,
|
||||
this_board->kernel_source[kernel].
|
||||
@ -107,7 +108,7 @@ void bootloader_second_phase(void)
|
||||
}
|
||||
}
|
||||
|
||||
puts("\n Cmdline: ");
|
||||
puts(" Cmdline: ");
|
||||
puts(p);
|
||||
puts("\n");
|
||||
|
||||
|
@ -102,6 +102,27 @@ void hexdump(unsigned char *start, int len)
|
||||
}
|
||||
}
|
||||
|
||||
void printdec(int n)
|
||||
{
|
||||
int d = 1 * 1000 * 1000 * 1000;
|
||||
int flag = 0;
|
||||
|
||||
if (n < 0) {
|
||||
this_board->putc('-');
|
||||
n = -n;
|
||||
}
|
||||
|
||||
while (d) {
|
||||
int r = n / d;
|
||||
if (r || flag || (d == 1)) {
|
||||
this_board->putc('0' + r);
|
||||
flag = 1;
|
||||
}
|
||||
n -= r * d;
|
||||
d = d / 10;
|
||||
}
|
||||
}
|
||||
|
||||
/* original copyright notice for this crc code (it is from U-Boot) --> */
|
||||
/*
|
||||
* This file is derived from crc32.c from the zlib-1.1.3 distribution
|
||||
|
Loading…
Reference in New Issue
Block a user