From: oharboe at B. <oh...@ma...> - 2009-05-07 15:04:14
|
Author: oharboe Date: 2009-05-07 15:04:13 +0200 (Thu, 07 May 2009) New Revision: 1638 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: jtag API error handling refactoring. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-07 12:33:26 UTC (rev 1637) +++ trunk/src/jtag/jtag.c 2009-05-07 13:04:13 UTC (rev 1638) @@ -42,8 +42,8 @@ #include <strings.h> #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 @@ 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 */ Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-05-07 12:33:26 UTC (rev 1637) +++ trunk/src/jtag/jtag.h 2009-05-07 13:04:13 UTC (rev 1638) @@ -700,6 +700,9 @@ */ 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,8 +711,18 @@ */ 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 */ extern int interface_jtag_execute_queue(void); extern int jtag_power_dropout(int* dropout); |