Move all include/* to include/urjtag/; start lifting command implementations into their library modules

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1539 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Rutger Hofman 16 years ago
parent 6fb6e82dbd
commit 08e72f4335

@ -1,3 +1,11 @@
2009-04-23 Rutger Hofman <rfhh>
Move all include/* to include/urjtag/* to lower collision chance on #include.
Start lifting commands from cmd/ into the library modules. Begun work on:
* src/cmd/cmd_bit.c
* src/cmd/cmd_instruction.c
* src/cmd/cmd_signal.c
2009-04-24 Mike Frysinger <vapier@gentoo.org>
* data/analog/bf518/bf518: Update with public BSDL file.

@ -25,7 +25,7 @@ include $(top_srcdir)/Makefile.rules
SUBDIRS = \
doc \
include \
include/urjtag \
data \
src \
po

@ -60,7 +60,7 @@ AC_CONFIG_FILES(
Makefile
doc/Makefile
data/Makefile
include/Makefile
include/urjtag/Makefile
src/Makefile
src/lib/Makefile
src/tap/Makefile

@ -53,3 +53,4 @@ noinst_HEADERS = \
usbconn/libftdx.h \
usbconn/libusb.h \
xpcu.h

@ -0,0 +1,92 @@
/*
* $Id: error.h 1519 2009-04-22 23:12:44Z rfhh $
*
* Copyright (C) 2009, Rutger Hofman, VU Amsterdam
*
* 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.
*
*/
#ifndef URJ_ERROR_H
#define URJ_ERROR_H
#include <stdio.h>
/**
* Error types
*/
typedef enum urj_error {
URJ_ERROR_OK = 0,
URJ_ERROR_ALREADY,
URJ_ERROR_OUT_OF_MEMORY,
URJ_ERROR_NO_ACTIVE_PART,
URJ_ERROR_INVALID,
URJ_ERROR_NOTFOUND,
} urj_error_t;
/** Max length of message string that can be recorded. */
#define URJ_ERROR_MSG_LEN 256
/**
* Error state.
*/
typedef struct urj_error_state {
urj_error_t errnum; /**< error number */
const char *file; /**< file where error is set */
const char *function; /**< function --,,-- */
int line; /**< line no --,,-- */
char msg[URJ_ERROR_MSG_LEN]; /**< printf-style message */
} urj_error_state_t;
extern urj_error_state_t urj_error_state;
/**
* Set error state. The macro interface allows for a stack of errors, where
* this macro would push an error. The implementation is free to maintain
* a stack of depth one.
*
* @param e urj_error_t value
* @param ... consists of a printf argument set. It needs to start with a
* const char *fmt, followed by arguments used by fmt.
*/
#define urj_error_set(e, ...) \
do { \
urj_error_state.errnum = e; \
urj_error_state.file = __FILE__; \
urj_error_state.function = __func__; \
urj_error_state.line = __LINE__; \
snprintf(urj_error_state.msg, sizeof urj_error_state.msg, __VA_ARGS__); \
} while (0)
/**
* The top of the error stack. The caller must not modify the returned struct.
*/
const urj_error_state_t *urj_error_get(void);
/**
* Pop the top off the error stack.
* @return #URJ_ERROR_OK if the bottom of the error stack is reached
*/
urj_error_t urj_error_get_reset(void);
/**
* The top of the error state in human-readable form.
*
* This function is not reentrant.
*
* @return a pointer to a static area.
*/
const char *urj_error_describe(void);
#endif /* URJ_ERROR_H */

