Add LPC8Nxx and NHS3xx support.
[fw/openocd] / src / jtag / core.c
index 8c79eb2302c3b643f3750a400270c0a3bbaea6ad..f90ae99baa3c7f3bc9477dec351c0e7b9410c2a9 100644 (file)
@@ -1308,6 +1308,14 @@ void jtag_tap_free(struct jtag_tap *tap)
 {
        jtag_unregister_event_callback(&jtag_reset_callback, tap);
 
+       struct jtag_tap_event_action *jteap = tap->event_action;
+       while (jteap) {
+               struct jtag_tap_event_action *next = jteap->next;
+               Jim_DecrRefCount(jteap->interp, jteap->body);
+               free(jteap);
+               jteap = next;
+       }
+
        free(tap->expected);
        free(tap->expected_mask);
        free(tap->expected_ids);
@@ -1472,13 +1480,19 @@ int jtag_init_inner(struct command_context *cmd_ctx)
 
 int adapter_quit(void)
 {
-       if (!jtag || !jtag->quit)
-               return ERROR_OK;
+       if (jtag && jtag->quit) {
+               /* close the JTAG interface */
+               int result = jtag->quit();
+               if (ERROR_OK != result)
+                       LOG_ERROR("failed: %d", result);
+       }
 
-       /* close the JTAG interface */
-       int result = jtag->quit();
-       if (ERROR_OK != result)
-               LOG_ERROR("failed: %d", result);
+       struct jtag_tap *t = jtag_all_taps();
+       while (t) {
+               struct jtag_tap *n = t->next_tap;
+               jtag_tap_free(t);
+               t = n;
+       }
 
        return ERROR_OK;
 }
@@ -1829,7 +1843,7 @@ void adapter_deassert_reset(void)
                LOG_ERROR("transport is not selected");
 }
 
-int adapter_config_trace(bool enabled, enum tpio_pin_protocol pin_protocol,
+int adapter_config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol,
                         uint32_t port_size, unsigned int *trace_freq)
 {
        if (jtag->config_trace)