refactor info call to info_P

This commit is contained in:
optixx 2009-08-28 12:43:54 +02:00
parent bb1367c243
commit bc08b4a71a
7 changed files with 56 additions and 56 deletions

View File

@ -34,7 +34,7 @@ extern uint32_t req_bank_size;
void send_reset() void send_reset()
{ {
info("Reset SNES\n"); info_P(PSTR("Reset SNES\n"));
cli(); cli();
snes_reset_on(); snes_reset_on();
snes_reset_lo(); snes_reset_lo();
@ -57,9 +57,9 @@ void set_rom_mode()
{ {
if (req_bank_size == 0x8000) { if (req_bank_size == 0x8000) {
snes_lorom(); snes_lorom();
info("Set SNES lowrom \n"); info_P(PSTR("Set SNES lowrom \n"));
} else { } else {
snes_hirom(); snes_hirom();
info("Set SNES hirom \n"); info_P(PSTR("Set SNES hirom \n"));
} }
} }

View File

@ -47,21 +47,21 @@ void dump_packet(uint32_t addr, uint32_t len, uint8_t * packet)
continue; continue;
} }
if (clear) { if (clear) {
info("*\n"); info_P(PSTR("*\n"));
clear = 0; clear = 0;
} }
info("%08lx:", addr + i); info_P(PSTR("%08lx:"), addr + i);
for (j = 0; j < 16; j++) { 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++) { for (j = 0; j < 16; j++) {
if (packet[i + j] >= 33 && packet[i + j] <= 126) if (packet[i + j] >= 33 && packet[i + j] <= 126)
info("%c", packet[i + j]); info_P(PSTR("%c"), packet[i + j]);
else 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); sram_bulk_read_start(bottom_addr);
for ( addr = bottom_addr; addr < top_addr; addr++) { for ( addr = bottom_addr; addr < top_addr; addr++) {
if (addr%0x10 == 0) if (addr%0x10 == 0)
info("\n%08lx:", addr); info_P(PSTR("\n%08lx:"), addr);
byte = sram_bulk_read(); byte = sram_bulk_read();
sram_bulk_read_next(); sram_bulk_read_next();
info(" %02x", byte); info_P(PSTR(" %02x"), byte);
} }
info("\n"); info_P(PSTR("\n"));
sram_bulk_read_end(); sram_bulk_read_end();
} }

View File

@ -64,8 +64,8 @@ void leave_application(void)
ISR (SIG_PIN_CHANGE3) ISR (SIG_PIN_CHANGE3)
{ {
if (snes_reset_test()){ if (snes_reset_test()){
info("Catch SNES reset button\n"); info_P(PSTR("Catch SNES reset button\n"));
info("Set watchdog...\n"); info_P(PSTR("Set watchdog...\n"));
leave_application(); leave_application();
} }
} }

View File

