* include/jtag.h (jtag_parse_line): Declare.

(jtag_parse_stream): Declare.
	* src/discovery.c: Move ...
	* src/tap/discovery.c: ... here.
	* src/detect.c: Move ...
	* src/tap/detect.c: ... here.
	* src/tap/Makefile.am (libtap_a_SOURCES): Add detect.c and
	discovery.c.
	* src/readmem.c: Move ...
	* src/bus/readmem.c: ... here.
	* src/writemem.c: Move ...
	* src/bus/writemem.c: ... here.
	* src/bus/Makefile.am (libbus_a_SOURCES): Add readmem.c and
	writemem.c.
	* src/flash.c: Move ...
	* src/flash/flash.c: ... here.
	* src/flash/Makefile.am (libflash_a_SOURCES): Add flash.c.
	* src/jtag.c (get_token, jtag_parse_line, jtag_parse_stream,
	jtag_parse_file): Move to ...
	* src/cmd/parse.c: ... here.
	* src/cmd/Makefile.am (libbus_a_SOURCES): Add parse.c.
	* src/Makefile.am (jtag_SOURCES): Remove detect.c, discovery.c,
	readmem.c, writemem.c and flash.c.
	(jtag_LDADD): Add -ltap and -lflash one more time to resolve
	undefined references.


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1120 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Jie Zhang 17 years ago
parent 670a23aa97
commit 11d5d2813c

@ -1,3 +1,31 @@
2008-03-15 Jie Zhang <jie.zhang@analog.com>
* include/jtag.h (jtag_parse_line): Declare.
(jtag_parse_stream): Declare.
* src/discovery.c: Move ...
* src/tap/discovery.c: ... here.
* src/detect.c: Move ...
* src/tap/detect.c: ... here.
* src/tap/Makefile.am (libtap_a_SOURCES): Add detect.c and
discovery.c.
* src/readmem.c: Move ...
* src/bus/readmem.c: ... here.
* src/writemem.c: Move ...
* src/bus/writemem.c: ... here.
* src/bus/Makefile.am (libbus_a_SOURCES): Add readmem.c and
writemem.c.
* src/flash.c: Move ...
* src/flash/flash.c: ... here.
* src/flash/Makefile.am (libflash_a_SOURCES): Add flash.c.
* src/jtag.c (get_token, jtag_parse_line, jtag_parse_stream,
jtag_parse_file): Move to ...
* src/cmd/parse.c: ... here.
* src/cmd/Makefile.am (libbus_a_SOURCES): Add parse.c.
* src/Makefile.am (jtag_SOURCES): Remove detect.c, discovery.c,
readmem.c, writemem.c and flash.c.
(jtag_LDADD): Add -ltap and -lflash one more time to resolve
undefined references.
2008-03-14 Arnim Laeuger <arniml@users.sourceforge.net>
* configure.ac: format AC_ARG_ENABLE help with AS_HELP_STRING macro

@ -39,6 +39,8 @@ extern int big_endian;
extern int debug_mode;
int jtag_parse_file( chain_t *chain, const char *filename );
int jtag_parse_line( chain_t *chain, char *line );
int jtag_parse_stream( chain_t *chain, FILE *f );
int detect_parts( chain_t *chain, char *db_path );
int detect_register_size( chain_t *chain );

@ -44,12 +44,7 @@ bin_PROGRAMS = \
bsdl2jtag
jtag_SOURCES = \
jtag.c \
detect.c \
discovery.c \
readmem.c \
writemem.c \
flash.c
jtag.c
bsdl2jtag_SOURCES = \
bsdl2jtag.c
@ -76,6 +71,8 @@ jtag_LDADD = \
-Llib -ljtaglib \
-Lflash -lflash \
-Lcmd -lcmd \
-Ltap -ltap \
-Lflash -lflash \
-Lbus -lbus \
-lm \
@FTD2XXLIB@ \

@ -46,6 +46,7 @@ libbus_a_SOURCES = \
prototype.c \
pxa2x0.c \
pxa2x0_mc.h \
readmem.c \
sa1110.c \
s3c4510x.c \
sh7727.c \
@ -56,4 +57,5 @@ libbus_a_SOURCES = \
tx4925.c \
jopcyc.c \
sharc21065l.c \
writemem.c \
zefant-xs3.c

@ -52,6 +52,7 @@ libcmd_a_SOURCES = \
shell.c \
set.c \
endian.c \
parse.c \
peekpoke.c \
readmem.c \
writemem.c \

