X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=firmware%2Fapps%2Fmonitor%2Fmonitor.c;h=db8749c64fdf39b26019c0eab1daf0573cfc8104;hp=39833d480d6cceae3c13cd9aef9c986fe8a59fc9;hb=HEAD;hpb=5b89da5a9d7864784dbe4942d856f751c3758c1c diff --git a/firmware/apps/monitor/monitor.c b/firmware/apps/monitor/monitor.c index 39833d4..db8749c 100644 --- a/firmware/apps/monitor/monitor.c +++ b/firmware/apps/monitor/monitor.c @@ -8,12 +8,19 @@ #include "monitor.h" #include "builddate.h" + +#if (platform == tilaunchpad) +#include +extern jmp_buf warmstart; +#endif + + #define MONITOR_APP //! Handles a monitor command. void monitor_handle_fn(uint8_t const app, - uint8_t const verb, - uint32_t const len); + uint8_t const verb, + uint32_t const len); //! Overwrite all of RAM with 0xBEEF, then reboot. void monitor_ram_pattern(); @@ -46,8 +53,8 @@ app_t const monitor_app = { //! Handles a monitor command. void monitor_handle_fn(uint8_t const app, - uint8_t const verb, - uint32_t const len) + uint8_t const verb, + uint32_t const len) { int i; @@ -58,9 +65,9 @@ void monitor_handle_fn(uint8_t const app, break; case MONITOR_ECHO: - //Echo back the same buffer. - txdata(app,verb,len); - break; + //Echo back the same buffer. + txdata(app,verb,len); + break; case MONITOR_LIST_APPS: // transmit firmware build date @@ -82,6 +89,8 @@ void monitor_handle_fn(uint8_t const app, cmddata[0]=memorybyte[cmddataword[0]]; #else debugstr("Monitor peeks are unsupported on this platform."); + debughex(cmddataword[0]); + cmddata[0]=0x00; #endif txdata(app,verb,1); break; @@ -93,6 +102,8 @@ void monitor_handle_fn(uint8_t const app, cmddata[0] = memorybyte[cmddataword[0]]; #else debugstr("Monitor pokes are unsupported on this platform."); + debughex(cmddataword[0]); + cmddata[0]=0x00; #endif txdata(app,verb,1); break; @@ -131,27 +142,16 @@ void monitor_handle_fn(uint8_t const app, 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; + silent=cmddata[0]; + txdata(app,verb,1); + break; case MONITOR_CONNECTED: #ifdef MSP430 @@ -159,6 +159,33 @@ void monitor_handle_fn(uint8_t const app, #endif txdata(app,verb,0); break; + + case MONITOR_LEDTEST: + //debugstr("Enter LEDTEST."); + i = 0; + #ifdef PLEDOUT + i++; + led_init(); + led_on(); + msdelay(5000); + led_off(); + #endif + #ifdef PLED2OUT + i++; + led2_on(); + msdelay(5000); + led2_off(); + #endif + #ifdef PLED3OUT + i++; + led3_on(); + msdelay(5000); + led3_off(); + #endif + cmddata[0] = i; //Return number of LEDs that we flashed. + txdata(app,verb,1); + break; + } } @@ -174,10 +201,14 @@ void monitor_ram_pattern() } txdata(0x00,0x90,0); +#if (platform == tilaunchpad) + longjmp(warmstart,1); +#else //Reboot #ifdef MSP430 asm("br &0xfffe"); #endif +#endif } //! Return the number of contiguous bytes 0xBEEF, to measure RAM usage. @@ -194,9 +225,13 @@ unsigned int monitor_ram_depth() //! Call a function by address. int fncall(unsigned int adr) { + #ifdef MSP430 int (*machfn)() = 0; machfn = (int (*)()) adr; return machfn(); + #else + debugstr("fncall() not supported on this platform."); + #endif }