From bc4b5366cd2863904abae103f0e198dd6952e438 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Sat, 28 Aug 2010 23:12:11 +0000 Subject: firmware/ : use lcd_putsf() (only in debug code) ata-meg-fx: use unsigned line number, so % (modulo) is optimized tcc7*: use proper printf format and remove casting git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27935 a1c6a512-1295-4272-9138-f99709370657 --- firmware/ifp_usb_serial.c | 5 +---- .../target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c | 6 ++---- firmware/target/arm/tcc77x/debug-tcc77x.c | 19 ++++++------------- firmware/target/arm/tcc780x/debug-tcc780x.c | 22 +++++++--------------- .../arm/tms320dm320/creative-zvm/pic-creativezvm.c | 10 +++------- 5 files changed, 19 insertions(+), 43 deletions(-) diff --git a/firmware/ifp_usb_serial.c b/firmware/ifp_usb_serial.c index 530f2c122b..5392de0d52 100644 --- a/firmware/ifp_usb_serial.c +++ b/firmware/ifp_usb_serial.c @@ -988,10 +988,7 @@ static void serial_restart_output(int ep) if (blen) { #ifdef LCD_DEBUG - char s[20]; - snprintf(s, sizeof(s), "o%03lx/%03x", block - serial_out_fifo.buf, - blen); - lcd_puts(0, 2, s); + lcd_putsf(0, 2, "o%03lx/%03x", block - serial_out_fifo.buf, blen); lcd_update(); #endif usb_send_block(block, blen, serial_free_out_fifo, ep); diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c index 4b1e1d9ccc..8cd0260fe4 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/ata-meg-fx.c @@ -95,10 +95,8 @@ void copy_read_sectors(unsigned char* buf, int wordcount) //#define GIGABEAT_DEBUG_ATA #ifdef GIGABEAT_DEBUG_ATA - static int line = 0; - static char str[256]; - snprintf(str, sizeof(str), "ODD DMA to %08x, %d", buf, wordcount); - lcd_puts(10, line, str); + static unsigned line = 0; + lcd_putsf(10, line, "ODD DMA to %08x, %d", buf, wordcount); line = (line+1) % 32; lcd_update(); #endif diff --git a/firmware/target/arm/tcc77x/debug-tcc77x.c b/firmware/target/arm/tcc77x/debug-tcc77x.c index cf98451329..20d6954b03 100644 --- a/firmware/target/arm/tcc77x/debug-tcc77x.c +++ b/firmware/target/arm/tcc77x/debug-tcc77x.c @@ -40,7 +40,6 @@ bool __dbg_hw_info(void) { int line = 0, i, button, oldline; bool done=false; - char buf[100]; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -63,21 +62,15 @@ bool __dbg_hw_info(void) #endif done=true; - snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", - (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "current tick: %08lx Seconds running: %08ld", + current_tick, current_tick/HZ); - snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x", - (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x", - (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIOE: 0x%08x", - (unsigned int)GPIOE); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPIOA: 0x%08lx GPIOB: 0x%08lx", GPIOA, GPIOB); + lcd_putsf(0, line++, "GPIOC: 0x%08lx GPIOD: 0x%08lx", GPIOC, GPIOD); + lcd_putsf(0, line++, "GPIOE: 0x%08lx", GPIOE); for (i = 0; i<4; i++) - { - snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i)); - lcd_puts(0, line++, buf); - } + lcd_putsf(0, line++, "ADC%d: 0x%04x", i, adc_read(i)); lcd_update(); } diff --git a/firmware/target/arm/tcc780x/debug-tcc780x.c b/firmware/target/arm/tcc780x/debug-tcc780x.c index 3afc5fafab..9267307e05 100644 --- a/firmware/target/arm/tcc780x/debug-tcc780x.c +++ b/firmware/target/arm/tcc780x/debug-tcc780x.c @@ -43,7 +43,6 @@ bool __dbg_ports(void) bool __dbg_hw_info(void) { int line = 0, i, oldline; - char buf[100]; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -61,24 +60,17 @@ bool __dbg_hw_info(void) if (button_get_w_tmo(HZ/20) == (BUTTON_POWER|BUTTON_REL)) break; - snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", - (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "current tick: %08lx Seconds running: %08ld", + current_tick, current_tick/HZ); - snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x", - (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x", - (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIOE: 0x%08x", - (unsigned int)GPIOE); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPIOA: 0x%08lx GPIOB: 0x%08lx", GPIOA, GPIOB); + lcd_putsf(0, line++, "GPIOC: 0x%08lx GPIOD: 0x%08lx", GPIOC, GPIOD); + lcd_putsf(0, line++, "GPIOE: 0x%08lx", GPIOE); for (i = 0; i<4; i++) - { - snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i)); - lcd_puts(0, line++, buf); - } + lcd_putsf(0, line++, "ADC%d: 0x%04x", i, adc_read(i)); - snprintf(buf, sizeof(buf), "STS: 0x%08x SRC: 0x%08x", - (unsigned int)STS, (unsigned int)SRC); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "STS: 0x%08lx SRC: 0x%08lx", STS, SRC); lcd_update(); } diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c index d910eeb3b6..ab5462fa90 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/pic-creativezvm.c @@ -255,18 +255,14 @@ void GIO0(void) break; } #ifdef BUTTON_DEBUG - unsigned char weergvn[10]; #ifdef BOOTLOADER lcd_set_foreground((sw ? LCD_RGBPACK(255,0,0) : LCD_RGBPACK(0,255,0) )); #endif - snprintf(weergvn, sizeof(char)*10, "%x", + lcd_putsxyf(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*10, "%x", (unsigned int)((msg[3] << 24) | (msg[2] << 16) | (msg[1] << 8) | msg[0])); - lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*10, - weergvn); - snprintf(weergvn, sizeof(char)*10, "%x", btn); - lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*7, - weergvn); + lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*10, LCD_HEIGHT-SYSFONT_HEIGHT*7, "%x", + btn); #ifdef BOOTLOADER lcd_set_foreground(LCD_BLACK); #endif -- cgit v1.2.3