mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-26 10:09:20 +02:00
qi-add-hex-sprintf-type-functions.patch
We need to print hex into string buffers now, only in phase 2 Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
parent
dd2344a9c7
commit
72ecb60392
@ -126,6 +126,10 @@ void printdec(int n);
|
|||||||
void hexdump(unsigned char *start, int len);
|
void hexdump(unsigned char *start, int len);
|
||||||
void udelay(int n);
|
void udelay(int n);
|
||||||
|
|
||||||
|
/* phase2 only */
|
||||||
|
void setnybble(char *p, unsigned char n);
|
||||||
|
void set8(char *p, unsigned char n);
|
||||||
|
void set32(char *p, unsigned int u);
|
||||||
|
|
||||||
unsigned long crc32(unsigned long crc, const unsigned char *buf,
|
unsigned long crc32(unsigned long crc, const unsigned char *buf,
|
||||||
unsigned int len);
|
unsigned int len);
|
||||||
|
@ -109,3 +109,26 @@ void hexdump(unsigned char *start, int len)
|
|||||||
len -= 16;
|
len -= 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setnybble(char *p, unsigned char n)
|
||||||
|
{
|
||||||
|
if (n < 10)
|
||||||
|
*p = '0' + n;
|
||||||
|
else
|
||||||
|
*p = 'a' + n - 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set8(char *p, unsigned char n)
|
||||||
|
{
|
||||||
|
setnybble(p, (n >> 4) & 15);
|
||||||
|
setnybble(p + 1, n & 15);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set32(char *p, unsigned int u)
|
||||||
|
{
|
||||||
|
set8(p, u >> 24);
|
||||||
|
set8(p + 2, u >> 16);
|
||||||
|
set8(p + 4, u >> 8);
|
||||||
|
set8(p + 6, u);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user