2 \author Dave Huseby <dave at linuxprogrammer.org>
3 \brief OpenOCD firmware
14 //! Handles a monitor command.
15 void openocd_handle_fn(uint8_t const app,
19 // define the openocd app's app_t
20 app_t const openocd_app = {
32 "\tThe OpenOCD app handles the OpenOCD bitbang protocol.\n"
35 //! Clock the JTAG clock line
36 static void openocd_tcktock()
43 static void openocd_reset_cpu(void)
53 //! reset the tap logic
54 static void openocd_reset_test_logic(void)
62 openocd_tcktock(); // now in reset-test-logic
64 openocd_tcktock(); // now in run-test-idle state
67 //! sets the LED value
68 void openocd_led(int led)
74 /* turn the LED off */
78 //! resets the device/JTAG logic
79 void openocd_reset(int trst, int srst)
83 // we need to drive TST from low to high at
84 // the same time as the RST
95 else if (!srst && trst)
97 openocd_reset_test_logic();
99 else if(srst && !trst)
105 //! updates the tck, tms, and tdi values
106 void openocd_write(int tck, int tms, int tdi)
124 //! Stop JTAG, release pins
131 //! Set up the pins for JTAG mode.
141 //! handles OpenOCD commands
142 void openocd_handle_fn(uint8_t const app,
164 openocd_reset(cmddata[0], cmddata[1]);
169 cmddata[0] = READMISO;
174 openocd_write(cmddata[0], cmddata[1], cmddata[2]);
179 openocd_led(cmddata[0]);