+/// reset, then initialize JTAG chain
+extern int jtag_init_reset(struct command_context_s* cmd_ctx);
+extern int jtag_register_commands(struct command_context_s* cmd_ctx);
+
+/**
+ * @file
+ * The JTAG interface can be implemented with a software or hardware fifo.
+ *
+ * TAP_DRSHIFT and TAP_IRSHIFT are illegal end states; however,
+ * TAP_DRSHIFT/IRSHIFT can be emulated as end states, by using longer
+ * scans.
+ *
+ * Code that is relatively insensitive to the path taken through state
+ * machine (as long as it is JTAG compliant) can use @a endstate for
+ * jtag_add_xxx_scan(). Otherwise, the pause state must be specified as
+ * end state and a subsequent jtag_add_pathmove() must be issued.
+ */
+
+extern void jtag_add_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate);
+/**
+ * The same as jtag_add_ir_scan except no verification is performed out
+ * the output values.
+ */
+extern void jtag_add_ir_scan_noverify(int num_fields, const scan_field_t *fields, tap_state_t state);
+
+
+/**
+ * Set in_value to point to 32 bits of memory to scan into. This
+ * function is a way to handle the case of synchronous and asynchronous
+ * JTAG queues.
+ *
+ * In the event of an asynchronous queue execution the queue buffer
+ * allocation method is used, for the synchronous case the temporary 32
+ * bits come from the input field itself.
+ */
+extern void jtag_alloc_in_value32(scan_field_t *field);
+
+extern void jtag_add_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+/// A version of jtag_add_dr_scan() that uses the check_value/mask fields
+extern void jtag_add_dr_scan_check(int num_fields, scan_field_t* fields, tap_state_t endstate);
+extern void jtag_add_plain_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+extern void jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
+
+
+/**
+ * Defines a simple JTAG callback that can allow conversions on data
+ * scanned in from an interface.
+ *
+ * This callback should only be used for conversion that cannot fail.
+ * For conversion types or checks that can fail, use the more complete
+ * variant: jtag_callback_t.
+ */
+typedef void (*jtag_callback1_t)(u8 *in);
+
+/// A simpler version of jtag_add_callback4().
+extern void jtag_add_callback(jtag_callback1_t, u8 *in);
+
+
+/**
+ * Defines the type of data passed to the jtag_callback_t interface.
+ * The underlying type must allow storing an @c int or pointer type.
+ */
+typedef intptr_t jtag_callback_data_t;
+
+/**
+ * Defines the interface of the JTAG callback mechanism.
+ *
+ * @param in the pointer to the data clocked in
+ * @param data1 An integer big enough to use as an @c int or a pointer.
+ * @param data2 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.
+ * @returns an error code
+ */
+typedef int (*jtag_callback_t)(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3);
+
+
+/**
+ * This callback can be executed immediately the queue has been flushed.
+ *
+ * The JTAG queue can be executed synchronously or asynchronously.
+ * Typically for USB, the queue is executed asynchronously. For
+ * low-latency interfaces, the queue may be executed synchronously.
+ *
+ * The callback mechanism is very general and does not make many
+ * assumptions about what the callback does or what its arguments are.
+ * These callbacks are typically executed *after* the *entire* JTAG
+ * queue has been executed for e.g. USB interfaces, and they are
+ * guaranteeed to be invoked in the order that they were queued.
+ *
+ * If the execution of the queue fails before the callbacks, then --
+ * depending on driver implementation -- the callbacks may or may not be
+ * invoked. @todo Can we make this behavior consistent?