minidriver: fix inline capability of minidriver
authorØyvind Harboe <oyvind.harboe@zylin.com>
Fri, 4 Dec 2009 15:00:43 +0000 (16:00 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 8 Dec 2009 09:29:58 +0000 (10:29 +0100)
Low latency low CPU processing power systems(embedded)
will benefit greatly from being able to inline certain
jtag_add_xxx() fn's. The trick is that this has to be
done in such a way as to allow implementing an OpenOCD
API with a shared library(eventually) on a PC hosted
OpenOCD.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
.gitignore
src/jtag/Makefile.am
src/jtag/commands.c
src/jtag/commands.h
src/jtag/core.c
src/jtag/drivers/driver.c
src/jtag/drivers/minidriver_imp.h
src/jtag/jtag.h
src/jtag/minidriver.h
src/jtag/minidriver/minidriver_imp.h
src/jtag/minidummy/minidummy.c

index 114fc057840a4f54990414a5d014e348ef2d526c..9928129ea605ffed00cfbf12b5dfa2310855082a 100644 (file)
 *.la
 *.in
 
 *.la
 *.in
 
+# generated source files
+src/jtag/minidriver_imp.h
+src/jtag/jtag_minidriver.h
+
 # editor files
 *.swp
 
 # editor files
 *.swp
 
index da2edddcbe8c122c743af607bb7f3dc051a00e2f..3f132d4778b8111ab73c2960bd48a764cad68836 100644 (file)
@@ -9,33 +9,49 @@ SUBDIRS =
 DRIVERFILES =
 libjtag_la_LIBADD =
 
 DRIVERFILES =
 libjtag_la_LIBADD =
 
-if MINIDRIVER
+CLEANFILES =
+
+BUILT_SOURCES =
+
+BUILT_SOURCES += minidriver_imp.h
+CLEANFILES += minidriver_imp.h
 
 
-# for minidriver_imp.h
-AM_CPPFLAGS += -I$(srcdir)/minidriver
+if MINIDRIVER
 
 if ZY1000
 DRIVERFILES += zy1000/zy1000.c
 
 if ZY1000
 DRIVERFILES += zy1000/zy1000.c
-AM_CPPFLAGS += -I$(srcdir)/zy1000
+JTAG_MINIDRIVER_DIR = $(srcdir)/zy1000
 endif
 if MINIDRIVER_DUMMY
 DRIVERFILES += minidummy/minidummy.c commands.c
 endif
 if MINIDRIVER_DUMMY
 DRIVERFILES += minidummy/minidummy.c commands.c
-AM_CPPFLAGS += -I$(srcdir)/minidummy
+JTAG_MINIDRIVER_DIR = $(srcdir)/minidummy
 endif
 
 endif
 
+MINIDRIVER_IMP_DIR = $(srcdir)/minidriver
+
+jtag_minidriver.h: $(JTAG_MINIDRIVER_DIR)/jtag_minidriver.h
+       cp $< $@
+
+BUILT_SOURCES += jtag_minidriver.h
+
+CLEANFILES += jtag_minidriver.h
+
 else
 
 else
 
+MINIDRIVER_IMP_DIR = $(srcdir)/drivers
 DRIVERFILES += commands.c
 
 SUBDIRS += drivers
 libjtag_la_LIBADD += $(top_builddir)/src/jtag/drivers/libocdjtagdrivers.la
 
 DRIVERFILES += commands.c
 
 SUBDIRS += drivers
 libjtag_la_LIBADD += $(top_builddir)/src/jtag/drivers/libocdjtagdrivers.la
 
-# for minidriver_imp.h
-AM_CPPFLAGS += -I$(srcdir)/drivers
-
 endif
 endif
+
 # endif // MINIDRIVER
 
 # endif // MINIDRIVER
 
+minidriver_imp.h: $(MINIDRIVER_IMP_DIR)/minidriver_imp.h
+       cp $< $@
+
+
 libjtag_la_SOURCES = \
        core.c \
        interface.c \
 libjtag_la_SOURCES = \
        core.c \
        interface.c \
index 4e8ce40f141f87a0e0d66a250456257f074e9953..6951f0317c6925a5dde6315628590e99b07b68c5 100644 (file)
@@ -31,6 +31,7 @@
 #include "config.h"
 #endif
 
 #include "config.h"
 #endif
 
+#include <jtag/jtag.h>
 #include "commands.h"
 
 struct cmd_queue_page {
 #include "commands.h"
 
 struct cmd_queue_page {
index 86ded1520b239c73702f2e7759a391fe8f2fe9ac..b10b545369e28643345fbc8bd7dfef4d44959258 100644 (file)
@@ -26,8 +26,6 @@
 #ifndef JTAG_COMMANDS_H
 #define JTAG_COMMANDS_H
 
 #ifndef JTAG_COMMANDS_H
 #define JTAG_COMMANDS_H
 
-#include <jtag/jtag.h>
-
 /**
  * The inferred type of a scan_command_s structure, indicating whether
  * the command has the host scan in from the device, the host scan out
 /**
  * The inferred type of a scan_command_s structure, indicating whether
  * the command has the host scan in from the device, the host scan out
index 373dd7e28deaf380f32bee8b64efa6f2bcec2b42..77cf48ac284abd4802a988acabf8ea8af28843b9 100644 (file)
@@ -32,7 +32,6 @@
 #endif
 
 #include "jtag.h"
 #endif
 
 #include "jtag.h"
-#include "minidriver.h"
 #include "interface.h"
 
 #ifdef HAVE_STRINGS_H
 #include "interface.h"
 
 #ifdef HAVE_STRINGS_H
@@ -398,18 +397,6 @@ void jtag_add_plain_ir_scan(int in_num_fields, const struct scan_field *in_field
        jtag_set_error(retval);
 }
 
        jtag_set_error(retval);
 }
 
-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);
-}
-
 static int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value,
                uint8_t *in_check_mask, int num_bits);
 
 static int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value,
                uint8_t *in_check_mask, int num_bits);
 
@@ -491,20 +478,6 @@ void jtag_add_plain_dr_scan(int in_num_fields, const struct scan_field *in_field
        jtag_set_error(retval);
 }
 
        jtag_set_error(retval);
 }
 
-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_tlr(void)
 {
        jtag_prelude(TAP_RESET);
 void jtag_add_tlr(void)
 {
        jtag_prelude(TAP_RESET);
index 7fa9eade3998c177fbde40a211525b560d492d40..c57386a4b12e802eb38eaa1b36ac4f3a59a635d1 100644 (file)
@@ -2,7 +2,7 @@
  *   Copyright (C) 2005 by Dominic Rath                                    *
  *   Dominic.Rath@gmx.de                                                   *
  *                                                                         *
  *   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                                *
  *   oyvind.harboe@zylin.com                                               *
  *                                                                         *
  *   Copyright (C) 2009 SoftPLC Corporation                                *
@@ -31,7 +31,9 @@
 #include "config.h"
 #endif
 
 #include "config.h"
 #endif
 
+#include <jtag/jtag.h>
 #include <jtag/interface.h>
 #include <jtag/interface.h>
+#include <jtag/commands.h>
 #include <jtag/minidriver.h>
 #include <helper/command.h>
 
 #include <jtag/minidriver.h>
 #include <helper/command.h>
 
@@ -525,3 +527,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);
 }
 
        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);
+}
index 1efd2428b0fb05cca28f882232a0c28e20e3562a..76cf9dd56846ea02493d3b861a6e203b6cf95fd8 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
  *   Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de>              *
 /***************************************************************************
  *   Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de>              *
- *   Copyright (C) 2007,2008 Øyvind Harboe <oyvind.harboe@zylin.com>       *
+ *   Copyright (C) 2007-2009 Øyvind Harboe <oyvind.harboe@zylin.com>       *
  *   Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net>             *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net>             *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -44,4 +44,13 @@ void interface_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);
 
                jtag_callback_data_t data1, jtag_callback_data_t data2,
                jtag_callback_data_t data3);
 
+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);
+
+
+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);
+
 #endif // MINIDRIVER_IMP_H
 #endif // MINIDRIVER_IMP_H
index eaa0c7c7a74ab69b6503630c98ad13350ec5894f..fece65210c3ec0b03ddd62a6e4c3e821b99a3bff 100644 (file)
@@ -461,10 +461,6 @@ typedef int (*jtag_callback_t)(jtag_callback_data_t data0,
  * @param data3 An integer big enough to use as an @c int or a pointer.
  *
  */
  * @param data3 An integer big enough to use as an @c int or a pointer.
  *
  */
-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);
-
 
 /**
  * Run a TAP_RESET reset where the end state is TAP_RESET,
 
 /**
  * Run a TAP_RESET reset where the end state is TAP_RESET,
@@ -688,9 +684,6 @@ void jtag_sleep(uint32_t us);
  * There is no jtag_add_dr_outin() version of this fn that also allows
  * clocking data back in. Patches gladly accepted!
  */
  * There is no jtag_add_dr_outin() version of this fn that also allows
  * clocking data back in. Patches gladly accepted!
  */
-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);
 
 
 /**
 
 
 /**
@@ -725,4 +718,9 @@ bool jtag_poll_get_enabled(void);
  */
 void jtag_poll_set_enabled(bool value);
 
  */
 void jtag_poll_set_enabled(bool value);
 
+
+/* The minidriver may have inline versions of some of the low
+ * level APIs that are used in inner loops. */
+#include <jtag/minidriver.h>
+
 #endif /* JTAG_H */
 #endif /* JTAG_H */
index ea780faf9210b8c96e5232079e99fba8aad4fa49..2109c75f69ff4deee0ef87982d99687765ecb2af 100644 (file)
@@ -47,7 +47,7 @@
 
 // this header will be provided by the minidriver implementation,
 // and it may provide additional declarations that must be defined.
 
 // this header will be provided by the minidriver implementation,
 // and it may provide additional declarations that must be defined.
-#include "minidriver_imp.h"
+#include <jtag/minidriver_imp.h>
 
 int interface_jtag_add_ir_scan(
                int num_fields, const struct scan_field* fields,
 
 int interface_jtag_add_ir_scan(
                int num_fields, const struct scan_field* fields,
index e37151405e4019a86ae20b751ccea76a4c8ae33e..b6cdbead5468e4a6e78a3618cb3a75ce0931d555 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef MINIDRIVER_IMP_H
 #define MINIDRIVER_IMP_H
 
 #ifndef MINIDRIVER_IMP_H
 #define MINIDRIVER_IMP_H
 
-#include "jtag_minidriver.h"
+#include <jtag/jtag_minidriver.h>
 
 static inline void interface_jtag_alloc_in_value32(struct scan_field *field)
 {
 
 static inline void interface_jtag_alloc_in_value32(struct scan_field *field)
 {
@@ -41,4 +41,21 @@ static inline void interface_jtag_add_scan_check_alloc(struct scan_field *field)
                field->in_value = field->intmp;
 }
 
                field->in_value = field->intmp;
 }
 
+static inline 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)
+{
+       cmd_queue_cur_state = end_state;
+
+       interface_jtag_add_dr_out(tap,
+                       num_fields, num_bits, value,
+                       end_state);
+}
+
+#define jtag_add_callback(callback, in) interface_jtag_add_callback(callback, in)
+
+#define jtag_add_callback4(callback, in, data1, data2, data3) interface_jtag_add_callback4(callback, in, data1, data2, data3)
+
+
+
 #endif // MINIDRIVER_IMP_H
 #endif // MINIDRIVER_IMP_H
index e60e832e9c2423f7c85e65432e1066615267b9b3..9c608cdbb460af9a292ac25b8eb39ef8035c6038 100644 (file)
@@ -20,6 +20,7 @@
 #include "config.h"
 #endif
 
 #include "config.h"
 #endif
 
+#include <jtag/jtag.h>
 #include <target/embeddedice.h>
 #include <jtag/minidriver.h>
 #include <jtag/interface.h>
 #include <target/embeddedice.h>
 #include <jtag/minidriver.h>
 #include <jtag/interface.h>

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)