aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-03 10:28:47 -0700
committerChristian Cunningham <cc@localhost>2021-12-03 10:28:47 -0700
commit2700eb584bc889b9c1e87a78480b927579fe2cc1 (patch)
tree957ddb5c8ef1dcc260acc506efecef19ca815175 /src
parent2243c481dfc335f09e270783ce9fda39a9a0da57 (diff)
Added Base 10 representation of numbers
Display frequency as base 10
Diffstat (limited to 'src')
-rw-r--r--src/lib.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/lib.c b/src/lib.c
index 1c6ce85..eb3833b 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -10,6 +10,8 @@ extern void write_cntv_tval(unsigned long); // Clear cntv interrupt and set next
extern void routing_core0cntv_to_core0irq();
extern void enable_cntv();
+void uart_10(unsigned long);
+
extern unsigned long cntfrq;
static char* irq_on = " \033[92mEnabled\033[0m\n";
@@ -69,7 +71,7 @@ void c_timer() {
uart_hexn(read_cntv_tval());
}
-// Checks IRQ statuses
+// Checks IRQ status
void chk_irq_stat() {
uart_string((char*)"Checking Enabled Services...\n");
@@ -103,7 +105,9 @@ void chk_irq_stat() {
// Output the frequency
uart_string((char*)" w/ CNTFRQ : ");
cntfrq = read_cntfrq();
- uart_hexn(cntfrq);
+ //uart_hexn(cntfrq);
+ uart_10(cntfrq);
+ uart_char(0x0a);
} else {
uart_string(irq_off);
}
@@ -129,3 +133,19 @@ void chk_irq_stat() {
uart_char(0x0a);
}
+
+void uart_10(unsigned long val) {
+ unsigned long t = val;
+ unsigned long c;
+ char buffer[11] = "0000000000\0";
+ char* dptr = buffer + 9;
+ for(int i = 0; i <= 10; i++) {
+ c = t%10;
+ *dptr = 0x30 + (c&0xF);
+ t /= 10;
+ if (t==0)
+ break;
+ dptr -= 1;
+ }
+ uart_string(dptr);
+}