-void handle(unsigned char app,
- unsigned char verb,
- unsigned long len){
- //debugstr("GoodFET");
- PLEDOUT&=~PLEDPIN;
- switch(app){
- case GLITCH:
- glitchhandle(app,verb,len);
- break;
- case MONITOR:
- monitorhandle(app,verb,len);
- break;
- case SPI:
- spihandle(app,verb,len);
- break;
- case NRF:
- nrfhandle(app,verb,len);
- break;
- case CCSPI:
- ccspihandle(app,verb,len);
- break;
- case AVR:
- avrhandle(app,verb,len);
- break;
- case PIC:
- pichandle(app,verb,len);
- break;
-
- case I2CAPP:
- i2chandle(app,verb,len);
- break;
- case CHIPCON:
- cchandle(app,verb,len);
- break;
- case JTAG:
- jtaghandle(app,verb,len);
- break;
- case EJTAG:
- ejtaghandle(app,verb,len);
- break;
- case JTAG430: //Also JTAG430X, JTAG430X2
- //Revert this when X2 support returns.
- jtag430x2handle(app,verb,len);
- //jtag430handle(app,verb,len);
- break;
- case SMARTCARD:
- smartcardhandle(app,verb,len);
- break;
- case JTAGARM7TDMI:
- jtagarm7tdmihandle(app,verb,len);
- break;
- default:
- if(pluginhandle){
- pluginhandle(app,verb,len);
- }else{
- debugstr("Plugin missing.");
- debughex(app);
- txdata(app,NOK,0);
- }
- break;
- }
+void handle(uint8_t const app,
+ uint8_t const verb,
+ uint32_t const len)
+{
+ int i;
+
+ //debugstr("GoodFET");
+ PLEDOUT&=~PLEDPIN;
+
+ // find the app and call the handle fn
+ for(i = 0; i < num_apps; i++)
+ {
+ if(apps[i]->app == app)
+ {
+ // call the app's handle fn
+ (*(apps[i]->handle))(app, verb, len);
+
+ // exit early
+ return;
+ }
+ }
+
+ // if we get here, then the desired app is not copiled in
+ // this firmware
+ debugstr("App missing.");
+ debughex(app);
+ txdata(app, NOK, 0);