From f34a841b0cc5d1a605375209e1b013b388f741bc Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Sat, 17 Oct 2009 18:02:48 +0000 Subject: Revise r23225 a bit, removing the debug_printf function and implementing more generic lcd_(remote)_putsf function(s) instead and use those in more places git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23233 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/debug-as3525.c | 82 +++++++++---------- firmware/target/arm/imx31/debug-imx31.c | 112 ++++++++++---------------- firmware/target/arm/s3c2440/debug-s3c2440.c | 51 ++++++------ firmware/target/arm/system-arm.c | 5 +- firmware/target/arm/tms320dm320/debug-dm320.c | 69 +++++++--------- 5 files changed, 135 insertions(+), 184 deletions(-) (limited to 'firmware/target/arm') diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 22958c9f22..d8d3e013e2 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c @@ -31,10 +31,6 @@ #include "ascodec-target.h" #include "adc.h" -#define _DEBUG_PRINTF(a,varargs...) do { \ - snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf); \ - } while(0) - #define ON "Enabled" #define OFF "Disabled" @@ -224,7 +220,6 @@ int calc_freq(int clk) bool __dbg_hw_info(void) { - char buf[50]; int line; int last_nand = 0; #if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) @@ -240,16 +235,16 @@ bool __dbg_hw_info(void) { lcd_clear_display(); line = 0; - _DEBUG_PRINTF("[Clock Frequencies:]"); - _DEBUG_PRINTF(" SET ACTUAL"); - _DEBUG_PRINTF("922T:%s %3dMHz", + lcd_puts(0, line++, "[Clock Frequencies:]"); + lcd_puts(0, line++, " SET ACTUAL"); + lcd_putsf(0, line++, "922T:%s %3dMHz", (!(read_cp15()>>30)) ? "FAST " : (read_cp15()>>31) ? "ASYNC" : "SYNC ", calc_freq(CLK_922T)/1000000); - _DEBUG_PRINTF("PLLA:%3dMHz %3dMHz", AS3525_PLLA_FREQ/1000000, + lcd_putsf(0, line++, "PLLA:%3dMHz %3dMHz", AS3525_PLLA_FREQ/1000000, calc_freq(CLK_PLLA)/1000000); - _DEBUG_PRINTF("PLLB: %3dMHz", calc_freq(CLK_PLLB)/1000000); - _DEBUG_PRINTF("FCLK: %3dMHz", calc_freq(CLK_FCLK)/1000000); + lcd_putsf(0, line++, "PLLB: %3dMHz", calc_freq(CLK_PLLB)/1000000); + lcd_putsf(0, line++, "FCLK: %3dMHz", calc_freq(CLK_FCLK)/1000000); #if LCD_HEIGHT < 176 /* clip */ lcd_update(); @@ -265,17 +260,17 @@ bool __dbg_hw_info(void) line = 0; #endif /* LCD_HEIGHT < 176 */ - _DEBUG_PRINTF("DRAM:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000, + lcd_putsf(0, line++, "DRAM:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000, calc_freq(CLK_EXTMEM)/1000000); - _DEBUG_PRINTF("PCLK:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000, + lcd_putsf(0, line++, "PCLK:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000, calc_freq(CLK_PCLK)/1000000); - _DEBUG_PRINTF("IDE :%3dMHz %3dMHz", AS3525_IDE_FREQ/1000000, + lcd_putsf(0, line++, "IDE :%3dMHz %3dMHz", AS3525_IDE_FREQ/1000000, calc_freq(CLK_IDE)/1000000); - _DEBUG_PRINTF("DBOP:%3dMHz %3dMHz", AS3525_DBOP_FREQ/1000000, + lcd_putsf(0, line++, "DBOP:%3dMHz %3dMHz", AS3525_DBOP_FREQ/1000000, calc_freq(CLK_DBOP)/1000000); - _DEBUG_PRINTF("I2C :%3dkHz %3dkHz", AS3525_I2C_FREQ/1000, + lcd_putsf(0, line++, "I2C :%3dkHz %3dkHz", AS3525_I2C_FREQ/1000, calc_freq(CLK_I2C)/1000); - _DEBUG_PRINTF("I2SI: %s %3dMHz", (CGU_AUDIO & (1<<23)) ? + lcd_putsf(0, line++, "I2SI: %s %3dMHz", (CGU_AUDIO & (1<<23)) ? "on " : "off" , calc_freq(CLK_I2SI)/1000000); #if LCD_HEIGHT < 176 /* clip */ @@ -292,27 +287,27 @@ bool __dbg_hw_info(void) line = 0; #endif /* LCD_HEIGHT < 176 */ - _DEBUG_PRINTF("I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ? + lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ? "on " : "off", calc_freq(CLK_I2SO)/1000000); if(MCI_NAND) last_nand = MCI_NAND; /* MCLK == PCLK */ - _DEBUG_PRINTF("SD :%3dMHz %3dMHz", + lcd_putsf(0, line++, "SD :%3dMHz %3dMHz", ((last_nand ? (AS3525_PCLK_FREQ/ 1000000): 0) / ((last_nand & MCI_CLOCK_BYPASS)? 1:(((last_nand & 0xff)+1) * 2))), calc_freq(CLK_SD_MCLK_NAND)/1000000); #if defined(SANSA_E200V2) || defined(SANSA_FUZE) || defined(SANSA_C200V2) if(MCI_SD) last_sd = MCI_SD; - _DEBUG_PRINTF("uSD :%3dMHz %3dMHz", + lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz", ((last_sd ? (AS3525_PCLK_FREQ/ 1000000): 0) / ((last_sd & MCI_CLOCK_BYPASS) ? 1: (((last_sd & 0xff) + 1) * 2))), calc_freq(CLK_SD_MCLK_MSD)/1000000); #endif - _DEBUG_PRINTF("USB : %3dMHz", calc_freq(CLK_USB)/1000000); - _DEBUG_PRINTF("MMU : %s CVDDP:%4d", (read_cp15() & CP15_MMU) ? + lcd_putsf(0, line++, "USB : %3dMHz", calc_freq(CLK_USB)/1000000); + lcd_putsf(0, line++, "MMU : %s CVDDP:%4d", (read_cp15() & CP15_MMU) ? " on" : "off", adc_read(ADC_CVDD) * 25); - _DEBUG_PRINTF("Icache:%s Dcache:%s", + lcd_putsf(0, line++, "Icache:%s Dcache:%s", (read_cp15() & CP15_IC) ? " on" : "off", (read_cp15() & CP15_DC) ? " on" : "off"); @@ -328,12 +323,12 @@ bool __dbg_hw_info(void) lcd_clear_display(); line = 0; - _DEBUG_PRINTF("CGU_PLLA :%8x", (unsigned int)(CGU_PLLA)); - _DEBUG_PRINTF("CGU_PLLB :%8x", (unsigned int)(CGU_PLLB)); - _DEBUG_PRINTF("CGU_PROC :%8x", (unsigned int)(CGU_PROC)); - _DEBUG_PRINTF("CGU_PERI :%8x", (unsigned int)(CGU_PERI)); - _DEBUG_PRINTF("CGU_IDE :%8x", (unsigned int)(CGU_IDE)); - _DEBUG_PRINTF("CGU_DBOP :%8x", (unsigned int)(CGU_DBOP)); + lcd_putsf(0, line++, "CGU_PLLA :%8x", (unsigned int)(CGU_PLLA)); + lcd_putsf(0, line++, "CGU_PLLB :%8x", (unsigned int)(CGU_PLLB)); + lcd_putsf(0, line++, "CGU_PROC :%8x", (unsigned int)(CGU_PROC)); + lcd_putsf(0, line++, "CGU_PERI :%8x", (unsigned int)(CGU_PERI)); + lcd_putsf(0, line++, "CGU_IDE :%8x", (unsigned int)(CGU_IDE)); + lcd_putsf(0, line++, "CGU_DBOP :%8x", (unsigned int)(CGU_DBOP)); #if LCD_HEIGHT < 176 /* clip */ lcd_update(); @@ -349,12 +344,12 @@ bool __dbg_hw_info(void) line = 0; #endif /* LCD_HEIGHT < 176 */ - _DEBUG_PRINTF("CGU_AUDIO :%8x", (unsigned int)(CGU_AUDIO)); - _DEBUG_PRINTF("CGU_USB :%8x", (unsigned int)(CGU_USB)); - _DEBUG_PRINTF("I2C2_CPSR :%8x", (unsigned int)(I2C2_CPSR1<<8 | + lcd_putsf(0, line++, "CGU_AUDIO :%8x", (unsigned int)(CGU_AUDIO)); + lcd_putsf(0, line++, "CGU_USB :%8x", (unsigned int)(CGU_USB)); + lcd_putsf(0, line++, "I2C2_CPSR :%8x", (unsigned int)(I2C2_CPSR1<<8 | I2C2_CPSR0)); - _DEBUG_PRINTF("MCI_NAND :%8x", (unsigned int)(MCI_NAND)); - _DEBUG_PRINTF("MCI_SD :%8x", (unsigned int)(MCI_SD)); + lcd_putsf(0, line++, "MCI_NAND :%8x", (unsigned int)(MCI_NAND)); + lcd_putsf(0, line++, "MCI_SD :%8x", (unsigned int)(MCI_SD)); lcd_update(); int btn = button_get_w_tmo(HZ/10); @@ -372,7 +367,6 @@ end: bool __dbg_ports(void) { - char buf[50]; int line; lcd_clear_display(); @@ -381,19 +375,19 @@ bool __dbg_ports(void) while(1) { line = 0; - _DEBUG_PRINTF("[GPIO Values and Directions]"); - _DEBUG_PRINTF("GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR); - _DEBUG_PRINTF("GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR); - _DEBUG_PRINTF("GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR); - _DEBUG_PRINTF("GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR); + lcd_puts(0, line++, "[GPIO Values and Directions]"); + lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR); + lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR); + lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR); + lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR); #ifdef DEBUG_DBOP line++; - _DEBUG_PRINTF("[DBOP_DIN]"); - _DEBUG_PRINTF("DBOP_DIN: %4x", button_dbop_data()); + lcd_puts(0, line++, "[DBOP_DIN]"); + lcd_putsf(0, line++, "DBOP_DIN: %4x", button_dbop_data()); #endif line++; - _DEBUG_PRINTF("[CP15]"); - _DEBUG_PRINTF("CP15: 0x%8x", read_cp15()); + lcd_puts(0, line++, "[CP15]"); + lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15()); lcd_update(); if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) break; diff --git a/firmware/target/arm/imx31/debug-imx31.c b/firmware/target/arm/imx31/debug-imx31.c index cc1e200c11..dc3c293495 100644 --- a/firmware/target/arm/imx31/debug-imx31.c +++ b/firmware/target/arm/imx31/debug-imx31.c @@ -32,7 +32,6 @@ bool __dbg_hw_info(void) { - char buf[50]; int line; unsigned int pllref; unsigned int mcu_pllfreq, ser_pllfreq, usb_pllfreq; @@ -46,9 +45,8 @@ bool __dbg_hw_info(void) while (1) { line = 0; - snprintf(buf, sizeof (buf), "Sys Rev Code: 0x%02X", - iim_system_rev()); - lcd_puts(0, line++, buf); line++; + lcd_putsf(0, line++, "Sys Rev Code: 0x%02X", iim_system_rev()); + line++; mpctl = CCM_MPCTL; spctl = CCM_SPCTL; @@ -60,69 +58,55 @@ bool __dbg_hw_info(void) ser_pllfreq = ccm_get_pll(PLL_SERIAL); usb_pllfreq = ccm_get_pll(PLL_USB); - snprintf(buf, sizeof (buf), "pll_ref_clk: %u", pllref); - lcd_puts(0, line++, buf); line++; + lcd_putsf(0, line++, "pll_ref_clk: %u", pllref); + line++; /* MCU clock domain */ - snprintf(buf, sizeof (buf), "MPCTL: %08lX", mpctl); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "MPCTL: %08lX", mpctl); - snprintf(buf, sizeof (buf), " mpl_dpdgck_clk: %u", mcu_pllfreq); - lcd_puts(0, line++, buf); line++; + lcd_putsf(0, line++, " mpl_dpdgck_clk: %u", mcu_pllfreq); + line++; regval = CCM_PDR0; - snprintf(buf, sizeof (buf), " PDR0: %08lX", regval); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " PDR0: %08lX", regval); freq = mcu_pllfreq / (((regval & 0x7) + 1)); - snprintf(buf, sizeof (buf), " mcu_clk: %u", freq); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " mcu_clk: %u", freq); freq = mcu_pllfreq / (((regval >> 11) & 0x7) + 1); - snprintf(buf, sizeof (buf), " hsp_clk: %u", freq); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " hsp_clk: %u", freq); freq = mcu_pllfreq / (((regval >> 3) & 0x7) + 1); - snprintf(buf, sizeof (buf), " hclk_clk: %u", freq); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " hclk_clk: %u", freq); - snprintf(buf, sizeof (buf), " ipg_clk: %u", + lcd_putsf(0, line++, " ipg_clk: %u", freq / (unsigned)(((regval >> 6) & 0x3) + 1)); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof (buf), " nfc_clk: %u", + lcd_putsf(0, line++, " nfc_clk: %u", freq / (unsigned)(((regval >> 8) & 0x7) + 1)); - lcd_puts(0, line++, buf); line++; /* Serial clock domain */ - snprintf(buf, sizeof (buf), "SPCTL: %08lX", spctl); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof (buf), " spl_dpdgck_clk: %u", ser_pllfreq); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "SPCTL: %08lX", spctl); + lcd_putsf(0, line++, " spl_dpdgck_clk: %u", ser_pllfreq); line++; /* USB clock domain */ - snprintf(buf, sizeof (buf), "UPCTL: %08lX", upctl); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "UPCTL: %08lX", upctl); - snprintf(buf, sizeof (buf), " upl_dpdgck_clk: %u", usb_pllfreq); - lcd_puts(0, line++, buf); line++; + lcd_putsf(0, line++, " upl_dpdgck_clk: %u", usb_pllfreq); regval = CCM_PDR1; - snprintf(buf, sizeof (buf), " PDR1: %08lX", regval); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " PDR1: %08lX", regval); freq = usb_pllfreq / ((((regval >> 30) & 0x3) + 1) * (((regval >> 27) & 0x7) + 1)); - snprintf(buf, sizeof (buf), " usb_clk: %u", freq); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " usb_clk: %u", freq); freq = usb_pllfreq / (((CCM_PDR0 >> 16) & 0x1f) + 1); - snprintf(buf, sizeof (buf), " ipg_per_baud: %u", freq); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " ipg_per_baud: %u", freq); lcd_update(); @@ -133,7 +117,6 @@ bool __dbg_hw_info(void) bool __dbg_ports(void) { - char buf[50]; int line; int i; @@ -171,71 +154,62 @@ bool __dbg_ports(void) while(1) { line = 0; - snprintf(buf, sizeof(buf), "[Ports and Registers]"); - lcd_puts(0, line++, buf); line++; + lcd_puts(0, line++, "[Ports and Registers]"); + line++; /* GPIO1 */ - snprintf(buf, sizeof(buf), "GPIO1: DR: %08lx GDIR: %08lx", GPIO1_DR, GPIO1_GDIR); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPIO1: DR: %08lx GDIR: %08lx", GPIO1_DR, GPIO1_GDIR); - snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO1_PSR, GPIO1_ICR1); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " PSR: %08lx ICR1: %08lx", GPIO1_PSR, GPIO1_ICR1); - snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO1_ICR2, GPIO1_IMR); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " ICR2: %08lx IMR: %08lx", GPIO1_ICR2, GPIO1_IMR); - snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO1_ISR); - lcd_puts(0, line++, buf); line++; + lcd_putsf(0, line++, " ISR: %08lx", GPIO1_ISR); + line++; /* GPIO2 */ - snprintf(buf, sizeof(buf), "GPIO2: DR: %08lx GDIR: %08lx", GPIO2_DR, GPIO2_GDIR); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPIO2: DR: %08lx GDIR: %08lx", GPIO2_DR, GPIO2_GDIR); - snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO2_PSR, GPIO2_ICR1); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " PSR: %08lx ICR1: %08lx", GPIO2_PSR, GPIO2_ICR1); - snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO2_ICR2, GPIO2_IMR); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " ICR2: %08lx IMR: %08lx", GPIO2_ICR2, GPIO2_IMR); - snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO2_ISR); - lcd_puts(0, line++, buf); line++; + lcd_putsf(0, line++, " ISR: %08lx", GPIO2_ISR); + line++; /* GPIO3 */ - snprintf(buf, sizeof(buf), "GPIO3: DR: %08lx GDIR: %08lx", GPIO3_DR, GPIO3_GDIR); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPIO3: DR: %08lx GDIR: %08lx", GPIO3_DR, GPIO3_GDIR); - snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO3_PSR, GPIO3_ICR1); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " PSR: %08lx ICR1: %08lx", GPIO3_PSR, GPIO3_ICR1); - snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO3_ICR2, GPIO3_IMR); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " ICR2: %08lx IMR: %08lx", GPIO3_ICR2, GPIO3_IMR); - snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO3_ISR); - lcd_puts(0, line++, buf); line++; + lcd_putsf(0, line++, " ISR: %08lx", GPIO3_ISR); + line++; - lcd_puts(0, line++, "PMIC Registers"); line++; + lcd_puts(0, line++, "PMIC Registers"); + line++; mc13783_read_regset(pmic_regset, pmic_regs, ARRAYLEN(pmic_regs)); for (i = 0; i < (int)ARRAYLEN(pmic_regs); i++) { - snprintf(buf, sizeof(buf), "%s: %08lx", pmic_regnames[i], pmic_regs[i]); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "%s: %08lx", pmic_regnames[i], pmic_regs[i]); } line++; - lcd_puts(0, line++, "ADC"); line++; + lcd_puts(0, line++, "ADC"); + line++; for (i = 0; i < NUM_ADC_CHANNELS; i += 4) { - snprintf(buf, sizeof(buf), + lcd_putsf(0, line++, "CH%02d:%04u CH%02d:%04u CH%02d:%04u CH%02d:%04u", i+0, adc_read(i+0), i+1, adc_read(i+1), i+2, adc_read(i+2), i+3, adc_read(i+3)); - lcd_puts(0, line++, buf); } lcd_update(); diff --git a/firmware/target/arm/s3c2440/debug-s3c2440.c b/firmware/target/arm/s3c2440/debug-s3c2440.c index 6c01f8bc1a..df3fa3c026 100644 --- a/firmware/target/arm/s3c2440/debug-s3c2440.c +++ b/firmware/target/arm/s3c2440/debug-s3c2440.c @@ -46,40 +46,39 @@ bool __dbg_ports(void) while(1) { line = 0; - snprintf(buf, sizeof(buf), "[Ports and Registers]"); - lcd_puts(0, line++, buf); + lcd_puts(0, line++, "[Ports and Registers]"); - snprintf(buf, sizeof(buf), "GPACON: %08lx GPBCON: %08lx", GPACON, GPBCON); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPADAT: %08lx GPBDAT: %08lx", GPADAT, GPBDAT); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPAUP: %08lx GPBUP: %08lx", 0ul, GPBUP); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPACON: %08lx GPBCON: %08lx", GPACON, GPBCON); + lcd_putsf(0, line++, "GPADAT: %08lx GPBDAT: %08lx", GPADAT, GPBDAT); + lcd_putsf(0, line++, "GPAUP: %08lx GPBUP: %08lx", 0ul, GPBUP); + lcd_putsf(0, line++, "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON); + lcd_putsf(0, line++, "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT); + lcd_putsf(0, line++, "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP) - snprintf(buf, sizeof(buf), "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPCCON: %08lx GPDCON: %08lx", GPCCON, GPDCON); + lcd_putsf(0, line++, "GPCDAT: %08lx GPDDAT: %08lx", GPCDAT, GPDDAT); + lcd_putsf(0, line++, "GPCUP: %08lx GPDUP: %08lx", GPCUP, GPDUP); - snprintf(buf, sizeof(buf), "GPECON: %08lx GPFCON: %08lx", GPECON, GPFCON); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPEDAT: %08lx GPFDAT: %08lx", GPEDAT, GPFDAT); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPEUP: %08lx GPFUP: %08lx", GPEUP, GPFUP); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPECON: %08lx GPFCON: %08lx", GPECON, GPFCON); + lcd_putsf(0, line++, "GPEDAT: %08lx GPFDAT: %08lx", GPEDAT, GPFDAT); + lcd_putsf(0, line++, "GPEUP: %08lx GPFUP: %08lx", GPEUP, GPFUP); - snprintf(buf, sizeof(buf), "GPGCON: %08lx GPHCON: %08lx", GPGCON, GPHCON); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPGDAT: %08lx GPHDAT: %08lx", GPGDAT, GPHDAT); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPGUP: %08lx GPHUP: %08lx", GPGUP, GPHUP); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPGCON: %08lx GPHCON: %08lx", GPGCON, GPHCON); + lcd_putsf(0, line++, "GPGDAT: %08lx GPHDAT: %08lx", GPGDAT, GPHDAT); + lcd_putsf(0, line++, "GPGUP: %08lx GPHUP: %08lx", GPGUP, GPHUP); - snprintf(buf, sizeof(buf), "GPJCON: %08lx", GPJCON); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPJDAT: %08lx", GPJDAT); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPJUP: %08lx", GPJUP); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "GPJCON: %08lx", GPJCON); + lcd_putsf(0, line++, "GPJDAT: %08lx", GPJDAT); + lcd_putsf(0, line++, "GPJUP: %08lx", GPJUP); line++; - snprintf(buf, sizeof(buf), "SRCPND: %08lx INTMOD: %08lx", SRCPND, INTMOD); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "INTMSK: %08lx INTPND: %08lx", INTMSK, INTPND); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "CLKCON: %08lx CLKSLOW: %08lx", CLKCON, CLKSLOW); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "MPLLCON: %08lx UPLLCON: %08lx", MPLLCON, UPLLCON); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "CLKDIVN: %08lx CAMDIVN: %08lx", CLKDIVN, CAMDIVN); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "BWSCON: %08lx TCONSEL: %08lx", BWSCON, TCONSEL); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "SRCPND: %08lx INTMOD: %08lx", SRCPND, INTMOD); + lcd_putsf(0, line++, "INTMSK: %08lx INTPND: %08lx", INTMSK, INTPND); + lcd_putsf(0, line++, "CLKCON: %08lx CLKSLOW: %08lx", CLKCON, CLKSLOW); + lcd_putsf(0, line++, "MPLLCON: %08lx UPLLCON: %08lx", MPLLCON, UPLLCON); + lcd_putsf(0, line++, "CLKDIVN: %08lx CAMDIVN: %08lx", CLKDIVN, CAMDIVN); + lcd_putsf(0, line++, "BWSCON: %08lx TCONSEL: %08lx", BWSCON, TCONSEL); lcd_update(); if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) diff --git a/firmware/target/arm/system-arm.c b/firmware/target/arm/system-arm.c index 5c5a18c867..920dbacd10 100644 --- a/firmware/target/arm/system-arm.c +++ b/firmware/target/arm/system-arm.c @@ -36,16 +36,13 @@ static const char* const uiename[] = { */ void __attribute__((noreturn)) UIE(unsigned int pc, unsigned int num) { - char str[32]; - lcd_clear_display(); #ifdef HAVE_LCD_BITMAP lcd_setfont(FONT_SYSFIXED); #endif lcd_puts(0, 0, uiename[num]); - snprintf(str, sizeof(str), "at %08x" IF_COP(" (%d)"), pc + lcd_putsf(0, 1, "at %08x" IF_COP(" (%d)"), pc IF_COP(, CURRENT_CORE)); - lcd_puts(0, 1, str); lcd_update(); disable_interrupt(IRQ_FIQ_STATUS); diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c index 53acd3f655..d4d478a007 100755 --- a/firmware/target/arm/tms320dm320/debug-dm320.c +++ b/firmware/target/arm/tms320dm320/debug-dm320.c @@ -48,7 +48,6 @@ bool __dbg_hw_info(void) int *address=0x0; #endif bool done=false; - char buf[100]; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -58,38 +57,27 @@ bool __dbg_hw_info(void) lcd_puts(0, line++, "Clock info:"); #if LCD_WIDTH > 320 - snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", - IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", - IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", - IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x", - IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", + IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); + lcd_putsf(0, line++, "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", + IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); + lcd_putsf(0, line++, "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", + IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); + lcd_putsf(0, line++, "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x", + IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); #else - snprintf(buf, sizeof(buf), " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0, IO_CLK_SEL1); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1, IO_CLK_DIV2); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP, IO_CLK_INV); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0, IO_CLK_MOD1); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB); + lcd_putsf(0, line++, " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0, IO_CLK_SEL1); + lcd_putsf(0, line++, " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0); + lcd_putsf(0, line++, " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1, IO_CLK_DIV2); + lcd_putsf(0, line++, " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4); + lcd_putsf(0, line++, " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP, IO_CLK_INV); + lcd_putsf(0, line++, " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0, IO_CLK_MOD1); + lcd_putsf(0, line++, " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, "Interrupt info:"); - snprintf(buf, sizeof(buf), " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1); + lcd_putsf(0, line++, " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0); + lcd_putsf(0, line++, " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2); #endif lcd_puts(0, line++, "Board revision:"); @@ -134,20 +122,19 @@ bool __dbg_hw_info(void) lcd_set_direct_fb(true); lcd_puts(0, line++, "LCD info:"); - snprintf(buf, sizeof(buf), " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no")); - lcd_puts(0, line++, buf); + lcd_putsf(0, line++, " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no")); line++; #endif lcd_puts(0, line++, "[Rockbox info]"); - 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: %08x Seconds running: %08d", + (unsigned int)current_tick, (unsigned int)current_tick/100); #ifndef CREATIVE_ZVx - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", - (unsigned int)address, *address); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", - (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", - (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf); + lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x", + (unsigned int)address, *address); + lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x", + (unsigned int)(address+1), *(address+1)); + lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x", + (unsigned int)(address+2), *(address+2)); #endif lcd_update(); -- cgit v1.2.3