From c4ee880715121ccfb2ad960673d0f5e603c60d3d Mon Sep 17 00:00:00 2001 From: oharboe Date: Thu, 7 May 2009 13:04:13 +0000 Subject: [PATCH] jtag API error handling refactoring. git-svn-id: svn://svn.berlios.de/openocd/trunk@1638 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/jtag/jtag.c | 4 ++-- src/jtag/jtag.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index 242eb56b..981f47e1 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -42,7 +42,7 @@ #include #endif -static void jtag_execute_queue_noclear(void); + /* 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 @@ -1446,7 +1446,7 @@ int MINIDRIVER(interface_jtag_execute_queue)(void) return retval; } -static void jtag_execute_queue_noclear(void) +void jtag_execute_queue_noclear(void) { int retval=interface_jtag_execute_queue(); /* we keep the first error */ diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index c0f94856..ce11d592 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -700,6 +700,9 @@ int interface_jtag_add_clocks(int num_cycles); */ extern int jtag_execute_queue(void); +/* same as jtag_execute_queue() but does not clear the error flag */ +extern void jtag_execute_queue_noclear(void); + /* this flag is set when an error occurs while executing the queue. cleared * by jtag_execute_queue() * @@ -708,6 +711,16 @@ extern int jtag_execute_queue(void); */ 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; +} + /* can be implemented by hw+sw */ -- 2.39.5