From bc08b4a71ac310d823bab0a9a8e6df1c7a574965 Mon Sep 17 00:00:00 2001 From: optixx Date: Fri, 28 Aug 2009 12:43:54 +0200 Subject: [PATCH] refactor info call to info_P --- avr/usbload/command.c | 6 ++-- avr/usbload/dump.c | 20 +++++++------- avr/usbload/irq.c | 4 +-- avr/usbload/main.c | 62 +++++++++++++++++++++--------------------- avr/usbload/rle.c | 6 ++-- avr/usbload/testing.c | 12 ++++---- avr/usbload/usb_bulk.c | 2 +- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/avr/usbload/command.c b/avr/usbload/command.c index 2a451f3..def7a31 100644 --- a/avr/usbload/command.c +++ b/avr/usbload/command.c @@ -34,7 +34,7 @@ extern uint32_t req_bank_size; void send_reset() { - info("Reset SNES\n"); + info_P(PSTR("Reset SNES\n")); cli(); snes_reset_on(); snes_reset_lo(); @@ -57,9 +57,9 @@ void set_rom_mode() { if (req_bank_size == 0x8000) { snes_lorom(); - info("Set SNES lowrom \n"); + info_P(PSTR("Set SNES lowrom \n")); } else { snes_hirom(); - info("Set SNES hirom \n"); + info_P(PSTR("Set SNES hirom \n")); } } diff --git a/avr/usbload/dump.c b/avr/usbload/dump.c index 46df814..d13d689 100644 --- a/avr/usbload/dump.c +++ b/avr/usbload/dump.c @@ -47,21 +47,21 @@ void dump_packet(uint32_t addr, uint32_t len, uint8_t * packet) continue; } if (clear) { - info("*\n"); + info_P(PSTR("*\n")); clear = 0; } - info("%08lx:", addr + i); + info_P(PSTR("%08lx:"), addr + i); for (j = 0; j < 16; j++) { - info(" %02x", packet[i + j]); + info_P(PSTR(" %02x"), packet[i + j]); } - info(" |"); + info_P(PSTR(" |")); for (j = 0; j < 16; j++) { if (packet[i + j] >= 33 && packet[i + j] <= 126) - info("%c", packet[i + j]); + info_P(PSTR("%c"), packet[i + j]); else - info("."); + info_P(PSTR(".")); } - info("|\n"); + info_P(PSTR("|\n")); } } @@ -72,11 +72,11 @@ void dump_memory(uint32_t bottom_addr, uint32_t top_addr) sram_bulk_read_start(bottom_addr); for ( addr = bottom_addr; addr < top_addr; addr++) { if (addr%0x10 == 0) - info("\n%08lx:", addr); + info_P(PSTR("\n%08lx:"), addr); byte = sram_bulk_read(); sram_bulk_read_next(); - info(" %02x", byte); + info_P(PSTR(" %02x"), byte); } - info("\n"); + info_P(PSTR("\n")); sram_bulk_read_end(); } diff --git a/avr/usbload/irq.c b/avr/usbload/irq.c index 81cccb2..a4e94df 100644 --- a/avr/usbload/irq.c +++ b/avr/usbload/irq.c @@ -64,8 +64,8 @@ void leave_application(void) ISR (SIG_PIN_CHANGE3) { if (snes_reset_test()){ - info("Catch SNES reset button\n"); - info("Set watchdog...\n"); + info_P(PSTR("Catch SNES reset button\n")); + info_P(PSTR("Set watchdog...\n")); leave_application(); } } diff --git a/avr/usbload/main.c b/avr/usbload/main.c index 3754432..1f2c012 100644 --- a/avr/usbload/main.c +++ b/avr/usbload/main.c @@ -273,10 +273,10 @@ usbMsgLen_t usbFunctionSetup(uchar data[8]) void usb_connect() { uint8_t i = 0; - info("USB init\n"); + info_P(PSTR("USB init\n")); usbDeviceDisconnect(); /* enforce re-enumeration, do this while */ cli(); - info("USB disconnect\n"); + info_P(PSTR("USB disconnect\n")); i = 10; while (--i) { /* fake USB disconnect for > 250 ms */ led_on(); @@ -286,28 +286,28 @@ void usb_connect() } led_on(); usbDeviceConnect(); - info("USB connect\n"); + info_P(PSTR("USB connect\n")); } void boot_startup_rom() { - info("Boot startup rom\n"); - info("Activate AVR bus\n"); + info_P(PSTR("Boot startup rom\n")); + info_P(PSTR("Activate AVR bus\n")); avr_bus_active(); - info("IRQ off\n"); + info_P(PSTR("IRQ off\n")); snes_irq_lo(); snes_irq_off(); snes_lorom(); rle_decode(&_rom, ROM_BUFFER_SIZE, 0x000000); - info("\n"); + info_P(PSTR("\n")); #if 1 dump_memory(0x10000 - 0x100, 0x10000); #endif snes_hirom(); snes_wr_disable(); snes_bus_active(); - info("Activate SNES bus\n"); + info_P(PSTR("Activate SNES bus\n")); send_reset(); _delay_ms(50); send_reset(); @@ -317,17 +317,17 @@ void boot_startup_rom() void banner(){ uint8_t i; for (i=0;i<40;i++) - info("\n"); - info(" ________ .__ __ ________ ____ ________\n"); - info(" \\_____ \\ __ __|__| ____ | | __\\______ \\ _______ _/_ |/ _____/\n"); - info(" / / \\ \\| | \\ |/ ___\\| |/ / | | \\_/ __ \\ \\/ /| / __ \\ \n"); - info(" / \\_/. \\ | / \\ \\___| < | ` \\ ___/\\ / | \\ |__\\ \\ \n"); - info(" \\_____\\ \\_/____/|__|\\___ >__|_ \\/_______ /\\___ >\\_/ |___|\\_____ / \n"); - info(" \\__> \\/ \\/ \\/ \\/ \\/ \n"); - info("\n"); - info(" www.optixx.org\n"); - info("\n"); - info("System Hw: %s Sw: %s\n",HW_VERSION,SW_VERSION); + info_P(PSTR("\n")); + info_P(PSTR(" ________ .__ __ ________ ____ ________\n")); + info_P(PSTR(" \\_____ \\ __ __|__| ____ | | __\\______ \\ _______ _/_ |/ _____/\n")); + info_P(PSTR(" / / \\ \\| | \\ |/ ___\\| |/ / | | \\_/ __ \\ \\/ /| / __ \\ \n")); + info_P(PSTR(" / \\_/. \\ | / \\ \\___| < | ` \\ ___/\\ / | \\ |__\\ \\ \n")); + info_P(PSTR(" \\_____\\ \\_/____/|__|\\___ >__|_ \\/_______ /\\___ >\\_/ |___|\\_____ / \n")); + info_P(PSTR(" \\__> \\/ \\/ \\/ \\/ \\/ \n")); + info_P(PSTR("\n")); + info_P(PSTR(" www.optixx.org\n")); + info_P(PSTR("\n")); + info_P(PSTR("System Hw: %s Sw: %s\n"),HW_VERSION,SW_VERSION); } @@ -356,12 +356,12 @@ int main(void) usb_connect(); while (1) { avr_bus_active(); - info("Activate AVR bus\n"); + info_P(PSTR("Activate AVR bus\n")); snes_lorom(); - info("Disable SNES WR\n"); + info_P(PSTR("Disable SNES WR\n")); snes_wr_disable(); sei(); - info("USB poll\n"); + info_P(PSTR("USB poll\n")); while (req_state != REQ_STATUS_SNES) { usbPoll(); } @@ -371,15 +371,15 @@ int main(void) shared_memory_scratchpad_region_tx_restore(); shared_memory_scratchpad_region_rx_restore(); #endif - info("USB poll done\n"); + info_P(PSTR("USB poll done\n")); set_rom_mode(); snes_wr_disable(); - info("Disable SNES WR\n"); + info_P(PSTR("Disable SNES WR\n")); snes_bus_active(); - info("Activate SNES bus\n"); + info_P(PSTR("Activate SNES bus\n")); irq_stop(); send_reset(); - info("Poll USB\n"); + info_P(PSTR("Poll USB\n")); while ((req_state != REQ_STATUS_AVR)) { usbPoll(); @@ -390,7 +390,7 @@ int main(void) while (--i) { _delay_ms(100); } - info("Send IRQ %i\n", ++irq_count); + info_P(PSTR("Send IRQ %i\n"), ++irq_count); send_irq(); #endif @@ -401,7 +401,7 @@ int main(void) i = 5; while (--i) { _delay_ms(500); - info("Wait to switch to snes mode %i\n", i); + info_P(PSTR("Wait to switch to snes mode %i\n"), i); } if (req_bank_size == 0x8000) { @@ -410,10 +410,10 @@ int main(void) snes_hirom(); } snes_wr_disable(); - info("Disable SNES WR\n"); + info_P(PSTR("Disable SNES WR\n")); snes_bus_active(); - info("Activate SNES bus\n"); - info("Read 0x3000=%c\n", c); + info_P(PSTR("Activate SNES bus\n")); + info_P(PSTR("Read 0x3000=%c\n"), c); #endif } irq_init(); diff --git a/avr/usbload/rle.c b/avr/usbload/rle.c index 562f67e..c8aac0a 100644 --- a/avr/usbload/rle.c +++ b/avr/usbload/rle.c @@ -36,7 +36,7 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr) { uint8_t in_byte, in_repeat, last_byte; uint32_t out_len, out_len_left; - info("RLE decode len=%li addr=0x%08lx\n", in_len, out_addr); + info_P(PSTR("RLE decode len=%li addr=0x%08lx\n"), in_len, out_addr); last_byte = 0; out_len_left = out_len; @@ -63,7 +63,7 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr) if (in_byte == RUNCHAR) { INBYTE(in_repeat); if (in_repeat != 0) { - info("Orphaned RLE code at start\n"); + info_P(PSTR("Orphaned RLE code at start\n")); return 1; } OUTBYTE(RUNCHAR); @@ -74,7 +74,7 @@ uint8_t rle_decode(PGM_VOID_P in_addr, int32_t in_len, uint32_t out_addr) while (in_len > 0) { INBYTE(in_byte); if (in_len % 1024 == 0) - info("."); + info_P(PSTR(".")); if (in_byte == RUNCHAR) { INBYTE(in_repeat); if (in_repeat == 0) { diff --git a/avr/usbload/testing.c b/avr/usbload/testing.c index 257b437..9657d67 100644 --- a/avr/usbload/testing.c +++ b/avr/usbload/testing.c @@ -45,7 +45,7 @@ void test_read_write() } addr = 0x000000; while (addr++ <= 0x0000ff) { - info("read addr=0x%08lx %x\n", addr, sram_read(addr)); + info_P(PSTR("read addr=0x%08lx %x\n"), addr, sram_read(addr)); } } @@ -69,7 +69,7 @@ void test_bulk_read_write() addr = 0x000000; sram_bulk_read_start(addr); while (addr <= 0x8000) { - info("addr=0x%08lx %x\n", addr, sram_bulk_read()); + info_P(PSTR("addr=0x%08lx %x\n"), addr, sram_bulk_read()); sram_bulk_read_next(); addr++; } @@ -85,7 +85,7 @@ void test_non_zero_memory(uint32_t bottom_addr, uint32_t top_addr) for (addr = bottom_addr; addr < top_addr; addr++) { c = sram_bulk_read(); if (c != 0xff) - info("addr=0x%08lx c=0x%x\n", addr, c); + info_P(PSTR("addr=0x%08lx c=0x%x\n"), addr, c); sram_bulk_read_next(); } sram_bulk_read_end(); @@ -95,12 +95,12 @@ void test_non_zero_memory(uint32_t bottom_addr, uint32_t top_addr) void test_crc() { - info("test_crc: clear\n"); + info_P(PSTR("test_crc: clear\n")); avr_bus_active(); sram_bulk_set(0x000000, 0x10000, 0xff); - info("test_crc: crc\n"); + info_P(PSTR("test_crc: crc\n")); crc_check_bulk_memory(0x000000, 0x10000, 0x8000); - info("test_crc: check\n"); + info_P(PSTR("test_crc: check\n")); test_non_zero_memory(0x000000, 0x10000); } diff --git a/avr/usbload/usb_bulk.c b/avr/usbload/usb_bulk.c index 3340692..4b1c5d7 100644 --- a/avr/usbload/usb_bulk.c +++ b/avr/usbload/usb_bulk.c @@ -56,7 +56,7 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len) uint8_t i; if (len > rx_remaining) { - info("ERROR:usbFunctionWrite more data than expected remain: %i len: %i\n", + info_P(PSTR("ERROR:usbFunctionWrite more data than expected remain: %i len: %i\n"), rx_remaining, len); len = rx_remaining; }