@ -273,10 +273,10 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
void usb_connect() void usb_connect()
{ {
uint8_t i = 0; uint8_t i = 0;
info("USB init\n"); info_P(PSTR("USB init\n"));
usbDeviceDisconnect(); /* enforce re-enumeration, do this while */ usbDeviceDisconnect(); /* enforce re-enumeration, do this while */
cli(); cli();
info("USB disconnect\n"); info_P(PSTR("USB disconnect\n"));
i = 10; i = 10;
while (--i) { /* fake USB disconnect for > 250 ms */ while (--i) { /* fake USB disconnect for > 250 ms */
led_on(); led_on();
@ -286,28 +286,28 @@ void usb_connect()
} }
led_on(); led_on();
usbDeviceConnect(); usbDeviceConnect();
info("USB connect\n"); info_P(PSTR("USB connect\n"));
} }
void boot_startup_rom() void boot_startup_rom()
{ {
info("Boot startup rom\n"); info_P(PSTR("Boot startup rom\n"));
info("Activate AVR bus\n"); info_P(PSTR("Activate AVR bus\n"));
avr_bus_active(); avr_bus_active();
info("IRQ off\n"); info_P(PSTR("IRQ off\n"));
snes_irq_lo(); snes_irq_lo();
snes_irq_off(); snes_irq_off();
snes_lorom(); snes_lorom();
rle_decode(&_rom, ROM_BUFFER_SIZE, 0x000000); rle_decode(&_rom, ROM_BUFFER_SIZE, 0x000000);
info("\n"); info_P(PSTR("\n"));
#if 1 #if 1
dump_memory(0x10000 - 0x100, 0x10000); dump_memory(0x10000 - 0x100, 0x10000);
#endif #endif
snes_hirom(); snes_hirom();
snes_wr_disable(); snes_wr_disable();
snes_bus_active(); snes_bus_active();
info("Activate SNES bus\n"); info_P(PSTR("Activate SNES bus\n"));
send_reset(); send_reset();
_delay_ms(50); _delay_ms(50);
send_reset(); send_reset();
@ -317,17 +317,17 @@ void boot_startup_rom()
void banner(){ void banner(){
uint8_t i; uint8_t i;
for (i=0;i<40;i++) for (i=0;i<40;i++)
info("\n"); info_P(PSTR("\n"));
info(" ________ .__ __ ________ ____ ________\n"); info_P(PSTR(" ________ .__ __ ________ ____ ________\n"));
info(" \\_____ \\ __ __|__| ____ | | __\\______ \\ _______ _/_ |/ _____/\n"); info_P(PSTR(" \\_____ \\ __ __|__| ____ | | __\\______ \\ _______ _/_ |/ _____/\n"));
info(" / / \\ \\| | \\ |/ ___\\| |/ / | | \\_/ __ \\ \\/ /| / __ \\ \n"); info_P(PSTR(" / / \\ \\| | \\ |/ ___\\| |/ / | | \\_/ __ \\ \\/ /| / __ \\ \n"));
info(" / \\_/. \\ | / \\ \\___| < | ` \\ ___/\\ / | \\ |__\\ \\ \n"); info_P(PSTR(" / \\_/. \\ | / \\ \\___| < | ` \\ ___/\\ / | \\ |__\\ \\ \n"));
info(" \\_____\\ \\_/____/|__|\\___ >__|_ \\/_______ /\\___ >\\_/ |___|\\_____ / \n"); info_P(PSTR(" \\_____\\ \\_/____/|__|\\___ >__|_ \\/_______ /\\___ >\\_/ |___|\\_____ / \n"));
info(" \\__> \\/ \\/ \\/ \\/ \\/ \n"); info_P(PSTR(" \\__> \\/ \\/ \\/ \\/ \\/ \n"));
info("\n"); info_P(PSTR("\n"));
info(" www.optixx.org\n"); info_P(PSTR(" www.optixx.org\n"));
info("\n"); info_P(PSTR("\n"));
info("System Hw: %s Sw: %s\n",HW_VERSION,SW_VERSION); info_P(PSTR("System Hw: %s Sw: %s\n"),HW_VERSION,SW_VERSION);
} }
@ -356,12 +356,12 @@ int main(void)
usb_connect(); usb_connect();
while (1) { while (1) {
avr_bus_active(); avr_bus_active();
info("Activate AVR bus\n"); info_P(PSTR("Activate AVR bus\n"));
snes_lorom(); snes_lorom();
info("Disable SNES WR\n"); info_P(PSTR("Disable SNES WR\n"));
snes_wr_disable(); snes_wr_disable();
sei(); sei();
info("USB poll\n"); info_P(PSTR("USB poll\n"));
while (req_state != REQ_STATUS_SNES) { while (req_state != REQ_STATUS_SNES) {
usbPoll(); usbPoll();
} }
@ -371,15 +371,15 @@ int main(void)
shared_memory_scratchpad_region_tx_restore(); shared_memory_scratchpad_region_tx_restore();
shared_memory_scratchpad_region_rx_restore(); shared_memory_scratchpad_region_rx_restore();
#endif #endif
info("USB poll done\n"); info_P(PSTR("USB poll done\n"));
set_rom_mode(); set_rom_mode();
snes_wr_disable(); snes_wr_disable();
info("Disable SNES WR\n"); info_P(PSTR("Disable SNES WR\n"));
snes_bus_active(); snes_bus_active();
info("Activate SNES bus\n"); info_P(PSTR("Activate SNES bus\n"));
irq_stop(); irq_stop();
send_reset(); send_reset();
info("Poll USB\n"); info_P(PSTR("Poll USB\n"));
while ((req_state != REQ_STATUS_AVR)) { while ((req_state != REQ_STATUS_AVR)) {
usbPoll(); usbPoll();
@ -390,7 +390,7 @@ int main(void)
while (--i) { while (--i) {
_delay_ms(100); _delay_ms(100);
} }
info("Send IRQ %i\n", ++irq_count); info_P(PSTR("Send IRQ %i\n"), ++irq_count);
send_irq(); send_irq();
#endif #endif
@ -401,7 +401,7 @@ int main(void)
i = 5; i = 5;
while (--i) { while (--i) {
_delay_ms(500); _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) { if (req_bank_size == 0x8000) {
@ -410,10 +410,10 @@ int main(void)
snes_hirom(); snes_hirom();
} }
snes_wr_disable(); snes_wr_disable();
info("Disable SNES WR\n"); info_P(PSTR("Disable SNES WR\n"));
snes_bus_active(); snes_bus_active();
info("Activate SNES bus\n"); info_P(PSTR("Activate SNES bus\n"));
info("Read 0x3000=%c\n", c); info_P(PSTR("Read 0x3000=%c\n"), c);
#endif #endif
} }
irq_init(); irq_init();

View File

@ -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; uint8_t in_byte, in_repeat, last_byte;
uint32_t out_len, out_len_left; 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; last_byte = 0;
out_len_left = out_len; 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) { if (in_byte == RUNCHAR) {
INBYTE(in_repeat); INBYTE(in_repeat);
if (in_repeat != 0) { if (in_repeat != 0) {
info("Orphaned RLE code at start\n"); info_P(PSTR("Orphaned RLE code at start\n"));
return 1; return 1;
} }
OUTBYTE(RUNCHAR); 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) { while (in_len > 0) {
INBYTE(in_byte); INBYTE(in_byte);
if (in_len % 1024 == 0) if (in_len % 1024 == 0)
info("."); info_P(PSTR("."));
if (in_byte == RUNCHAR) { if (in_byte == RUNCHAR) {
INBYTE(in_repeat); INBYTE(in_repeat);
if (in_repeat == 0) { if (in_repeat == 0) {

View File

@ -45,7 +45,7 @@ void test_read_write()
} }
addr = 0x000000; addr = 0x000000;
while (addr++ <= 0x0000ff) { 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; addr = 0x000000;
sram_bulk_read_start(addr); sram_bulk_read_start(addr);
while (addr <= 0x8000) { 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(); sram_bulk_read_next();
addr++; 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++) { for (addr = bottom_addr; addr < top_addr; addr++) {
c = sram_bulk_read(); c = sram_bulk_read();
if (c != 0xff) 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_next();
} }
sram_bulk_read_end(); sram_bulk_read_end();
@ -95,12 +95,12 @@ void test_non_zero_memory(uint32_t bottom_addr, uint32_t top_addr)
void test_crc() void test_crc()
{ {
info("test_crc: clear\n"); info_P(PSTR("test_crc: clear\n"));
avr_bus_active(); avr_bus_active();
sram_bulk_set(0x000000, 0x10000, 0xff); 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); 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); test_non_zero_memory(0x000000, 0x10000);
} }

View File

@ -56,7 +56,7 @@ uint8_t usbFunctionWrite(uint8_t * data, uint8_t len)
uint8_t i; uint8_t i;
if (len > rx_remaining) { 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); rx_remaining, len);
len = rx_remaining; len = rx_remaining;
} }