2 \author Travis Goodspeed
\r
5 This is the main module of the GoodFET, which calls the initialization
\r
6 routines and delegates commands to the various applications.
\r
10 #include "platform.h"
\r
11 #include "command.h"
\r
19 //! Initialize registers and all that jazz.
\r
21 WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
\r
25 PLEDOUT &= ~PLEDPIN;
\r
27 //Setup clocks, unique to each '430.
\r
31 //Enable Interrupts.
\r
36 //! Handle a command.
\r
37 void handle(unsigned char app,
\r
40 //debugstr("GoodFET");
\r
43 glitchhandle(app,verb,len);
\r
46 monitorhandle(app,verb,len);
\r
49 spihandle(app,verb,len);
\r
52 avrhandle(app,verb,len);
\r
55 i2chandle(app,verb,len);
\r
58 cchandle(app,verb,len);
\r
61 jtaghandle(app,verb,len);
\r
63 case JTAG430: //Also JTAG430X, JTAG430X2
\r
64 jtag430x2handle(app,verb,len);
\r
68 pluginhandle(app,verb,len);
\r
70 debugstr("Plugin missing.");
\r
81 volatile unsigned int i;
\r
82 unsigned char app, verb;
\r
88 txstring(MONITOR,OK,"http://goodfet.sf.net/");
\r
91 //Command loop. There's no end!
\r
99 //Read data, looking for buffer overflow.y
\r
100 if(len<=CMDDATALEN){
\r
101 for(i=0;i<len;i++){
\r
102 cmddata[i]=serial_rx();
\r
104 handle(app,verb,len);
\r
106 //Listen to the blaberring.
\r
109 //Reply with an error.
\r
110 debugstr("Buffer length exceeded.");
\r
111 txdata(MONITOR,NOK,0);
\r