replace wrapper shell script with application that links to liburjtag

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1620 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 16 years ago
parent 5475adaba1
commit c38a0135b1

@ -1,3 +1,9 @@
2009-05-23 Arnim Laeuger <arniml>
* src/bsdl2jtag, configure.ac, Makefile.am,
src/apps/bsdl2jtag/Makefile.am, src/apps/bsdl2jtag/bsdl2jtag.c:
replace wrapper shell script with application that links to liburjtag
2009-05-22 Arnim Laeuger <arniml>
* src/bsdl/bsdl_sem.c: replace remaining printf invocations with urj_log

@ -29,6 +29,7 @@ SUBDIRS = \
data \
src \
src/apps/jtag \
src/apps/bsdl2jtag \
po
DIST_SUBDIRS = \
@ -40,4 +41,3 @@ EXTRA_DIST = \
tools/config.rpath
ACLOCAL_AMFLAGS = -I m4

@ -73,6 +73,7 @@ AC_CONFIG_FILES(
src/jim/Makefile
src/global/Makefile
src/apps/jtag/Makefile
src/apps/bsdl2jtag/Makefile
po/Makefile.in
)

@ -1,10 +1,7 @@
#!/bin/bash
#
# $Id$
#
# Convert a BSDL file to a jtag part description
#
# Copyright (C) 2009, A. Laeuger
# Copyright (C) 2002 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
@ -22,27 +19,19 @@
# 02111-1307, USA.
#
scriptname=`basename $0`
function usage ()
{
cat <<EOF
Usage: $scriptname <bsdl-file> <jtag-file>
Converts a BSDL file to a jtag part description.
Parameters
bsdl-file : Name of BSDL file
jtag-file : Name of converted jtag description file
include $(top_srcdir)/Makefile.rules
EOF
}
bin_PROGRAMS = \
bsdl2jtag
if [[ -z $1 || -z $2 ]]; then
usage
exit 1
fi
bsdl2jtag_SOURCES = \
bsdl2jtag.c
bsdl2jtag_LDADD = \
$(top_srcdir)/src/liburjtag.la \
@LIBINTL@
echo "bsdl dump $1" | jtag > $2
localedir = $(datadir)/locale
INCLUDES = -DLOCALEDIR=\"$(localedir)\"
exit 0
AM_CFLAGS = $(WARNINGCFLAGS)

@ -0,0 +1,98 @@
/*
* $Id$
*
* Copyright (C) 2009, Arnim Laeuger
*
* 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 Arnim Laeuger <arniml@users.sourceforge.net>, 2009.
*
*/
#include <stdio.h>
#include <urjtag/chain.h>
#include <urjtag/log.h>
#include <urjtag/bsdl_mode.h>
#include <urjtag/bsdl.h>
FILE *jtag_file;
static int
log_to_file (const char *fmt, va_list ap)
{
return vfprintf (jtag_file, fmt, ap);
}
static void
cleanup (urj_chain_t *chain)
{
urj_tap_chain_free (chain);
}
static void
usage (void)
{
puts ("Usage: bsdl2jtag <bsdl-file> <jtag-file>");
puts ("Converts a BSDL file to a jtag part description.\n");
puts ("Parameters");
puts (" bsdl-file : Name of BSDL file");
puts (" jtag-file : Name of converted jtag description file");
puts ("");
}
int
main (int argc, char *const argv[])
{
int result;
urj_chain_t *chain = NULL;
chain = urj_tap_chain_alloc ();
if (chain == NULL)
{
urj_log (URJ_LOG_LEVEL_NORMAL, "Error: %s\n",
urj_error_describe());
return 1;
}
if (argc != 3)
{
usage ();
cleanup (chain);
return 1;
}
jtag_file = fopen (argv[2], "w");
if (jtag_file == NULL)
{
printf ("Error: Can't open '%s' in write mode.\n", argv[2]);
cleanup (chain);
return 1;
}
/* log all messages to the jtag_file */
urj_log_state.out_vprintf = log_to_file;
result = urj_bsdl_read_file (chain, argv[1], URJ_BSDL_MODE_DUMP, NULL);
fclose (jtag_file);
cleanup (chain);
return result < 0 ? 1 : 0;
}
Loading…
Cancel
Save