A major refactor of the GoodFET firmware build system and apps to give better
[goodfet] / firmware / apps / jtag / ejtag.c
1 /*! \file ejtag.c
2   \author Travis Goodspeed <travis at radiantmachines.com>
3   \brief MIPS EJTAG (32-bit)
4 */
5
6 #include "platform.h"
7 #include "command.h"
8 #include "jtag.h"
9 #include "ejtag.h"
10
11 //! Handles MIPS EJTAG commands.  Forwards others to JTAG.
12 void ejtag_handle_fn( uint8_t const app,
13                                           uint8_t const verb,
14                                           uint32_t const len);
15
16 // define the ejtag app's app_t
17 app_t const ejtag_app = {
18
19         /* app number */
20         EJTAG,
21
22         /* handle fn */
23         ejtag_handle_fn,
24
25         /* name */
26         "EJTAG",
27
28         /* desc */
29         "\tThe EJTAG app extends the basic JTAG app with support\n"
30         "\tfor JTAG'ing MIPS based devices.\n"
31 };
32
33 //! Handles MIPS EJTAG commands.  Forwards others to JTAG.
34 void ejtag_handle_fn( uint8_t const app,
35                                           uint8_t const verb,
36                                           uint32_t const len)
37 {
38         switch(verb)
39         {
40         case START:
41                 cmddata[0] = jtag_ir_shift8(EJTAG_IR_BYPASS);
42                 txdata(app, verb, 1);
43                 break;
44         case STOP:
45                 txdata(app,verb,0);
46                 break;
47         case PEEK:
48                 //WRITEME
49         case POKE:
50                 //WRITEME
51         default:
52                 (*(ejtag_app.handle))(app, verb, len);
53         }
54 }