static char xarg3[66];
static unsigned char tmparea[256];
-#define SHELL_CMD_NONE -1
-#define SHELL_CMD_NOTFOUND -2
-#define SHELL_CMD_ILLTOKEN -3
-#define SHELL_CMD_TOOLONG -4
-#define SHELL_CMD_OK 0
-
-#define SHELL_TOPCMDS 16
static void shell_printnum(unsigned int v)
{
"AM",
"POFF",
"PON",
- "SEQ",
+ "DUMP",
"LOG",
"SCAN",
"BAND",
"EXIT"
};
+
+static const char shell_helpstr_help[] = "HELP [about-command]\n -- Online help.\n";
+static const char shell_helpstr_freq[] = "FREQ frequency\n -- Set frequency.\n";
+static const char shell_helpstr_stat[] = "STAT\n -- Print status.\n";
+static const char shell_helpstr_load[] = "LOAD section [S]\n -- Load settings from terminal.\n Arg2: if 'S' then Save to internal EEPROM.\n";
+static const char shell_helpstr_save[] = "SAVE section\n -- Save settings to terminal.\n";
+static const char shell_helpstr_fm[] = "FM\n -- Switch to FM.\n";
+static const char shell_helpstr_am[] = "AM\n -- Switch to AM.\n";
+static const char shell_helpstr_poff[] = "\nPOFF [savef]\n -- Power OFF.\n savef: if 'N' then power-off without saving.\n";
+static const char shell_helpstr_pon[] = "\nPON\n -- Power ON.\n";
+static const char shell_helpstr_dump[] = "\nDUMP section [number]\n -- Dump section(s).\n";
+static const char shell_helpstr_log[] = "\nLOG\n -- View Log.\n";
+static const char shell_helpstr_scan[] = "\nSCAN [direction]\n -- DO Scan.\n direction : UP / DOWN\n";
+static const char shell_helpstr_band[] = "\nBAND [band-name]\n -- Set band\n";
+static const char shell_helpstr_set[] = "\nSET entry [value]\n -- Set setting / viewing value.\n value : Decimal.\n";
+static const char shell_helpstr_print[] = "\nPRINT [entry]\n -- Print system value(s).\n";
+static const char shell_helpstr_exit[] = "\nEXIT\n -- EXIT FROM SHELL.\n";
+
+
+static const char *shell_helpstr_sections[2] = {
+ "\nsection :\n INT : Internal EEPROM\n FTBL : Freq table\n",
+ "\n FREQ num : Save user freq #num.\n BAND : Save user band table."
+};
+
+
static void cmd_printhelp(char cmdnum)
{
- uart_term_putstr("\nSynopsys:\n");
- switch(cmdnum){
- case 0:
- uart_term_putstr("HELP [about-command]\n");
- uart_term_putstr(" -- Online help.\n");
- break;
- case 1:
- uart_term_putstr("FREQ frequency\n");
- uart_term_putstr(" -- Set frequency.\n");
- break;
- case 2:
- uart_term_putstr("\nSTAT\n");
- uart_term_putstr(" -- Print status.\n");
- break;
- case 3:
- uart_term_putstr("\nLOAD section [S]\n");
- uart_term_putstr(" -- Load settings from terminal.\n");
- uart_term_putstr(" Arg2: if 'S' then Save to internal EEPROM.\n");
- break;
- case 4:
- uart_term_putstr("\nSAVE section\n");
- uart_term_putstr(" -- Save settings to terminal.\n");
- uart_term_putstr(" section :\n");
- uart_term_putstr(" INT : Internal EEPROM\n");
- uart_term_putstr(" FTBL : Freq table");
- uart_term_putstr(" FREQ num : Save user freq #num.");
- uart_term_putstr(" BAND : Save user band table.");
- break;
- case 5:
- uart_term_putstr("\nFM\n");
- uart_term_putstr(" -- Change to FM\n");
- break;
- case 6:
- uart_term_putstr("\nAM\n");
- uart_term_putstr(" -- Change to AM\n");
- break;
- case 7:
- uart_term_putstr("\nPOFF [savef]\n");
- uart_term_putstr(" -- Power OFF\n");
- uart_term_putstr(" savef: if 'N' then power-off without saving.\n");
- break;
- case 8:
- uart_term_putstr("\nPON\n");
- uart_term_putstr(" -- Power ON\n");
- break;
- case 9:
- uart_term_putstr("\nSEQ\n");
- break;
- case 10:
- uart_term_putstr("\nLOG\n");
- uart_term_putstr(" -- View LOG(Reserved command)\n");
- break;
- case 11:
- uart_term_putstr("\nSCAN [direction]\n");
- uart_term_putstr(" -- DO Scan\n");
- uart_term_putstr(" direction : UP / DOWN\n");
- break;
- case 12:
- uart_term_putstr("\nBAND [band-name]\n");
- uart_term_putstr(" -- Set band\n");
- break;
- case 13:
- uart_term_putstr("\nSET offset value\n");
- uart_term_putstr(" -- Set system value.\n");
- break;
- case 14:
- uart_term_putstr("\nPRINT offset\n");
- uart_term_putstr(" -- PRINT system value.\n");
- break;
- case 15:
- uart_term_putstr("\nEXIT\n");
- uart_term_putstr(" -- EXIT shell\n");
- break;
- default:
- break;
- }
+ const char *p;
+ unsigned char i;
+ unsigned char sectionf = 0;
+
+ switch(cmdnum) {
+ case 0:
+ p = shell_helpstr_help;
+ break;
+ case 1:
+ p = shell_helpstr_freq;
+ break;
+ case 2:
+ p = shell_helpstr_stat;
+ break;
+ case 3:
+ p = shell_helpstr_load;
+ sectionf = 0xff;
+ break;
+ case 4:
+ p = shell_helpstr_save;
+ sectionf = 0xff;
+ break;
+ case 5:
+ p = shell_helpstr_fm;
+ break;
+ case 6:
+ p = shell_helpstr_am;
+ break;
+ case 7:
+ p = shell_helpstr_poff;
+ break;
+ case 8:
+ p = shell_helpstr_pon;
+ break;
+ case 9:
+ p = shell_helpstr_dump;
+ sectionf = 0xff;
+ break;
+ case 10:
+ p = shell_helpstr_log;
+ break;
+ case 11:
+ p = shell_helpstr_scan;
+ break;
+ case 12:
+ p = shell_helpstr_band;
+ break;
+ case 13:
+ p = shell_helpstr_set;
+ break;
+ case 14:
+ p = shell_helpstr_print;
+ break;
+ case 15:
+ p = shell_helpstr_exit;
+ break;
+ default:
+ return;
+ };
+ uart_term_putstr(p);
+ if(sectionf != 0) {
+ for(i = 0; i < 2; i++) {
+ uart_term_putstr(shell_helpstr_sections[i]);
+ }
+ }
}
static void cmd_help(char *p)