@ -0,0 +1,120 @@
/*
* parse.c
*
* Copyright (C) 2002, 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>, 2002, 2003.
* Modified by Ajith Kumar P.C <ajithpc@kila.com>, 20/09/2006.
*
*/
#include "sysdep.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "chain.h"
#include "cmd.h"
#include "jtag.h"
static char *
get_token( char *buf )
{
char *t = strtok( buf, " \f\n\r\t\v" );
if (t && (*t == '#'))
return NULL;
return t;
}
int
jtag_parse_line( chain_t *chain, char *line )
{
char *t;
int l;
int n;
char **a;
int r;
if (!line || !(strlen( line ) > 0))
return 1;
t = get_token( line );
if (!t)
return 1;
n = 0;
l = 0;
a = NULL;
while (t) {
if (n + 2 > l) {
char **newa;
l = (l < 16) ? 16 : (l * 2);
newa = realloc( a, l * sizeof (char *) );
if (!newa) {
free( a );
printf( _("Out of memory\n") );
return 1;
}
a = newa;
}
a[n++] = t;
a[n] = NULL;
t = get_token( NULL );
}
r = cmd_run( chain, a );
if(debug_mode & 1)printf("Return in jtag_parse_line r=%d\n",r);
free( a );
return r;
}
int
jtag_parse_stream( chain_t *chain, FILE *f )
{
int go = 1;
char *line = NULL;
size_t n = 0;
while (go && (getline( &line, &n, f ) != -1))
if ((strlen(line) > 0) && (line[0] != '#'))
go = jtag_parse_line(chain, line);
free(line);
return go;
}
int
jtag_parse_file( chain_t *chain, const char *filename )
{
FILE *f;
int go;
f = fopen( filename, "r" );
if (!f)
return -1;
go = jtag_parse_stream( chain, f );
fclose(f);
if(debug_mode & 1)printf("File Closed gp=%d\n",go);
return go;
}

@ -30,6 +30,7 @@ libflash_a_SOURCES = \
amd_flash.c \
cfi.c \
detectflash.c \
flash.c \
intel.c \
jedec.c

@ -60,15 +60,6 @@ int big_endian = 0;
int interactive = 0;
extern cfi_array_t *cfi_array;
static char *
get_token( char *buf )
{
char *t = strtok( buf, " \f\n\r\t\v" );
if (t && (*t == '#'))
return NULL;
return t;
}
#define JTAGDIR ".jtag"
#define HISTORYFILE "history"
#define RCFILE "rc"
@ -152,50 +143,6 @@ jtag_save_history( void )
#endif /* HAVE_READLINE_HISTORY */
#endif
static int
jtag_parse_line( chain_t *chain, char *line )
{
char *t;
int l;
int n;
char **a;
int r;
if (!line || !(strlen( line ) > 0))
return 1;
t = get_token( line );
if (!t)
return 1;
n = 0;
l = 0;
a = NULL;
while (t) {
if (n + 2 > l) {
char **newa;
l = (l < 16) ? 16 : (l * 2);
newa = realloc( a, l * sizeof (char *) );
if (!newa) {
free( a );
printf( _("Out of memory\n") );
return 1;
}
a = newa;
}
a[n++] = t;
a[n] = NULL;
t = get_token( NULL );
}
r = cmd_run( chain, a );
if(debug_mode & 1)printf("Return in jtag_parse_line r=%d\n",r);
free( a );
return r;
}
static int jtag_readline_multiple_commands_support(chain_t *chain, char * line) /* multiple commands should be separated with '::' */
{
int r;
@ -265,39 +212,6 @@ jtag_readline_loop( chain_t *chain, const char *prompt )
#endif
}
static int
jtag_parse_stream( chain_t *chain, FILE *f )
{
int go = 1;
char *line = NULL;
size_t n = 0;
while (go && (getline( &line, &n, f ) != -1))
if ((strlen(line) > 0) && (line[0] != '#'))
go = jtag_parse_line(chain, line);
free(line);
return go;
}
int
jtag_parse_file( chain_t *chain, const char *filename )
{
FILE *f;
int go;
f = fopen( filename, "r" );
if (!f)
return -1;
go = jtag_parse_stream( chain, f );
fclose(f);
if(debug_mode & 1)printf("File Closed gp=%d\n",go);
return go;
}
static int
jtag_parse_rc( chain_t *chain )
{

@ -30,6 +30,8 @@ libtap_a_SOURCES = \
register.c \
state.c \
chain.c \
detect.c \
discovery.c \
parport.c \
parport/direct.c \
parport/ppdev.c \

Loading…
Cancel
Save