-void monitorhandle(unsigned char app,
- unsigned char verb,
- unsigned long len){
- switch(verb){
- default:
- debugstr("ERROR: Command unsupported by debug monitor.");
- break;
- case PEEK:
- cmddata[0]=memorybyte[cmddataword[0]];
- txdata(app,verb,1);
- break;
- case POKE:
- //Todo, make word or byte.
- memorybyte[cmddataword[0]]=cmddata[2];
- cmddata[0]=memorybyte[cmddataword[0]];
- txdata(app,verb,1);
- break;
- case CALL:
- //Set the program counter to cmdword[0];
- cmddataword[0]=fncall(cmddataword[0]);
- txdata(app,verb,2);
- break;
- case EXEC:
- //Execute the argument as code from RAM.
- cmddataword[0]=fncall((u16) cmddataword);
- txdata(app,verb,2);
- break;
- case MONITOR_SIZEBUF:
- //TODO make the data length target-specific, varying by ram.
- cmddataword[0]=0x100;
- txdata(app,verb,2);
- break;
- case MONITOR_CHANGE_BAUD:
- //This command, and ONLY this command, does not reply.
- setbaud(cmddata[0]);
- //txdata(app,verb,0);
- break;
- case MONITOR_RAM_PATTERN:
- monitor_ram_pattern();//reboots, will never return
- break;
- case MONITOR_RAM_DEPTH:
- cmddataword[0]=monitor_ram_depth();
- txdata(app,verb,2);
- break;
- case MONITOR_DIR:
- P5DIR=cmddata[0];
- txdata(app,verb,1);
- break;
- case MONITOR_IN:
- cmddata[0]=P5IN;
- txdata(app,verb,1);
- break;
- case MONITOR_OUT:
- P5OUT=cmddata[0];
- txdata(app,verb,1);
- break;
- case MONITOR_SILENT:
- silent=cmddata[0];
- txdata(app,verb,1);
- break;
- case MONITOR_CONNECTED:
- msp430_init_dco_done();
- txdata(app,verb,0);
- break;
- }
+void monitor_handle_fn(uint8_t const app,
+ uint8_t const verb,
+ uint32_t const len)
+{
+ int i;
+
+ switch(verb)
+ {
+ default:
+ debugstr("ERROR: Command unsupported by debug monitor.");
+ break;
+
+ case MONITOR_ECHO:
+ //Echo back the same buffer.
+ txdata(app,verb,len);
+ break;
+
+ case MONITOR_LIST_APPS:
+ // transmit firmware build date
+ txstring(app, verb, build_date);
+
+ // transmit app descriptions
+ for(i = 0; i < num_apps; i++)
+ {
+ txstring(app, verb, apps[i]->name);
+ // if full list, then add in description
+ if(cmddata[0])
+ txstring(app, verb, apps[i]->desc);
+ }
+ txdata(app, verb, 0);
+ break;
+
+ case PEEK:
+ cmddata[0]=memorybyte[cmddataword[0]];
+ txdata(app,verb,1);
+ break;
+
+ case POKE:
+ //Todo, make word or byte.
+ memorybyte[cmddataword[0]] = cmddata[2];
+ cmddata[0] = memorybyte[cmddataword[0]];
+ txdata(app,verb,1);
+ break;
+
+ case CALL:
+ //Set the program counter to cmdword[0];
+ cmddataword[0]=fncall(cmddataword[0]);
+ txdata(app,verb,2);
+ break;
+
+ case EXEC:
+ //Execute the argument as code from RAM.
+ cmddataword[0]=fncall((u16) cmddataword);
+ txdata(app,verb,2);
+ break;
+
+ case MONITOR_SIZEBUF:
+ //TODO make the data length target-specific, varying by ram.
+ cmddataword[0]=0x100;
+ txdata(app,verb,2);
+ break;
+
+ case MONITOR_CHANGE_BAUD:
+ //This command, and ONLY this command, does not reply.
+ setbaud(cmddata[0]);
+ //txdata(app,verb,0);
+ break;
+
+ case MONITOR_RAM_PATTERN:
+ monitor_ram_pattern();//reboots, will never return
+ break;
+
+ case MONITOR_RAM_DEPTH:
+ cmddataword[0]=monitor_ram_depth();
+ txdata(app,verb,2);
+ break;
+
+ case MONITOR_DIR:
+ //P5DIR=cmddata[0];
+ debugstr("Command deprecated.");
+ txdata(app,verb,1);
+ break;
+
+ case MONITOR_IN:
+ //cmddata[0]=P5IN;
+ debugstr("Command deprecated.");
+ txdata(app,verb,1);
+ break;
+
+ case MONITOR_OUT:
+ //P5OUT=cmddata[0];
+ debugstr("Command deprecated.");
+ txdata(app,verb,1);
+ break;
+
+ case MONITOR_SILENT:
+ silent=cmddata[0];
+ txdata(app,verb,1);
+ break;
+
+ case MONITOR_CONNECTED:
+ msp430_init_dco_done();
+ txdata(app,verb,0);
+ break;
+ }