You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
| 2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
| 2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
| 2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
| 2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
| 2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
| 2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
| 2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
| 2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
| 2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
| 2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
| 2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
| 2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
| 2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
| 2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
| 2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
| 2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(54) |
Sep
(47) |
Oct
(15) |
Nov
(58) |
Dec
|
|
From: <zw...@ma...> - 2009-06-09 10:41:27
|
Author: zwelch Date: 2009-06-09 10:41:23 +0200 (Tue, 09 Jun 2009) New Revision: 2167 Modified: trunk/src/jtag/jtag.h Log: Expose jtag_unregister_event_callback with related API declarations. Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-09 08:41:14 UTC (rev 2166) +++ trunk/src/jtag/jtag.h 2009-06-09 08:41:23 UTC (rev 2167) @@ -610,6 +610,7 @@ extern void jtag_sleep(u32 us); extern int jtag_call_event_callbacks(enum jtag_event event); extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv); +extern int jtag_unregister_event_callback(int (*callback)(enum jtag_event event, void *priv)); /* * The JTAG subsystem defines a number of error codes, |
|
From: <zw...@ma...> - 2009-06-09 10:41:19
|
Author: zwelch
Date: 2009-06-09 10:41:14 +0200 (Tue, 09 Jun 2009)
New Revision: 2166
Modified:
trunk/src/jtag/core.c
trunk/src/jtag/jtag.h
trunk/src/jtag/tcl.c
Log:
Improve encapsulation of JTAG event handling:
- Move nvp_jtag_tap_event and jtag_tap_handle_event to tcl.c.
- Change both to be static; remove declaration of function from jtag.h.
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:41:08 UTC (rev 2165)
+++ trunk/src/jtag/core.c 2009-06-09 08:41:14 UTC (rev 2166)
@@ -63,13 +63,6 @@
"JTAG controller reset (RESET or TRST)"
};
-const Jim_Nvp nvp_jtag_tap_event[] = {
- { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
- { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
-
- { .name = NULL, .value = -1 }
-};
-
static int jtag_trst = 0;
static int jtag_srst = 0;
@@ -1222,37 +1215,6 @@
return jtag->srst_asserted(srst_asserted);
}
-void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e)
-{
- jtag_tap_event_action_t * jteap;
- int done;
-
- jteap = tap->event_action;
-
- done = 0;
- while (jteap) {
- if (jteap->event == e) {
- done = 1;
- LOG_DEBUG( "JTAG tap: %s event: %d (%s) action: %s\n",
- tap->dotted_name,
- e,
- Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name,
- Jim_GetString(jteap->body, NULL) );
- if (Jim_EvalObj(interp, jteap->body) != JIM_OK) {
- Jim_PrintErrorMessage(interp);
- }
- }
-
- jteap = jteap->next;
- }
-
- if (!done) {
- LOG_DEBUG( "event %d %s - no action",
- e,
- Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name);
- }
-}
-
int jtag_add_statemove(tap_state_t goal_state)
{
tap_state_t cur_state = cmd_queue_cur_state;
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:41:08 UTC (rev 2165)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:41:14 UTC (rev 2166)
@@ -611,8 +611,6 @@
extern int jtag_call_event_callbacks(enum jtag_event event);
extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv);
-void jtag_tap_handle_event(jtag_tap_t* tap, enum jtag_tap_event e);
-
/*
* The JTAG subsystem defines a number of error codes,
* using codes between -100 and -199.
Modified: trunk/src/jtag/tcl.c
===================================================================
--- trunk/src/jtag/tcl.c 2009-06-09 08:41:08 UTC (rev 2165)
+++ trunk/src/jtag/tcl.c 2009-06-09 08:41:14 UTC (rev 2166)
@@ -39,8 +39,13 @@
#include <strings.h>
#endif
-extern const Jim_Nvp nvp_jtag_tap_event[];
+static const Jim_Nvp nvp_jtag_tap_event[] = {
+ { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
+ { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
+ { .name = NULL, .value = -1 }
+};
+
/* jtag interfaces (parport, FTDI-USB, TI-USB, ...)
*/
@@ -443,6 +448,38 @@
return JIM_ERR;
}
+static void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e)
+{
+ jtag_tap_event_action_t * jteap;
+ int done;
+
+ jteap = tap->event_action;
+
+ done = 0;
+ while (jteap) {
+ if (jteap->event == e) {
+ done = 1;
+ LOG_DEBUG( "JTAG tap: %s event: %d (%s) action: %s\n",
+ tap->dotted_name,
+ e,
+ Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name,
+ Jim_GetString(jteap->body, NULL) );
+ if (Jim_EvalObj(interp, jteap->body) != JIM_OK) {
+ Jim_PrintErrorMessage(interp);
+ }
+ }
+
+ jteap = jteap->next;
+ }
+
+ if (!done) {
+ LOG_DEBUG( "event %d %s - no action",
+ e,
+ Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name);
+ }
+}
+
+
static int jim_jtag_command( Jim_Interp *interp, int argc, Jim_Obj *const *argv )
{
Jim_GetOptInfo goi;
|
|
From: <zw...@ma...> - 2009-06-09 10:41:11
|
Author: zwelch
Date: 2009-06-09 10:41:08 +0200 (Tue, 09 Jun 2009)
New Revision: 2165
Modified:
trunk/src/jtag/core.c
trunk/src/jtag/tcl.c
Log:
Properly encapsulate core hasKHZ variable.
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:41:00 UTC (rev 2164)
+++ trunk/src/jtag/core.c 2009-06-09 08:41:08 UTC (rev 2165)
@@ -100,13 +100,13 @@
/* speed in kHz*/
static int speed_khz = 0;
/* flag if the kHz speed was defined */
-bool hasKHz = false;
+static bool hasKHz = false;
+static int jtag_speed = 0;
struct jtag_interface_s *jtag = NULL;
/* configuration */
jtag_interface_t *jtag_interface = NULL;
-static int jtag_speed = 0;
void jtag_set_error(int error)
{
@@ -1188,6 +1188,7 @@
jtag_speed = speed;
/* this command can be called during CONFIG,
* in which case jtag isn't initialized */
+ hasKHz = !jtag;
return jtag ? jtag->speed(speed) : ERROR_OK;
}
Modified: trunk/src/jtag/tcl.c
===================================================================
--- trunk/src/jtag/tcl.c 2009-06-09 08:41:00 UTC (rev 2164)
+++ trunk/src/jtag/tcl.c 2009-06-09 08:41:08 UTC (rev 2165)
@@ -39,8 +39,6 @@
#include <strings.h>
#endif
-extern bool hasKHz;
-
extern const Jim_Nvp nvp_jtag_tap_event[];
/* jtag interfaces (parport, FTDI-USB, TI-USB, ...)
@@ -994,11 +992,8 @@
return retval;
}
cur_speed = speed_div1;
-
- retval = jtag_set_speed(cur_speed);
}
- else
- hasKHz = true;
+ retval = jtag_set_speed(cur_speed);
}
cur_speed = jtag_get_speed_khz();
|
|
From: <zw...@ma...> - 2009-06-09 10:41:05
|
Author: zwelch
Date: 2009-06-09 10:41:00 +0200 (Tue, 09 Jun 2009)
New Revision: 2164
Modified:
trunk/src/jtag/core.c
trunk/src/jtag/jtag.h
trunk/src/jtag/tcl.c
Log:
Cleanup and encapsulate IR Capture verification:
- Add accessors for setting the jtag_verify_capture_ir flag.
- Use them in handle_verify_ircapture_cpmmand
- Change variable type to bool; make it static.
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:40:54 UTC (rev 2163)
+++ trunk/src/jtag/core.c 2009-06-09 08:41:00 UTC (rev 2164)
@@ -87,7 +87,7 @@
static tap_state_t cmd_queue_end_state = TAP_RESET;
tap_state_t cmd_queue_cur_state = TAP_RESET;
-int jtag_verify_capture_ir = 1;
+static bool jtag_verify_capture_ir = true;
static int jtag_verify = 1;
/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
@@ -1201,7 +1201,16 @@
return jtag_verify;
}
+void jtag_set_verify_capture_ir(bool enable)
+{
+ jtag_verify_capture_ir = enable;
+}
+bool jtag_will_verify_capture_ir()
+{
+ return jtag_verify_capture_ir;
+}
+
int jtag_power_dropout(int *dropout)
{
return jtag->power_dropout(dropout);
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:40:54 UTC (rev 2163)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:41:00 UTC (rev 2164)
@@ -611,8 +611,6 @@
extern int jtag_call_event_callbacks(enum jtag_event event);
extern int jtag_register_event_callback(int (* callback)(enum jtag_event event, void* priv), void* priv);
-extern int jtag_verify_capture_ir;
-
void jtag_tap_handle_event(jtag_tap_t* tap, enum jtag_tap_event e);
/*
@@ -708,4 +706,7 @@
void jtag_set_verify(bool enable);
bool jtag_will_verify(void);
+void jtag_set_verify_capture_ir(bool enable);
+bool jtag_will_verify_capture_ir(void);
+
#endif /* JTAG_H */
Modified: trunk/src/jtag/tcl.c
===================================================================
--- trunk/src/jtag/tcl.c 2009-06-09 08:40:54 UTC (rev 2163)
+++ trunk/src/jtag/tcl.c 2009-06-09 08:41:00 UTC (rev 2164)
@@ -1304,25 +1304,21 @@
static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
+ if (argc > 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
if (argc == 1)
{
if (strcmp(args[0], "enable") == 0)
- {
- jtag_verify_capture_ir = 1;
- }
+ jtag_set_verify_capture_ir(true);
else if (strcmp(args[0], "disable") == 0)
- {
- jtag_verify_capture_ir = 0;
- } else
- {
+ jtag_set_verify_capture_ir(false);
+ else
return ERROR_COMMAND_SYNTAX_ERROR;
- }
- } else if (argc != 0)
- {
- return ERROR_COMMAND_SYNTAX_ERROR;
}
- command_print(cmd_ctx, "verify Capture-IR is %s", (jtag_verify_capture_ir) ? "enabled": "disabled");
+ const char *status = jtag_will_verify_capture_ir() ? "enabled": "disabled";
+ command_print(cmd_ctx, "verify Capture-IR is %s", status);
return ERROR_OK;
}
|
|
From: <zw...@ma...> - 2009-06-09 10:40:57
|
Author: zwelch
Date: 2009-06-09 10:40:54 +0200 (Tue, 09 Jun 2009)
New Revision: 2163
Modified:
trunk/src/jtag/core.c
Log:
Add missing static keywords to a few variables in JTAG core module.
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:40:46 UTC (rev 2162)
+++ trunk/src/jtag/core.c 2009-06-09 08:40:54 UTC (rev 2163)
@@ -58,7 +58,7 @@
*/
static int jtag_error = ERROR_OK;
-char* jtag_event_strings[] =
+static char* jtag_event_strings[] =
{
"JTAG controller reset (RESET or TRST)"
};
@@ -83,12 +83,12 @@
*/
static unsigned jtag_num_taps = 0;
-enum reset_types jtag_reset_config = RESET_NONE;
-tap_state_t cmd_queue_end_state = TAP_RESET;
+static enum reset_types jtag_reset_config = RESET_NONE;
+static tap_state_t cmd_queue_end_state = TAP_RESET;
tap_state_t cmd_queue_cur_state = TAP_RESET;
int jtag_verify_capture_ir = 1;
-int jtag_verify = 1;
+static int jtag_verify = 1;
/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
static int jtag_nsrst_delay = 0; /* default to no nSRST delay */
@@ -106,7 +106,7 @@
/* configuration */
jtag_interface_t *jtag_interface = NULL;
-int jtag_speed = 0;
+static int jtag_speed = 0;
void jtag_set_error(int error)
{
|
|
From: <zw...@ma...> - 2009-06-09 10:40:51
|
Author: zwelch
Date: 2009-06-09 10:40:46 +0200 (Tue, 09 Jun 2009)
New Revision: 2162
Modified:
trunk/src/jtag/core.c
trunk/src/jtag/jtag.h
Log:
Move the jtag_error helper routines out of header file:
- Makes jtag_error static, add new get helper function for completeness.
- Improve and add documentation and style for these helpers.
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:40:31 UTC (rev 2161)
+++ trunk/src/jtag/core.c 2009-06-09 08:40:46 UTC (rev 2162)
@@ -46,10 +46,17 @@
static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
int in_num_fields, scan_field_t *in_fields, tap_state_t state);
-/* note that this is not marked as static as it must be available from outside core.c for those
- that implement the jtag_xxx() minidriver layer
-*/
-int jtag_error=ERROR_OK;
+/**
+ * The jtag_error variable is set when an error occurs while executing
+ * the queue. Application code may set this using jtag_set_error(),
+ * when an error occurs during processing that should be reported during
+ * jtag_execute_queue().
+ *
+ * Tts value may be checked with jtag_get_error() and cleared with
+ * jtag_error_clear(). This value is returned (and cleared) by
+ * jtag_execute_queue().
+ */
+static int jtag_error = ERROR_OK;
char* jtag_event_strings[] =
{
@@ -101,6 +108,24 @@
jtag_interface_t *jtag_interface = NULL;
int jtag_speed = 0;
+void jtag_set_error(int error)
+{
+ if ((error == ERROR_OK) || (jtag_error != ERROR_OK))
+ return;
+ jtag_error = error;
+}
+int jtag_get_error(void)
+{
+ return jtag_error;
+}
+int jtag_error_clear(void)
+{
+ int temp = jtag_error;
+ jtag_error = ERROR_OK;
+ return temp;
+}
+
+
jtag_tap_t *jtag_all_taps(void)
{
return __jtag_all_taps;
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:40:31 UTC (rev 2161)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:40:46 UTC (rev 2162)
@@ -578,36 +578,19 @@
extern void jtag_execute_queue_noclear(void);
/**
- * The jtag_error variable is set when an error occurs while executing
- * the queue.
- *
- * This flag can also be set from application code, if an error happens
- * during processing that should be reported during jtag_execute_queue().
- *
- * It is cleared by jtag_execute_queue().
+ * Set the current JTAG core execution error, unless one was set
+ * by a previous call previously. Driver or application code must
+ * use jtag_error_clear to reset jtag_error once this routine has been
+ * called with a non-zero error code.
*/
-extern int jtag_error;
-
-static __inline__ void jtag_set_error(int error)
-{
- if ((error==ERROR_OK)||(jtag_error!=ERROR_OK))
- {
- /* keep first error */
- return;
- }
- jtag_error=error;
-}
-
+void jtag_set_error(int error);
+/// @returns The current value of jtag_error
+int jtag_get_error(void);
/**
* Resets jtag_error to ERROR_OK, returning its previous value.
* @returns The previous value of @c jtag_error.
*/
-static inline int jtag_error_clear(void)
-{
- int temp = jtag_error;
- jtag_error = ERROR_OK;
- return temp;
-}
+int jtag_error_clear(void);
/* can be implemented by hw+sw */
extern int jtag_power_dropout(int* dropout);
|
|
From: <zw...@ma...> - 2009-06-09 10:40:43
|
Author: zwelch
Date: 2009-06-09 10:40:31 +0200 (Tue, 09 Jun 2009)
New Revision: 2161
Modified:
trunk/src/jtag/amt_jtagaccel.c
trunk/src/jtag/bitbang.c
trunk/src/jtag/bitq.c
trunk/src/jtag/core.c
trunk/src/jtag/dummy.c
trunk/src/jtag/ft2232.c
trunk/src/jtag/jtag.h
trunk/src/jtag/rlink/rlink.c
trunk/src/jtag/tcl.c
trunk/src/jtag/zy1000/zy1000.c
trunk/src/target/arm7_9_common.c
trunk/src/target/cortex_m3.c
trunk/src/target/mips_m4k.c
Log:
Encapsulate jtag_reset_config using accessors:
- Update handle_reset_config_command in tcl.c to use new helpers.
- Replace direct accesses in JTAG interface and target drivers.
Modified: trunk/src/jtag/amt_jtagaccel.c
===================================================================
--- trunk/src/jtag/amt_jtagaccel.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/amt_jtagaccel.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -500,6 +500,7 @@
amt_jtagaccel_speed(jtag_get_speed());
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
aw_control_rst &= ~0x8;
else
Modified: trunk/src/jtag/bitbang.c
===================================================================
--- trunk/src/jtag/bitbang.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/bitbang.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -258,7 +258,7 @@
#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
#endif
- if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+ if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
{
tap_set_state(TAP_RESET);
}
Modified: trunk/src/jtag/bitq.c
===================================================================
--- trunk/src/jtag/bitq.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/bitq.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -298,7 +298,7 @@
#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
#endif
- if ( (cmd->cmd.reset->trst == 1) || ( cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST) ) )
+ if ( (cmd->cmd.reset->trst == 1) || ( cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST) ) )
{
tap_set_state(TAP_RESET);
}
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/core.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -1262,6 +1262,15 @@
return ERROR_OK;
}
+enum reset_types jtag_get_reset_config(void)
+{
+ return jtag_reset_config;
+}
+void jtag_set_reset_config(enum reset_types type)
+{
+ jtag_reset_config = type;
+}
+
int jtag_get_trst(void)
{
return jtag_trst;
Modified: trunk/src/jtag/dummy.c
===================================================================
--- trunk/src/jtag/dummy.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/dummy.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -123,7 +123,7 @@
{
dummy_clock = 0;
- if (trst || (srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+ if (trst || (srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
dummy_state = TAP_RESET;
LOG_DEBUG("reset to: %s", tap_state_name(dummy_state) );
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/ft2232.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -1193,6 +1193,7 @@
static void usbjtag_reset(int trst, int srst)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (trst == 1)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
@@ -1232,6 +1233,7 @@
static void jtagkey_reset(int trst, int srst)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (trst == 1)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
@@ -1273,6 +1275,7 @@
static void olimex_jtag_reset(int trst, int srst)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (trst == 1)
{
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
@@ -2155,6 +2158,7 @@
return ERROR_JTAG_INIT_FAILED;
}
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
low_direction &= ~nTRSTnOE; /* nTRST input */
@@ -2229,6 +2233,7 @@
high_output = 0x0;
high_direction = 0x0c;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
LOG_ERROR("can't set nTRSTOE to push-pull on the Dicarlo jtag");
@@ -2307,6 +2312,7 @@
high_output = 0x0;
high_direction = 0x0f;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
high_output |= nTRSTnOE;
@@ -2373,6 +2379,7 @@
high_output = 0x0;
high_direction = 0x0f;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
{
high_output |= nTRSTnOE;
@@ -2944,6 +2951,7 @@
nTRST = 0x10;
nSRST = 0x20;
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0) {
low_direction &= ~nTRST; /* nTRST high impedance */
}
@@ -2991,6 +2999,7 @@
low_output &= ~nTRST;
}
else if (trst == 0) {
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0)
low_direction &= ~nTRST;
else
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:40:31 UTC (rev 2161)
@@ -277,7 +277,8 @@
RESET_SRST_PUSH_PULL = 0x20,
};
-extern enum reset_types jtag_reset_config;
+enum reset_types jtag_get_reset_config(void);
+void jtag_set_reset_config(enum reset_types type);
/**
* Initialize interface upon startup. Return a successful no-op upon
Modified: trunk/src/jtag/rlink/rlink.c
===================================================================
--- trunk/src/jtag/rlink/rlink.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/rlink/rlink.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -1419,7 +1419,7 @@
#ifdef _DEBUG_JTAG_IO_
LOG_DEBUG("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst);
#endif
- if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_reset_config & RESET_SRST_PULLS_TRST)))
+ if ((cmd->cmd.reset->trst == 1) || (cmd->cmd.reset->srst && (jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
{
tap_set_state(TAP_RESET);
}
Modified: trunk/src/jtag/tcl.c
===================================================================
--- trunk/src/jtag/tcl.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/tcl.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -921,8 +921,10 @@
}
/* clear previous values of those bits, save new values */
- jtag_reset_config &= ~mask;
- jtag_reset_config |= new_cfg;
+ enum reset_types old_cfg = jtag_get_reset_config();
+ old_cfg &= ~mask;
+ new_cfg |= old_cfg;
+ jtag_set_reset_config(new_cfg);
return ERROR_OK;
}
Modified: trunk/src/jtag/zy1000/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000/zy1000.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/jtag/zy1000/zy1000.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -164,7 +164,7 @@
ZY1000_POKE(ZY1000_JTAG_BASE+0x10, 0x00000002);
}
- if (trst||(srst&&(jtag_reset_config & RESET_SRST_PULLS_TRST)))
+ if (trst||(srst&&(jtag_get_reset_config() & RESET_SRST_PULLS_TRST)))
{
waitIdle();
/* we're now in the RESET state until trst is deasserted */
Modified: trunk/src/target/arm7_9_common.c
===================================================================
--- trunk/src/target/arm7_9_common.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/target/arm7_9_common.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -905,6 +905,7 @@
{
if (target->reset_halt)
{
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)
{
check_pc = 1;
@@ -975,6 +976,7 @@
LOG_DEBUG("target->state: %s",
Jim_Nvp_value2name_simple( nvp_target_state,target->state)->name);
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (!(jtag_reset_config & RESET_HAS_SRST))
{
LOG_ERROR("Can't assert SRST");
@@ -1047,6 +1049,7 @@
/* deassert reset lines */
jtag_add_reset(0, 0);
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (target->reset_halt&&(jtag_reset_config & RESET_SRST_PULLS_TRST)!=0)
{
LOG_WARNING("srst pulls trst - can not reset into halted mode. Issuing halt after reset.");
Modified: trunk/src/target/cortex_m3.c
===================================================================
--- trunk/src/target/cortex_m3.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/target/cortex_m3.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -544,7 +544,7 @@
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
+ if ((jtag_get_reset_config() & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
@@ -753,6 +753,7 @@
LOG_DEBUG("target->state: %s",
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name );
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (!(jtag_reset_config & RESET_HAS_SRST))
{
LOG_ERROR("Can't assert SRST");
Modified: trunk/src/target/mips_m4k.c
===================================================================
--- trunk/src/target/mips_m4k.c 2009-06-09 08:40:23 UTC (rev 2160)
+++ trunk/src/target/mips_m4k.c 2009-06-09 08:40:31 UTC (rev 2161)
@@ -235,7 +235,7 @@
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
+ if ((jtag_get_reset_config() & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
@@ -267,6 +267,7 @@
LOG_DEBUG("target->state: %s",
Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name);
+ enum reset_types jtag_reset_config = jtag_get_reset_config();
if (!(jtag_reset_config & RESET_HAS_SRST))
{
LOG_ERROR("Can't assert SRST");
|
|
From: <zw...@ma...> - 2009-06-09 10:40:26
|
Author: zwelch
Date: 2009-06-09 10:40:23 +0200 (Tue, 09 Jun 2009)
New Revision: 2160
Modified:
trunk/src/jtag/jtag.h
Log:
Remove superfluous extern for non-existant global variable.
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:40:10 UTC (rev 2159)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:40:23 UTC (rev 2160)
@@ -266,8 +266,6 @@
*/
int jtag_set_speed(int speed);
-extern int jtag_speed_post_reset;
-
enum reset_types {
RESET_NONE = 0x0,
RESET_HAS_TRST = 0x1,
|
|
From: <zw...@ma...> - 2009-06-09 10:40:20
|
Author: zwelch
Date: 2009-06-09 10:40:10 +0200 (Tue, 09 Jun 2009)
New Revision: 2159
Modified:
trunk/src/jtag/amt_jtagaccel.c
trunk/src/jtag/core.c
trunk/src/jtag/ft2232.c
trunk/src/jtag/gw16012.c
trunk/src/jtag/jlink.c
trunk/src/jtag/jtag.h
trunk/src/jtag/parport.c
trunk/src/jtag/presto.c
trunk/src/jtag/rlink/rlink.c
trunk/src/jtag/tcl.c
trunk/src/jtag/zy1000/zy1000.c
Log:
Add get and set accessors for jtag_speed:
- Setter calls the interface driver callback to improve core encapsulation.
- Use getter in standard JTAG interface drivers and ZY1000 minidriver.
Modified: trunk/src/jtag/amt_jtagaccel.c
===================================================================
--- trunk/src/jtag/amt_jtagaccel.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/amt_jtagaccel.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -187,6 +187,7 @@
aw_scan_tms_5 = 0x40 | (tms_scan[0] & 0x1f);
AMT_AW(aw_scan_tms_5);
+ int jtag_speed = jtag_get_speed();
if (jtag_speed > 3 || rtck_enabled)
amt_wait_scan_busy();
@@ -244,6 +245,7 @@
u8 dr_tdo;
u8 aw_tms_scan;
u8 tms_scan[2];
+ int jtag_speed = jtag_get_speed();
if (ir_scan)
amt_jtagaccel_end_state(TAP_IRSHIFT);
@@ -496,7 +498,7 @@
aw_control_fsm |= 0x04;
AMT_AW(aw_control_fsm);
- amt_jtagaccel_speed(jtag_speed);
+ amt_jtagaccel_speed(jtag_get_speed());
if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
aw_control_rst &= ~0x8;
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/core.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -1153,7 +1153,19 @@
{
return speed_khz;
}
+int jtag_get_speed(void)
+{
+ return jtag_speed;
+}
+int jtag_set_speed(int speed)
+{
+ jtag_speed = speed;
+ /* this command can be called during CONFIG,
+ * in which case jtag isn't initialized */
+ return jtag ? jtag->speed(speed) : ERROR_OK;
+}
+
void jtag_set_verify(bool enable)
{
jtag_verify = enable;
Modified: trunk/src/jtag/ft2232.c
===================================================================
--- trunk/src/jtag/ft2232.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/ft2232.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -2099,7 +2099,7 @@
if (layout->init() != ERROR_OK)
return ERROR_JTAG_INIT_FAILED;
- ft2232_speed(jtag_speed);
+ ft2232_speed(jtag_get_speed());
buf[0] = 0x85; /* Disconnect TDI/DO to TDO/DI for Loopback */
if (((retval = ft2232_write(buf, 1, &bytes_written)) != ERROR_OK) || (bytes_written != 1))
Modified: trunk/src/jtag/gw16012.c
===================================================================
--- trunk/src/jtag/gw16012.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/gw16012.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -557,7 +557,7 @@
gw16012_input(&status_port);
gw16012_msb = (status_port & 0x80) ^ 0x80;
- gw16012_speed(jtag_speed);
+ gw16012_speed(jtag_get_speed());
gw16012_reset(0, 0);
return ERROR_OK;
Modified: trunk/src/jtag/jlink.c
===================================================================
--- trunk/src/jtag/jlink.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/jlink.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -340,7 +340,7 @@
jlink_reset(0, 0);
jtag_sleep(3000);
jlink_tap_init();
- jlink_speed(jtag_speed);
+ jlink_speed(jtag_get_speed());
/* v5/6 jlink seems to have an issue if the first tap move
* is not divisible by 8, so we send a TLR on first power up */
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:40:10 UTC (rev 2159)
@@ -255,7 +255,17 @@
struct jtag_event_callback_s* next;
} jtag_event_callback_t;
-extern int jtag_speed;
+/// @returns The current JTAG speed setting.
+int jtag_get_speed(void);
+/**
+ * Set the JTAG speed. This routine will call the underlying
+ * interface @c speed callback, if the interface has been initialized.
+ * @param speed The new speed setting.
+ * @returns ERROR_OK during configuration or on success, or an error
+ * code returned from the interface @c speed callback.
+ */
+int jtag_set_speed(int speed);
+
extern int jtag_speed_post_reset;
enum reset_types {
Modified: trunk/src/jtag/parport.c
===================================================================
--- trunk/src/jtag/parport.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/parport.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -189,7 +189,7 @@
static void parport_write(int tck, int tms, int tdi)
{
- int i = jtag_speed + 1;
+ int i = jtag_get_speed() + 1;
if (tck)
dataport_value |= cable->TCK_MASK;
Modified: trunk/src/jtag/presto.c
===================================================================
--- trunk/src/jtag/presto.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/presto.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -787,7 +787,7 @@
LOG_INFO("PRESTO open, serial number '%s'", presto->serial);
/* use JTAG speed setting from configuration file */
- presto_jtag_speed(jtag_speed);
+ presto_jtag_speed(jtag_get_speed());
bitq_interface = &presto_bitq;
return ERROR_OK;
Modified: trunk/src/jtag/rlink/rlink.c
===================================================================
--- trunk/src/jtag/rlink/rlink.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/rlink/rlink.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -1849,7 +1849,7 @@
tap_state_queue_init();
dtc_queue_init();
- rlink_speed(jtag_speed);
+ rlink_speed(jtag_get_speed());
rlink_reset(0, 0);
return ERROR_OK;
Modified: trunk/src/jtag/tcl.c
===================================================================
--- trunk/src/jtag/tcl.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/tcl.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -960,14 +960,11 @@
LOG_DEBUG("handle jtag speed");
int cur_speed = 0;
- cur_speed = jtag_speed = strtoul(args[0], NULL, 0);
+ cur_speed = strtoul(args[0], NULL, 0);
+ retval = jtag_set_speed(cur_speed);
- /* this command can be called during CONFIG,
- * in which case jtag isn't initialized */
- if (jtag)
- retval = jtag->speed(cur_speed);
}
- command_print(cmd_ctx, "jtag_speed: %d", jtag_speed);
+ command_print(cmd_ctx, "jtag_speed: %d", jtag_get_speed());
return retval;
}
@@ -994,9 +991,9 @@
jtag_set_speed_khz(0);
return retval;
}
- cur_speed = jtag_speed = speed_div1;
+ cur_speed = speed_div1;
- retval = jtag->speed(cur_speed);
+ retval = jtag_set_speed(cur_speed);
}
else
hasKHz = true;
@@ -1005,7 +1002,7 @@
cur_speed = jtag_get_speed_khz();
if (jtag != NULL)
{
- retval = jtag->speed_div(jtag_speed, &cur_speed);
+ retval = jtag->speed_div(jtag_get_speed(), &cur_speed);
if (ERROR_OK != retval)
return retval;
}
Modified: trunk/src/jtag/zy1000/zy1000.c
===================================================================
--- trunk/src/jtag/zy1000/zy1000.c 2009-06-09 08:40:02 UTC (rev 2158)
+++ trunk/src/jtag/zy1000/zy1000.c 2009-06-09 08:40:10 UTC (rev 2159)
@@ -356,7 +356,7 @@
/* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */
zy1000_reset(0, 0);
- zy1000_speed(jtag_speed);
+ zy1000_speed(jtag_get_speed());
return ERROR_OK;
}
|
|
From: <zw...@ma...> - 2009-06-09 10:40:06
|
Author: zwelch Date: 2009-06-09 10:40:02 +0200 (Tue, 09 Jun 2009) New Revision: 2158 Modified: trunk/src/jtag/core.c trunk/src/jtag/jtag.h Log: Encapsulate the jtag_event_callback list; add helper functions if needed. Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-09 08:39:50 UTC (rev 2157) +++ trunk/src/jtag/core.c 2009-06-09 08:40:02 UTC (rev 2158) @@ -88,7 +88,7 @@ static int jtag_ntrst_delay = 0; /* default to no nTRST delay */ /* callbacks to inform high-level handlers about JTAG state changes */ -jtag_event_callback_t *jtag_event_callbacks; +static jtag_event_callback_t *jtag_event_callbacks; /* speed in kHz*/ static int speed_khz = 0; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-09 08:39:50 UTC (rev 2157) +++ trunk/src/jtag/jtag.h 2009-06-09 08:40:02 UTC (rev 2158) @@ -255,8 +255,6 @@ struct jtag_event_callback_s* next; } jtag_event_callback_t; -extern jtag_event_callback_t* jtag_event_callbacks; - extern int jtag_speed; extern int jtag_speed_post_reset; |
|
From: <zw...@ma...> - 2009-06-09 10:39:56
|
Author: zwelch
Date: 2009-06-09 10:39:50 +0200 (Tue, 09 Jun 2009)
New Revision: 2157
Modified:
trunk/src/jtag/core.c
trunk/src/jtag/jtag.h
trunk/src/target/cortex_m3.c
trunk/src/target/mips_m4k.c
Log:
Encapsulate the jtag_trst and jtag_srst variables:
- Add accessor functions to return their value.
- Use new SRST accessor in cortex_m3.c and mips_m4k.c
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 08:39:44 UTC (rev 2156)
+++ trunk/src/jtag/core.c 2009-06-09 08:39:50 UTC (rev 2157)
@@ -63,8 +63,8 @@
{ .name = NULL, .value = -1 }
};
-int jtag_trst = 0;
-int jtag_srst = 0;
+static int jtag_trst = 0;
+static int jtag_srst = 0;
/**
* List all TAPs that have been created.
@@ -1250,6 +1250,15 @@
return ERROR_OK;
}
+int jtag_get_trst(void)
+{
+ return jtag_trst;
+}
+int jtag_get_srst(void)
+{
+ return jtag_srst;
+}
+
void jtag_set_nsrst_delay(unsigned delay)
{
jtag_nsrst_delay = delay;
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:39:44 UTC (rev 2156)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:39:50 UTC (rev 2157)
@@ -243,8 +243,10 @@
jtag_tap_event_action_t* next;
};
-extern int jtag_trst;
-extern int jtag_srst;
+/// @returns The current state of TRST.
+int jtag_get_trst(void);
+/// @returns The current state of SRST.
+int jtag_get_srst(void);
typedef struct jtag_event_callback_s
{
Modified: trunk/src/target/cortex_m3.c
===================================================================
--- trunk/src/target/cortex_m3.c 2009-06-09 08:39:44 UTC (rev 2156)
+++ trunk/src/target/cortex_m3.c 2009-06-09 08:39:50 UTC (rev 2157)
@@ -544,7 +544,7 @@
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_srst)
+ if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
Modified: trunk/src/target/mips_m4k.c
===================================================================
--- trunk/src/target/mips_m4k.c 2009-06-09 08:39:44 UTC (rev 2156)
+++ trunk/src/target/mips_m4k.c 2009-06-09 08:39:50 UTC (rev 2157)
@@ -235,7 +235,7 @@
if (target->state == TARGET_RESET)
{
- if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_srst)
+ if ((jtag_reset_config & RESET_SRST_PULLS_TRST) && jtag_get_srst())
{
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
|
|
From: <zw...@ma...> - 2009-06-09 10:39:48
|
Author: zwelch
Date: 2009-06-09 10:39:44 +0200 (Tue, 09 Jun 2009)
New Revision: 2156
Modified:
trunk/src/jtag/jtag.h
trunk/src/jtag/tcl.c
Log:
Move extern of nvp_jtag_tap_event from jtag.h to tcl.c.
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 08:39:37 UTC (rev 2155)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:39:44 UTC (rev 2156)
@@ -236,8 +236,6 @@
JTAG_TAP_EVENT_DISABLE
};
-extern const Jim_Nvp nvp_jtag_tap_event[];
-
struct jtag_tap_event_action_s
{
enum jtag_tap_event event;
Modified: trunk/src/jtag/tcl.c
===================================================================
--- trunk/src/jtag/tcl.c 2009-06-09 08:39:37 UTC (rev 2155)
+++ trunk/src/jtag/tcl.c 2009-06-09 08:39:44 UTC (rev 2156)
@@ -41,6 +41,8 @@
extern bool hasKHz;
+extern const Jim_Nvp nvp_jtag_tap_event[];
+
/* jtag interfaces (parport, FTDI-USB, TI-USB, ...)
*/
|
|
From: <zw...@ma...> - 2009-06-09 10:39:42
|
Author: zwelch
Date: 2009-06-09 10:39:37 +0200 (Tue, 09 Jun 2009)
New Revision: 2155
Modified:
trunk/src/jtag/jtag.h
Log:
Remove superfluous extern of jtag_event_strings from jtag.h.
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 07:51:47 UTC (rev 2154)
+++ trunk/src/jtag/jtag.h 2009-06-09 08:39:37 UTC (rev 2155)
@@ -231,8 +231,6 @@
JTAG_TRST_ASSERTED
};
-extern char* jtag_event_strings[];
-
enum jtag_tap_event {
JTAG_TAP_EVENT_ENABLE,
JTAG_TAP_EVENT_DISABLE
|
|
From: oharboe at B. <oh...@ma...> - 2009-06-09 09:51:48
|
Author: oharboe
Date: 2009-06-09 09:51:47 +0200 (Tue, 09 Jun 2009)
New Revision: 2154
Modified:
trunk/Makefile.am
trunk/configure.in
Log:
remove native line style
Property changes on: trunk/Makefile.am
___________________________________________________________________
Name: svn:eol-style
- native
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2009-06-09 06:53:26 UTC (rev 2153)
+++ trunk/configure.in 2009-06-09 07:51:47 UTC (rev 2154)
@@ -1,1028 +1,1028 @@
-AC_PREREQ(2.60)
-AC_INIT([openocd], [0.2.0-in-development],
- [OpenOCD Mailing List <ope...@li...>])
-AC_CONFIG_SRCDIR([src/openocd.c])
-
-AM_INIT_AUTOMAKE([-Wall -Wno-portability])
-AM_MAINTAINER_MODE
-
-AM_CONFIG_HEADER(config.h)
-AH_BOTTOM([
-#include "system.h"
-#include "replacements.h"
-])
-
-AC_LANG_C
-AC_PROG_CC
-AC_PROG_CC_C99
-AM_PROG_CC_C_O
-AC_PROG_RANLIB
-
-dnl disable checks for C++, Fortran and GNU Java Compiler
-m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
-m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
-m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
-AC_DISABLE_SHARED
-AC_PROG_LIBTOOL
-
-
-dnl configure checks required for Jim files (these are obsolete w/ C99)
-AC_C_CONST
-AC_TYPE_LONG_LONG_INT
-
-
-AC_SEARCH_LIBS([ioperm], [ioperm])
-AC_SEARCH_LIBS([dlopen], [dl])
-
-AC_CHECK_HEADERS(arpa/inet.h)
-AC_CHECK_HEADERS(elf.h)
-AC_CHECK_HEADERS(dirent.h)
-AC_CHECK_HEADERS(fcntl.h)
-AC_CHECK_HEADERS(ifaddrs.h)
-AC_CHECK_HEADERS(malloc.h)
-AC_CHECK_HEADERS(netdb.h)
-AC_CHECK_HEADERS(netinet/in.h)
-AC_CHECK_HEADERS(netinet/tcp.h)
-AC_CHECK_HEADERS(pthread.h)
-AC_CHECK_HEADERS(strings.h)
-AC_CHECK_HEADERS(sys/ioctl.h)
-AC_CHECK_HEADERS(sys/param.h)
-AC_CHECK_HEADERS(sys/poll.h)
-AC_CHECK_HEADERS(sys/select.h)
-AC_CHECK_HEADERS(sys/socket.h)
-AC_CHECK_HEADERS(sys/stat.h)
-AC_CHECK_HEADERS(sys/time.h)
-AC_CHECK_HEADERS(sys/types.h)
-AC_CHECK_HEADERS(unistd.h)
-
-AC_CHECK_HEADERS([net/if.h], [], [], [dnl
-#include <stdio.h>
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-])
-
-AC_HEADER_ASSERT
-AC_HEADER_STDBOOL
-AC_HEADER_TIME
-
-AC_C_BIGENDIAN
-
-AC_CHECK_FUNCS(strndup)
-AC_CHECK_FUNCS(strnlen)
-AC_CHECK_FUNCS(gettimeofday)
-AC_CHECK_FUNCS(usleep)
-AC_CHECK_FUNCS(vasprintf)
-
-build_bitbang=no
-build_bitq=no
-is_cygwin=no
-is_mingw=no
-is_win32=no
-is_darwin=no
-build_release=yes
-
-AC_ARG_ENABLE(release,
- AS_HELP_STRING([--enable-release], [Enable Release Build, default no]),
- [build_release=$enableval], [build_release=no])
-
-if test $cross_compiling = no; then
- if test $build_release = no; then
- # check we can find guess-rev.sh
- AC_CHECK_FILE("$srcdir/guess-rev.sh", build_release=no, build_release=yes)
- fi
-fi
-
-# We are not *ALWAYS* being installed in the standard place.
-# We may be installed in a "tool-build" specific location.
-# Normally with other packages - as part of a tool distro.
-# Thus - we should search that 'libdir' also.
-#
-# And - if we are being installed there - the odds are
-# The libraries unique to what we are are there too.
-#
-
-# Expand nd deal with NONE - just like configure will do later
-OCDprefix=$prefix
-OCDxprefix=$exec_prefix
-test x"$OCDprefix" = xNONE && OCDprefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test x"$OCDxprefix" = xNONE && OCDxprefix="$OCDprefix"
-
-# what matters is the "exec-prefix"
-if test "$OCDxprefix" != "$ac_default_prefix"
-then
- # We are installing in a non-standard place
- # Nonstandard --prefix and/or --exec-prefix
- # We have an override of some sort.
- # use build specific install library dir
-
- LDFLAGS="$LDFLAGS -L$OCDxprefix/lib"
- # RPATH becomes an issue on Linux only
- if test $host_os = linux-gnu || test $host_os = linux ; then
- LDFLAGS="$LDFLAGS -Wl,-rpath,$OCDxprefix/lib"
- fi
- # The "INCDIR" is also usable
- CFLAGS="$CFLAGS -I$includedir"
-fi
-
-AC_ARG_WITH(ftd2xx,
- AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
- [
-# Option Given.
-cat << __EOF__
-
-The option: --with-ftd2xx=<PATH> has been removed.
-On Linux, the new option is:
-
- --with-ftd2xx-linux-tardir=/path/to/files
-
-Where <path> is the path the the directory where the "tar.gz" file
-from FTDICHIP.COM was unpacked, for example:
-
- --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
-
-On Cygwin/MingW32, the new option is:
-
- --with-ftd2xx-win32-zipdir=/path/to/files
-
-Where <path> is the path to the directory where the "zip" file from
-FTDICHIP.COM was unpacked, for example:
-
- --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
-
-__EOF__
-
- AC_MSG_ERROR([Sorry Cannot continue])
- ], [true])
-
-#========================================
-# FTD2XXX support comes in 4 forms.
-# (1) win32 - via a zip file
-# (2) linux - via a tar file
-# (3) linux/cygwin/mingw - via libftdi
-# (4) darwin - installed under /usr/local
-#
-# In case (1) and (2) we need to know where the package was unpacked.
-
-AC_ARG_WITH(ftd2xx-win32-zipdir,
- AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
- [
- # option present
- if test -d $with_ftd2xx_win32_zipdir
- then
- with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
- AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
- else
- AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
- fi
- ], [true])
-
-AC_ARG_WITH(ftd2xx-linux-tardir,
- AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
- [
- # Option present
- if test $is_win32 = yes ; then
- AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
- fi
- if test -d $with_ftd2xx_linux_tardir
- then
- with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
- AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
- else
- AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
- fi
- ], [true])
-
-AC_ARG_WITH(ftd2xx-lib,
- AS_HELP_STRING([--with-ftd2xx-lib],
- [Use static or shared ftd2xx libs on default static]),
- [
- case "$withval" in
- static)
- with_ftd2xx_lib=$withval
- ;;
- shared)
- with_ftd2xx_lib=$withval
- ;;
- *)
- AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
- ;;
- esac
- ], [
- # Default is static - it is simpler :-(
- with_ftd2xx_lib=static
- ])
-
-AC_ARG_ENABLE(gccwarnings,
- AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
- [gcc_warnings=$enableval], [gcc_warnings=yes])
-
-AC_ARG_ENABLE(wextra,
- AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
- [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
-
-AC_ARG_ENABLE(werror,
- AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
- [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
-
-# set default verbose options, overridden by following options
-debug_jtag_io=no
-debug_usb_io=no
-debug_usb_comms=no
-
-AC_ARG_ENABLE(verbose,
- AS_HELP_STRING([--enable-verbose],
- [Enable verbose JTAG I/O messages (for debugging).]),
- [
- debug_jtag_io=$enableval
- debug_usb_io=$enableval
- debug_usb_comms=$enableval
- ], [])
-
-AC_ARG_ENABLE(verbose_jtag_io,
- AS_HELP_STRING([--enable-verbose-jtag-io],
- [Enable verbose JTAG I/O messages (for debugging).]),
- [debug_jtag_io=$enableval], [])
-AC_ARG_ENABLE(verbose_usb_io,
- AS_HELP_STRING([--enable-verbose-usb-io],
- [Enable verbose USB I/O messages (for debugging)]),
- [debug_usb_io=$enableval], [])
-AC_ARG_ENABLE(verbose_usb_comms,
- AS_HELP_STRING([--enable-verbose-usb-comms],
- [Enable verbose USB communication messages (for debugging)]),
- [debug_usb_comms=$enableval], [])
-
-AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
-AC_MSG_RESULT($debug_jtag_io)
-if test $debug_jtag_io = yes; then
- AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
-fi
-
-AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
-AC_MSG_RESULT($debug_usb_io)
-if test $debug_usb_io = yes; then
- AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
-fi
-
-AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
-AC_MSG_RESULT($debug_usb_comms)
-if test $debug_usb_comms = yes; then
- AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
-fi
-
-
-debug_malloc=no
-AC_ARG_ENABLE(malloc_logging,
- AS_HELP_STRING([--enable-malloc-logging],
- [Include free space in logging messages (requires malloc.h).]),
- [debug_malloc=$enableval], [])
-
-AC_MSG_CHECKING([whether to enable malloc free space logging]);
-AC_MSG_RESULT($debug_malloc)
-if test $debug_malloc = yes; then
- AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
-fi
-
-
-AC_ARG_ENABLE(dummy,
- AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
- [build_dummy=$enableval], [build_dummy=no])
-
-AC_ARG_ENABLE(parport,
- AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
- [build_parport=$enableval], [build_parport=no])
-
-AC_ARG_ENABLE(parport_ppdev,
- AS_HELP_STRING([--disable-parport-ppdev],
- [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
- [parport_use_ppdev=$enableval], [parport_use_ppdev=])
-
-AC_ARG_ENABLE(parport_giveio,
- AS_HELP_STRING([--enable-parport-giveio],
- [Enable use of giveio for parport (for CygWin only)]),
- [parport_use_giveio=$enableval], [parport_use_giveio=])
-
-AC_ARG_ENABLE(ft2232_libftdi,
- AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
- [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
-
-AC_ARG_ENABLE(ft2232_ftd2xx,
- AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
- [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
-
-AC_ARG_ENABLE(ftd2xx_highspeed,
- AS_HELP_STRING([--enable-ftd2xx-highspeed], [Enable building support for FT2232H and FT4232H-based devices (requires >=libftd2xx-0.4.16)]),
- [want_ftd2xx_highspeed=$enableval], [want_ftd2xx_highspeed=maybe])
-
-AC_ARG_ENABLE(amtjtagaccel,
- AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
- [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
-
-AC_ARG_ENABLE(ecosboard,
- AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCosBoard based JTAG debugger]),
- [build_ecosboard=$enableval], [build_ecosboard=no])
-
-AC_ARG_ENABLE(ioutil,
- AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
- [build_ioutil=$enableval], [build_ioutil=no])
-
-AC_ARG_ENABLE(httpd,
- AS_HELP_STRING([--enable-httpd], [Enable builtin httpd server - useful for standalone OpenOCD implementations]),
- [build_httpd=$enableval], [build_httpd=no])
-
-case "${host_cpu}" in
- arm*)
- AC_ARG_ENABLE(ep93xx,
- AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
- [build_ep93xx=$enableval], [build_ep93xx=no])
-
- AC_ARG_ENABLE(at91rm9200,
- AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
- [build_at91rm9200=$enableval], [build_at91rm9200=no])
- ;;
-
- *)
- build_ep93xx=no
- build_at91rm9200=no
- ;;
-esac
-
-AC_ARG_ENABLE(gw16012,
- AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
- [build_gw16012=$enableval], [build_gw16012=no])
-
-AC_ARG_ENABLE(presto_libftdi,
- AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
- [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
-
-AC_ARG_ENABLE(presto_ftd2xx,
- AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
- [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
-
-AC_ARG_ENABLE(usbprog,
- AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
- [build_usbprog=$enableval], [build_usbprog=no])
-
-AC_ARG_ENABLE(oocd_trace,
- AS_HELP_STRING([--enable-oocd_trace], [Enable building support for the OpenOCD+trace ETM capture device]),
- [build_oocd_trace=$enableval], [build_oocd_trace=no])
-
-AC_ARG_ENABLE(jlink,
- AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
- [build_jlink=$enableval], [build_jlink=no])
-
-AC_ARG_ENABLE(vsllink,
- AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
- [build_vsllink=$enableval], [build_vsllink=no])
-
-AC_ARG_ENABLE(rlink,
- AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
- [build_rlink=$enableval], [build_rlink=no])
-
-AC_ARG_ENABLE(arm-jtag-ew,
- AS_HELP_STRING([--enable-arm-jtag-ew], [Enable building support for the Olimex ARM-JTAG-EW Programmer]),
- [build_armjtagew=$enableval], [build_armjtagew=no])
-
-AC_ARG_ENABLE(minidriver_dummy,
- AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
- [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
-
-
-build_minidriver=no
-AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
-if test $build_ecosboard = yes; then
- if test $build_minidriver = yes; then
- AC_MSG_ERROR([Multiple minidriver options have been enabled.])
- fi
- AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
- [Define to 1 if you have the <jtag_minidriver.h> header file.])
- build_minidriver=yes
-fi
-AC_MSG_RESULT($build_ecosboard)
-
-
-AC_MSG_CHECKING([whether to enable dummy minidriver])
-if test $build_minidriver_dummy = yes; then
- if test $build_minidriver = yes; then
- AC_MSG_ERROR([Multiple minidriver options have been enabled.])
- fi
- build_minidriver=yes
- AC_DEFINE(BUILD_MINIDRIVER_DUMMY, 1, [Use the dummy minidriver.])
- AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
- [Define to 1 if you have the <jtag_minidriver.h> header file.])
-fi
-AC_MSG_RESULT($build_minidriver_dummy)
-
-AC_MSG_CHECKING([whether standard drivers can be built])
-if test "$build_minidriver" = yes; then
- AC_MSG_RESULT([no])
- AC_MSG_WARN([Using the minidriver disables all other drivers.])
- sleep 2
-else
- AC_MSG_RESULT([yes])
-fi
-
-case "${host_cpu}" in
- i?86|x86*)
- ;;
- *)
- if test x$parport_use_ppdev = xno; then
- AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
- fi
- parport_use_ppdev=yes
- ;;
-esac
-
-case $host in
- *-cygwin*)
- is_win32=yes
-
- AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return __MINGW32__;]),
- [is_mingw=yes],[is_mingw=no])
- if test $is_mingw = yes; then
- AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
- if test x$parport_use_giveio = xno; then
- AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
- fi
- parport_use_giveio=yes
- is_cygwin=no
- else
- is_cygwin=yes
- AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
- fi
-
- AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
- AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
- ;;
- *-mingw*)
- is_mingw=yes
- is_win32=yes
-
- if test x$parport_use_giveio = xno; then
- AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
- fi
- parport_use_giveio=yes
-
- AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
- AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
- AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
- ;;
- *darwin*)
- is_darwin=yes
-
- if test x$parport_use_giveio = xyes; then
- AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
- fi
- parport_use_giveio=no
-
- AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
- AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
- AC_DEFINE(IS_DARWIN, 1, [1 if building for Darwin.])
- ;;
- *)
- if test x$parport_use_giveio = xyes; then
- AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
- fi
- parport_use_giveio=no
- AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
- AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
- AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
- ;;
-esac
-
-if test $build_parport = yes; then
- build_bitbang=yes
- AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
-else
- AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
-fi
-
-if test $build_dummy = yes; then
- build_bitbang=yes
- AC_DEFINE(BUILD_DUMMY, 1, [1 if you want dummy driver.])
-else
- AC_DEFINE(BUILD_DUMMY, 0, [0 if you don't want dummy driver.])
-fi
-
-if test $build_ep93xx = yes; then
- build_bitbang=yes
- AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
-else
- AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
-fi
-
-if test $build_ecosboard = yes; then
- AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
-else
- AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
-fi
-
-if test $build_ioutil = yes; then
- AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.])
-else
- AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.])
-fi
-
-if test $build_httpd = yes; then
- AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.])
-else
- AC_DEFINE(BUILD_HTTPD, 0, [0 if you don't want httpd.])
-fi
-
-if test $build_at91rm9200 = yes; then
- build_bitbang=yes
- AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
-else
- AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
-fi
-
-if test x$parport_use_ppdev = xyes; then
- AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
-else
- AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
-fi
-
-if test x$parport_use_giveio = xyes; then
- AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
-else
- AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
-fi
-
-if test $build_bitbang = yes; then
- AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
-else
- AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
-fi
-
-if test $build_ft2232_libftdi = yes; then
- AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
-else
- AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
-fi
-
-if test $build_ft2232_ftd2xx = yes; then
- AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
-else
- AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
-fi
-
-if test $build_amtjtagaccel = yes; then
- AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
-else
- AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
-fi
-
-if test $build_gw16012 = yes; then
- AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
-else
- AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
-fi
-
-if test $build_presto_libftdi = yes; then
- build_bitq=yes
- AC_DEFINE(BUILD_PRESTO_LIBFTDI, 1, [1 if you want the ASIX PRESTO driver using libftdi.])
-else
- AC_DEFINE(BUILD_PRESTO_LIBFTDI, 0, [0 if you don't want the ASIX PRESTO driver using libftdi.])
-fi
-
-if test $build_presto_ftd2xx = yes; then
- build_bitq=yes
- AC_DEFINE(BUILD_PRESTO_FTD2XX, 1, [1 if you want the ASIX PRESTO driver using FTD2XX.])
-else
- AC_DEFINE(BUILD_PRESTO_FTD2XX, 0, [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
-fi
-
-if test $build_bitq = yes; then
- AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
-else
- AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
-fi
-
-if test $build_usbprog = yes; then
- AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
-else
- AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
-fi
-
-if test $build_oocd_trace = yes; then
- AC_DEFINE(BUILD_OOCD_TRACE, 1, [1 if you want the OpenOCD+trace ETM capture driver.])
-else
- AC_DEFINE(BUILD_OOCD_TRACE, 0, [0 if you don't want the OpenOCD+trace ETM capture driver.])
-fi
-
-if test $build_jlink = yes; then
- AC_DEFINE(BUILD_JLINK, 1, [1 if you want the J-Link JTAG driver.])
-else
- AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
-fi
-
-if test $build_vsllink = yes; then
- AC_DEFINE(BUILD_VSLLINK, 1, [1 if you want the Versaloon-Link JTAG driver.])
-else
- AC_DEFINE(BUILD_VSLLINK, 0, [0 if you don't want the Versaloon-Link JTAG driver.])
-fi
-
-if test $build_rlink = yes; then
- AC_DEFINE(BUILD_RLINK, 1, [1 if you want the RLink JTAG driver.])
-else
- AC_DEFINE(BUILD_RLINK, 0, [0 if you don't want the RLink JTAG driver.])
-fi
-
-if test $build_armjtagew = yes; then
- AC_DEFINE(BUILD_ARMJTAGEW, 1, [1 if you want the ARM-JTAG-EW JTAG driver.])
-else
- AC_DEFINE(BUILD_ARMJTAGEW, 0, [0 if you don't want the ARM-JTAG-EW JTAG driver.])
-fi
-
-#-- Deal with MingW/Cygwin FTD2XX issues
-
-if test $is_win32 = yes; then
-if test "${with_ftd2xx_linux_tardir+set}" = set
-then
- AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
-fi
-
-if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
- AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
-
- # if we are given a zipdir...
- if test "${with_ftd2xx_win32_zipdir+set}" = set
- then
- # Set the CFLAGS for "ftd2xx.h"
- f=$with_ftd2xx_win32_zipdir/ftd2xx.h
- if test ! -f $f ; then
- AC_MSG_ERROR([File: $f cannot be found])
- fi
- CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
-
- # And calculate the LDFLAGS for the machine
- case "$host_cpu" in
- i?86|x86_*)
- LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
- LIBS="$LIBS -lftd2xx"
- f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
- ;;
- amd64)
- LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
- LIBS="$LIBS -lftd2xx"
- f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
- ;;
- *)
- AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
- ;;
- esac
- if test ! -f $f ; then
- AC_MSG_ERROR([Library: $f not found])
- fi
- else
- LIBS="$LIBS -lftd2xx"
- AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
- fi
-fi
-fi # win32
-
-if test $is_darwin = yes ; then
-if test "${with_ftd2xx_win32_zipdir+set}" = set
-then
- AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
-fi
-if test "${with_ftd2xx_linux_tardir+set}" = set
-then
- AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
-fi
-
-if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
- AC_MSG_CHECKING([for libftd2xx.a (darwin)])
-
- if test ! -f /usr/local/include/ftd2xx.h ; then
- AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
- fi
-
- CFLAGS="$CFLAGS -I/usr/local/include"
- LDFLAGS="$LDFLAGS -L/usr/local/lib"
- LIBS="$LIBS -lftd2xx"
- AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
-fi
-fi # darwin
-
-if test $is_win32 = no && test $is_darwin = no ; then
-
-if test "${with_ftd2xx_win32_zipdir+set}" = set
-then
- AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
-fi
-
-if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
- # Must be linux
- if test $host_os != linux-gnu && test $host_os != linux ; then
- AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
- fi
- # Are we given a TAR directory?
- if test "${with_ftd2xx_linux_tardir+set}" = set
- then
- AC_MSG_CHECKING([uninstalled ftd2xx distribution])
- # The .H file is simple..
- FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
- if test ! -f "${FTD2XX_H}"; then
- AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
- fi
- CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
- FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
- FTD2XX_LIB="-lftd2xx"
- if test $with_ftd2xx_lib != shared; then
- # Test #1 - Future proof - if/when ftdichip fixes their distro.
- # Try it with the simple ".a" suffix.
- FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a"
- if test -f "${FTD2XX_LIB}"; then
- FTD2XX_LDFLAGS="${FTD2XX_LDFLAGS}/static_lib"
- else
- # Test Number2.
- # Grr.. perhaps it exists as a version number?
- FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
- count=`ls ${FTD2XX_LIB} | wc -l`
- if test $count -gt 1 ; then
- AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
- fi
- if test $count -ne 1 ; then
- AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
- fi
- # Because the "-l" rules do not understand version numbers...
- # we will just stuff the absolute path onto the LIBS variable
- FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
- FTD2XX_LDFLAGS=""
- fi
- fi
- LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
- LIBS="${LIBS} ${FTD2XX_LIB}"
- AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
- else
- AC_CHECK_HEADER([ftd2xx.h],[],[
- AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
- ])
- AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
- AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
- ],[])
- fi
-fi
-fi # linux
-
-if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes; then
-
-# Before we go any further - make sure we can *BUILD* and *RUN*
-# a simple app with the "ftd2xx.lib" file - in what ever form we where given
-# We should be able to compile, link and run this test program now
-AC_MSG_CHECKING([whether ftd2xx library works])
-
-#
-# Save the LDFLAGS for later..
-LDFLAGS_SAVE=$LDFLAGS
-CFLAGS_SAVE=$CFLAGS
-_LDFLAGS=`eval echo $LDFLAGS`
-_CFLAGS=`eval echo $CFLAGS`
-LDFLAGS=$_LDFLAGS
-CFLAGS=$_CFLAGS
-
-AC_RUN_IFELSE([
-#include "confdefs.h"
-#if IS_WIN32
-#include "windows.h"
-#endif
-#include <stdio.h>
-#include <ftd2xx.h>
-
-int
-main( int argc, char **argv )
-{
- DWORD x;
- FT_GetLibraryVersion( &x );
- return 0;
-}
- ], [
- AC_MSG_RESULT([Success!])
- ], [
- AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
- ] )
-
-AC_MSG_CHECKING([whether to build ftd2xx device support])
-AC_MSG_RESULT([$want_ftd2xx_highspeed])
-if test $want_ftd2xx_highspeed != no; then
- AC_MSG_CHECKING([for ftd2xx highspeed device support])
- AC_COMPILE_IFELSE([
-#include "confdefs.h"
-#if IS_WIN32
-#include "windows.h"
-#endif
-#include <stdio.h>
-#include <ftd2xx.h>
-DWORD x = FT_DEVICE_4232H;
- ], [
- AC_DEFINE(BUILD_FTD2XX_HIGHSPEED, [1],
- [Support FT2232H/FT4232HS with FTD2XX.])
- build_ftd2xx_highspeed=yes
- ], [
- build_ftd2xx_highspeed=no
- ])
- AC_MSG_RESULT([$build_ftd2xx_highspeed])
-
- if test $want_ftd2xx_highspeed = yes -a $build_ftd2xx_highspeed = no; then
- AC_MSG_ERROR([You need a newer FTD2XX driver (version 0.4.16 or later).])
- fi
-fi
-
-LDFLAGS=$LDFLAGS_SAVE
-CFLAGS=$CFLAGS_SAVE
-fi
-
-if test $build_ft2232_libftdi = yes ; then
- # We assume: the package is preinstalled in the proper place
- # these present as 2 libraries..
- LIBS="$LIBS -lftdi -lusb"
- #
- # Try to build a small program.
- AC_MSG_CHECKING([Build & Link with libftdi...])
-
- LDFLAGS_SAVE=$LDFLAGS
- CFLAGS_SAVE=$CFLAGS
- _LDFLAGS=`eval echo $LDFLAGS`
- _CFLAGS=`eval echo $CFLAGS`
- LDFLAGS=$_LDFLAGS
- CFLAGS=$_CFLAGS
-
- AC_RUN_IFELSE([
-#include <stdio.h>
-#include <ftdi.h>
-
-int
-main( int argc, char **argv )
-{
- struct ftdi_context *p;
- p = ftdi_new();
- if( p != NULL ){
- return 0;
- } else {
- fprintf( stderr, "calling ftdi_new() failed\n");
- return 1;
- }
-}
- ], [
- AC_MSG_RESULT([Success])
- ], [
- AC_MSG_ERROR([Cannot build & run test program using libftdi])
- ])
- # Restore the 'unexpanded ldflags'
- LDFLAGS=$LDFLAGS_SAVE
- CFLAGS=$CFLAGS_SAVE
-fi
-
-# check for usb.h when a driver will require it
-if test $build_jlink = yes -o $build_vsllink = yes -o $build_usbprog = yes -o \
- $build_rlink = yes -o $build_armjtagew = yes
-then
- AC_CHECK_HEADERS([usb.h],[],
- [AC_MSG_ERROR([usb.h is required to build some OpenOCD driver(s)])])
-fi
-
-AM_CONDITIONAL(RELEASE, test $build_release = yes)
-AM_CONDITIONAL(PARPORT, test $build_parport = yes)
-AM_CONDITIONAL(DUMMY, test $build_dummy = yes)
-AM_CONDITIONAL(GIVEIO, test x$parport_use_giveio = xyes)
-AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes)
-AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes)
-AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes)
-AM_CONDITIONAL(HTTPD, test $build_httpd = yes)
-AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes)
-AM_CONDITIONAL(BITBANG, test $build_bitbang = yes)
-AM_CONDITIONAL(FT2232_LIBFTDI, test $build_ft2232_libftdi = yes)
-AM_CONDITIONAL(FT2232_FTD2XX, test $build_ft2232_ftd2xx = yes)
-AM_CONDITIONAL(AMTJTAGACCEL, test $build_amtjtagaccel = yes)
-AM_CONDITIONAL(GW16012, test $build_gw16012 = yes)
-AM_CONDITIONAL(PRESTO_LIBFTDI, test $build_presto_libftdi = yes)
-AM_CONDITIONAL(PRESTO_FTD2XX, test $build_presto_ftd2xx = yes)
-AM_CONDITIONAL(USBPROG, test $build_usbprog = yes)
-AM_CONDITIONAL(OOCD_TRACE, test $build_oocd_trace = yes)
-AM_CONDITIONAL(JLINK, test $build_jlink = yes)
-AM_CONDITIONAL(VSLLINK, test $build_vsllink = yes)
-AM_CONDITIONAL(RLINK, test $build_rlink = yes)
-AM_CONDITIONAL(ARMJTAGEW, test $build_armjtagew = yes)
-AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes)
-AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes)
-AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes)
-AM_CONDITIONAL(IS_DARWIN, test $is_darwin = yes)
-AM_CONDITIONAL(BITQ, test $build_bitq = yes)
-
-AM_CONDITIONAL(MINIDRIVER, test $build_minidriver = yes)
-AM_CONDITIONAL(MINIDRIVER_DUMMY, test $build_minidriver_dummy = yes)
-
-# Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
-AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
-AC_COMPILE_IFELSE([
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <stdlib.h>
-int main(int argc, char **argv) { char **ep = environ; }
- ], [
- AC_MSG_RESULT([yes])
- has_environ=yes
- ], [
- AC_MSG_RESULT([no])
-
- # Possibility #2: can environ be found in an available library?
- AC_MSG_CHECKING([for extern environ])
- AC_LINK_IFELSE([
-extern char **environ;
-int main(int argc, char **argv) { char **ep = environ; }
- ], [
- AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
- has_environ=yes
- ], [
- has_environ=no
- ])
- AC_MSG_RESULT([${has_environ}])
- ])
-
-if test "${has_environ}" != "yes" ; then
- AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
-fi
-
-AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
-
-# set default gcc warnings
-GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security"
-if test "${gcc_wextra}" = yes; then
- GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
- GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
- GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
- GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
-fi
-if test "${gcc_werror}" = yes; then
- GCC_WARNINGS="${GCC_WARNINGS} -Werror"
-fi
-
-# overide default gcc cflags
-if test $gcc_warnings = yes; then
- CFLAGS="$CFLAGS $GCC_WARNINGS"
-fi
-
-# Setup for compiling build tools
-AC_MSG_CHECKING([for a C compiler for build tools])
-if test $cross_compiling = yes; then
- AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
- CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
-else
- CC_FOR_BUILD=$CC
- CFLAGS_FOR_BUILD=$CFLAGS
-fi
-
-AC_MSG_RESULT([$CC_FOR_BUILD])
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-
-AC_MSG_CHECKING([for suffix of executable build tools])
-if test $cross_compiling = yes; then
- cat >conftest.c <<\_______EOF
-int main ()
-{
- exit (0);
-}
-_______EOF
- for i in .exe ""; do
- compile="$CC_FOR_BUILD conftest.c -o conftest$i"
- if AC_TRY_EVAL(compile); then
- if (./conftest) 2>&AC_FD_CC; then
- EXEEXT_FOR_BUILD=$i
- break
- fi
- fi
- done
- rm -f conftest*
- if test "${EXEEXT_FOR_BUILD+set}" != set; then
- AC_MSG_ERROR([Cannot determine suffix of executable build tools])
- fi
-else
- EXEEXT_FOR_BUILD=$EXEEXT
-fi
-AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
-AC_SUBST(EXEEXT_FOR_BUILD)
-
-AC_OUTPUT(dnl
- Makefile dnl
- src/Makefile dnl
- src/helper/Makefile dnl
- src/jtag/Makefile dnl
- src/xsvf/Makefile dnl
- src/svf/Makefile dnl
- src/target/Makefile dnl
- src/server/Makefile dnl
- src/flash/Makefile dnl
- src/pld/Makefile dnl
- doc/Makefile dnl
- )
+AC_PREREQ(2.60)
+AC_INIT([openocd], [0.2.0-in-development],
+ [OpenOCD Mailing List <ope...@li...>])
+AC_CONFIG_SRCDIR([src/openocd.c])
+
+AM_INIT_AUTOMAKE([-Wall -Wno-portability])
+AM_MAINTAINER_MODE
+
+AM_CONFIG_HEADER(config.h)
+AH_BOTTOM([
+#include "system.h"
+#include "replacements.h"
+])
+
+AC_LANG_C
+AC_PROG_CC
+AC_PROG_CC_C99
+AM_PROG_CC_C_O
+AC_PROG_RANLIB
+
+dnl disable checks for C++, Fortran and GNU Java Compiler
+m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
+m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
+m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
+AC_DISABLE_SHARED
+AC_PROG_LIBTOOL
+
+
+dnl configure checks required for Jim files (these are obsolete w/ C99)
+AC_C_CONST
+AC_TYPE_LONG_LONG_INT
+
+
+AC_SEARCH_LIBS([ioperm], [ioperm])
+AC_SEARCH_LIBS([dlopen], [dl])
+
+AC_CHECK_HEADERS(arpa/inet.h)
+AC_CHECK_HEADERS(elf.h)
+AC_CHECK_HEADERS(dirent.h)
+AC_CHECK_HEADERS(fcntl.h)
+AC_CHECK_HEADERS(ifaddrs.h)
+AC_CHECK_HEADERS(malloc.h)
+AC_CHECK_HEADERS(netdb.h)
+AC_CHECK_HEADERS(netinet/in.h)
+AC_CHECK_HEADERS(netinet/tcp.h)
+AC_CHECK_HEADERS(pthread.h)
+AC_CHECK_HEADERS(strings.h)
+AC_CHECK_HEADERS(sys/ioctl.h)
+AC_CHECK_HEADERS(sys/param.h)
+AC_CHECK_HEADERS(sys/poll.h)
+AC_CHECK_HEADERS(sys/select.h)
+AC_CHECK_HEADERS(sys/socket.h)
+AC_CHECK_HEADERS(sys/stat.h)
+AC_CHECK_HEADERS(sys/time.h)
+AC_CHECK_HEADERS(sys/types.h)
+AC_CHECK_HEADERS(unistd.h)
+
+AC_CHECK_HEADERS([net/if.h], [], [], [dnl
+#include <stdio.h>
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+])
+
+AC_HEADER_ASSERT
+AC_HEADER_STDBOOL
+AC_HEADER_TIME
+
+AC_C_BIGENDIAN
+
+AC_CHECK_FUNCS(strndup)
+AC_CHECK_FUNCS(strnlen)
+AC_CHECK_FUNCS(gettimeofday)
+AC_CHECK_FUNCS(usleep)
+AC_CHECK_FUNCS(vasprintf)
+
+build_bitbang=no
+build_bitq=no
+is_cygwin=no
+is_mingw=no
+is_win32=no
+is_darwin=no
+build_release=yes
+
+AC_ARG_ENABLE(release,
+ AS_HELP_STRING([--enable-release], [Enable Release Build, default no]),
+ [build_release=$enableval], [build_release=no])
+
+if test $cross_compiling = no; then
+ if test $build_release = no; then
+ # check we can find guess-rev.sh
+ AC_CHECK_FILE("$srcdir/guess-rev.sh", build_release=no, build_release=yes)
+ fi
+fi
+
+# We are not *ALWAYS* being installed in the standard place.
+# We may be installed in a "tool-build" specific location.
+# Normally with other packages - as part of a tool distro.
+# Thus - we should search that 'libdir' also.
+#
+# And - if we are being installed there - the odds are
+# The libraries unique to what we are are there too.
+#
+
+# Expand nd deal with NONE - just like configure will do later
+OCDprefix=$prefix
+OCDxprefix=$exec_prefix
+test x"$OCDprefix" = xNONE && OCDprefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test x"$OCDxprefix" = xNONE && OCDxprefix="$OCDprefix"
+
+# what matters is the "exec-prefix"
+if test "$OCDxprefix" != "$ac_default_prefix"
+then
+ # We are installing in a non-standard place
+ # Nonstandard --prefix and/or --exec-prefix
+ # We have an override of some sort.
+ # use build specific install library dir
+
+ LDFLAGS="$LDFLAGS -L$OCDxprefix/lib"
+ # RPATH becomes an issue on Linux only
+ if test $host_os = linux-gnu || test $host_os = linux ; then
+ LDFLAGS="$LDFLAGS -Wl,-rpath,$OCDxprefix/lib"
+ fi
+ # The "INCDIR" is also usable
+ CFLAGS="$CFLAGS -I$includedir"
+fi
+
+AC_ARG_WITH(ftd2xx,
+ AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
+ [
+# Option Given.
+cat << __EOF__
+
+The option: --with-ftd2xx=<PATH> has been removed.
+On Linux, the new option is:
+
+ --with-ftd2xx-linux-tardir=/path/to/files
+
+Where <path> is the path the the directory where the "tar.gz" file
+from FTDICHIP.COM was unpacked, for example:
+
+ --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
+
+On Cygwin/MingW32, the new option is:
+
+ --with-ftd2xx-win32-zipdir=/path/to/files
+
+Where <path> is the path to the directory where the "zip" file from
+FTDICHIP.COM was unpacked, for example:
+
+ --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
+
+__EOF__
+
+ AC_MSG_ERROR([Sorry Cannot continue])
+ ], [true])
+
+#========================================
+# FTD2XXX support comes in 4 forms.
+# (1) win32 - via a zip file
+# (2) linux - via a tar file
+# (3) linux/cygwin/mingw - via libftdi
+# (4) darwin - installed under /usr/local
+#
+# In case (1) and (2) we need to know where the package was unpacked.
+
+AC_ARG_WITH(ftd2xx-win32-zipdir,
+ AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
+ [
+ # option present
+ if test -d $with_ftd2xx_win32_zipdir
+ then
+ with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
+ AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
+ else
+ AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
+ fi
+ ], [true])
+
+AC_ARG_WITH(ftd2xx-linux-tardir,
+ AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
+ [
+ # Option present
+ if test $is_win32 = yes ; then
+ AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
+ fi
+ if test -d $with_ftd2xx_linux_tardir
+ then
+ with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
+ AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
+ else
+ AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
+ fi
+ ], [true])
+
+AC_ARG_WITH(ftd2xx-lib,
+ AS_HELP_STRING([--with-ftd2xx-lib],
+ [Use static or shared ftd2xx libs on default static]),
+ [
+ case "$withval" in
+ static)
+ with_ftd2xx_lib=$withval
+ ;;
+ shared)
+ with_ftd2xx_lib=$withval
+ ;;
+ *)
+ AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
+ ;;
+ esac
+ ], [
+ # Default is static - it is simpler :-(
+ with_ftd2xx_lib=static
+ ])
+
+AC_ARG_ENABLE(gccwarnings,
+ AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
+ [gcc_warnings=$enableval], [gcc_warnings=yes])
+
+AC_ARG_ENABLE(wextra,
+ AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
+ [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
+
+AC_ARG_ENABLE(werror,
+ AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
+ [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
+
+# set default verbose options, overridden by following options
+debug_jtag_io=no
+debug_usb_io=no
+debug_usb_comms=no
+
+AC_ARG_ENABLE(verbose,
+ AS_HELP_STRING([--enable-verbose],
+ [Enable verbose JTAG I/O messages (for debugging).]),
+ [
+ debug_jtag_io=$enableval
+ debug_usb_io=$enableval
+ debug_usb_comms=$enableval
+ ], [])
+
+AC_ARG_ENABLE(verbose_jtag_io,
+ AS_HELP_STRING([--enable-verbose-jtag-io],
+ [Enable verbose JTAG I/O messages (for debugging).]),
+ [debug_jtag_io=$enableval], [])
+AC_ARG_ENABLE(verbose_usb_io,
+ AS_HELP_STRING([--enable-verbose-usb-io],
+ [Enable verbose USB I/O messages (for debugging)]),
+ [debug_usb_io=$enableval], [])
+AC_ARG_ENABLE(verbose_usb_comms,
+ AS_HELP_STRING([--enable-verbose-usb-comms],
+ [Enable verbose USB communication messages (for debugging)]),
+ [debug_usb_comms=$enableval], [])
+
+AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
+AC_MSG_RESULT($debug_jtag_io)
+if test $debug_jtag_io = yes; then
+ AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
+fi
+
+AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
+AC_MSG_RESULT($debug_usb_io)
+if test $debug_usb_io = yes; then
+ AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
+fi
+
+AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
+AC_MSG_RESULT($debug_usb_comms)
+if test $debug_usb_comms = yes; then
+ AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
+fi
+
+
+debug_malloc=no
+AC_ARG_ENABLE(malloc_logging,
+ AS_HELP_STRING([--enable-malloc-logging],
+ [Include free space in logging messages (requires malloc.h).]),
+ [debug_malloc=$enableval], [])
+
+AC_MSG_CHECKING([whether to enable malloc free space logging]);
+AC_MSG_RESULT($debug_malloc)
+if test $debug_malloc = yes; then
+ AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
+fi
+
+
+AC_ARG_ENABLE(dummy,
+ AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
+ [build_dummy=$enableval], [build_dummy=no])
+
+AC_ARG_ENABLE(parport,
+ AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
+ [build_parport=$enableval], [build_parport=no])
+
+AC_ARG_ENABLE(parport_ppdev,
+ AS_HELP_STRING([--disable-parport-ppdev],
+ [Disable use of ppdev (/dev/parportN) for parport (for x86 only)]),
+ [parport_use_ppdev=$enableval], [parport_use_ppdev=])
+
+AC_ARG_ENABLE(parport_giveio,
+ AS_HELP_STRING([--enable-parport-giveio],
+ [Enable use of giveio for parport (for CygWin only)]),
+ [parport_use_giveio=$enableval], [parport_use_giveio=])
+
+AC_ARG_ENABLE(ft2232_libftdi,
+ AS_HELP_STRING([--enable-ft2232_libftdi], [Enable building support for FT2232 based devices using the libftdi driver, opensource alternate of FTD2XX]),
+ [build_ft2232_libftdi=$enableval], [build_ft2232_libftdi=no])
+
+AC_ARG_ENABLE(ft2232_ftd2xx,
+ AS_HELP_STRING([--enable-ft2232_ftd2xx], [Enable building support for FT2232 based devices using the FTD2XX driver from ftdichip.com]),
+ [build_ft2232_ftd2xx=$enableval], [build_ft2232_ftd2xx=no])
+
+AC_ARG_ENABLE(ftd2xx_highspeed,
+ AS_HELP_STRING([--enable-ftd2xx-highspeed], [Enable building support for FT2232H and FT4232H-based devices (requires >=libftd2xx-0.4.16)]),
+ [want_ftd2xx_highspeed=$enableval], [want_ftd2xx_highspeed=maybe])
+
+AC_ARG_ENABLE(amtjtagaccel,
+ AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
+ [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
+
+AC_ARG_ENABLE(ecosboard,
+ AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCosBoard based JTAG debugger]),
+ [build_ecosboard=$enableval], [build_ecosboard=no])
+
+AC_ARG_ENABLE(ioutil,
+ AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]),
+ [build_ioutil=$enableval], [build_ioutil=no])
+
+AC_ARG_ENABLE(httpd,
+ AS_HELP_STRING([--enable-httpd], [Enable builtin httpd server - useful for standalone OpenOCD implementations]),
+ [build_httpd=$enableval], [build_httpd=no])
+
+case "${host_cpu}" in
+ arm*)
+ AC_ARG_ENABLE(ep93xx,
+ AS_HELP_STRING([--enable-ep93xx], [Enable building support for EP93xx based SBCs]),
+ [build_ep93xx=$enableval], [build_ep93xx=no])
+
+ AC_ARG_ENABLE(at91rm9200,
+ AS_HELP_STRING([--enable-at91rm9200], [Enable building support for AT91RM9200 based SBCs]),
+ [build_at91rm9200=$enableval], [build_at91rm9200=no])
+ ;;
+
+ *)
+ build_ep93xx=no
+ build_at91rm9200=no
+ ;;
+esac
+
+AC_ARG_ENABLE(gw16012,
+ AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
+ [build_gw16012=$enableval], [build_gw16012=no])
+
+AC_ARG_ENABLE(presto_libftdi,
+ AS_HELP_STRING([--enable-presto_libftdi], [Enable building support for ASIX Presto Programmer using the libftdi driver]),
+ [build_presto_libftdi=$enableval], [build_presto_libftdi=no])
+
+AC_ARG_ENABLE(presto_ftd2xx,
+ AS_HELP_STRING([--enable-presto_ftd2xx], [Enable building support for ASIX Presto Programmer using the FTD2XX driver]),
+ [build_presto_ftd2xx=$enableval], [build_presto_ftd2xx=no])
+
+AC_ARG_ENABLE(usbprog,
+ AS_HELP_STRING([--enable-usbprog], [Enable building support for the usbprog JTAG Programmer]),
+ [build_usbprog=$enableval], [build_usbprog=no])
+
+AC_ARG_ENABLE(oocd_trace,
+ AS_HELP_STRING([--enable-oocd_trace], [Enable building support for the OpenOCD+trace ETM capture device]),
+ [build_oocd_trace=$enableval], [build_oocd_trace=no])
+
+AC_ARG_ENABLE(jlink,
+ AS_HELP_STRING([--enable-jlink], [Enable building support for the Segger J-Link JTAG Programmer]),
+ [build_jlink=$enableval], [build_jlink=no])
+
+AC_ARG_ENABLE(vsllink,
+ AS_HELP_STRING([--enable-vsllink], [Enable building support for the Versaloon-Link JTAG Programmer]),
+ [build_vsllink=$enableval], [build_vsllink=no])
+
+AC_ARG_ENABLE(rlink,
+ AS_HELP_STRING([--enable-rlink], [Enable building support for the Raisonance RLink JTAG Programmer]),
+ [build_rlink=$enableval], [build_rlink=no])
+
+AC_ARG_ENABLE(arm-jtag-ew,
+ AS_HELP_STRING([--enable-arm-jtag-ew], [Enable building support for the Olimex ARM-JTAG-EW Programmer]),
+ [build_armjtagew=$enableval], [build_armjtagew=no])
+
+AC_ARG_ENABLE(minidriver_dummy,
+ AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
+ [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
+
+
+build_minidriver=no
+AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
+if test $build_ecosboard = yes; then
+ if test $build_minidriver = yes; then
+ AC_MSG_ERROR([Multiple minidriver options have been enabled.])
+ fi
+ AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
+ [Define to 1 if you have the <jtag_minidriver.h> header file.])
+ build_minidriver=yes
+fi
+AC_MSG_RESULT($build_ecosboard)
+
+
+AC_MSG_CHECKING([whether to enable dummy minidriver])
+if test $build_minidriver_dummy = yes; then
+ if test $build_minidriver = yes; then
+ AC_MSG_ERROR([Multiple minidriver options have been enabled.])
+ fi
+ build_minidriver=yes
+ AC_DEFINE(BUILD_MINIDRIVER_DUMMY, 1, [Use the dummy minidriver.])
+ AC_DEFINE(HAVE_JTAG_MINIDRIVER_H, 1,
+ [Define to 1 if you have the <jtag_minidriver.h> header file.])
+fi
+AC_MSG_RESULT($build_minidriver_dummy)
+
+AC_MSG_CHECKING([whether standard drivers can be built])
+if test "$build_minidriver" = yes; then
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([Using the minidriver disables all other drivers.])
+ sleep 2
+else
+ AC_MSG_RESULT([yes])
+fi
+
+case "${host_cpu}" in
+ i?86|x86*)
+ ;;
+ *)
+ if test x$parport_use_ppdev = xno; then
+ AC_MSG_WARN([--disable-parport-ppdev is not supported by the host CPU])
+ fi
+ parport_use_ppdev=yes
+ ;;
+esac
+
+case $host in
+ *-cygwin*)
+ is_win32=yes
+
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([],[return __MINGW32__;]),
+ [is_mingw=yes],[is_mingw=no])
+ if test $is_mingw = yes; then
+ AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
+ if test x$parport_use_giveio = xno; then
+ AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
+ fi
+ parport_use_giveio=yes
+ is_cygwin=no
+ else
+ is_cygwin=yes
+ AC_DEFINE(IS_CYGWIN, 1, [1 if building for Cygwin.])
+ fi
+
+ AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
+ AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
+ ;;
+ *-mingw*)
+ is_mingw=yes
+ is_win32=yes
+
+ if test x$parport_use_giveio = xno; then
+ AC_MSG_WARN([--disable-parport-giveio is not supported by MinGW32 hosts])
+ fi
+ parport_use_giveio=yes
+
+ AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.])
+ AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.])
+ AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
+ ;;
+ *darwin*)
+ is_darwin=yes
+
+ if test x$parport_use_giveio = xyes; then
+ AC_MSG_WARN([--enable-parport-giveio cannot be used by Darwin hosts])
+ fi
+ parport_use_giveio=no
+
+ AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
+ AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
+ AC_DEFINE(IS_DARWIN, 1, [1 if building for Darwin.])
+ ;;
+ *)
+ if test x$parport_use_giveio = xyes; then
+ AC_MSG_WARN([--enable-parport-giveio cannot be used by ]$host[ hosts])
+ fi
+ parport_use_giveio=no
+ AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.])
+ AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.])
+ AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.])
+ ;;
+esac
+
+if test $build_parport = yes; then
+ build_bitbang=yes
+ AC_DEFINE(BUILD_PARPORT, 1, [1 if you want parport.])
+else
+ AC_DEFINE(BUILD_PARPORT, 0, [0 if you don't want parport.])
+fi
+
+if test $build_dummy = yes; then
+ build_bitbang=yes
+ AC_DEFINE(BUILD_DUMMY, 1, [1 if you want dummy driver.])
+else
+ AC_DEFINE(BUILD_DUMMY, 0, [0 if you don't want dummy driver.])
+fi
+
+if test $build_ep93xx = yes; then
+ build_bitbang=yes
+ AC_DEFINE(BUILD_EP93XX, 1, [1 if you want ep93xx.])
+else
+ AC_DEFINE(BUILD_EP93XX, 0, [0 if you don't want ep93xx.])
+fi
+
+if test $build_ecosboard = yes; then
+ AC_DEFINE(BUILD_ECOSBOARD, 1, [1 if you want eCosBoard.])
+else
+ AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.])
+fi
+
+if test $build_ioutil = yes; then
+ AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.])
+else
+ AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.])
+fi
+
+if test $build_httpd = yes; then
+ AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.])
+else
+ AC_DEFINE(BUILD_HTTPD, 0, [0 if you don't want httpd.])
+fi
+
+if test $build_at91rm9200 = yes; then
+ build_bitbang=yes
+ AC_DEFINE(BUILD_AT91RM9200, 1, [1 if you want at91rm9200.])
+else
+ AC_DEFINE(BUILD_AT91RM9200, 0, [0 if you don't want at91rm9200.])
+fi
+
+if test x$parport_use_ppdev = xyes; then
+ AC_DEFINE(PARPORT_USE_PPDEV, 1, [1 if you want parport to use ppdev.])
+else
+ AC_DEFINE(PARPORT_USE_PPDEV, 0, [0 if you don't want parport to use ppdev.])
+fi
+
+if test x$parport_use_giveio = xyes; then
+ AC_DEFINE(PARPORT_USE_GIVEIO, 1, [1 if you want parport to use giveio.])
+else
+ AC_DEFINE(PARPORT_USE_GIVEIO, 0, [0 if you don't want parport to use giveio.])
+fi
+
+if test $build_bitbang = yes; then
+ AC_DEFINE(BUILD_BITBANG, 1, [1 if you want a bitbang interface.])
+else
+ AC_DEFINE(BUILD_BITBANG, 0, [0 if you don't want a bitbang interface.])
+fi
+
+if test $build_ft2232_libftdi = yes; then
+ AC_DEFINE(BUILD_FT2232_LIBFTDI, 1, [1 if you want libftdi ft2232.])
+else
+ AC_DEFINE(BUILD_FT2232_LIBFTDI, 0, [0 if you don't want libftdi ft2232.])
+fi
+
+if test $build_ft2232_ftd2xx = yes; then
+ AC_DEFINE(BUILD_FT2232_FTD2XX, 1, [1 if you want ftd2xx ft2232.])
+else
+ AC_DEFINE(BUILD_FT2232_FTD2XX, 0, [0 if you don't want ftd2xx ft2232.])
+fi
+
+if test $build_amtjtagaccel = yes; then
+ AC_DEFINE(BUILD_AMTJTAGACCEL, 1, [1 if you want the Amontec JTAG-Accelerator driver.])
+else
+ AC_DEFINE(BUILD_AMTJTAGACCEL, 0, [0 if you don't want the Amontec JTAG-Accelerator driver.])
+fi
+
+if test $build_gw16012 = yes; then
+ AC_DEFINE(BUILD_GW16012, 1, [1 if you want the Gateworks GW16012 driver.])
+else
+ AC_DEFINE(BUILD_GW16012, 0, [0 if you don't want the Gateworks GW16012 driver.])
+fi
+
+if test $build_presto_libftdi = yes; then
+ build_bitq=yes
+ AC_DEFINE(BUILD_PRESTO_LIBFTDI, 1, [1 if you want the ASIX PRESTO driver using libftdi.])
+else
+ AC_DEFINE(BUILD_PRESTO_LIBFTDI, 0, [0 if you don't want the ASIX PRESTO driver using libftdi.])
+fi
+
+if test $build_presto_ftd2xx = yes; then
+ build_bitq=yes
+ AC_DEFINE(BUILD_PRESTO_FTD2XX, 1, [1 if you want the ASIX PRESTO driver using FTD2XX.])
+else
+ AC_DEFINE(BUILD_PRESTO_FTD2XX, 0, [0 if you don't want the ASIX PRESTO driver using FTD2XX.])
+fi
+
+if test $build_bitq = yes; then
+ AC_DEFINE(BUILD_BITQ, 1, [1 if you want a bitq interface.])
+else
+ AC_DEFINE(BUILD_BITQ, 0, [0 if you don't want a bitq interface.])
+fi
+
+if test $build_usbprog = yes; then
+ AC_DEFINE(BUILD_USBPROG, 1, [1 if you want the usbprog JTAG driver.])
+else
+ AC_DEFINE(BUILD_USBPROG, 0, [0 if you don't want the usbprog JTAG driver.])
+fi
+
+if test $build_oocd_trace = yes; then
+ AC_DEFINE(BUILD_OOCD_TRACE, 1, [1 if you want the OpenOCD+trace ETM capture driver.])
+else
+ AC_DEFINE(BUILD_OOCD_TRACE, 0, [0 if you don't want the OpenOCD+trace ETM capture driver.])
+fi
+
+if test $build_jlink = yes; then
+ AC_DEFINE(BUILD_JLINK, 1, [1 if you want the J-Link JTAG driver.])
+else
+ AC_DEFINE(BUILD_JLINK, 0, [0 if you don't want the J-Link JTAG driver.])
+fi
+
+if test $build_vsllink = yes; then
+ AC_DEFINE(BUILD_VSLLINK, 1, [1 if you want the Versaloon-Link JTAG driver.])
+else
+ AC_DEFINE(BUILD_VSLLINK, 0, [0 if you don't want the Versaloon-Link JTAG driver.])
+fi
+
+if test $build_rlink = yes; then
+ AC_DEFINE(BUILD_RLINK, 1, [1 if you want the RLink JTAG driver.])
+else
+ AC_DEFINE(BUILD_RLINK, 0, [0 if you don't want the RLink JTAG driver.])
+fi
+
+if test $build_armjtagew = yes; then
+ AC_DEFINE(BUILD_ARMJTAGEW, 1, [1 if you want the ARM-JTAG-EW JTAG driver.])
+else
+ AC_DEFINE(BUILD_ARMJTAGEW, 0, [0 if you don't want the ARM-JTAG-EW JTAG driver.])
+fi
+
+#-- Deal with MingW/Cygwin FTD2XX issues
+
+if test $is_win32 = yes; then
+if test "${with_ftd2xx_linux_tardir+set}" = set
+then
+ AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
+fi
+
+if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
+ AC_MSG_CHECKING([for ftd2xx.lib exists (win32)])
+
+ # if we are given a zipdir...
+ if test "${with_ftd2xx_win32_zipdir+set}" = set
+ then
+ # Set the CFLAGS for "ftd2xx.h"
+ f=$with_ftd2xx_win32_zipdir/ftd2xx.h
+ if test ! -f $f ; then
+ AC_MSG_ERROR([File: $f cannot be found])
+ fi
+ CFLAGS="$CFLAGS -I$with_ftd2xx_win32_zipdir"
+
+ # And calculate the LDFLAGS for the machine
+ case "$host_cpu" in
+ i?86|x86_*)
+ LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/i386"
+ LIBS="$LIBS -lftd2xx"
+ f=$with_ftd2xx_win32_zipdir/i386/ftd2xx.lib
+ ;;
+ amd64)
+ LDFLAGS="$LDFLAGS -L$with_ftd2xx_win32_zipdir/amd64"
+ LIBS="$LIBS -lftd2xx"
+ f=$with_ftd2xx_win32_zipdir/amd64/ftd2xx.lib
+ ;;
+ *)
+ AC_MSG_ERROR([Unknown Win32 host cpu: $host_cpu])
+ ;;
+ esac
+ if test ! -f $f ; then
+ AC_MSG_ERROR([Library: $f not found])
+ fi
+ else
+ LIBS="$LIBS -lftd2xx"
+ AC_MSG_WARN([ASSUMPTION: The (win32) FTDICHIP.COM files: ftd2xx.h and ftd2xx.lib are in a proper place])
+ fi
+fi
+fi # win32
+
+if test $is_darwin = yes ; then
+if test "${with_ftd2xx_win32_zipdir+set}" = set
+then
+ AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
+fi
+if test "${with_ftd2xx_linux_tardir+set}" = set
+then
+ AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.])
+fi
+
+if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
+ AC_MSG_CHECKING([for libftd2xx.a (darwin)])
+
+ if test ! -f /usr/local/include/ftd2xx.h ; then
+ AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h])
+ fi
+
+ CFLAGS="$CFLAGS -I/usr/local/include"
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+ LIBS="$LIBS -lftd2xx"
+ AC_MSG_RESULT([-L/usr/local/lib -lftd2xx])
+fi
+fi # darwin
+
+if test $is_win32 = no && test $is_darwin = no ; then
+
+if test "${with_ftd2xx_win32_zipdir+set}" = set
+then
+ AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only])
+fi
+
+if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes ; then
+ # Must be linux
+ if test $host_os != linux-gnu && test $host_os != linux ; then
+ AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead])
+ fi
+ # Are we given a TAR directory?
+ if test "${with_ftd2xx_linux_tardir+set}" = set
+ then
+ AC_MSG_CHECKING([uninstalled ftd2xx distribution])
+ # The .H file is simple..
+ FTD2XX_H=$with_ftd2xx_linux_tardir/ftd2xx.h
+ if test ! -f "${FTD2XX_H}"; then
+ AC_MSG_ERROR([Option: --with-ftd2xx-linux-tardir appears wrong, cannot find: ${FTD2XX_H}])
+ fi
+ CFLAGS="$CFLAGS -I$with_ftd2xx_linux_tardir"
+ FTD2XX_LDFLAGS="-L$with_ftd2xx_linux_tardir"
+ FTD2XX_LIB="-lftd2xx"
+ if test $with_ftd2xx_lib != shared; then
+ # Test #1 - Future proof - if/when ftdichip fixes their distro.
+ # Try it with the simple ".a" suffix.
+ FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a"
+ if test -f "${FTD2XX_LIB}"; then
+ FTD2XX_LDFLAGS="${FTD2XX_LDFLAGS}/static_lib"
+ else
+ # Test Number2.
+ # Grr.. perhaps it exists as a version number?
+ FTD2XX_LIB="$with_ftd2xx_linux_tardir/static_lib/libftd2xx.a.*.*.*"
+ count=`ls ${FTD2XX_LIB} | wc -l`
+ if test $count -gt 1 ; then
+ AC_MSG_ERROR([Multiple libftd2xx.a files found in: $with_ftd2xx_linux_tardir/static_lib sorry cannot handle this yet])
+ fi
+ if test $count -ne 1 ; then
+ AC_MSG_ERROR([Not found: $f, option: --with-ftd2xx-linux-tardir appears to be wrong])
+ fi
+ # Because the "-l" rules do not understand version numbers...
+ # we will just stuff the absolute path onto the LIBS variable
+ FTD2XX_LIB="`ls ${FTD2XX_LIB}` -lpthread"
+ FTD2XX_LDFLAGS=""
+ fi
+ fi
+ LDFLAGS="${LDFLAGS} ${FTD2XX_LDFLAGS}"
+ LIBS="${LIBS} ${FTD2XX_LIB}"
+ AC_MSG_RESULT([${FTD2XX_LDFLAGS} ${FTD2XX_LIB}])
+ else
+ AC_CHECK_HEADER([ftd2xx.h],[],[
+ AC_MSG_ERROR([You seem to be missing the FTD2xx driver header file.])
+ ])
+ AC_SEARCH_LIBS([FT_GetLibraryVersion],[ftd2xx],,[
+ AC_MSG_ERROR([You appear to be missing the FTD2xx driver library.])
+ ],[])
+ fi
+fi
+fi # linux
+
+if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes; then
+
+# Before we go any further - make sure we can *BUILD* and *RUN*
+# a simple app with the "ftd2xx.lib" file - in what ever form we where given
+# We should be able to compile, link and run this test program now
+AC_MSG_CHECKING([whether ftd2xx library works])
+
+#
+# Save the LDFLAGS for later..
+LDFLAGS_SAVE=$LDFLAGS
+CFLAGS_SAVE=$CFLAGS
+_LDFLAGS=`eval echo $LDFLAGS`
+_CFLAGS=`eval echo $CFLAGS`
+LDFLAGS=$_LDFLAGS
+CFLAGS=$_CFLAGS
+
+AC_RUN_IFELSE([
+#include "confdefs.h"
+#if IS_WIN32
+#include "windows.h"
+#endif
+#include <stdio.h>
+#include <ftd2xx.h>
+
+int
+main( int argc, char **argv )
+{
+ DWORD x;
+ FT_GetLibraryVersion( &x );
+ return 0;
+}
+ ], [
+ AC_MSG_RESULT([Success!])
+ ], [
+ AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
+ ] )
+
+AC_MSG_CHECKING([whether to build ftd2xx device support])
+AC_MSG_RESULT([$want_ftd2xx_highspeed])
+if test $want_ftd2xx_highspeed != no; then
+ AC_MSG_CHECKING([for ftd2xx highspeed device support])
+ AC_COMPILE_IFELSE([
+#include "confdefs.h"
+#if IS_WIN32
+#include "windows.h"
+#endif
+#include <stdio.h>
+#include <ftd2xx.h>
+DWORD x = FT_DEVICE_4232H;
+ ], [
+ AC_DEFINE(BUILD_FTD2XX_HIGHSPEED, [1],
+ [Support FT2232H/FT4232HS with FTD2XX.])
+ build_ftd2xx_highspe...
[truncated message content] |
|
From: oharboe at B. <oh...@ma...> - 2009-06-09 08:53:30
|
Author: oharboe Date: 2009-06-09 08:53:26 +0200 (Tue, 09 Jun 2009) New Revision: 2153 Modified: trunk/guess-rev.sh Log: removed native line end style - breaks cygwin Property changes on: trunk/guess-rev.sh ___________________________________________________________________ Name: svn:eol-style - native |
|
From: <zw...@ma...> - 2009-06-09 06:54:18
|
Author: zwelch
Date: 2009-06-09 06:54:09 +0200 (Tue, 09 Jun 2009)
New Revision: 2152
Modified:
trunk/src/jtag/core.c
trunk/src/target/arm11_dbgtap.c
Log:
Replace 'jtag.c' with 'core.c' in code comments.
Modified: trunk/src/jtag/core.c
===================================================================
--- trunk/src/jtag/core.c 2009-06-09 04:39:54 UTC (rev 2151)
+++ trunk/src/jtag/core.c 2009-06-09 04:54:09 UTC (rev 2152)
@@ -46,7 +46,7 @@
static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
int in_num_fields, scan_field_t *in_fields, tap_state_t state);
-/* note that this is not marked as static as it must be available from outside jtag.c for those
+/* note that this is not marked as static as it must be available from outside core.c for those
that implement the jtag_xxx() minidriver layer
*/
int jtag_error=ERROR_OK;
Modified: trunk/src/target/arm11_dbgtap.c
===================================================================
--- trunk/src/target/arm11_dbgtap.c 2009-06-09 04:39:54 UTC (rev 2151)
+++ trunk/src/target/arm11_dbgtap.c 2009-06-09 04:54:09 UTC (rev 2152)
@@ -124,7 +124,7 @@
*/
static void arm11_in_handler_SCAN_N(u8 *in_value)
{
- /** \todo TODO: clarify why this isnt properly masked in jtag.c jtag_read_buffer() */
+ /** \todo TODO: clarify why this isnt properly masked in core.c jtag_read_buffer() */
u8 v = *in_value & 0x1F;
if (v != 0x10)
|
|
From: <zw...@ma...> - 2009-06-09 06:40:13
|
Author: zwelch Date: 2009-06-09 06:39:54 +0200 (Tue, 09 Jun 2009) New Revision: 2151 Modified: trunk/src/jtag/core.c trunk/src/jtag/tcl.c Log: Remove accidental duplicate of hasKHz; fixes pre-init speed setup. Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-09 04:35:16 UTC (rev 2150) +++ trunk/src/jtag/core.c 2009-06-09 04:39:54 UTC (rev 2151) @@ -93,7 +93,7 @@ /* speed in kHz*/ static int speed_khz = 0; /* flag if the kHz speed was defined */ -static bool hasKHz = false; +bool hasKHz = false; struct jtag_interface_s *jtag = NULL; Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-09 04:35:16 UTC (rev 2150) +++ trunk/src/jtag/tcl.c 2009-06-09 04:39:54 UTC (rev 2151) @@ -39,8 +39,7 @@ #include <strings.h> #endif -/* flag if the kHz speed was defined */ -static bool hasKHz = false; +extern bool hasKHz; /* jtag interfaces (parport, FTDI-USB, TI-USB, ...) */ |
|
From: <zw...@ma...> - 2009-06-09 06:35:29
|
Author: zwelch Date: 2009-06-09 06:35:16 +0200 (Tue, 09 Jun 2009) New Revision: 2150 Modified: trunk/doc/manual/jtag.txt Log: Provide brief description of newly factored TCL layer in The Manual. Modified: trunk/doc/manual/jtag.txt =================================================================== --- trunk/doc/manual/jtag.txt 2009-06-09 04:15:13 UTC (rev 2149) +++ trunk/doc/manual/jtag.txt 2009-06-09 04:35:16 UTC (rev 2150) @@ -14,6 +14,11 @@ - declared in @c src/jtag/jtag.h - used by other modules +- @subpage jtagtcl + - @b private TCL handling routines + - defined in @c src/jtag/tcl.c + - registers and handles Jim commands that configure and use the JTAG core + - @subpage jtagcmd - @b private command queue API - declared in @c src/jtag/commands.h @@ -43,6 +48,12 @@ */ +/** @page jtagtcl JTAG TCL API + +This section needs to be expanded. + + */ + /** @page jtagcmd JTAG Command API This section needs to be expanded. |
|
From: <zw...@ma...> - 2009-06-09 06:15:21
|
Author: zwelch
Date: 2009-06-09 06:15:13 +0200 (Tue, 09 Jun 2009)
New Revision: 2149
Added:
trunk/src/jtag/core.c
trunk/src/jtag/tcl.c
Removed:
trunk/src/jtag/jtag.c
Modified:
trunk/src/jtag/Makefile.am
Log:
Split main jtag.c file into two layers:
- src/jtag/core.c: contains the low-level JTAG TAP and scanning routines.
- src/jtag/tcl.c: contains high-level JTAG TCL commands that use the core.
- Remove static keywords from routines in core.c, extern from tcl.c:
- jtag, jtag_interface global variables
- jtag_{examine,validate}_chain and jtag_tap_{init,free} functions
- Added myself to the copyright header in both of these files.
- Used 'svn cp' to add files, so versioning was preserved for both.
Modified: trunk/src/jtag/Makefile.am
===================================================================
--- trunk/src/jtag/Makefile.am 2009-06-09 02:48:28 UTC (rev 2148)
+++ trunk/src/jtag/Makefile.am 2009-06-09 04:15:13 UTC (rev 2149)
@@ -124,7 +124,8 @@
endif
libjtag_la_SOURCES = \
- jtag.c \
+ core.c \
+ tcl.c \
interface.c \
$(DRIVERFILES) \
$(BITBANGFILES) \
Copied: trunk/src/jtag/core.c (from rev 2148, trunk/src/jtag/jtag.c)
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-09 02:48:28 UTC (rev 2148)
+++ trunk/src/jtag/core.c 2009-06-09 04:15:13 UTC (rev 2149)
@@ -0,0 +1,1268 @@
+/***************************************************************************
+ * Copyright (C) 2005 by Dominic Rath *
+ * Dom...@gm... *
+ * *
+ * Copyright (C) 2007,2008 vind Harboe *
+ * oyv...@zy... *
+ * *
+ * Copyright (C) 2009 SoftPLC Corporation *
+ * http://softplc.com *
+ * di...@so... *
+ * *
+ * Copyright (C) 2009 Zachary T Welch *
+ * zw...@su... *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "jtag.h"
+#include "minidriver.h"
+#include "interface.h"
+
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+
+/// The number of JTAG queue flushes (for profiling and debugging purposes).
+static int jtag_flush_queue_count;
+
+static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
+ int in_num_fields, scan_field_t *in_fields, tap_state_t state);
+
+/* note that this is not marked as static as it must be available from outside jtag.c for those
+ that implement the jtag_xxx() minidriver layer
+*/
+int jtag_error=ERROR_OK;
+
+char* jtag_event_strings[] =
+{
+ "JTAG controller reset (RESET or TRST)"
+};
+
+const Jim_Nvp nvp_jtag_tap_event[] = {
+ { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
+ { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
+
+ { .name = NULL, .value = -1 }
+};
+
+int jtag_trst = 0;
+int jtag_srst = 0;
+
+/**
+ * List all TAPs that have been created.
+ */
+static jtag_tap_t *__jtag_all_taps = NULL;
+/**
+ * The number of TAPs in the __jtag_all_taps list, used to track the
+ * assigned chain position to new TAPs
+ */
+static unsigned jtag_num_taps = 0;
+
+enum reset_types jtag_reset_config = RESET_NONE;
+tap_state_t cmd_queue_end_state = TAP_RESET;
+tap_state_t cmd_queue_cur_state = TAP_RESET;
+
+int jtag_verify_capture_ir = 1;
+int jtag_verify = 1;
+
+/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
+static int jtag_nsrst_delay = 0; /* default to no nSRST delay */
+static int jtag_ntrst_delay = 0; /* default to no nTRST delay */
+
+/* callbacks to inform high-level handlers about JTAG state changes */
+jtag_event_callback_t *jtag_event_callbacks;
+
+/* speed in kHz*/
+static int speed_khz = 0;
+/* flag if the kHz speed was defined */
+static bool hasKHz = false;
+
+struct jtag_interface_s *jtag = NULL;
+
+/* configuration */
+jtag_interface_t *jtag_interface = NULL;
+int jtag_speed = 0;
+
+jtag_tap_t *jtag_all_taps(void)
+{
+ return __jtag_all_taps;
+};
+
+unsigned jtag_tap_count(void)
+{
+ return jtag_num_taps;
+}
+
+unsigned jtag_tap_count_enabled(void)
+{
+ jtag_tap_t *t = jtag_all_taps();
+ unsigned n = 0;
+ while(t)
+ {
+ if (t->enabled)
+ n++;
+ t = t->next_tap;
+ }
+ return n;
+}
+
+/// Append a new TAP to the chain of all taps.
+void jtag_tap_add(struct jtag_tap_s *t)
+{
+ t->abs_chain_position = jtag_num_taps++;
+
+ jtag_tap_t **tap = &__jtag_all_taps;
+ while(*tap != NULL)
+ tap = &(*tap)->next_tap;
+ *tap = t;
+}
+
+jtag_tap_t *jtag_tap_by_string(const char *s)
+{
+ /* try by name first */
+ jtag_tap_t *t = jtag_all_taps();
+ while (t)
+ {
+ if (0 == strcmp(t->dotted_name, s))
+ return t;
+ t = t->next_tap;
+ }
+
+ /* no tap found by name, so try to parse the name as a number */
+ char *cp;
+ unsigned n = strtoul(s, &cp, 0);
+ if ((s == cp) || (*cp != 0))
+ return NULL;
+
+ return jtag_tap_by_position(n);
+}
+
+jtag_tap_t *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
+{
+ const char *cp = Jim_GetString(o, NULL);
+ jtag_tap_t *t = cp ? jtag_tap_by_string(cp) : NULL;
+ if (NULL == cp)
+ cp = "(unknown)";
+ if (NULL == t)
+ Jim_SetResult_sprintf(interp, "Tap '%s' could not be found", cp);
+ return t;
+}
+
+/* returns a pointer to the n-th device in the scan chain */
+jtag_tap_t *jtag_tap_by_position(unsigned n)
+{
+ jtag_tap_t *t = jtag_all_taps();
+
+ while (t && n-- > 0)
+ t = t->next_tap;
+
+ return t;
+}
+
+const char *jtag_tap_name(const jtag_tap_t *tap)
+{
+ return (tap == NULL) ? "(unknown)" : tap->dotted_name;
+}
+
+
+int jtag_register_event_callback(int (*callback)(enum jtag_event event, void *priv), void *priv)
+{
+ jtag_event_callback_t **callbacks_p = &jtag_event_callbacks;
+
+ if (callback == NULL)
+ {
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ if (*callbacks_p)
+ {
+ while ((*callbacks_p)->next)
+ callbacks_p = &((*callbacks_p)->next);
+ callbacks_p = &((*callbacks_p)->next);
+ }
+
+ (*callbacks_p) = malloc(sizeof(jtag_event_callback_t));
+ (*callbacks_p)->callback = callback;
+ (*callbacks_p)->priv = priv;
+ (*callbacks_p)->next = NULL;
+
+ return ERROR_OK;
+}
+
+int jtag_unregister_event_callback(int (*callback)(enum jtag_event event, void *priv))
+{
+ jtag_event_callback_t **callbacks_p = &jtag_event_callbacks;
+
+ if (callback == NULL)
+ {
+ return ERROR_INVALID_ARGUMENTS;
+ }
+
+ while (*callbacks_p)
+ {
+ jtag_event_callback_t **next = &((*callbacks_p)->next);
+ if ((*callbacks_p)->callback == callback)
+ {
+ free(*callbacks_p);
+ *callbacks_p = *next;
+ }
+ callbacks_p = next;
+ }
+
+ return ERROR_OK;
+}
+
+int jtag_call_event_callbacks(enum jtag_event event)
+{
+ jtag_event_callback_t *callback = jtag_event_callbacks;
+
+ LOG_DEBUG("jtag event: %s", jtag_event_strings[event]);
+
+ while (callback)
+ {
+ callback->callback(event, callback->priv);
+ callback = callback->next;
+ }
+
+ return ERROR_OK;
+}
+
+static void jtag_checks(void)
+{
+ assert(jtag_trst == 0);
+}
+
+static void jtag_prelude(tap_state_t state)
+{
+ jtag_checks();
+
+ assert(state!=TAP_INVALID);
+
+ cmd_queue_cur_state = state;
+}
+
+void jtag_alloc_in_value32(scan_field_t *field)
+{
+ interface_jtag_alloc_in_value32(field);
+}
+
+void jtag_add_ir_scan_noverify(int in_count, const scan_field_t *in_fields,
+ tap_state_t state)
+{
+ jtag_prelude(state);
+
+ int retval = interface_jtag_add_ir_scan(in_count, in_fields, state);
+ jtag_set_error(retval);
+}
+
+
+void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+{
+ if (jtag_verify&&jtag_verify_capture_ir)
+ {
+ /* 8 x 32 bit id's is enough for all invocations */
+
+ for (int j = 0; j < in_num_fields; j++)
+ {
+ /* if we are to run a verification of the ir scan, we need to get the input back.
+ * We may have to allocate space if the caller didn't ask for the input back.
+ */
+ in_fields[j].check_value=in_fields[j].tap->expected;
+ in_fields[j].check_mask=in_fields[j].tap->expected_mask;
+ }
+ jtag_add_scan_check(jtag_add_ir_scan_noverify, in_num_fields, in_fields, state);
+ } else
+ {
+ jtag_add_ir_scan_noverify(in_num_fields, in_fields, state);
+ }
+}
+
+void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields,
+ tap_state_t state)
+{
+ jtag_prelude(state);
+
+ int retval = interface_jtag_add_plain_ir_scan(
+ in_num_fields, in_fields, state);
+ jtag_set_error(retval);
+}
+
+void jtag_add_callback(jtag_callback1_t f, u8 *in)
+{
+ interface_jtag_add_callback(f, in);
+}
+
+void jtag_add_callback4(jtag_callback_t f, u8 *in,
+ jtag_callback_data_t data1, jtag_callback_data_t data2,
+ jtag_callback_data_t data3)
+{
+ interface_jtag_add_callback4(f, in, data1, data2, data3);
+}
+
+int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits);
+
+static int jtag_check_value_mask_callback(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
+{
+ return jtag_check_value_inner(in, (u8 *)data1, (u8 *)data2, (int)data3);
+}
+
+static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
+ int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+{
+ for (int i = 0; i < in_num_fields; i++)
+ {
+ struct scan_field_s *field = &in_fields[i];
+ field->allocated = 0;
+ field->modified = 0;
+ if (field->check_value || field->in_value)
+ continue;
+ interface_jtag_add_scan_check_alloc(field);
+ field->modified = 1;
+ }
+
+ jtag_add_scan(in_num_fields, in_fields, state);
+
+ for (int i = 0; i < in_num_fields; i++)
+ {
+ if ((in_fields[i].check_value != NULL) && (in_fields[i].in_value != NULL))
+ {
+ /* this is synchronous for a minidriver */
+ jtag_add_callback4(jtag_check_value_mask_callback, in_fields[i].in_value,
+ (jtag_callback_data_t)in_fields[i].check_value,
+ (jtag_callback_data_t)in_fields[i].check_mask,
+ (jtag_callback_data_t)in_fields[i].num_bits);
+ }
+ if (in_fields[i].allocated)
+ {
+ free(in_fields[i].in_value);
+ }
+ if (in_fields[i].modified)
+ {
+ in_fields[i].in_value = NULL;
+ }
+ }
+}
+
+void jtag_add_dr_scan_check(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
+{
+ if (jtag_verify)
+ {
+ jtag_add_scan_check(jtag_add_dr_scan, in_num_fields, in_fields, state);
+ } else
+ {
+ jtag_add_dr_scan(in_num_fields, in_fields, state);
+ }
+}
+
+
+void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields,
+ tap_state_t state)
+{
+ jtag_prelude(state);
+
+ int retval;
+ retval = interface_jtag_add_dr_scan(in_num_fields, in_fields, state);
+ jtag_set_error(retval);
+}
+
+void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields,
+ tap_state_t state)
+{
+ jtag_prelude(state);
+
+ int retval;
+ retval = interface_jtag_add_plain_dr_scan(in_num_fields, in_fields, state);
+ jtag_set_error(retval);
+}
+
+void jtag_add_dr_out(jtag_tap_t* tap,
+ int num_fields, const int* num_bits, const u32* value,
+ tap_state_t end_state)
+{
+ 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);
+ jtag_set_error(interface_jtag_add_tlr());
+ jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
+}
+
+void jtag_add_pathmove(int num_states, const tap_state_t *path)
+{
+ tap_state_t cur_state = cmd_queue_cur_state;
+
+ /* the last state has to be a stable state */
+ if (!tap_is_state_stable(path[num_states - 1]))
+ {
+ LOG_ERROR("BUG: TAP path doesn't finish in a stable state");
+ jtag_set_error(ERROR_JTAG_NOT_STABLE_STATE);
+ return;
+ }
+
+ for (int i = 0; i < num_states; i++)
+ {
+ if (path[i] == TAP_RESET)
+ {
+ LOG_ERROR("BUG: TAP_RESET is not a valid state for pathmove sequences");
+ jtag_set_error(ERROR_JTAG_STATE_INVALID);
+ return;
+ }
+
+ if ( tap_state_transition(cur_state, true) != path[i]
+ && tap_state_transition(cur_state, false) != path[i])
+ {
+ LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition",
+ tap_state_name(cur_state), tap_state_name(path[i]));
+ jtag_set_error(ERROR_JTAG_TRANSITION_INVALID);
+ return;
+ }
+ cur_state = path[i];
+ }
+
+ jtag_checks();
+
+ jtag_set_error(interface_jtag_add_pathmove(num_states, path));
+ cmd_queue_cur_state = path[num_states - 1];
+}
+
+void jtag_add_runtest(int num_cycles, tap_state_t state)
+{
+ jtag_prelude(state);
+ jtag_set_error(interface_jtag_add_runtest(num_cycles, state));
+}
+
+
+void jtag_add_clocks(int num_cycles)
+{
+ if (!tap_is_state_stable(cmd_queue_cur_state))
+ {
+ LOG_ERROR("jtag_add_clocks() called with TAP in unstable state \"%s\"",
+ tap_state_name(cmd_queue_cur_state));
+ jtag_set_error(ERROR_JTAG_NOT_STABLE_STATE);
+ return;
+ }
+
+ if (num_cycles > 0)
+ {
+ jtag_checks();
+ jtag_set_error(interface_jtag_add_clocks(num_cycles));
+ }
+}
+
+void jtag_add_reset(int req_tlr_or_trst, int req_srst)
+{
+ int trst_with_tlr = 0;
+
+ /* FIX!!! there are *many* different cases here. A better
+ * approach is needed for legal combinations of transitions...
+ */
+ if ((jtag_reset_config & RESET_HAS_SRST)&&
+ (jtag_reset_config & RESET_HAS_TRST)&&
+ ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0))
+ {
+ if (((req_tlr_or_trst&&!jtag_trst)||
+ (!req_tlr_or_trst&&jtag_trst))&&
+ ((req_srst&&!jtag_srst)||
+ (!req_srst&&jtag_srst)))
+ {
+ /* FIX!!! srst_pulls_trst allows 1,1 => 0,0 transition.... */
+ //LOG_ERROR("BUG: transition of req_tlr_or_trst and req_srst in the same jtag_add_reset() call is undefined");
+ }
+ }
+
+ /* Make sure that jtag_reset_config allows the requested reset */
+ /* if SRST pulls TRST, we can't fulfill srst == 1 with trst == 0 */
+ if (((jtag_reset_config & RESET_SRST_PULLS_TRST) && (req_srst == 1)) && (!req_tlr_or_trst))
+ {
+ LOG_ERROR("BUG: requested reset would assert trst");
+ jtag_set_error(ERROR_FAIL);
+ return;
+ }
+
+ /* if TRST pulls SRST, we reset with TAP T-L-R */
+ if (((jtag_reset_config & RESET_TRST_PULLS_SRST) && (req_tlr_or_trst)) && (req_srst == 0))
+ {
+ trst_with_tlr = 1;
+ }
+
+ if (req_srst && !(jtag_reset_config & RESET_HAS_SRST))
+ {
+ LOG_ERROR("BUG: requested SRST assertion, but the current configuration doesn't support this");
+ jtag_set_error(ERROR_FAIL);
+ return;
+ }
+
+ if (req_tlr_or_trst)
+ {
+ if (!trst_with_tlr && (jtag_reset_config & RESET_HAS_TRST))
+ {
+ jtag_trst = 1;
+ } else
+ {
+ trst_with_tlr = 1;
+ }
+ } else
+ {
+ jtag_trst = 0;
+ }
+
+ jtag_srst = req_srst;
+
+ int retval = interface_jtag_add_reset(jtag_trst, jtag_srst);
+ if (retval != ERROR_OK)
+ {
+ jtag_set_error(retval);
+ return;
+ }
+ jtag_execute_queue();
+
+ if (jtag_srst)
+ {
+ LOG_DEBUG("SRST line asserted");
+ }
+ else
+ {
+ LOG_DEBUG("SRST line released");
+ if (jtag_nsrst_delay)
+ jtag_add_sleep(jtag_nsrst_delay * 1000);
+ }
+
+ if (trst_with_tlr)
+ {
+ LOG_DEBUG("JTAG reset with RESET instead of TRST");
+ jtag_set_end_state(TAP_RESET);
+ jtag_add_tlr();
+ return;
+ }
+
+ if (jtag_trst)
+ {
+ /* we just asserted nTRST, so we're now in Test-Logic-Reset,
+ * and inform possible listeners about this
+ */
+ LOG_DEBUG("TRST line asserted");
+ tap_set_state(TAP_RESET);
+ jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
+ }
+ else
+ {
+ if (jtag_ntrst_delay)
+ jtag_add_sleep(jtag_ntrst_delay * 1000);
+ }
+}
+
+tap_state_t jtag_set_end_state(tap_state_t state)
+{
+ if ((state == TAP_DRSHIFT)||(state == TAP_IRSHIFT))
+ {
+ LOG_ERROR("BUG: TAP_DRSHIFT/IRSHIFT can't be end state. Calling code should use a larger scan field");
+ }
+
+ if (state!=TAP_INVALID)
+ cmd_queue_end_state = state;
+ return cmd_queue_end_state;
+}
+
+tap_state_t jtag_get_end_state(void)
+{
+ return cmd_queue_end_state;
+}
+
+void jtag_add_sleep(u32 us)
+{
+ /// @todo Here, keep_alive() appears to be a layering violation!!!
+ keep_alive();
+ jtag_set_error(interface_jtag_add_sleep(us));
+}
+
+int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits)
+{
+ int retval = ERROR_OK;
+
+ int compare_failed = 0;
+
+ if (in_check_mask)
+ compare_failed = buf_cmp_mask(captured, in_check_value, in_check_mask, num_bits);
+ else
+ compare_failed = buf_cmp(captured, in_check_value, num_bits);
+
+ if (compare_failed){
+ /* An error handler could have caught the failing check
+ * only report a problem when there wasn't a handler, or if the handler
+ * acknowledged the error
+ */
+ /*
+ LOG_WARNING("TAP %s:",
+ jtag_tap_name(field->tap));
+ */
+ if (compare_failed)
+ {
+ char *captured_char = buf_to_str(captured, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16);
+ char *in_check_value_char = buf_to_str(in_check_value, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16);
+
+ if (in_check_mask)
+ {
+ char *in_check_mask_char;
+ in_check_mask_char = buf_to_str(in_check_mask, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16);
+ LOG_WARNING("value captured during scan didn't pass the requested check:");
+ LOG_WARNING("captured: 0x%s check_value: 0x%s check_mask: 0x%s",
+ captured_char, in_check_value_char, in_check_mask_char);
+ free(in_check_mask_char);
+ }
+ else
+ {
+ LOG_WARNING("value captured during scan didn't pass the requested check: captured: 0x%s check_value: 0x%s", captured_char, in_check_value_char);
+ }
+
+ free(captured_char);
+ free(in_check_value_char);
+
+ retval = ERROR_JTAG_QUEUE_FAILED;
+ }
+
+ }
+ return retval;
+}
+
+void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask)
+{
+ assert(field->in_value != NULL);
+
+ if (value==NULL)
+ {
+ /* no checking to do */
+ return;
+ }
+
+ jtag_execute_queue_noclear();
+
+ int retval=jtag_check_value_inner(field->in_value, value, mask, field->num_bits);
+ jtag_set_error(retval);
+}
+
+
+
+int default_interface_jtag_execute_queue(void)
+{
+ if (NULL == jtag)
+ {
+ LOG_ERROR("No JTAG interface configured yet. "
+ "Issue 'init' command in startup scripts "
+ "before communicating with targets.");
+ return ERROR_FAIL;
+ }
+
+ return jtag->execute_queue();
+}
+
+void jtag_execute_queue_noclear(void)
+{
+ jtag_flush_queue_count++;
+ jtag_set_error(interface_jtag_execute_queue());
+}
+
+int jtag_get_flush_queue_count(void)
+{
+ return jtag_flush_queue_count;
+}
+
+int jtag_execute_queue(void)
+{
+ jtag_execute_queue_noclear();
+ return jtag_error_clear();
+}
+
+static int jtag_reset_callback(enum jtag_event event, void *priv)
+{
+ jtag_tap_t *tap = priv;
+
+ LOG_DEBUG("-");
+
+ if (event == JTAG_TRST_ASSERTED)
+ {
+ buf_set_ones(tap->cur_instr, tap->ir_length);
+ tap->bypass = 1;
+ }
+
+ return ERROR_OK;
+}
+
+void jtag_sleep(u32 us)
+{
+ alive_sleep(us/1000);
+}
+
+/// maximum number of JTAG devices expected in the chain
+#define JTAG_MAX_CHAIN_SIZE 20
+
+#define EXTRACT_MFG(X) (((X) & 0xffe) >> 1)
+#define EXTRACT_PART(X) (((X) & 0xffff000) >> 12)
+#define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28)
+
+static int jtag_examine_chain_execute(u8 *idcode_buffer, unsigned num_idcode)
+{
+ scan_field_t field = {
+ .tap = NULL,
+ .num_bits = num_idcode * 32,
+ .out_value = idcode_buffer,
+ .in_value = idcode_buffer,
+ };
+
+ // initialize to the end of chain ID value
+ for (unsigned i = 0; i < JTAG_MAX_CHAIN_SIZE; i++)
+ buf_set_u32(idcode_buffer, i * 32, 32, 0x000000FF);
+
+ jtag_add_plain_dr_scan(1, &field, TAP_RESET);
+ return jtag_execute_queue();
+}
+
+static bool jtag_examine_chain_check(u8 *idcodes, unsigned count)
+{
+ u8 zero_check = 0x0;
+ u8 one_check = 0xff;
+
+ for (unsigned i = 0; i < count * 4; i++)
+ {
+ zero_check |= idcodes[i];
+ one_check &= idcodes[i];
+ }
+
+ /* if there wasn't a single non-zero bit or if all bits were one,
+ * the scan is not valid */
+ if (zero_check == 0x00 || one_check == 0xff)
+ {
+ LOG_ERROR("JTAG communication failure: check connection, "
+ "JTAG interface, target power etc.");
+ return false;
+ }
+ return true;
+}
+
+static void jtag_examine_chain_display(enum log_levels level, const char *msg,
+ const char *name, u32 idcode)
+{
+ log_printf_lf(level, __FILE__, __LINE__, __FUNCTION__,
+ "JTAG tap: %s %16.16s: 0x%08x "
+ "(mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
+ name, msg, idcode,
+ EXTRACT_MFG(idcode), EXTRACT_PART(idcode), EXTRACT_VER(idcode) );
+}
+
+static bool jtag_idcode_is_final(u32 idcode)
+{
+ return idcode == 0x000000FF || idcode == 0xFFFFFFFF;
+}
+
+/**
+ * This helper checks that remaining bits in the examined chain data are
+ * all as expected, but a single JTAG device requires only 64 bits to be
+ * read back correctly. This can help identify and diagnose problems
+ * with the JTAG chain earlier, gives more helpful/explicit error messages.
+ */
+static void jtag_examine_chain_end(u8 *idcodes, unsigned count, unsigned max)
+{
+ bool triggered = false;
+ for ( ; count < max - 31; count += 32)
+ {
+ u32 idcode = buf_get_u32(idcodes, count, 32);
+ // do not trigger the warning if the data looks good
+ if (!triggered && jtag_idcode_is_final(idcode))
+ continue;
+ LOG_WARNING("Unexpected idcode after end of chain: %d 0x%08x",
+ count, idcode);
+ triggered = true;
+ }
+}
+
+static bool jtag_examine_chain_match_tap(const struct jtag_tap_s *tap)
+{
+ if (0 == tap->expected_ids_cnt)
+ {
+ /// @todo Enable LOG_INFO to ask for reports about unknown TAP IDs.
+#if 0
+ LOG_INFO("Uknown JTAG TAP ID: 0x%08x", tap->idcode)
+ LOG_INFO("Please report the chip name and reported ID code to the openocd project");
+#endif
+ return true;
+ }
+
+ /* Loop over the expected identification codes and test for a match */
+ u8 ii;
+ for (ii = 0; ii < tap->expected_ids_cnt; ii++)
+ {
+ if (tap->idcode == tap->expected_ids[ii])
+ break;
+ }
+
+ /* If none of the expected ids matched, log an error */
+ if (ii != tap->expected_ids_cnt)
+ {
+ LOG_INFO("JTAG Tap/device matched");
+ return true;
+ }
+ jtag_examine_chain_display(LOG_LVL_ERROR, "got",
+ tap->dotted_name, tap->idcode);
+ for (ii = 0; ii < tap->expected_ids_cnt; ii++)
+ {
+ char msg[32];
+ snprintf(msg, sizeof(msg), "expected %hhu of %hhu",
+ ii + 1, tap->expected_ids_cnt);
+ jtag_examine_chain_display(LOG_LVL_ERROR, msg,
+ tap->dotted_name, tap->expected_ids[ii]);
+ }
+ return false;
+}
+
+/* Try to examine chain layout according to IEEE 1149.1 §12
+ */
+int jtag_examine_chain(void)
+{
+ u8 idcode_buffer[JTAG_MAX_CHAIN_SIZE * 4];
+ unsigned device_count = 0;
+
+ jtag_examine_chain_execute(idcode_buffer, JTAG_MAX_CHAIN_SIZE);
+
+ if (!jtag_examine_chain_check(idcode_buffer, JTAG_MAX_CHAIN_SIZE))
+ return ERROR_JTAG_INIT_FAILED;
+
+ /* point at the 1st tap */
+ jtag_tap_t *tap = jtag_tap_next_enabled(NULL);
+ if (tap == NULL)
+ {
+ LOG_ERROR("JTAG: No taps enabled?");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ for (unsigned bit_count = 0; bit_count < (JTAG_MAX_CHAIN_SIZE * 32) - 31;)
+ {
+ u32 idcode = buf_get_u32(idcode_buffer, bit_count, 32);
+ if ((idcode & 1) == 0)
+ {
+ /* LSB must not be 0, this indicates a device in bypass */
+ LOG_WARNING("Tap/Device does not have IDCODE");
+ idcode = 0;
+
+ bit_count += 1;
+ }
+ else
+ {
+ /*
+ * End of chain (invalid manufacturer ID) some devices, such
+ * as AVR will output all 1's instead of TDI input value at
+ * end of chain.
+ */
+ if (jtag_idcode_is_final(idcode))
+ {
+ jtag_examine_chain_end(idcode_buffer,
+ bit_count + 32, JTAG_MAX_CHAIN_SIZE * 32);
+ break;
+ }
+
+ jtag_examine_chain_display(LOG_LVL_INFO, "tap/device found",
+ tap ? tap->dotted_name : "(not-named)",
+ idcode);
+
+ bit_count += 32;
+ }
+ device_count++;
+ if (!tap)
+ continue;
+
+ tap->idcode = idcode;
+
+ // ensure the TAP ID does matches what was expected
+ if (!jtag_examine_chain_match_tap(tap))
+ return ERROR_JTAG_INIT_FAILED;
+
+ tap = jtag_tap_next_enabled(tap);
+ }
+
+ /* see if number of discovered devices matches configuration */
+ if (device_count != jtag_tap_count_enabled())
+ {
+ LOG_ERROR("number of discovered devices in JTAG chain (%i) "
+ "does not match (enabled) configuration (%i), total taps: %d",
+ device_count, jtag_tap_count_enabled(), jtag_tap_count());
+ LOG_ERROR("check the config file and ensure proper JTAG communication"
+ " (connections, speed, ...)");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ return ERROR_OK;
+}
+
+int jtag_validate_chain(void)
+{
+ jtag_tap_t *tap;
+ int total_ir_length = 0;
+ u8 *ir_test = NULL;
+ scan_field_t field;
+ int chain_pos = 0;
+
+ tap = NULL;
+ total_ir_length = 0;
+ for(;;){
+ tap = jtag_tap_next_enabled(tap);
+ if( tap == NULL ){
+ break;
+ }
+ total_ir_length += tap->ir_length;
+ }
+
+ total_ir_length += 2;
+ ir_test = malloc(CEIL(total_ir_length, 8));
+ buf_set_ones(ir_test, total_ir_length);
+
+ field.tap = NULL;
+ field.num_bits = total_ir_length;
+ field.out_value = ir_test;
+ field.in_value = ir_test;
+
+
+ jtag_add_plain_ir_scan(1, &field, TAP_RESET);
+ jtag_execute_queue();
+
+ tap = NULL;
+ chain_pos = 0;
+ int val;
+ for(;;){
+ tap = jtag_tap_next_enabled(tap);
+ if( tap == NULL ){
+ break;
+ }
+
+ val = buf_get_u32(ir_test, chain_pos, 2);
+ if (val != 0x1)
+ {
+ char *cbuf = buf_to_str(ir_test, total_ir_length, 16);
+ LOG_ERROR("Could not validate JTAG scan chain, IR mismatch, scan returned 0x%s. tap=%s pos=%d expected 0x1 got %0x", cbuf, jtag_tap_name(tap), chain_pos, val);
+ free(cbuf);
+ free(ir_test);
+ return ERROR_JTAG_INIT_FAILED;
+ }
+ chain_pos += tap->ir_length;
+ }
+
+ val = buf_get_u32(ir_test, chain_pos, 2);
+ if (val != 0x3)
+ {
+ char *cbuf = buf_to_str(ir_test, total_ir_length, 16);
+ LOG_ERROR("Could not validate end of JTAG scan chain, IR mismatch, scan returned 0x%s. pos=%d expected 0x3 got %0x", cbuf, chain_pos, val);
+ free(cbuf);
+ free(ir_test);
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ free(ir_test);
+
+ return ERROR_OK;
+}
+
+
+void jtag_tap_init(jtag_tap_t *tap)
+{
+ assert(0 != tap->ir_length);
+
+ tap->expected = malloc(tap->ir_length);
+ tap->expected_mask = malloc(tap->ir_length);
+ tap->cur_instr = malloc(tap->ir_length);
+
+ buf_set_u32(tap->expected, 0, tap->ir_length, tap->ir_capture_value);
+ buf_set_u32(tap->expected_mask, 0, tap->ir_length, tap->ir_capture_mask);
+ buf_set_ones(tap->cur_instr, tap->ir_length);
+
+ // place TAP in bypass mode
+ tap->bypass = 1;
+ // register the reset callback for the TAP
+ jtag_register_event_callback(&jtag_reset_callback, tap);
+
+ LOG_DEBUG("Created Tap: %s @ abs position %d, "
+ "irlen %d, capture: 0x%x mask: 0x%x", tap->dotted_name,
+ tap->abs_chain_position, tap->ir_length,
+ tap->ir_capture_value, tap->ir_capture_mask);
+ jtag_tap_add(tap);
+}
+
+void jtag_tap_free(jtag_tap_t *tap)
+{
+ /// @todo is anything missing? no memory leaks please
+ free((void *)tap->expected_ids);
+ free((void *)tap->chip);
+ free((void *)tap->tapname);
+ free((void *)tap->dotted_name);
+ free(tap);
+}
+
+int jtag_interface_init(struct command_context_s *cmd_ctx)
+{
+ if (jtag)
+ return ERROR_OK;
+
+ if (!jtag_interface)
+ {
+ /* nothing was previously specified by "interface" command */
+ LOG_ERROR("JTAG interface has to be specified, see \"interface\" command");
+ return ERROR_JTAG_INVALID_INTERFACE;
+ }
+ if(hasKHz)
+ {
+ jtag_interface->khz(jtag_get_speed_khz(), &jtag_speed);
+ hasKHz = false;
+ }
+
+ if (jtag_interface->init() != ERROR_OK)
+ return ERROR_JTAG_INIT_FAILED;
+
+ jtag = jtag_interface;
+ return ERROR_OK;
+}
+
+static int jtag_init_inner(struct command_context_s *cmd_ctx)
+{
+ jtag_tap_t *tap;
+ int retval;
+
+ LOG_DEBUG("Init JTAG chain");
+
+ tap = jtag_tap_next_enabled(NULL);
+ if( tap == NULL ){
+ LOG_ERROR("There are no enabled taps?");
+ return ERROR_JTAG_INIT_FAILED;
+ }
+
+ jtag_add_tlr();
+ if ((retval=jtag_execute_queue())!=ERROR_OK)
+ return retval;
+
+ /* examine chain first, as this could discover the real chain layout */
+ if (jtag_examine_chain() != ERROR_OK)
+ {
+ LOG_ERROR("trying to validate configured JTAG chain anyway...");
+ }
+
+ if (jtag_validate_chain() != ERROR_OK)
+ {
+ LOG_WARNING("Could not validate JTAG chain, continuing anyway...");
+ }
+
+ return ERROR_OK;
+}
+
+int jtag_interface_quit(void)
+{
+ if (!jtag || !jtag->quit)
+ return ERROR_OK;
+
+ // close the JTAG interface
+ int result = jtag->quit();
+ if (ERROR_OK != result)
+ LOG_ERROR("failed: %d", result);
+
+ return ERROR_OK;
+}
+
+
+int jtag_init_reset(struct command_context_s *cmd_ctx)
+{
+ int retval;
+
+ if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
+ return retval;
+
+ LOG_DEBUG("Trying to bring the JTAG controller to life by asserting TRST / RESET");
+
+ /* Reset can happen after a power cycle.
+ *
+ * Ideally we would only assert TRST or run RESET before the target reset.
+ *
+ * However w/srst_pulls_trst, trst is asserted together with the target
+ * reset whether we want it or not.
+ *
+ * NB! Some targets have JTAG circuitry disabled until a
+ * trst & srst has been asserted.
+ *
+ * NB! here we assume nsrst/ntrst delay are sufficient!
+ *
+ * NB! order matters!!!! srst *can* disconnect JTAG circuitry
+ *
+ */
+ jtag_add_reset(1, 0); /* RESET or TRST */
+ if (jtag_reset_config & RESET_HAS_SRST)
+ {
+ jtag_add_reset(1, 1);
+ if ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0)
+ jtag_add_reset(0, 1);
+ }
+ jtag_add_reset(0, 0);
+ if ((retval = jtag_execute_queue()) != ERROR_OK)
+ return retval;
+
+ /* Check that we can communication on the JTAG chain + eventually we want to
+ * be able to perform enumeration only after OpenOCD has started
+ * telnet and GDB server
+ *
+ * That would allow users to more easily perform any magic they need to before
+ * reset happens.
+ */
+ return jtag_init_inner(cmd_ctx);
+}
+
+int jtag_init(struct command_context_s *cmd_ctx)
+{
+ int retval;
+ if ((retval=jtag_interface_init(cmd_ctx)) != ERROR_OK)
+ return retval;
+ if (jtag_init_inner(cmd_ctx)==ERROR_OK)
+ {
+ return ERROR_OK;
+ }
+ return jtag_init_reset(cmd_ctx);
+}
+
+void jtag_set_speed_khz(unsigned khz)
+{
+ speed_khz = khz;
+}
+unsigned jtag_get_speed_khz(void)
+{
+ return speed_khz;
+}
+
+void jtag_set_verify(bool enable)
+{
+ jtag_verify = enable;
+}
+
+bool jtag_will_verify()
+{
+ return jtag_verify;
+}
+
+
+int jtag_power_dropout(int *dropout)
+{
+ return jtag->power_dropout(dropout);
+}
+
+int jtag_srst_asserted(int *srst_asserted)
+{
+ return jtag->srst_asserted(srst_asserted);
+}
+
+void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e)
+{
+ jtag_tap_event_action_t * jteap;
+ int done;
+
+ jteap = tap->event_action;
+
+ done = 0;
+ while (jteap) {
+ if (jteap->event == e) {
+ done = 1;
+ LOG_DEBUG( "JTAG tap: %s event: %d (%s) action: %s\n",
+ tap->dotted_name,
+ e,
+ Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name,
+ Jim_GetString(jteap->body, NULL) );
+ if (Jim_EvalObj(interp, jteap->body) != JIM_OK) {
+ Jim_PrintErrorMessage(interp);
+ }
+ }
+
+ jteap = jteap->next;
+ }
+
+ if (!done) {
+ LOG_DEBUG( "event %d %s - no action",
+ e,
+ Jim_Nvp_value2name_simple( nvp_jtag_tap_event, e)->name);
+ }
+}
+
+int jtag_add_statemove(tap_state_t goal_state)
+{
+ tap_state_t cur_state = cmd_queue_cur_state;
+
+ LOG_DEBUG( "cur_state=%s goal_state=%s",
+ tap_state_name(cur_state),
+ tap_state_name(goal_state) );
+
+
+ if (goal_state==cur_state )
+ ; /* nothing to do */
+ else if( goal_state==TAP_RESET )
+ {
+ jtag_add_tlr();
+ }
+ else if( tap_is_state_stable(cur_state) && tap_is_state_stable(goal_state) )
+ {
+ unsigned tms_bits = tap_get_tms_path(cur_state, goal_state);
+ unsigned tms_count = tap_get_tms_path_len(cur_state, goal_state);
+ tap_state_t moves[8];
+ assert(tms_count < DIM(moves));
+
+ for (unsigned i = 0; i < tms_count; i++, tms_bits >>= 1)
+ {
+ bool bit = tms_bits & 1;
+
+ cur_state = tap_state_transition(cur_state, bit);
+ moves[i] = cur_state;
+ }
+
+ jtag_add_pathmove(tms_count, moves);
+ }
+ else if( tap_state_transition(cur_state, true) == goal_state
+ || tap_state_transition(cur_state, false) == goal_state )
+ {
+ jtag_add_pathmove(1, &goal_state);
+ }
+
+ else
+ return ERROR_FAIL;
+
+ return ERROR_OK;
+}
+
+void jtag_set_nsrst_delay(unsigned delay)
+{
+ jtag_nsrst_delay = delay;
+}
+unsigned jtag_get_nsrst_delay(void)
+{
+ return jtag_nsrst_delay;
+}
+void jtag_set_ntrst_delay(unsigned delay)
+{
+ jtag_ntrst_delay = delay;
+}
+unsigned jtag_get_ntrst_delay(void)
+{
+ return jtag_ntrst_delay;
+}
Deleted: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-09 02:48:28 UTC (rev 2148)
+++ trunk/src/jtag/jtag.c 2009-06-09 04:15:13 UTC (rev 2149)
@@ -1,2585 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2005 by Dominic Rath *
- * Dom...@gm... *
- * *
- * Copyright (C) 2007,2008 vind Harboe *
- * oyv...@zy... *
- * *
- * Copyright (C) 2009 SoftPLC Corporation *
- * http://softplc.com *
- * di...@so... *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "jtag.h"
-#include "minidriver.h"
-#include "interface.h"
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-
-/// The number of JTAG queue flushes (for profiling and debugging purposes).
-static int jtag_flush_queue_count;
-
-static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
- int in_num_fields, scan_field_t *in_fields, tap_state_t state);
-
-/* note that this is not marked as static as it must be available from outside jtag.c for those
- that implement the jtag_xxx() minidriver layer
-*/
-int jtag_error=ERROR_OK;
-
-char* jtag_event_strings[] =
-{
- "JTAG controller reset (RESET or TRST)"
-};
-
-const Jim_Nvp nvp_jtag_tap_event[] = {
- { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
- { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
-
- { .name = NULL, .value = -1 }
-};
-
-int jtag_trst = 0;
-int jtag_srst = 0;
-
-/**
- * List all TAPs that have been created.
- */
-static jtag_tap_t *__jtag_all_taps = NULL;
-/**
- * The number of TAPs in the __jtag_all_taps list, used to track the
- * assigned chain position to new TAPs
- */
-static unsigned jtag_num_taps = 0;
-
-enum reset_types jtag_reset_config = RESET_NONE;
-tap_state_t cmd_queue_end_state = TAP_RESET;
-tap_state_t cmd_queue_cur_state = TAP_RESET;
-
-int jtag_verify_capture_ir = 1;
-int jtag_verify = 1;
-
-/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
-static int jtag_nsrst_delay = 0; /* default to no nSRST delay */
-static int jtag_ntrst_delay = 0; /* default to no nTRST delay */
-
-/* callbacks to inform high-level handlers about JTAG state changes */
-jtag_event_callback_t *jtag_event_callbacks;
-
-/* speed in kHz*/
-static int speed_khz = 0;
-/* flag if the kHz speed was defined */
-static bool hasKHz = false;
-
-/* jtag interfaces (parport, FTDI-USB, TI-USB, ...)
- */
-
-#if BUILD_ECOSBOARD == 1
- extern jtag_interface_t zy1000_interface;
-#elif defined(BUILD_MINIDRIVER_DUMMY)
- extern jtag_interface_t minidummy_interface;
-#else // standard drivers
-#if BUILD_PARPORT == 1
- extern jtag_interface_t parport_interface;
-#endif
-
-#if BUILD_DUMMY == 1
- extern jtag_interface_t dummy_interface;
-#endif
-
-#if BUILD_FT2232_FTD2XX == 1
- extern jtag_interface_t ft2232_interface;
-#endif
-
-#if BUILD_FT2232_LIBFTDI == 1
- extern jtag_interface_t ft2232_interface;
-#endif
-
-#if BUILD_AMTJTAGACCEL == 1
- extern jtag_interface_t amt_jtagaccel_interface;
-#endif
-
-#if BUILD_EP93XX == 1
- extern jtag_interface_t ep93xx_interface;
-#endif
-
-#if BUILD_AT91RM9200 == 1
- extern jtag_interface_t at91rm9200_interface;
-#endif
-
-#if BUILD_GW16012 == 1
- extern jtag_interface_t gw16012_interface;
-#endif
-
-#if BUILD_PRESTO_LIBFTDI == 1 || BUILD_PRESTO_FTD2XX == 1
- extern jtag_interface_t presto_interface;
-#endif
-
-#if BUILD_USBPROG == 1
- extern jtag_interface_t usbprog_interface;
-#endif
-
-#if BUILD_JLINK == 1
- extern jtag_interface_t jlink_interface;
-#endif
-
-#if BUILD_VSLLINK == 1
- extern jtag_interface_t vsllink_interface;
-#endif
-
-#if BUILD_RLINK == 1
- extern jtag_interface_t rlink_interface;
-#endif
-
-#if BUILD_ARMJTAGEW == 1
- extern jtag_interface_t armjtagew_interface;
-#endif
-#endif // standard drivers
-
-/**
- * The list of built-in JTAG interfaces, containing entries for those
- * drivers that were enabled by the @c configure script.
- *
- * The list should be defined to contain either one minidriver interface
- * or some number of standard driver interfaces, never both.
- */
-jtag_interface_t *jtag_interfaces[] = {
-#if BUILD_ECOSBOARD == 1
- &zy1000_interface,
-#elif defined(BUILD_MINIDRIVER_DUMMY)
- &minidummy_interface,
-#else // standard drivers
-#if BUILD_PARPORT == 1
- &parport_interface,
-#endif
-#if BUILD_DUMMY == 1
- &dummy_interface,
-#endif
-#if BUILD_FT2232_FTD2XX == 1
- &ft2232_interface,
-#endif
-#if BUILD_FT2232_LIBFTDI == 1
- &ft2232_interface,
-#endif
-#if BUILD_AMTJTAGACCEL == 1
- &amt_jtagaccel_interface,
-#endif
-#if BUILD_EP93XX == 1
- &ep93xx_interface,
-#endif
-#if BUILD_AT91RM9200 == 1
- &at91rm9200_interface,
-#endif
-#if BUILD_GW16012 == 1
- &gw16012_interface,
-#endif
-#if BUILD_PRESTO_LIBFTDI == 1 || BUILD_PRESTO_FTD2XX == 1
- &presto_interface,
-#endif
-#if BUILD_USBPROG == 1
- &usbprog_interface,
-#endif
-#if BUILD_JLINK == 1
- &jlink_interface,
-#endif
-#if BUILD_VSLLINK == 1
- &vsllink_interface,
-#endif
-#if BUILD_RLINK == 1
- &rlink_interface,
-#endif
-#if BUILD_ARMJTAGEW == 1
- &armjtagew_interface,
-#endif
-#endif // standard drivers
- NULL,
-};
-
-struct jtag_interface_s *jtag = NULL;
-
-/* configuration */
-static jtag_interface_t *jtag_interface = NULL;
-int jtag_speed = 0;
-
-/* jtag commands */
-static int handle_interface_list_command(struct command_context_s *cmd_ctx,
- char *cmd, char **args, int argc);
-static int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_khz_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
-static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args);
-
-static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_verify_jtag_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-static int handle_tms_sequence_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
-
-jtag_tap_t *jtag_all_taps(void)
-{
- return __jtag_all_taps;
-};
-
-unsigned jtag_tap_count(void)
-{
- return jtag_num_taps;
-}
-
-unsigned jtag_tap_count_enabled(void)
-{
- jtag_tap_t *t = jtag_all_taps();
- unsigned n = 0;
- while(t)
- {
- if (t->enabled)
- n++;
- t = t->next_tap;
- }
- return n;
-}
-
-/// Append a new TAP to the chain of all taps.
-void jtag_tap_add(struct jtag_tap_s *t)
-{
- t->abs_chain_position = jtag_num_taps++;
-
- jtag_tap_t **tap = &__jtag_all_taps;
- while(*tap != NULL)
- tap = &(*tap)->next_tap;
- *tap = t;
-}
-
-jtag_tap_t *jtag_tap_by_string(const char *s)
-{
- /* try by name first */
- jtag_tap_t *t = jtag_all_taps();
- while (t)
- {
- if (0 == strcmp(t->dotted_name, s))
- return t;
- t = t->next_tap;
- }
-
- /* no tap found by name, so try to parse the name as a number */
- char *cp;
- unsigned n = strtoul(s, &cp, 0);
- if ((s == cp) || (*cp != 0))
- return NULL;
-
- return jtag_tap_by_position(n);
-}
-
-jtag_tap_t *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
-{
- const char *cp = Jim_GetString(o, NULL);
- jtag_tap_t *t = cp ? jtag_tap_by_string(cp) : NULL;
- if (NULL == cp)
- cp = "(unknown)";
- if (NULL == t)
- Jim_SetResult_sprintf(interp, "Tap '%s' could not be found", cp);
- return t;
-}
-
-/* returns a pointer to the n-th device in the scan chain */
-jtag_tap_t *jtag_tap_by_position(unsigned n)
-{
- jtag_tap_t *t = jtag_all_taps();
-
- while (t && n-- > 0)
- t = t->next_tap;
-
- return t;
-}
-
-const char *jtag_tap_name(const jtag_tap_t *tap)
-{
- return (tap == NULL) ? "(unknown)" : tap->dotted_name;
-}
-
-
-int jtag_register_event_callback(int (*callback)(enum jtag_event event, void *priv), void *priv)
-{
- jtag_event_callback_t **callbacks_p = &jtag_event_callbacks;
-
- if (callback == NULL)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
-
- if (*callbacks_p)
- {
- while ((*callbacks_p)->next)
- callbacks_p = &((*callbacks_p)->next);
- callbacks_p = &((*callbacks_p)->next);
- }
-
- (*callbacks_p) = malloc(sizeof(jtag_event_callback_t));
- (*callbacks_p)->callback = callback;
- (*callbacks_p)->priv = priv;
- (*callbacks_p)->next = NULL;
-
- return ERROR_OK;
-}
-
-int jtag_unregister_event_callback(int (*callback)(enum jtag_event event, void *priv))
-{
- jtag_event_callback_t **callbacks_p = &jtag_event_callbacks;
-
- if (callback == NULL)
- {
- return ERROR_INVALID_ARGUMENTS;
- }
-
- while (*callbacks_p)
- {
- jtag_event_callback_t **next = &((*callbacks_p)->next);
- if ((*callbacks_p)->callback == callback)
- {
- free(*callbacks_p);
- *callbacks_p = *next;
- }
- callbacks_p = next;
- }
-
- return ERROR_OK;
-}
-
-int jtag_call_event_callbacks(enum jtag_event event)
-{
- jtag_event_callback_t *callback = jtag_event_callbacks;
-
- LOG_DEBUG("jtag event: %s", jtag_event_strings[event]);
-
- while (callback)
- {
- callback->callback(event, callback->priv);
- callback = callback->next;
- }
-
- return ERROR_OK;
-}
-
-static void jtag_checks(void)
-{
- assert(jtag_trst == 0);
-}
-
-static void jtag_prelude(tap_state_t state)
-{
- jtag_checks();
-
- assert(state!=TAP_INVALID);
-
- cmd_queue_cur_state = state;
-}
-
-void jtag_alloc_in_value32(scan_field_t *field)
-{
- interface_jtag_alloc_in_value32(field);
-}
-
-void jtag_add_ir_scan_noverify(int in_count, const scan_field_t *in_fields,
- tap_state_t state)
-{
- jtag_prelude(state);
-
- int retval = interface_jtag_add_ir_scan(in_count, in_fields, state);
- jtag_set_error(retval);
-}
-
-
-void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
-{
- if (jtag_verify&&jtag_verify_capture_ir)
- {
- /* 8 x 32 bit id's is enough for all invocations */
-
- for (int j = 0; j < in_num_fields; j++)
- {
- /* if we are to run a verification of the ir scan, we need to get the input back.
- * We may have to allocate space if the caller didn't ask for the input back.
- */
- in_fields[j].check_value=in_fields[j].tap->expected;
- in_fields[j].check_mask=in_fields[j].tap->expected_mask;
- }
- jtag_add_scan_check(jtag_add_ir_scan_noverify, in_num_fields, in_fields, state);
- } else
- {
- jtag_add_ir_scan_noverify(in_num_fields, in_fields, state);
- }
-}
-
-void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields,
- tap_state_t state)
-{
- jtag_prelude(state);
-
- int retval = interface_jtag_add_plain_ir_scan(
- in_num_fields, in_fields, state);
- jtag_set_error(retval);
-}
-
-void jtag_add_callback(jtag_callback1_t f, u8 *in)
-{
- interface_jtag_add_callback(f, in);
-}
-
-void jtag_add_callback4(jtag_callback_t f, u8 *in,
- jtag_callback_data_t data1, jtag_callback_data_t data2,
- jtag_callback_data_t data3)
-{
- interface_jtag_add_callback4(f, in, data1, data2, data3);
-}
-
-int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits);
-
-static int jtag_check_value_mask_callback(u8 *in, jtag_callback_data_t data1, jtag_callback_data_t data2, jtag_callback_data_t data3)
-{
- return jtag_check_value_inner(in, (u8 *)data1, (u8 *)data2, (int)data3);
-}
-
-static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const scan_field_t *in_fields, tap_state_t state),
- int in_num_fields, scan_field_t *in_fields, tap_state_t state)
-{
- for (int i = 0; i < in_num_fields; i++)
- {
- struct scan_field_s *field = &in_fields[i];
- field->allocated = 0;
- field->modified = 0;
- if (field->check_value || field->in_value)
- continue;
- interface_jtag_add_scan_check_alloc(field);
- field->modified = 1;
- }
-
- jtag_add_scan(in_num_fields, in_fields, state);
-
- for (int i = 0; i < in_num_fields; i++)
- {
- if ((in_fields[i].check_value != NULL) && (in_fields[i].in_value != NULL))
- {
- /* this is synchronous for a minidriver */
- jtag_add_callback4(jtag_check_value_mask_callback, in_fields[i].in_value,
- (jtag_callback_data_t)in_fields[i].check_value,
- (jtag_callback_data_t)in_fields[i].check_mask,
- (jtag_callback_data_t)in_fields[i].num_bits);
- }
- if (in_fields[i].allocated)
- {
- free(in_fields[i].in_value);
- }
- if (in_fields[i].modified)
- {
- in_fields[i].in_value = NULL;
- }
- }
-}
-
-void jtag_add_dr_scan_check(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
-{
- if (jtag_verify)
- {
- jtag_add_scan_check(jtag_add_dr_scan, in_num_fields, in_fields, state);
- } else
- {
- jtag_add_dr_scan(in_num_fields, in_fields, state);
- }
-}
-
-
-void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields,
- tap_state_t state)
-{
- jtag_prelude(state);
-
- int retval;
- retval = interface_jtag_add_dr_scan(in_num_fields, in_fields, state);
- jtag_set_error(retval);
-}
-
-void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields,
- tap_state_t state)
-{
- jtag_prelude(state);
-
- int retval;
- retval = interface_jtag_add_plain_dr_scan(in_num_fields, in_fields, state);
- jtag_set_error(retval);
-}
-
-void jtag_add_dr_out(jtag_tap_t* tap,
- int num_fields, const int* num_bits, const u32* value,
- tap_state_t end_state)
-{
- 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);
- jtag_set_error(interface_jtag_add_tlr());
- jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
-}
-
-void jtag_add_pathmove(int num_states, const tap_state_t *path)
-{
- tap_state_t cur_state = cmd_queue_cur_state;
-
- /* the last state has to be a stable state */
- if (!tap_is_state_stable(path[num_states - 1]))
- {
- LOG_ERROR("BUG: TAP path doesn't finish in a stable state");
- jtag_set_error(ERROR_JTAG_NOT_STABLE_STATE);
- return;
- }
-
- for (int i = 0; i < num_states; i++)
- {
- if (path[i] == TAP_RESET)
- {
- LOG_ERROR("BUG: TAP_RESET is not a valid state for pathmove sequences");
- jtag_set_error(ERROR_JTAG_STATE_INVALID);
- return;
- }
-
- if ( tap_state_transition(cur_state, true) != path[i]
- && tap_state_transition(cur_state, false) != path[i])
- {
- LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition",
- tap_state_name(cur_state), tap_state_name(path[i]));
- jtag_set_error(ERROR_JTAG_TRANSITION_INVALID);
- return;
- }
- cur_state = path[i];
- }
-
- jtag_checks();
-
- jtag_set_error(interface_jtag_add_pathmove(num_states, path));
- cmd_queue_cur_state = path[num_states - 1];
-}
-
-void jtag_add_runtest(int num_cycles, tap_state_t state)
-{
- jtag_prelude(state);
- jtag_set_error(interface_jtag_add_runtest(num_cycles, state));
-}
-
-
-void jtag_add_clocks(int num_cycles)
-{
- if (!tap_is_state_stable(cmd_queue_cur_state))
- {
- LOG_ERROR("jtag_add_clocks() called with TAP in unstable state \"%s\"",
- tap_state_name(cmd_queue_cur_state));
- jtag_set_error(ERROR_JTAG_NOT_STABLE_STATE);
- return;
- }
-
- if (num_cycles > 0)
- {
- jtag_checks();
- jtag_set_error(interface_jtag_add_clocks(num_cycles));
- }
-}
-
-void jtag_add_reset(int req_tlr_or_trst, int req_srst)
-{
- int trst_with_tlr = 0;
-
- /* FIX!!! there are *many* different cases here. A better
- * approach is needed for legal combinations of transitions...
- */
- if ((jtag_reset_config & RESET_HAS_SRST)&&
- (jtag_reset_config & RESET_HAS_TRST)&&
- ((jtag_reset_config & RESET_SRST_PULLS_TRST)==0))
- {
- if (((req_tlr_or_trst&&!jtag_trst)||
- (!req_tlr_or_trst&&jtag_trst))&&
- ((req_srst&&!jtag_srst)||
- (!req_srst&&jtag_srst)))
- {
- /* FIX!!! srst_pulls_trst allows 1,1 => 0,0 transition.... */
- //LOG_ERROR("BUG: transition of req_tlr_or_trst and req_srst in the same jtag_add_reset() call is undefined");
- }
- }
-
- /* Make sure that jtag_reset_config allows the requested reset */
- /* if SRST pulls TRST, we can't fulfill srst == 1 with trst == 0 */
- if (((jtag_reset_config & RESET_SRST_PULLS_TRST) && (req_srst == 1)) && (!req_tlr_or_trst))
- {
- LOG_ERROR("BUG: requested reset would assert trst");
- jtag_set_error(ERROR_FAIL);
- return;
- }
-
- /* if TRST pulls SRST, we reset with TAP T-L-R */
- if (((jtag_reset_config & RESET_TRST_PULLS_SRST) && (req_tlr_or_trst)) && (req_srst == 0))
- {
- trst_with_tlr = 1;
- }
-
- if (req_srst && !(jtag_reset_config & RESET_HAS_SRST))
- {
- LOG_ERROR("BUG: requested SRST assertion, but the current configuration doesn't support this");
- jtag_set_error(ERROR_FAIL);
- return;
- }
-
- if (req_tlr_or_trst)
- {
- if (!trst_with_tlr && (jtag_reset_config & RESET_HAS_TRST))
- {
- jtag_trst = 1;
- } else
- {
- trst_with_tlr = 1;
- }
- } else
- {
- jtag_trst = 0;
- }
-
- jtag_srst = req_srst;
-
- int retval = interface_jtag_add_reset(jtag_trst, jtag_srst);
- if (retval != ERROR_OK)
- {
- jtag_set_error(retval);
- return;
- }
- jtag_execute_queue();
-
- if (jtag_srst)
- {
- LOG_DEBUG("SRST line asserted");
- }
- else
- {
- LOG_DEBUG("SRST line released");
- if (jtag_nsrst_delay)
- jtag_add_sleep(jtag_nsrst_delay * 1000);
- }
-
- if (trst_with_tlr)
- {
- LOG_DEBUG("JTAG reset with RESET instead of TRST");
- jtag_set_end_state(TAP_RESET);
- jtag_add_tlr();
- return;
- }
-
- if (jtag_trst)
- {
- /* we just asserted nTRST, so we're now in Test-Logic-Reset,
- * and inform possible listeners about this
- */
- LOG_DEBUG("TRST line asserted");
- tap_set_state(TAP_RESET);
- jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
- }
- else
- {
- if (jtag_ntrst_delay)
- jtag_add_sleep(jtag_ntrst_delay * 1000);
- }
-}
-
-tap_state_t jtag_set_end_state(tap_state_t state)
-{
- if ((state == TAP_DRSHIFT)||(state == TAP_IRSHIFT))
- {
- LOG_ERROR("BUG: TAP_DRSHIFT/IRSHIFT can't be end state. Calling code should use a larger scan field");
- }
-
- if (state!=TAP_INVALID)
- cmd_queue_end_state = state;
- return cmd_queue_end_state;
-}
-
-tap_state_t jtag_get_end_state(void)
-{
- return cmd_queue_end_state;
-}
-
-void jtag_add_sleep(u32 us)
-{
- /// @todo Here, keep_alive() appears to be a layering violation!!!
- keep_alive();
- jtag_set_error(interface_jtag_add_sleep(us));
-}
-
-int jtag_check_value_inner(u8 *captured, u8 *in_check_value, u8 *in_check_mask, int num_bits)
-{
- int retval = ERROR_OK;
-
- int compare_failed = 0;
-
- if (in_check_mask)
- compare_failed = buf_cmp_mask(captured, in_check_value, in_check_mask, num_bits);
- else
- compare_failed = buf_cmp(captured, in_check_value, num_bits);
-
- if (compare_failed){
- /* An error handler could have caught the failing check
- * only report a problem when there wasn't a handler, or if the handler
- * acknowledged the error
- */
- /*
- LOG_WARNING("TAP %s:",
- jtag_tap_name(field->tap));
- */
- if (compare_failed)
- {
- char *captured_char = buf_to_str(captured, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16);
- char *in_check_value_char = buf_to_str(in_check_value, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16);
-
- if (in_check_mask)
- {
- char *in_check_mask_char;
- in_check_mask_char = buf_to_str(in_check_mask, (num_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : num_bits, 16);
- LOG_WARNING("value captured during scan didn't pass the requested check:");
- LOG_WARNING("captured: 0x%s check_value: 0x%s check_mask: 0x%s",
- captured_char, in_check_value_char, in_check_mask_char);
- free(in_check_mask_char);
- }
- else
- {
- LOG_WARNING("value captured during scan didn't pass the requested check: captured: 0x%s check_value: 0x%s", captured_char, in_check_value_char);
- }
-
- free(captured_char);
- free(in_check_value_char);
-
- retval = ERROR_JTAG_QUEUE_FAILED;
- }
-
- }
- return retval;
-}
-
-void jtag_check_value_mask(scan_field_t *field, u8 *value, u8 *mask)
-{
- assert(field->in_value != NULL);
-
- if (value==NULL)
- {
- /* no checking to do */
- return;
- }
-
- jtag_execute_queue_noclear();
-
- int retval=jtag_check_value_inner(field->in_value, value, mask, field->num_bits);
- jtag_set_error(retval);
-}
-
-
-
-int default_interface_jtag_execute_queue(void)
-{
- if (NULL == jtag)
- {
- LOG_ERROR("No JTAG interface configured yet. "
- "Issue 'init' command in startup scripts "
- "before communicating with targets.");
- return ERROR_FAIL;
- }
-
- return jtag->execute_queue();
-}
-
-void jtag_execute_queue_noclear(void)
-{
- jtag_flush_queue_count++;
- jtag_set_error(interface_jtag_execute_queue());
-}
-
-int jtag_get_flush_queue_count(void)
-{
- return jtag_flush_queue_count;
-}
-
-int jtag_execute_queue(void)
-{
- jtag_execute_queue_noclear();
- return jtag_error_clear();
-}
-
-static int jtag_reset_callback(enum jtag_event event, void *priv)
-{
- jtag_tap_t *tap = priv;
-
- LOG_DEBUG("-");
-
- if (event == JTAG_TRST_ASSERTED)
- {
- buf_set_ones(tap->cur_instr, tap->ir_length);
- tap->bypass = 1;
- }
-
- return ERROR_OK;
-}
-
-void jtag_sleep(u32 us)
-{
- alive_sleep(us/1000);
-}
-
-/// maximum number of JTAG devices expected in the chain
-#define JTAG_MAX_CHAIN_SIZE 20
-
-#define EXTRACT_MFG(X) (((X) & 0xffe) >> 1)
-#define EXTRACT_PART(X) (((X) & 0xffff000) >> 12)
-#define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28)
-
-static int jtag_examine_chain_execute(u8 *idcode_buffer, unsigned num_idcode)
-{
- scan_field_t field = {
- .tap = NULL,
- .num_bits = num_idcode * 32,
- .out_value = idcode_buffer,
- .in_value = idcode_buffer,
- };
-
- // initialize to the end of chain ID value
- for (unsigned i = 0; i < JTAG_MAX_CHAIN_SIZE; i++)
- buf_set_u32(idcode_buffer, i * 32, 32, 0x000000FF);
-
- jtag_add_plain_dr_scan(1, &field, TAP_RESET);
- return jtag_execute_queue();
-}
-
-static bool jtag_examine_chain_check(u8 *idcodes, unsigned count)
-{
- u8 zero_check = 0x0;
- u8 one_check = 0xff;
-
- for (unsigned i = 0; i < count * 4; i++)
- {
- zero_check |= idcodes[i];
- one_check &= idcodes[i];
- }
-
- /* if there wasn't a single non-zero bit or if all bits were one,
- * the scan is not valid */
- if (zero_check == 0x00 || one_check == 0xff)
- {
- LOG_ERROR("JTAG communication failure: check connection, "
- "JTAG interface, target power etc.");
- return false;
- }
- return true;
-}
-
-static void jtag_examine_chain_display(enum log_levels level, const char *msg,
- const char *name, u32 idcode)
-{
- log_printf_lf(level, __FILE__, __LINE__, __FUNCTION__,
- "JTAG tap: %s %16.16s: 0x%08x "
- "(mfg: 0x%3.3x, part: 0x%4.4x, ver: 0x%1.1x)",
- name, msg, idcode,
- EXTRACT_MFG(idcode), EXTRACT_PART(idcode), EXTRACT_VER(idcode) );
-}
-
-static bool jtag_idcode_is_final(u32 idcode)
-{
- return idcode == 0x000000FF || idcode == 0xFFFFFFFF;
-}
-
-/**
- * This helper checks that remaining bits in the examined chain data are
- * all as expected, but a single JTAG device requires only 64 bits to be
- * read back correctly. This can help identify and diagnose problems
- * with the JTAG chain earlier, gives more helpful/explicit error messages.
- */
-static void jtag_examine_chain_end(u8 *idcodes, unsigned count, unsigned max)
-{
- bool triggered = false;
- for ( ; count < max - 31; count += 32)
- {
- u32 idcode = buf_get_u32(idcodes, count, 32);
- // do not trigger the warning if the data looks good
- if (!triggered && jtag_idcode_is_final(idcode))
- continue;
- LOG_WARNING("Unexpected idcode after end of chain: %d 0x%08x",
- count, idcode);
- triggered = true;
- }
-}
-
-static bool jtag_examine_chain_match_tap(const struct jtag_tap_s *tap)
-{
- if (0 == tap->expected_ids_cnt)
- {
- /// @todo Enable LOG_INFO to ask for reports about unknown TAP IDs.
-#if 0
- LOG_INFO("Uknown JTAG TAP ID: 0x%08x", tap->idcode)
- LOG_INFO("Please report the...
[truncated message content] |
|
From: <zw...@ma...> - 2009-06-09 04:48:32
|
Author: zwelch
Date: 2009-06-09 04:48:28 +0200 (Tue, 09 Jun 2009)
New Revision: 2148
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
Merge documentation for jtag_add_statemove from source into header block.
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-09 02:48:18 UTC (rev 2147)
+++ trunk/src/jtag/jtag.c 2009-06-09 02:48:28 UTC (rev 2148)
@@ -2523,33 +2523,6 @@
return ERROR_OK;
}
-/**
- * Moves from the current state to the goal \a state. This needs
- * to be handled according to the xsvf spec, see the XSTATE command
- * description.
- *
- * From the XSVF spec, pertaining to XSTATE:
- *
- * For special states known as stable states (Test-Logic-Reset,
- * Run-Test/Idle, Pause-DR, Pause- IR), an XSVF interpreter follows
- * predefined TAP state paths when the starting state is a stable state
- * and when the XSTATE specifies a new stable state. See the STATE
- * command in the [Ref 5] for the TAP state paths between stable
- * states.
- *
- * For non-stable states, XSTATE should specify a state that is only one
- * TAP state transition distance from the current TAP state to avoid
- * undefined TAP state paths. A sequence of multiple XSTATE commands can
- * be issued to transition the TAP through a specific state path.
- *
- * @note Unless @a tms_bits holds a path that agrees with [Ref 5] in *
- * above spec, then this code is not fully conformant to the xsvf spec.
- * This puts a burden on tap_get_tms_path() function from the xsvf spec.
- * If in doubt, you should confirm that that burden is being met.
- *
- * Otherwise, state must be immediately reachable in one clock cycle,
- * and does not need to be a stable state.
- */
int jtag_add_statemove(tap_state_t goal_state)
{
tap_state_t cur_state = cmd_queue_cur_state;
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 02:48:18 UTC (rev 2147)
+++ trunk/src/jtag/jtag.h 2009-06-09 02:48:28 UTC (rev 2148)
@@ -675,16 +675,36 @@
/**
* jtag_add_statemove() moves from the current state to @a goal_state.
*
- * This function was originally designed to handle the XSTATE command
- * from the XSVF specification.
- *
* @param goal_state The final TAP state.
* @return ERROR_OK on success, or an error code on failure.
+ *
+ * Moves from the current state to the goal \a state.
+ *
+ * This needs to be handled according to the xsvf spec, see the XSTATE
+ * command description. From the XSVF spec, pertaining to XSTATE:
+ *
+ * For special states known as stable states (Test-Logic-Reset,
+ * Run-Test/Idle, Pause-DR, Pause- IR), an XSVF interpreter follows
+ * predefined TAP state paths when the starting state is a stable state
+ * and when the XSTATE specifies a new stable state. See the STATE
+ * command in the [Ref 5] for the TAP state paths between stable
+ * states.
+ *
+ * For non-stable states, XSTATE should specify a state that is only one
+ * TAP state transition distance from the current TAP state to avoid
+ * undefined TAP state paths. A sequence of multiple XSTATE commands can
+ * be issued to transition the TAP through a specific state path.
+ *
+ * @note Unless @c tms_bits holds a path that agrees with [Ref 5] in the
+ * above spec, then this code is not fully conformant to the xsvf spec.
+ * This puts a burden on tap_get_tms_path() function from the xsvf spec.
+ * If in doubt, you should confirm that that burden is being met.
+ *
+ * Otherwise, @a goal_state must be immediately reachable in one clock
+ * cycle, and does not need to be a stable state.
*/
extern int jtag_add_statemove(tap_state_t goal_state);
-
-
/// @returns the number of times the scan queue has been flushed
int jtag_get_flush_queue_count(void);
|
|
From: <zw...@ma...> - 2009-06-09 04:48:25
|
Author: zwelch
Date: 2009-06-09 04:48:18 +0200 (Tue, 09 Jun 2009)
New Revision: 2147
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
Move Doxygen documentation for IR/DR scan routines to header file.
- Move plain IR scan declaration closer to the other IR scan declarations.
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-09 02:24:05 UTC (rev 2146)
+++ trunk/src/jtag/jtag.c 2009-06-09 02:48:18 UTC (rev 2147)
@@ -418,15 +418,6 @@
}
-/**
- * Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.
- *
- * If the input field list contains an instruction value for a TAP then that is used
- * otherwise the TAP is set to bypass.
- *
- * TAPs for which no fields are passed are marked as bypassed for subsequent DR SCANs.
- *
- */
void jtag_add_ir_scan(int in_num_fields, scan_field_t *in_fields, tap_state_t state)
{
if (jtag_verify&&jtag_verify_capture_ir)
@@ -448,12 +439,6 @@
}
}
-/**
- * Duplicate the scan fields passed into the function into an IR SCAN command
- *
- * This function assumes that the caller handles extra fields for bypassed TAPs
- *
- */
void jtag_add_plain_ir_scan(int in_num_fields, const scan_field_t *in_fields,
tap_state_t state)
{
@@ -532,12 +517,6 @@
}
-/**
- * Generate a DR SCAN using the fields passed to the function.
- * For connected TAPs, the function checks in_fields and uses fields
- * specified there. For bypassed TAPs, the function generates a dummy
- * 1-bit field. The bypass status of TAPs is set by jtag_add_ir_scan().
- */
void jtag_add_dr_scan(int in_num_fields, const scan_field_t *in_fields,
tap_state_t state)
{
@@ -548,11 +527,6 @@
jtag_set_error(retval);
}
-/**
- * Duplicate the scan fields passed into the function into a DR SCAN
- * command. Unlike jtag_add_dr_scan(), this function assumes that the
- * caller handles extra fields for bypassed TAPs.
- */
void jtag_add_plain_dr_scan(int in_num_fields, const scan_field_t *in_fields,
tap_state_t state)
{
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 02:24:05 UTC (rev 2146)
+++ trunk/src/jtag/jtag.h 2009-06-09 02:48:18 UTC (rev 2147)
@@ -308,12 +308,29 @@
* end state and a subsequent jtag_add_pathmove() must be issued.
*/
+/**
+ * Generate an IR SCAN with a list of scan fields with one entry for
+ * each enabled TAP.
+ *
+ * If the input field list contains an instruction value for a TAP then
+ * that is used otherwise the TAP is set to bypass.
+ *
+ * TAPs for which no fields are passed are marked as bypassed for
+ * subsequent DR SCANs.
+ *
+ */
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);
+/**
+ * Duplicate the scan fields passed into the function into an IR SCAN
+ * command. This function assumes that the caller handles extra fields
+ * for bypassed TAPs.
+ */
+extern void jtag_add_plain_ir_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
/**
@@ -327,10 +344,20 @@
*/
extern void jtag_alloc_in_value32(scan_field_t *field);
+/**
+ * Generate a DR SCAN using the fields passed to the function.
+ * For connected TAPs, the function checks in_fields and uses fields
+ * specified there. For bypassed TAPs, the function generates a dummy
+ * 1-bit field. The bypass status of TAPs is set by jtag_add_ir_scan().
+ */
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);
+/**
+ * Duplicate the scan fields passed into the function into a DR SCAN
+ * command. Unlike jtag_add_dr_scan(), this function assumes that the
+ * caller handles extra fields for bypassed TAPs.
+ */
extern void jtag_add_plain_dr_scan(int num_fields, const scan_field_t* fields, tap_state_t endstate);
|
|
From: <zw...@ma...> - 2009-06-09 04:24:12
|
Author: zwelch
Date: 2009-06-09 04:24:05 +0200 (Tue, 09 Jun 2009)
New Revision: 2146
Modified:
trunk/src/flash/str9xpec.c
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
- Replace 'jtag_tap_by_abs_position' with 'jtag_tap_by_position'.
Modified: trunk/src/flash/str9xpec.c
===================================================================
--- trunk/src/flash/str9xpec.c 2009-06-09 02:24:00 UTC (rev 2145)
+++ trunk/src/flash/str9xpec.c 2009-06-09 02:24:05 UTC (rev 2146)
@@ -325,7 +325,7 @@
arm7_9 = armv4_5->arch_info;
jtag_info = &arm7_9->jtag_info;
- str9xpec_info->tap = jtag_tap_by_abs_position( jtag_info->tap->abs_chain_position - 1);
+ str9xpec_info->tap = jtag_tap_by_position( jtag_info->tap->abs_chain_position - 1);
str9xpec_info->isc_enable = 0;
str9xpec_build_block_list(bank);
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-09 02:24:00 UTC (rev 2145)
+++ trunk/src/jtag/jtag.c 2009-06-09 02:24:05 UTC (rev 2146)
@@ -296,7 +296,7 @@
if ((s == cp) || (*cp != 0))
return NULL;
- return jtag_tap_by_abs_position(n);
+ return jtag_tap_by_position(n);
}
jtag_tap_t *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
@@ -311,7 +311,7 @@
}
/* returns a pointer to the n-th device in the scan chain */
-jtag_tap_t *jtag_tap_by_abs_position(unsigned n)
+jtag_tap_t *jtag_tap_by_position(unsigned n)
{
jtag_tap_t *t = jtag_all_taps();
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 02:24:00 UTC (rev 2145)
+++ trunk/src/jtag/jtag.h 2009-06-09 02:24:05 UTC (rev 2146)
@@ -179,7 +179,7 @@
extern const char *jtag_tap_name(const jtag_tap_t *tap);
extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name);
extern jtag_tap_t* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj);
-extern jtag_tap_t* jtag_tap_by_abs_position(unsigned abs_position);
+extern jtag_tap_t* jtag_tap_by_position(unsigned abs_position);
extern unsigned jtag_tap_count_enabled(void);
extern unsigned jtag_tap_count(void);
|
|
From: <zw...@ma...> - 2009-06-09 04:24:03
|
Author: zwelch Date: 2009-06-09 04:24:00 +0200 (Tue, 09 Jun 2009) New Revision: 2145 Modified: trunk/src/jtag/jtag.h Log: Remove non-existant jtag_tap_by_position API declaration. Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-09 02:23:53 UTC (rev 2144) +++ trunk/src/jtag/jtag.h 2009-06-09 02:24:00 UTC (rev 2145) @@ -177,7 +177,6 @@ }; extern jtag_tap_t* jtag_all_taps(void); extern const char *jtag_tap_name(const jtag_tap_t *tap); -extern jtag_tap_t* jtag_tap_by_position(int n); extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name); extern jtag_tap_t* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj); extern jtag_tap_t* jtag_tap_by_abs_position(unsigned abs_position); |
|
From: <zw...@ma...> - 2009-06-09 04:23:57
|
Author: zwelch
Date: 2009-06-09 04:23:53 +0200 (Tue, 09 Jun 2009)
New Revision: 2144
Modified:
trunk/src/jtag/jtag.c
trunk/src/jtag/jtag.h
Log:
Use unsigned type for jtag_tap_count and jtag_tap_by_abs_position.
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-09 02:23:44 UTC (rev 2143)
+++ trunk/src/jtag/jtag.c 2009-06-09 02:23:53 UTC (rev 2144)
@@ -71,7 +71,7 @@
* The number of TAPs in the __jtag_all_taps list, used to track the
* assigned chain position to new TAPs
*/
-static int jtag_num_taps = 0;
+static unsigned jtag_num_taps = 0;
enum reset_types jtag_reset_config = RESET_NONE;
tap_state_t cmd_queue_end_state = TAP_RESET;
@@ -250,7 +250,7 @@
return __jtag_all_taps;
};
-int jtag_tap_count(void)
+unsigned jtag_tap_count(void)
{
return jtag_num_taps;
}
@@ -311,7 +311,7 @@
}
/* returns a pointer to the n-th device in the scan chain */
-jtag_tap_t *jtag_tap_by_abs_position(int n)
+jtag_tap_t *jtag_tap_by_abs_position(unsigned n)
{
jtag_tap_t *t = jtag_all_taps();
Modified: trunk/src/jtag/jtag.h
===================================================================
--- trunk/src/jtag/jtag.h 2009-06-09 02:23:44 UTC (rev 2143)
+++ trunk/src/jtag/jtag.h 2009-06-09 02:23:53 UTC (rev 2144)
@@ -180,9 +180,9 @@
extern jtag_tap_t* jtag_tap_by_position(int n);
extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name);
extern jtag_tap_t* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj);
-extern jtag_tap_t* jtag_tap_by_abs_position(int abs_position);
+extern jtag_tap_t* jtag_tap_by_abs_position(unsigned abs_position);
extern unsigned jtag_tap_count_enabled(void);
-extern int jtag_tap_count(void);
+extern unsigned jtag_tap_count(void);
static __inline__ jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p)
{
|
|
From: <zw...@ma...> - 2009-06-09 04:23:49
|
Author: zwelch
Date: 2009-06-09 04:23:44 +0200 (Tue, 09 Jun 2009)
New Revision: 2143
Modified:
trunk/src/jtag/jtag.c
Log:
Cleanup jtag_tap_by_abs_position:
- Remove unused orig_n local variable.
- Merge variable declaration with first use.
- Update code to use current style guidelines.
Modified: trunk/src/jtag/jtag.c
===================================================================
--- trunk/src/jtag/jtag.c 2009-06-09 02:23:35 UTC (rev 2142)
+++ trunk/src/jtag/jtag.c 2009-06-09 02:23:44 UTC (rev 2143)
@@ -311,18 +311,13 @@
}
/* returns a pointer to the n-th device in the scan chain */
-jtag_tap_t * jtag_tap_by_abs_position( int n )
+jtag_tap_t *jtag_tap_by_abs_position(int n)
{
- int orig_n;
- jtag_tap_t *t;
+ jtag_tap_t *t = jtag_all_taps();
- orig_n = n;
- t = jtag_all_taps();
-
- while( t && (n > 0)) {
- n--;
+ while (t && n-- > 0)
t = t->next_tap;
- }
+
return t;
}
|