From f7b02f32904c7c547c4814c070215c18a021d9e7 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Mon, 17 Feb 2003 20:27:40 +0000 Subject: [PATCH] 2003-02-17 Marcel Telka * src/jtag.c (jtag_parse_line): Added new 'get signal' command. * src/help.c (help): Added help for new 'get signal' command. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@365 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 5 +++++ jtag/NEWS | 2 +- jtag/TODO | 1 - jtag/src/help.c | 10 ++++++++- jtag/src/jtag.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 93c75bfd..64647463 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,8 @@ +2003-02-17 Marcel Telka + + * src/jtag.c (jtag_parse_line): Added new 'get signal' command. + * src/help.c (help): Added help for new 'get signal' command. + 2003-02-17 Marcel Telka * data/intel/pxa250/pxa250: Changed comment. diff --git a/jtag/NEWS b/jtag/NEWS index a7628d0e..0556fa64 100644 --- a/jtag/NEWS +++ b/jtag/NEWS @@ -1,7 +1,7 @@ $Id$ * Enhanced 'dr' command functionality. - * Added new 'set signal' command. + * Added new 'set signal' and 'get signal' commands. * Added support for Mpcbdm JTAG Cable (Christian Pellegrin). * Added support for Arcom JTAG Cable (patch 682310, Ian Campbell). * Added support for all 6 static memory banks for Intel SA1110 (bug 682660). diff --git a/jtag/TODO b/jtag/TODO index 6c6d9e32..10fa8058 100644 --- a/jtag/TODO +++ b/jtag/TODO @@ -1,6 +1,5 @@ $Id$ -* Add 'get signal' command. * Add support for non-IDCODE-capable parts. * Support for display the result of a boundary scan formated according to the CPU definitions (e.g. MA[0-26] = 0x00001c00). * Remove direct relation between JTAG instruction and data register (e.g. ARM7TDMI). diff --git a/jtag/src/help.c b/jtag/src/help.c index d6cf1816..715d033c 100644 --- a/jtag/src/help.c +++ b/jtag/src/help.c @@ -53,6 +53,7 @@ help( const char *cmd ) "readmem read content of the memory and write it to file\n" "flashmem burn flash memory with data from a file\n" "set set external signal value\n" + "get get external signal value\n" "script run command sequence from external file\n" "\n" "Type \"help COMMAND\" for details about particular command.\n", PACKAGE @@ -189,7 +190,14 @@ help( const char *cmd ) ); for (i = 0; flash_drivers[i]; i++) printf( "%s\n %s\n", flash_drivers[i]->name, flash_drivers[i]->description ); - } + } else if (strcmp( cmd, "get" ) == 0) + printf( + "Usage: get signal PART SIGNAL\n" + "Get signal state from output BSR (Boundary Scan Register).\n" + "\n" + "PART part number (see print command)\n" + "SIGNAL signal name (from JTAG declaration file)\n" + ); else if (strcmp( cmd, "set" ) == 0) printf( "Usage: set signal PART SIGNAL DIR [DATA]\n" diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index f66f4950..ee7ca882 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -650,11 +650,65 @@ jtag_parse_line( char *line ) } else data = 0; + if (get_token( NULL )) { + printf( "set: syntax error\n" ); + return 1; + } + part_set_signal( ps->parts[n], s, dir, data ); return 1; } + if (strcmp( t, "get" ) == 0) { + int n; + int data; + + if (!cable) { + printf( "Error: Cable not configured. Use 'cable' command first!\n" ); + return 1; + } + + if (!ps) { + printf( "Run \"detect\" first.\n" ); + return 1; + } + + t = get_token( NULL ); + if (!t || strcmp( t, "signal" ) != 0) { + printf( "get: syntax error\n" ); + return 1; + } + + t = get_token( NULL ); + if (!t) { + printf( "get: syntax error\n" ); + return 1; + } + n = strtol( t, &t, 10 ); + if (t && *t) { + printf( "get: syntax error\n" ); + return 1; + } + + if ((n < 0) || (n >= ps->len)) { + printf( "get: invalid part number\n" ); + return 1; + } + + t = get_token( NULL ); /* signal name */ + if (!t || get_token( NULL )) { + printf( "get: syntax error\n" ); + return 1; + } + + data = part_get_signal( ps->parts[n], t ); + if (data != -1) + printf( "%s = %d\n", t, data ); + + return 1; + } + if (strcmp( t, "script" ) == 0) { t = get_token( NULL ); /* filename */ if (!t) {