@ -0,0 +1,48 @@
/*
* $Id: urjtag.h 1525 2009-04-23 15:56:49Z rfhh $
*
* Global opaque types that had better be predefined
* Copyright (C) 2009, Rutger Hofman
*
* 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.
*
* Author: Rutger Hofman, VU Amsterdam
*
*/
#ifndef URJ_URJ_TYPES_H
#define URJ_URJ_TYPES_H
typedef struct urj_bus urj_bus_t;
typedef struct urj_bus_driver urj_bus_driver_t;
typedef struct urj_chain urj_chain_t;
typedef struct urj_cable urj_cable_t;
typedef struct urj_usbconn urj_usbconn_t;
typedef struct urj_parport urj_parport_t;
typedef struct urj_part urj_part_t;
typedef struct urj_parts urj_parts_t;
typedef struct urj_part_signal urj_part_signal_t;
typedef struct urj_part_salias urj_part_salias_t;
typedef struct urj_part_instruction urj_part_instruction_t;
typedef struct urj_data_register urj_data_register_t;
typedef struct urj_bsbit urj_bsbit_t;
typedef struct urj_tap_register urj_tap_register_t;
#define URJ_STATUS_OK 0
#define URJ_STATUS_FAIL 1
#define URJ_STATUS_SYNTAX_ERROR (-1)
#endif /* URJ_URJ_TYPES_H */

@ -0,0 +1,58 @@
/*
* $Id: urjtag.h 1525 2009-04-23 15:56:49Z rfhh $
*
* Public include file for the UrJTAG library.
* Copyright (C) 2009, Rutger Hofman
*
* 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.
*
* Author: Rutger Hofman, VU Amsterdam
*
*/
#ifndef URJ_URJTAG_H
#define URJ_URJTAG_H
#include "types.h"
#include "bitmask.h"
#include "bsbit.h"
#include "bsdl.h"
#include "bsdl_mode.h"
#include "bssignal.h"
#include "bus.h"
#include "bus_driver.h"
#include "cable.h"
#include "chain.h"
#include "cmd.h"
#include "data_register.h"
#include "fclock.h"
#include "flash.h"
#include "gettext.h"
#include "jim.h"
#include "jtag.h"
#include "parport.h"
#include "part.h"
#include "part_instruction.h"
#include "pod.h"
#include "svf.h"
#include "tap.h"
#include "tap_register.h"
#include "tap_state.h"
#include "urjtag.h"
#include "usbconn.h"
#include "xpcu.h"
#endif /* URJ_URJTAG_H */

@ -33,8 +33,10 @@
#include "sysdep.h"
#include "jtag.h"
#include "cmd.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/jtag.h>
#include <urjtag/cmd.h>
//#include "bsdl_local.h"
#include "bsdl_types.h"

@ -29,8 +29,8 @@
#include <stdio.h>
#include <string.h>
#include <jtag.h>
#include <cmd.h>
#include <urjtag/jtag.h>
#include <urjtag/cmd.h>
#include "bsdl_sysdep.h"

@ -28,7 +28,7 @@
#include "bsdl_config.h"
#include "gettext.h"
#include <urjtag/gettext.h>
#define _(s) gettext(s)
#define N_(s) gettext_noop(s)
#define P_(s,p,n) ngettext(s,p,n)

@ -25,8 +25,8 @@
#ifndef URJ_BSDL_TYPES_H
#define URJ_BSDL_TYPES_H
#include <jtag.h>
#include <bsdl_mode.h>
#include <urjtag/jtag.h>
#include <urjtag/bsdl_mode.h>
/* private data of the flex scanner
handled internally in bsdl_flex.l as yyextra */

@ -128,6 +128,8 @@ LEGAL NOTICES:
#include <stdio.h>
#include <ctype.h>
#include <urjtag/part.h>
#include "bsdl_sysdep.h"
#include "bsdl_types.h"

