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()
{
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"));
}
}

View File

@ -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();
}

View File

@ -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();
}
}

View File

@ -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();

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;
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) {

View File

@ -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);
}

View File

@ -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;
}