From d3a48efb0b06db7d239942bba10b2388559a26b7 Mon Sep 17 00:00:00 2001 From: optixx Date: Tue, 22 Sep 2009 22:28:31 +0200 Subject: [PATCH] move string constants to progmem --- avr/usbload/shell.c | 65 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/avr/usbload/shell.c b/avr/usbload/shell.c index e62cf9b..8771d88 100644 --- a/avr/usbload/shell.c +++ b/avr/usbload/shell.c @@ -179,6 +179,40 @@ ISR(USART0_RX_vect) // Interrupt for UART Byte received UCSR0B |= (1< \n")); - }else if (strcmp((char*)t, "CRC") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_CRC]) == 0) { if (get_hex_arg2(&arg1,&arg2)){ crc = crc_check_bulk_memory(arg1,arg2,0x8000); info_P(PSTR("0x%06lx - 0x%06lx crc=0x%04x\n"),arg1,arg2,crc); } else info_P(PSTR("CRC \n")); - }else if (strcmp((char*)t, "EXIT") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_EXIT]) == 0) { leave_application(); - }else if (strcmp((char*)t, "RESET") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_RESET]) == 0) { send_reset(); - }else if (strcmp((char*)t, "IRQ") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_IRQ]) == 0) { info_P(PSTR("Send IRQ\n")); snes_irq_on(); snes_irq_lo(); _delay_us(20); snes_irq_hi(); snes_irq_off(); - }else if (strcmp((char*)t, "AVR") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_AVR]) == 0) { info_P(PSTR("Activate AVR bus\n")); avr_bus_active(); snes_irq_lo(); snes_irq_off(); - }else if (strcmp((char*)t, "SNES") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_SNES]) == 0) { info_P(PSTR("Activate SNES bus\n")); snes_irq_lo(); snes_irq_off(); snes_wr_disable(); snes_bus_active(); - }else if (strcmp((char*)t, "LOROM") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_LOROM]) == 0) { info_P(PSTR("Set LOROM\n")); snes_lorom(); snes_wr_disable(); - }else if (strcmp((char*)t, "HIROM") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_HIROM]) == 0) { info_P(PSTR("Set HIROM\n")); snes_hirom(); snes_wr_disable(); - }else if (strcmp((char*)t, "WR") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_WR]) == 0) { arg1 = get_bool(); if(arg1==1){ info_P(PSTR("Set WR enable")); @@ -253,25 +287,24 @@ void shell_run(void) info_P(PSTR("Set WR disable")); snes_wr_disable(); } - }else if (strcmp((char*)t, "SHMWR") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_SHMWR]) == 0) { if (get_hex_arg2(&arg1,&arg2)) shared_memory_write((uint8_t)arg1, (uint8_t)arg1); else info_P(PSTR("SHMWR \n")); - }else if (strcmp((char*)t, "SHMSAVE") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_SHMSAVE]) == 0) { shared_memory_scratchpad_region_tx_save(); shared_memory_scratchpad_region_rx_save(); info_P(PSTR("Save scratchpad\n")); - }else if (strcmp((char*)t, "SHMRESTORE") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_SHMRESTORE]) == 0) { shared_memory_scratchpad_region_tx_restore(); shared_memory_scratchpad_region_rx_restore(); info_P(PSTR("Restore scratchpad\n")); - }else if (strcmp((char*)t, "LOADER") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_LOADER]) == 0) { boot_startup_rom(500); - }else if (strcmp((char*)t, "RECONNECT") == 0) { + }else if (strcmp_P((char*)t, (PGM_P)cmdlist[CMD_RECONNECT]) == 0) { usb_connect(); } - prompt(); /*