summaryrefslogtreecommitdiffstats
path: root/firmware/microblaze/lib/nonstdio.c
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-07-26 15:33:30 -0700
committerNick Foster <nick@nerdnetworks.org>2010-07-26 15:33:30 -0700
commitf72ad02f5ec370f45995ecd2b3e8b322e9a7e4dc (patch)
tree069b728b6e44a5db8607a8c5815e3a2d50a114ac /firmware/microblaze/lib/nonstdio.c
parentf86c25317b457b280c697fc47905c79bdbbc0c93 (diff)
downloaduhd-f72ad02f5ec370f45995ecd2b3e8b322e9a7e4dc.tar.gz
uhd-f72ad02f5ec370f45995ecd2b3e8b322e9a7e4dc.tar.bz2
uhd-f72ad02f5ec370f45995ecd2b3e8b322e9a7e4dc.zip
New branch with firmware dir from USRP2P branch.
Diffstat (limited to 'firmware/microblaze/lib/nonstdio.c')
-rw-r--r--firmware/microblaze/lib/nonstdio.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/firmware/microblaze/lib/nonstdio.c b/firmware/microblaze/lib/nonstdio.c
index 1c991afee..4b5fa4123 100644
--- a/firmware/microblaze/lib/nonstdio.c
+++ b/firmware/microblaze/lib/nonstdio.c
@@ -78,3 +78,46 @@ puthex32_nl(unsigned long x)
puthex32(x);
newline();
}
+/*
+void reverse(char s[])
+{
+ int c, i, j;
+
+ for (i = 0, j = strlen(s)-1; i<j; i++, j--) {
+ c = s[i];
+ s[i] = s[j];
+ s[j] = c;
+ }
+}
+
+int abs(signed long value) {
+ return (value >= 0) ? value : 0-value;
+}
+
+//we'll keep the puthex functions above because they're way more lightweight. but sometimes you just want to print in decimal, you know?
+char *itoa(signed long value, char *result, int base)
+{
+ // check that the base if valid
+ if (base < 2 || base > 16) { *result = 0; return result; }
+
+ char* out = result;
+ signed long quotient = value;
+
+ do {
+ *out = hex[ abs(quotient % base) ];
+ ++out;
+ quotient /= base;
+ } while ( quotient );
+
+ // Only apply negative sign for base 10
+ if ( value < 0 && base == 10) *out++ = '-';
+
+ *out = 0;
+ reverse( result );
+
+ return result;
+
+}
+*/
+
+