FT2232: add missing enum when using ftd2xx library
[openocd.git] / src / jtag / drivers / driver.c
index cadd88e8f400fc634cd3dbf24704be1c5306ddea..14efe965e7aad3037b12ac2a88b3809dcf0d4d06 100644 (file)
@@ -2,7 +2,7 @@
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
- *   Copyright (C) 2007,2008 Øyvind Harboe                                 *
+ *   Copyright (C) 2007-2009 Øyvind Harboe                                 *
  *   oyvind.harboe@zylin.com                                               *
  *                                                                         *
  *   Copyright (C) 2009 SoftPLC Corporation                                *
 #include "config.h"
 #endif
 
-#include "interface.h"
-#include "minidriver.h"
-#include "command.h"
+#include <jtag/jtag.h>
+#include <jtag/interface.h>
+#include <jtag/commands.h>
+#include <jtag/minidriver.h>
+#include <helper/command.h>
 
 struct jtag_callback_entry
 {
@@ -213,7 +215,10 @@ int interface_jtag_add_dr_scan(int in_num_fields, const struct scan_field *in_fi
 
                if (!tap->bypass)
                {
-                       struct scan_field * start_field = field;        /* keep initial position for assert() */
+#ifndef NDEBUG
+                       /* remember initial position for assert() */
+                       struct scan_field *start_field = field;
+#endif /* NDEBUG */
 
                        for (int j = 0; j < in_num_fields; j++)
                        {
@@ -383,6 +388,31 @@ int interface_jtag_add_tlr(void)
        return ERROR_OK;
 }
 
+int interface_add_tms_seq(unsigned num_bits, const uint8_t *seq)
+{
+       struct jtag_command *cmd;
+
+       cmd = cmd_queue_alloc(sizeof(struct jtag_command));
+       if (cmd == NULL)
+               return ERROR_FAIL;
+
+       cmd->type = JTAG_TMS;
+       cmd->cmd.tms = cmd_queue_alloc(sizeof(*cmd->cmd.tms));
+       if (!cmd->cmd.tms)
+               return ERROR_FAIL;
+
+       /* copy the bits; our caller doesn't guarantee they'll persist */
+       cmd->cmd.tms->num_bits = num_bits;
+       cmd->cmd.tms->bits = buf_cpy(seq,
+                       cmd_queue_alloc(DIV_ROUND_UP(num_bits, 8)), num_bits);
+       if (!cmd->cmd.tms->bits)
+               return ERROR_FAIL;
+
+       jtag_queue_command(cmd);
+
+       return ERROR_OK;
+}
+
 int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
 {
        /* allocate memory for a new list member */
@@ -525,3 +555,30 @@ void interface_jtag_add_callback(jtag_callback1_t callback, jtag_callback_data_t
        jtag_add_callback4(jtag_convert_to_callback4, data0, (jtag_callback_data_t)callback, 0, 0);
 }
 
+
+/* A minidriver can use use an inline versions of this API level fn */
+void jtag_add_dr_out(struct jtag_tap* tap,
+               int num_fields, const int* num_bits, const uint32_t* value,
+               tap_state_t end_state)
+{
+       assert(end_state != TAP_RESET);
+       assert(end_state != TAP_INVALID);
+
+       cmd_queue_cur_state = end_state;
+
+       interface_jtag_add_dr_out(tap,
+                       num_fields, num_bits, value,
+                       end_state);
+}
+
+void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
+{
+       interface_jtag_add_callback(f, data0);
+}
+
+void jtag_add_callback4(jtag_callback_t f, jtag_callback_data_t data0,
+               jtag_callback_data_t data1, jtag_callback_data_t data2,
+               jtag_callback_data_t data3)
+{
+       interface_jtag_add_callback4(f, data0, data1, data2, data3);
+}

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)