Remaining diffs from gumstix repository: Add debug, test and shell command, aliases for parts, small fixes.
git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@731 b68d4a1b-bc3d-0410-92ed-d4ac073336b7master
parent
2b8ab248ff
commit
851277f003
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* $Id: debug.c,v 1.0 2005/10/10 00:00:0 DJF $
|
||||
*
|
||||
* Copyright (C) 2005 Protoparts
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Written by David Farrell, 2005
|
||||
* based on templates by and portions Written by Marcel Telka <marcel@telka.sk>, 2003.i
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
//#include <stdlib.h>
|
||||
//#include "part.h"
|
||||
//#include "bssignal.h"
|
||||
#include "jtag.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
static int
|
||||
cmd_debug_run( char *params[] )
|
||||
{
|
||||
int data,i;
|
||||
signal_t *s;
|
||||
|
||||
if (cmd_params( params ) != 2)
|
||||
return -1;
|
||||
|
||||
if (cmd_get_number( params[1], &i ))
|
||||
return 1;
|
||||
|
||||
debug_mode = i;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_debug_help( void )
|
||||
{
|
||||
printf( _(
|
||||
"Usage: %s n\n"
|
||||
"Enabled debugging.\n"
|
||||
"\n"
|
||||
"n =1 fileio, 2=tap commands, 4 =?\n"
|
||||
), "debug n" );
|
||||
}
|
||||
|
||||
cmd_t cmd_debug = {
|
||||
"debug",
|
||||
N_("debug jtag program"),
|
||||
cmd_debug_help,
|
||||
cmd_debug_run
|
||||
};
|
||||
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* $Id: shell.c,v 1.6 2003/08/19 08:42:20 telka Exp $
|
||||
*
|
||||
* Copyright (C) 2003 ETC s.r.o.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Written by Marcel Telka <marcel@telka.sk>, 2003.
|
||||
* shell.c added by djf
|
||||
*/
|
||||
|
||||
#include "sysdep.h"
|
||||
|
||||
//#include <stdio.h>
|
||||
//#include <string.h>
|
||||
#include <stdlib.h>
|
||||
//#include "part.h"
|
||||
//#include "bssignal.h"
|
||||
#include "jtag.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
static int
|
||||
cmd_shell_run( char *params[] )
|
||||
{
|
||||
int n,l1,l2;
|
||||
char *t;
|
||||
|
||||
if((n=cmd_params( params )) == 1)
|
||||
return -1;
|
||||
|
||||
/* I must apologize to everyone who knows what they are doing for
|
||||
* the following. If you can pass a shell argument past strtok the
|
||||
* please fix this.
|
||||
*/
|
||||
|
||||
l1 = strlen(params[1]);
|
||||
l2 = strlen(params[2]);
|
||||
t = malloc(l1+l2+2); /* space + term */
|
||||
strcpy(t,params[1]); /* main command */
|
||||
|
||||
if(n == 3) {
|
||||
*(t+l1)= ' '; /* add space */
|
||||
strcpy((t+l1+1),params[2]);
|
||||
}
|
||||
system(t);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_shell_help( void )
|
||||
{
|
||||
printf( _(
|
||||
"Usage: %s cmmd\n"
|
||||
"Shell out to os for a command.\n"
|
||||
"\n"
|
||||
"CMMD OS Shell Command\n"
|
||||
), "shell cmmd" );
|
||||
}
|
||||
|
||||
cmd_t cmd_shell = {
|
||||
"shell",
|
||||
N_("shell cmmd"),
|
||||
cmd_shell_help,
|
||||
cmd_shell_run
|
||||
};
|
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* $Id: test.c,v 1.0 2005/10/10 00:00:0 DJF $
|
||||
*
|
||||
* Copyright (C) 2005 Protoparts
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Written by David Farrell, 2005
|
||||
* based on templates by and portions Written by Marcel Telka <marcel@telka.sk>, 2003.i
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
//#include <stdlib.h>
|
||||
#include "part.h"
|
||||
#include "bssignal.h"
|
||||
#include "jtag.h"
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
static int
|
||||
cmd_test_run( char *params[] )
|
||||
{
|
||||
int data,i;
|
||||
signal_t *s;
|
||||
|
||||
if (cmd_params( params ) != 4)
|
||||
return -1;
|
||||
|
||||
if (strcmp( params[1], "signal") != 0)
|
||||
return -1;
|
||||
|
||||
if (!cmd_test_cable())
|
||||
return 1;
|
||||
|
||||
if (!chain->parts) {
|
||||
printf( _("Run \"detect\" first.\n") );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (chain->active_part >= chain->parts->len) {
|
||||
printf( _("%s: no active part\n"), "get" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
s = part_find_signal( chain->parts->parts[chain->active_part], params[2] );
|
||||
if (!s) {
|
||||
printf( _("signal '%s' not found\n"), params[2] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* values 0,1,X since X is not a number, the following failure exits clean
|
||||
* and doesnt test anything, as it should.
|
||||
*/
|
||||
if (cmd_get_number( params[3], &i ))
|
||||
return 1;
|
||||
|
||||
data = part_get_signal( chain->parts->parts[chain->active_part], s );
|
||||
if (data != -1) {
|
||||
if(data != i) {
|
||||
printf( _("<FAIL>%s = %d\n"), params[2], data );
|
||||
return -99;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_test_help( void )
|
||||
{
|
||||
printf( _(
|
||||
"Usage: %s SIGNAL 0/1\n"
|
||||
"Test signal state from output BSR (Boundary Scan Register).\n"
|
||||
"\n"
|
||||
"SIGNAL signal name (from JTAG declaration file)\n"
|
||||
), "get signal" );
|
||||
}
|
||||
|
||||
cmd_t cmd_test = {
|
||||
"test",
|
||||
N_("test external signal value"),
|
||||
cmd_test_help,
|
||||
cmd_test_run
|
||||
};
|
||||
|
Loading…
Reference in New Issue