From 084056f729cb4408cbeda954a5aec8ef4f01a0df Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 2 Jul 2015 10:46:21 +0200 Subject: [PATCH] Unsigned arguments for print_dec() Patch by Larry Doolittle --- firmware/firmware.h | 2 +- firmware/irq.c | 6 +++--- firmware/print.c | 2 +- firmware/stats.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/firmware/firmware.h b/firmware/firmware.h index 3faf147..ca797e9 100644 --- a/firmware/firmware.h +++ b/firmware/firmware.h @@ -17,7 +17,7 @@ uint32_t *irq(uint32_t *regs, uint32_t irqs); // print.c void print_chr(char ch); void print_str(const char *p); -void print_dec(int val); +void print_dec(unsigned int val); void print_hex(unsigned int val); // sieve.c diff --git a/firmware/irq.c b/firmware/irq.c index 997e439..af80764 100644 --- a/firmware/irq.c +++ b/firmware/irq.c @@ -9,9 +9,9 @@ uint32_t *irq(uint32_t *regs, uint32_t irqs) { - static int ext_irq_4_count = 0; - static int ext_irq_5_count = 0; - static int timer_irq_count = 0; + static unsigned int ext_irq_4_count = 0; + static unsigned int ext_irq_5_count = 0; + static unsigned int timer_irq_count = 0; if ((irqs & (1<<4)) != 0) { ext_irq_4_count++; diff --git a/firmware/print.c b/firmware/print.c index 2aef715..b12f5a0 100644 --- a/firmware/print.c +++ b/firmware/print.c @@ -20,7 +20,7 @@ void print_str(const char *p) *((volatile uint32_t*)OUTPORT) = *(p++); } -void print_dec(int val) +void print_dec(unsigned int val) { char buffer[10]; char *p = buffer; diff --git a/firmware/stats.c b/firmware/stats.c index 7c4434a..bb38de5 100644 --- a/firmware/stats.c +++ b/firmware/stats.c @@ -7,7 +7,7 @@ #include "firmware.h" -static void stats_print_dec(int val, int digits, bool zero_pad) +static void stats_print_dec(unsigned int val, int digits, bool zero_pad) { char buffer[32]; char *p = buffer; @@ -27,7 +27,7 @@ static void stats_print_dec(int val, int digits, bool zero_pad) void stats() { - int num_cycles, num_instr; + unsigned int num_cycles, num_instr; asm("rdcycle %0; rdinstret %1;" : "=r"(num_cycles), "=r"(num_instr)); print_str("Cycle counter ........"); stats_print_dec(num_cycles, 8, false);