add first batch of commands to shell
This commit is contained in:
@@ -35,10 +35,12 @@
|
||||
#include "uart.h"
|
||||
#include "dump.h"
|
||||
#include "irq.h"
|
||||
#include "crc.h"
|
||||
#include "command.h"
|
||||
|
||||
#define RECEIVE_BUF_LEN 40
|
||||
|
||||
uint8_t recv_buf[RECEIVE_BUF_LEN];
|
||||
uint8_t recv_buf[RECEIVE_BUF_LEN];
|
||||
volatile uint8_t recv_counter = 0;
|
||||
volatile uint8_t cr = 0;
|
||||
|
||||
@@ -54,11 +56,11 @@ uint8_t *get_token(void)
|
||||
token_ptr = p;
|
||||
do {
|
||||
token_ptr++;
|
||||
if (*token_ptr == ' ') {
|
||||
if (*token_ptr == ' ' || *token_ptr == '\n' || *token_ptr == '\r') {
|
||||
*token_ptr++ = '\0';
|
||||
break;
|
||||
}
|
||||
} while (*token_ptr != '\0');
|
||||
} while (*token_ptr != ' ' && *token_ptr != '\n' && *token_ptr != '\r');
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -79,8 +81,6 @@ uint8_t get_dec(uint32_t *decval)
|
||||
uint8_t parse_hex(const uint8_t *s, uint32_t *hexval)
|
||||
{
|
||||
uint32_t x = util_sscanhex(s);
|
||||
if (x > 0xffffff)
|
||||
return 0;
|
||||
*hexval = (uint32_t) x;
|
||||
return 1;
|
||||
}
|
||||
@@ -142,7 +142,6 @@ static uint8_t get_int32(uint32_t *val)
|
||||
|
||||
uart_putc('\r');
|
||||
uart_putc('\n');
|
||||
uart_putc(':');
|
||||
uart_putc('>');
|
||||
|
||||
}
|
||||
@@ -185,6 +184,7 @@ void shell_run(void)
|
||||
uint32_t arg1;
|
||||
uint32_t arg2;
|
||||
uint32_t arg3;
|
||||
uint16_t crc;
|
||||
|
||||
if (!cr)
|
||||
return;
|
||||
@@ -203,25 +203,58 @@ void shell_run(void)
|
||||
if (get_hex_arg2(&arg1,&arg2))
|
||||
dump_memory(arg1,arg2);
|
||||
else
|
||||
printf("DUMP <start addr> <end addr> %i %i\n",arg1,arg2);
|
||||
}
|
||||
else if (strcmp((char*)t, "RESET") == 0) {
|
||||
printf("DUMP <start addr> <end addr>\n");
|
||||
|
||||
}else if (strcmp((char*)t, "CRC") == 0) {
|
||||
if (get_hex_arg2(&arg1,&arg2)){
|
||||
crc = crc_check_bulk_memory(arg1,arg2,0x8000);
|
||||
printf("0x%06lx - 0x%06lx crc=0x%04x\n",arg1,arg2,crc);
|
||||
} else
|
||||
printf("CRC <start addr> <end addr>\n");
|
||||
}else if (strcmp((char*)t, "EXIT") == 0) {
|
||||
leave_application();
|
||||
}
|
||||
}else if (strcmp((char*)t, "RESET") == 0) {
|
||||
send_reset();
|
||||
}else if (strcmp((char*)t, "IRQ") == 0) {
|
||||
printf("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) {
|
||||
printf("Activate AVR bus\n");
|
||||
avr_bus_active();
|
||||
snes_irq_lo();
|
||||
snes_irq_off();
|
||||
}else if (strcmp((char*)t, "SNES") == 0) {
|
||||
printf("Activate SNES bus\n");
|
||||
snes_irq_lo();
|
||||
snes_irq_off();
|
||||
snes_wr_disable();
|
||||
snes_bus_active();
|
||||
}else if (strcmp((char*)t, "LOROM") == 0) {
|
||||
printf("Set LOROM\n");
|
||||
snes_lorom();
|
||||
snes_wr_disable();
|
||||
}else if (strcmp((char*)t, "HIROM") == 0) {
|
||||
printf("Set HIROM\n");
|
||||
snes_hirom();
|
||||
snes_wr_disable();
|
||||
}else if (strcmp((char*)t, "LOADER") == 0) {
|
||||
boot_startup_rom(500);
|
||||
}else if (strcmp((char*)t, "RECONNECT") == 0) {
|
||||
usb_connect();
|
||||
}
|
||||
|
||||
prompt();
|
||||
|
||||
/*
|
||||
reset
|
||||
reset snes
|
||||
dias
|
||||
switch to avr mode
|
||||
swicth to snes mode
|
||||
send irq
|
||||
crc
|
||||
set irq vector
|
||||
set reset vector
|
||||
set rom mode
|
||||
|
||||
dump cart header
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user