@ -33,11 +33,12 @@
#include <stdint.h>
#include <stdlib.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -31,15 +31,17 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/part_instruction.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/data_register.h>
#include <urjtag/tap.h>
#include "buses.h"
#include "generic_bus.h"
#include "data_register.h"
#include "tap.h"
typedef struct
{

@ -29,11 +29,12 @@
#include <stdint.h>
#include <stdlib.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -28,11 +28,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -30,14 +30,15 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/tap_state.h>
#include "buses.h"
#include "generic_bus.h"
#include "tap_state.h"
typedef struct

@ -24,9 +24,11 @@
#include "sysdep.h"
#include <stdio.h>
#include <stdlib.h>
#include "bus.h"
#include <urjtag/bus.h>
#include "buses.h"
const urj_bus_driver_t *urj_bus_drivers[] = {

@ -33,14 +33,17 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/tap_state.h>
#include <urjtag/tap_register.h>
#include <urjtag/data_register.h>
#include "buses.h"
#include "generic_bus.h"
#include "tap_state.h"
typedef struct
{

@ -40,14 +40,17 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/tap_state.h>
#include <urjtag/tap_register.h>
#include <urjtag/data_register.h>
#include "buses.h"
#include "generic_bus.h"
#include "tap_state.h"
typedef struct
{

@ -28,15 +28,17 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/jtag.h>
#include <urjtag/cmd.h>
#include <urjtag/tap.h>
#include <urjtag/data_register.h>
#include <urjtag/part_instruction.h>
#include "buses.h"
#include "generic_bus.h"
#include "cmd.h"
#include "tap.h"
#undef DEBUG

@ -26,7 +26,9 @@
#include <stdlib.h>
#include <jtag.h>
#include <urjtag/part.h>
#include <urjtag/chain.h>
#include <urjtag/jtag.h>
#include "generic_bus.h"

@ -25,7 +25,7 @@
#ifndef URJ_BUS_GENERIC_BUS_H
#define URJ_BUS_GENERIC_BUS_H
#include "bus.h"
#include <urjtag/bus.h>
int urj_bus_generic_attach_sig (urj_part_t *part, urj_part_signal_t **sig,
char *id);

@ -29,11 +29,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -60,14 +60,15 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/tap_state.h>
#include "buses.h"
#include "generic_bus.h"
#include "tap_state.h"
#define RAM_ADDR_WIDTH 18
#define RAM_DATA_WIDTH 16

@ -38,11 +38,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -33,10 +33,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -33,10 +33,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/chain.h>
#include <urjtag/bus.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -26,11 +26,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -25,11 +25,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -36,13 +36,15 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/tap_state.h>
#include "buses.h"
#include "generic_bus.h"
#include "tap_state.h"
#include "pxa2x0_mc.h"

@ -45,7 +45,7 @@
#ifndef PXA2X0_MC_H
#define PXA2X0_MC_H
#include <bitmask.h>
#include <urjtag/bitmask.h>
#ifndef __ASSEMBLY__
#include <stdint.h>

@ -32,15 +32,10 @@
#include <stdint.h>
#include <string.h>
#ifdef UNUSED /* RFHH */
#include <flash/cfi.h>
#include <flash/intel.h>
#include <flash/mic.h>
#endif
#include "bus.h"
#include "flash.h"
#include "jtag.h"
#include <urjtag/bus.h>
#include <urjtag/flash.h>
#include <urjtag/jtag.h>
void
urj_bus_readmem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len)

@ -58,14 +58,15 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/tap_state.h>
#include "buses.h"
#include "generic_bus.h"
#include "tap_state.h"
#ifndef DEBUG_LVL2

@ -32,11 +32,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdlib.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdlib.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -29,11 +29,12 @@
#include <stdlib.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -33,10 +33,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -32,10 +32,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -30,11 +30,12 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "buses.h"
#include "generic_bus.h"

@ -25,15 +25,10 @@
#include <stdint.h>
#include <string.h>
#ifdef UNUSED /* RFHH */
#include <flash/cfi.h>
#include <flash/intel.h>
#include <flash/mic.h>
#endif
#include "bus.h"
#include "flash.h"
#include "jtag.h"
#include <urjtag/bus.h>
#include <urjtag/flash.h>
#include <urjtag/jtag.h>
void
urj_bus_writemem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len)

@ -60,14 +60,15 @@
#include <stdint.h>
#include <string.h>
#include "part.h"
#include "bus.h"
#include "chain.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/chain.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include <urjtag/tap_state.h>
#include "buses.h"
#include "generic_bus.h"
#include "tap_state.h"
/* EEPROM commands */
#define EEPROM_CMD_WREN 0x06

@ -25,11 +25,11 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include "chain.h"
#include "bus.h"
#include <urjtag/jtag.h>
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_addpart_run (urj_chain_t *chain, char *params[])

@ -28,9 +28,10 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include <urjtag/bsbit.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static void
cmd_bit_print_params (char *params[], unsigned int parameters, char *command,
@ -50,13 +51,12 @@ cmd_bit_print_params (char *params[], unsigned int parameters, char *command,
static int
cmd_bit_run (urj_chain_t *chain, char *params[])
{
urj_part_t *part;
urj_data_register_t *bsr;
unsigned int bit;
int type;
int safe;
unsigned int control;
unsigned int parameters = urj_cmd_params (params);
urj_bsbit_t *bsbit;
char command[1024];
cmd_bit_print_params (params, parameters, command, sizeof command);
@ -75,28 +75,6 @@ cmd_bit_run (urj_chain_t *chain, char *params[])
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"), "bit");
return 1;
}
part = chain->parts->parts[chain->active_part];
bsr = urj_part_find_data_register (part, "BSR");
if (bsr == NULL)
{
printf (_
("%s: missing Boundary Scan Register (BSR) for command '%s'\n"),
"bit", command);
return 1;
}
/* bit number */
if (urj_cmd_get_number (params[1], &bit))
{
@ -105,19 +83,6 @@ cmd_bit_run (urj_chain_t *chain, char *params[])
return -1;
}
if (bit >= bsr->in->len)
{
printf (_("%s: invalid boundary bit number for command '%s'\n"),
"bit", command);
return 1;
}
if (part->bsbits[bit] != NULL)
{
printf (_("%s: duplicate bit declaration for command '%s'\n"), "bit",
command);
return 1;
}
/* bit type */
if (strlen (params[2]) != 1)
{
@ -159,53 +124,50 @@ cmd_bit_run (urj_chain_t *chain, char *params[])
"bit", command);
return -1;
}
safe = (params[3][0] == '1');
bsr->in->data[bit] = safe;
/* allocate bsbit */
part->bsbits[bit] =
urj_part_bsbit_alloc (bit, params[4], type,
urj_part_find_signal (part, params[4]), safe);
if (part->bsbits[bit] == NULL)
{
printf (_("%s: out of memory for command '%s'\n"), "bit", command);
return 1;
}
/* test for control bit */
if (urj_cmd_params (params) == 5)
return 1;
/* control bit number */
if (urj_cmd_get_number (params[5], &control))
{
printf (_("%s: unable to get control bit number for command '%s'\n"),
"bit", command);
return -1;
}
if (control >= bsr->in->len)
{
printf (_("%s: invalid control bit number for command '%s'\n"), "bit",
command);
return 1;
if (urj_cmd_params (params) == 5) {
bsbit = urj_part_bsbit_alloc (chain, bit, params[4], type, safe);
if (bsbit == NULL)
{
return -1;
}
} else {
int control_value;
int control_state;
/* control bit number */
if (urj_cmd_get_number (params[5], &control))
{
printf (_("%s: unable to get control bit number for command '%s'\n"),
"bit", command);
return -1;
}
/* control value */
if (strlen (params[6]) != 1)
{
printf (_("%s: invalid control value length for command '%s'\n"),
"bit", command);
return -1;
}
control_value = (params[6][0] == '1');
/* control state */
if (strcasecmp (params[7], "Z"))
return -1;
control_state = URJ_BSBIT_STATE_Z;
bsbit = urj_part_bsbit_alloc_control (chain, bit, params[4], type, safe,
control, control_value,
control_state);
if (bsbit == NULL)
{
return -1;
}
}
part->bsbits[bit]->control = control;
/* control value */
if (strlen (params[6]) != 1)
{
printf (_("%s: invalid control value length for command '%s'\n"),
"bit", command);
return -1;
}
part->bsbits[bit]->control_value = (params[6][0] == '1') ? 1 : 0;
/* control state */
if (strcasecmp (params[7], "Z"))
return -1;
part->bsbits[bit]->control_state = URJ_BSBIT_STATE_Z;
return 1;
}

@ -28,9 +28,9 @@
#include <stdio.h>
#include <string.h>
#include "bsdl.h"
#include "chain.h"
#include "cmd.h"
#include <urjtag/bsdl.h>
#include <urjtag/chain.h>
#include <urjtag/cmd.h>
static int
cmd_bsdl_run (urj_chain_t *chain, char *params[])

@ -27,9 +27,10 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include <urjtag/bus.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_bus_run (urj_chain_t *chain, char *params[])

@ -28,14 +28,14 @@
#include <string.h>
#include <stdlib.h>
#include "parport.h"
#include "tap.h"
#include "cable.h"
#include "chain.h"
#include "jtag.h"
#include "bus.h"
#include "cmd.h"
#include <urjtag/parport.h>
#include <urjtag/tap.h>
#include <urjtag/cable.h>
#include <urjtag/chain.h>
#include <urjtag/jtag.h>
#include <urjtag/bus.h>
#include <urjtag/cmd.h>
static int
cmd_cable_run (urj_chain_t *chain, char *params[])

@ -27,9 +27,9 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
extern urj_cmd_t urj_cmd_quit;
extern urj_cmd_t urj_cmd_help;
@ -155,6 +155,7 @@ urj_cmd_run (urj_chain_t *chain, char *params[])
if (strcasecmp (urj_cmds[i]->name, params[0]) == 0)
{
int r;
run_cmd:
r = urj_cmds[i]->run (chain, params);
if (r < 0)

@ -30,9 +30,9 @@
//#include <stdlib.h>
//#include "part.h"
//#include "bssignal.h"
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_debug_run (urj_chain_t *chain, char *params[])

@ -27,11 +27,12 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include "chain.h"
#include "bus.h"
#include <urjtag/jtag.h>
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_detect_run (urj_chain_t *chain, char *params[])

@ -26,9 +26,9 @@
#include <stdio.h>
#include <jtag.h>
#include <flash.h>
#include <cmd.h>
#include <urjtag/jtag.h>
#include <urjtag/flash.h>
#include <urjtag/cmd.h>
static int
cmd_detectflash_run (urj_chain_t *chain, char *params[])

@ -26,9 +26,9 @@
#include <stdio.h>
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_discovery_run (urj_chain_t *chain, char *params[])

@ -27,10 +27,14 @@
#include <stdio.h>
#include <string.h>
#include "tap_register.h"
#include "jtag.h"
#include "cmd.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/part_instruction.h>
#include <urjtag/data_register.h>
#include <urjtag/tap_register.h>
#include <urjtag/jtag.h>
#include <urjtag/cmd.h>
static int
cmd_dr_run (urj_chain_t *chain, char *params[])

@ -27,9 +27,9 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_endian_run (urj_chain_t *chain, char *params[])

@ -28,10 +28,10 @@
#include <stdint.h>
#include <string.h>
#include "jtag.h"
#include "flash.h"
#include <urjtag/jtag.h>
#include <urjtag/flash.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_eraseflash_run (urj_chain_t *chain, char *params[])

@ -28,10 +28,10 @@
#include <stdint.h>
#include <string.h>
#include "jtag.h"
#include "flash.h"
#include <urjtag/jtag.h>
#include <urjtag/flash.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_flashmem_run (urj_chain_t *chain, char *params[])

@ -26,10 +26,10 @@
#include <stdio.h>
#include "cable.h"
#include "jtag.h"
#include <urjtag/cable.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_frequency_run (urj_chain_t *chain, char *params[])

@ -27,11 +27,11 @@
#include <stdio.h>
#include <string.h>
#include "part.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_get_run (urj_chain_t *chain, char *params[])

@ -27,7 +27,7 @@
#include <stdio.h>
#include <string.h>
#include <cmd.h>
#include <urjtag/cmd.h>
static int
cmd_help_run (urj_chain_t *chain, char *params[])

@ -25,9 +25,9 @@
#include <stdio.h>
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_idcode_run (urj_chain_t *chain, char *params[])

@ -29,10 +29,10 @@
#include <stdlib.h>
#include <string.h>
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include "bsdl.h"
#include <urjtag/cmd.h>
#include <urjtag/bsdl.h>
static int
cmd_include_or_script_run (urj_chain_t *chain, int is_include, char *params[])

@ -28,8 +28,11 @@
#include <stdlib.h>
#include <string.h>
#include "cmd.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/cmd.h>
#include <urjtag/jtag.h>
static int
cmd_initbus_run (urj_chain_t *chain, char *params[])

@ -27,10 +27,10 @@
#include <stdio.h>
#include <string.h>
#include "part.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_instruction_run (urj_chain_t *chain, char *params[])
@ -70,50 +70,19 @@ cmd_instruction_run (urj_chain_t *chain, char *params[])
if (strcasecmp (params[1], "length") != 0)
return -1;
if (part->instructions != NULL)
{
printf (_("instruction length is already set and used\n"));
return 1;
}
if (urj_cmd_get_number (params[2], &len))
return -1;
part->instruction_length = len;
return 1;
return urj_part_instruction_length_set (part, len);
}
if (urj_cmd_params (params) == 4)
{
urj_part_instruction_t *i;
if (strlen (params[2]) != part->instruction_length)
{
printf (_("invalid instruction length\n"));
return 1;
}
if (urj_part_find_instruction (part, params[1]) != NULL)
{
printf (_("Instruction '%s' already defined\n"), params[1]);
return 1;
}
i = urj_part_instruction_alloc (params[1], part->instruction_length,
params[2]);
i = urj_part_instruction_define (part, params[1], params[2], params[3]);
if (!i)
{
printf (_("out of memory\n"));
return 1;
}
i->next = part->instructions;
part->instructions = i;
i->data_register = urj_part_find_data_register (part, params[3]);
if (i->data_register == NULL)
{
printf (_("unknown data register '%s'\n"), params[3]);
return 1;
}

@ -6,7 +6,7 @@
*/
#include <config.h>
#include "jtag.h"
#include <urjtag/jtag.h>
static const char *jtag_argv0;

@ -31,9 +31,9 @@
#include <string.h>
#include <ctype.h>
#include "chain.h"
#include "cmd.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/cmd.h>
#include <urjtag/jtag.h>
#define MAXINPUTLINE 100 /* Maximum input line length */
@ -54,7 +54,7 @@ urj_cmd_jtag_parse_line (urj_chain_t *chain, char *line)
return 1;
/* allocate as many chars as in the input line; this will be enough in all cases */
sline = malloc ((l + 1) * sizeof (char));
sline = malloc (l + 1);
if (sline == NULL)
{
printf (_("Out of memory\n"));

@ -28,9 +28,11 @@
#include <string.h>
#include <stdlib.h>
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_part_run (urj_chain_t *chain, char *params[])

@ -27,9 +27,10 @@
#include <stdio.h>
#include <stdint.h>
#include "jtag.h"
#include <urjtag/bus.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_peek_run (urj_chain_t *chain, char *params[])

@ -30,10 +30,10 @@
#include <stdlib.h>
#include <string.h>
#include "jtag.h"
#include <cable.h>
#include <urjtag/jtag.h>
#include <urjtag/cable.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_pod_run (urj_chain_t *chain, char *params[])

@ -38,10 +38,16 @@ typedef char wchar_t;
# define wcslen(str) strlen(str)
#endif
#include "part.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/bus.h>
#include <urjtag/data_register.h>
#include <urjtag/part_instruction.h>
#include <urjtag/bssignal.h>
#include <urjtag/bsbit.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_print_run (urj_chain_t *chain, char *params[])

@ -26,7 +26,7 @@
#include <stdio.h>
#include <cmd.h>
#include <urjtag/cmd.h>
static int
cmd_quit_run (urj_chain_t *chain, char *params[])

@ -27,9 +27,9 @@
#include <stdio.h>
#include <stdint.h>
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_readmem_run (urj_chain_t *chain, char *params[])

@ -28,9 +28,13 @@
#include <stdlib.h>
#include <string.h>
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/data_register.h>
#include <urjtag/tap_register.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_register_run (urj_chain_t *chain, char *params[])

@ -27,10 +27,10 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include "tap.h"
#include <urjtag/jtag.h>
#include <urjtag/tap.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_reset_run (urj_chain_t *chain, char *params[])

@ -28,9 +28,12 @@
#include <stdlib.h>
#include <string.h>
#include "jtag.h"
#include "urjtag/chain.h"
#include "urjtag/part.h"
#include "urjtag/bssignal.h"
#include "urjtag/jtag.h"
#include "cmd.h"
#include "urjtag/cmd.h"
static int
cmd_salias_run (urj_chain_t *chain, char *params[])

@ -28,9 +28,15 @@
#include <stdlib.h>
#include <string.h>
#include "jtag.h"
#include "cmd.h"
#include <urjtag/chain.h>
#include <urjtag/part.h>
#include <urjtag/tap_register.h>
#include <urjtag/data_register.h>
#include <urjtag/bssignal.h>
#include <urjtag/bsbit.h>
#include <urjtag/jtag.h>
#include <urjtag/cmd.h>
static int
cmd_scan_run (urj_chain_t *chain, char *params[])

@ -27,11 +27,11 @@
#include <stdio.h>
#include <string.h>
#include "part.h"
#include "bssignal.h"
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_set_run (urj_chain_t *chain, char *params[])

@ -30,11 +30,11 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include "part.h"
//#include "bssignal.h"
#include "jtag.h"
//#include <urjtag/part.h>
//#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_shell_run (urj_chain_t *chain, char *params[])

@ -27,10 +27,10 @@
#include <stdio.h>
#include <string.h>
#include "chain.h"
#include "jtag.h"
#include <urjtag/chain.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_shift_run (urj_chain_t *chain, char *params[])

@ -28,9 +28,11 @@
#include <stdlib.h>
#include <string.h>
#include "jtag.h"
#include <urjtag/part.h>
#include <urjtag/bssignal.h>
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_signal_run (urj_chain_t *chain, char *params[])
@ -42,37 +44,22 @@ cmd_signal_run (urj_chain_t *chain, char *params[])
if ((i = urj_cmd_params (params)) < 2)
return -1;
if (!urj_cmd_test_cable (chain))
return 1;
if (!chain->parts)
part = urj_part_active_part (chain);
if (part == NULL)
{
printf (_("Run \"detect\" first.\n"));
return 1;
}
if (chain->active_part >= chain->parts->len)
{
printf (_("%s: no active part\n"), "signal");
return 1;
}
part = chain->parts->parts[chain->active_part];
if ((s = urj_part_find_signal (part, params[1])) != NULL)
{
if (i == 3)
{
printf ("Defining pin for signal %s\n", s->name);
if (s->pin)
free (s->pin); /* erase old */
/* Allocate the space for the pin number & copy it */
s->pin = malloc (strlen (params[2]) + 1);
strcpy (s->pin, params[2]);
return 1;
return urj_part_signal_redefine_pin(chain, s, params[2]);
}
else
{
@ -81,25 +68,18 @@ cmd_signal_run (urj_chain_t *chain, char *params[])
}
}
s = urj_part_signal_alloc (params[1]);
if (i == 3)
{ /* Add pin number */
/* Allocate the space for the pin number & copy it */
s->pin = malloc (strlen (params[2]) + 1);
strcpy (s->pin, params[2]);
s = urj_part_signal_define_pin(chain, params[1], params[2]);
}
if (!s)
else
{
printf (_("out of memory\n"));
s = urj_part_signal_define(chain, params[1]);
}
if (s == NULL) {
return 1;
}
s->next = part->signals;
part->signals = s;
return 1;
}

@ -25,12 +25,13 @@
#include "sysdep.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <svf.h>
#include <cmd.h>
#include <urjtag/svf.h>
#include <urjtag/cmd.h>
static int
cmd_svf_run (urj_chain_t *chain, char *params[])

@ -28,11 +28,11 @@
#include <stdio.h>
#include <string.h>
//#include <stdlib.h>
#include "part.h"
#include "bssignal.h"
#include "jtag.h"
#include "urjtag/part.h"
#include "urjtag/bssignal.h"
#include "urjtag/jtag.h"
#include "cmd.h"
#include "urjtag/cmd.h"
static int
cmd_test_run (urj_chain_t *chain, char *params[])

@ -29,8 +29,8 @@
#include <stdio.h>
#include <string.h>
#include "jtag.h"
#include "cmd.h"
#include <urjtag/jtag.h>
#include <urjtag/cmd.h>
static int
cmd_usleep_run (urj_chain_t *chain, char *params[])

@ -25,9 +25,9 @@
#include <stdio.h>
#include <stdint.h>
#include "jtag.h"
#include <urjtag/jtag.h>
#include "cmd.h"
#include <urjtag/cmd.h>
static int
cmd_writemem_run (urj_chain_t *chain, char *params[])

@ -38,12 +38,12 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <intel.h>
#include <unistd.h>
#include <flash.h>
#include <bus.h>
#include <urjtag/flash.h>
#include <urjtag/bus.h>
#include "intel.h"
#include "cfi.h"
static int dbg = 0;

@ -34,9 +34,9 @@
#include <stdio.h>
#include <unistd.h>
#include <jtag.h>
#include <flash.h>
#include <bus.h>
#include <urjtag/jtag.h>
#include <urjtag/flash.h>
#include <urjtag/bus.h>
#include "jedec.h"
#include "cfi.h"

@ -33,9 +33,9 @@
#include <stdint.h>
#include <stdlib.h>
#include <jtag.h>
#include <flash.h>
#include <bus.h>
#include <urjtag/jtag.h>
#include <urjtag/flash.h>
#include <urjtag/bus.h>
#include "cfi.h"

@ -33,8 +33,8 @@
#include <stdint.h>
#include <string.h>
#include <flash.h>
#include <bus.h>
#include <urjtag/flash.h>
#include <urjtag/bus.h>
#include "jedec.h"
#include "cfi.h"

@ -39,12 +39,12 @@
#include <stdlib.h>
#include <string.h>
#include <cfi.h>
#include <intel.h>
#include "cfi.h"
#include "intel.h"
#include "bus.h"
#include "flash.h"
#include "jtag.h"
#include <urjtag/bus.h>
#include <urjtag/flash.h>
#include <urjtag/jtag.h>
extern urj_flash_driver_t urj_flash_amd_32_flash_driver;
extern urj_flash_driver_t urj_flash_amd_16_flash_driver;

@ -41,9 +41,9 @@
#include <stdlib.h>
#include <string.h>
#include <jtag.h>
#include <flash.h>
#include <bus.h>
#include <urjtag/jtag.h>
#include <urjtag/flash.h>
#include <urjtag/bus.h>
#include "cfi.h"
#include "intel.h"

@ -40,7 +40,7 @@
#ifndef FLASH_INTEL_H
#define FLASH_INTEL_H
#include <bitmask.h>
#include <urjtag/bitmask.h>
/* Intel CFI commands - see Table 4. in [1] and Table 3. in [2] */

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save