From a6e31a3b1bfe7f439bf2ea73d9af19b8c7b0aeb0 Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Fri, 1 May 2009 12:48:51 +0000 Subject: [PATCH] Trying to restore the mv i.s.o. the delete/add: Step II -- does not compile git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1543 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/include/urjtag/bitmask.h | 65 +++++++++ urjtag/include/urjtag/bsbit.h | 56 ++++++++ urjtag/include/urjtag/bsdl.h | 48 +++++++ urjtag/include/urjtag/bsdl_mode.h | 66 +++++++++ urjtag/include/urjtag/bssignal.h | 58 ++++++++ urjtag/include/urjtag/bus.h | 46 +++++++ urjtag/include/urjtag/bus_driver.h | 92 +++++++++++++ urjtag/include/urjtag/cable.h | 165 +++++++++++++++++++++++ urjtag/include/urjtag/chain.h | 77 +++++++++++ urjtag/include/urjtag/cmd.h | 54 ++++++++ urjtag/include/urjtag/data_register.h | 45 +++++++ urjtag/include/urjtag/fclock.h | 55 ++++++++ urjtag/include/urjtag/flash.h | 103 ++++++++++++++ urjtag/include/urjtag/gettext.h | 69 ++++++++++ urjtag/include/urjtag/jim.h | 131 ++++++++++++++++++ urjtag/include/urjtag/jtag.h | 67 +++++++++ urjtag/include/urjtag/parport.h | 64 +++++++++ urjtag/include/urjtag/part.h | 87 ++++++++++++ urjtag/include/urjtag/part_instruction.h | 48 +++++++ urjtag/include/urjtag/pod.h | 41 ++++++ urjtag/include/urjtag/svf.h | 32 +++++ urjtag/include/urjtag/tap.h | 45 +++++++ urjtag/include/urjtag/tap_register.h | 53 ++++++++ urjtag/include/urjtag/tap_state.h | 66 +++++++++ urjtag/include/urjtag/usbconn.h | 72 ++++++++++ urjtag/include/urjtag/xpcu.h | 49 +++++++ 26 files changed, 1754 insertions(+) create mode 100644 urjtag/include/urjtag/bitmask.h create mode 100644 urjtag/include/urjtag/bsbit.h create mode 100644 urjtag/include/urjtag/bsdl.h create mode 100644 urjtag/include/urjtag/bsdl_mode.h create mode 100644 urjtag/include/urjtag/bssignal.h create mode 100644 urjtag/include/urjtag/bus.h create mode 100644 urjtag/include/urjtag/bus_driver.h create mode 100644 urjtag/include/urjtag/cable.h create mode 100644 urjtag/include/urjtag/chain.h create mode 100644 urjtag/include/urjtag/cmd.h create mode 100644 urjtag/include/urjtag/data_register.h create mode 100644 urjtag/include/urjtag/fclock.h create mode 100644 urjtag/include/urjtag/flash.h create mode 100644 urjtag/include/urjtag/gettext.h create mode 100644 urjtag/include/urjtag/jim.h create mode 100644 urjtag/include/urjtag/jtag.h create mode 100644 urjtag/include/urjtag/parport.h create mode 100644 urjtag/include/urjtag/part.h create mode 100644 urjtag/include/urjtag/part_instruction.h create mode 100644 urjtag/include/urjtag/pod.h create mode 100644 urjtag/include/urjtag/svf.h create mode 100644 urjtag/include/urjtag/tap.h create mode 100644 urjtag/include/urjtag/tap_register.h create mode 100644 urjtag/include/urjtag/tap_state.h create mode 100644 urjtag/include/urjtag/usbconn.h create mode 100644 urjtag/include/urjtag/xpcu.h diff --git a/urjtag/include/urjtag/bitmask.h b/urjtag/include/urjtag/bitmask.h new file mode 100644 index 00000000..59917021 --- /dev/null +++ b/urjtag/include/urjtag/bitmask.h @@ -0,0 +1,65 @@ +/* + * $Id$ + * + * Common header file + * Copyright (C) 2002 ETC s.r.o. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the ETC s.r.o. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Written by Marcel Telka , 2002. + * + */ + +#ifndef URJ_BITMASK_H +#define URJ_BITMASK_H + +#ifdef UNUSED /* RFHH */ +#ifndef LANGUAGE +# ifdef __ASSEMBLY__ +# define LANGUAGE ASM +# else +# define LANGUAGE C +# endif +#endif + +#ifndef ASM +#define ASM 0 +#endif + +#ifndef C +#define C 1 +#endif +#endif /* def UNUSED */ + +#define URJ_MAX_BITS_ABS_VAL 1024 +#define URJ_BITS_ABS(a) (((((a) + URJ_MAX_BITS_ABS_VAL) / URJ_MAX_BITS_ABS_VAL) * 2 - 1) * (a)) +#define URJ_BITS_MIN(a,b) (((a) + (b) - URJ_BITS_ABS((a) - (b))) / 2) + +#define URJ_BIT(b) (1 << (b)) +#define URJ_BITS(b1,b2) (((2 << URJ_BITS_ABS((b1) - (b2))) - 1) << URJ_BITS_MIN(b1,b2)) +#define URJ_BITS_VAL(b1,b2,v) (((v) << URJ_BITS_MIN(b1,b2)) & URJ_BITS (b1,b2)) +#define URJ_BITS_GET(b1,b2,v) (((v) & URJ_BITS (b1,b2)) >> URJ_BITS_MIN(b1,b2)) + +#endif /* URJ_BITMASK_H */ diff --git a/urjtag/include/urjtag/bsbit.h b/urjtag/include/urjtag/bsbit.h new file mode 100644 index 00000000..1352fb7f --- /dev/null +++ b/urjtag/include/urjtag/bsbit.h @@ -0,0 +1,56 @@ +/* + * $Id$ + * + * 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 + * 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 , 2002. + * + */ + +#ifndef URJ_BSBIT_BSBIT_H +#define URJ_BSBIT_BSBIT_H + +typedef struct urj_bsbit urj_bsbit_t; + +#include "bssignal.h" + +#define URJ_BSBIT_INPUT 1 +#define URJ_BSBIT_OUTPUT 2 +#define URJ_BSBIT_CONTROL 3 +#define URJ_BSBIT_INTERNAL 4 +#define URJ_BSBIT_BIDIR 5 + +#define URJ_BSBIT_STATE_Z (-1) + +struct urj_bsbit +{ + int bit; + char *name; + int type; + urj_part_signal_t *signal; + int safe; /* safe value */ + int control; /* -1 for none */ + int control_value; + int control_state; +}; + +urj_bsbit_t *urj_part_bsbit_alloc (int bit, const char *name, int type, + urj_part_signal_t *signal, int safe); +void urj_part_bsbit_free (urj_bsbit_t *b); + +#endif /* URJ_BSBIT_BSBIT_H */ diff --git a/urjtag/include/urjtag/bsdl.h b/urjtag/include/urjtag/bsdl.h new file mode 100644 index 00000000..baa10b5e --- /dev/null +++ b/urjtag/include/urjtag/bsdl.h @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * Copyright (C) 2007, 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 , 2007. + * + */ + +#ifndef URJ_BSDL_BSDL_H +#define URJ_BSDL_BSDL_H + +#include + +typedef struct +{ + char **path_list; + int debug; +} urj_bsdl_globs_t; + +#define URJ_BSDL_GLOBS_INIT(bsdl) \ + do { \ + bsdl.path_list = NULL; \ + bsdl.debug = 0; \ + } while (0) + +#include "chain.h" + +int urj_bsdl_read_file (urj_chain_t *, const char *, int, const char *); +void urj_bsdl_set_path (urj_chain_t *, const char *); +int urj_bsdl_scan_files (urj_chain_t *, const char *, int); + +#endif /* URJ_BSDL_BSDL_H */ diff --git a/urjtag/include/urjtag/bsdl_mode.h b/urjtag/include/urjtag/bsdl_mode.h new file mode 100644 index 00000000..09800820 --- /dev/null +++ b/urjtag/include/urjtag/bsdl_mode.h @@ -0,0 +1,66 @@ +/* + * $Id$ + * + * Copyright (C) 2008, 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 , 2008. + * + */ + +#ifndef URJ_BSDL_MODE_H +#define URJ_BSDL_MODE_H + +#define URJ_BSDL_MODE_MSG_NOTE (1 << 0) +#define URJ_BSDL_MODE_MSG_WARN (1 << 1) +#define URJ_BSDL_MODE_MSG_ERR (1 << 2) +#define URJ_BSDL_MODE_MSG_FATAL (1 << 3) + +#define URJ_BSDL_MODE_MSG_ALL (URJ_BSDL_MODE_MSG_FATAL | \ + URJ_BSDL_MODE_MSG_ERR | \ + URJ_BSDL_MODE_MSG_WARN | \ + URJ_BSDL_MODE_MSG_NOTE) +#define URJ_BSDL_MODE_MSG_ALWAYS URJ_BSDL_MODE_MSG_FATAL + +#define URJ_BSDL_MODE_SYN_CHECK (1 << 4) +#define URJ_BSDL_MODE_INSTR_PRINT (1 << 5) +#define URJ_BSDL_MODE_INSTR_EXEC (1 << 6) +#define URJ_BSDL_MODE_IDCODE_CHECK (1 << 7) +#define URJ_BSDL_MODE_ACTION_ALL (URJ_BSDL_MODE_SYN_CHECK | \ + URJ_BSDL_MODE_INSTR_PRINT | \ + URJ_BSDL_MODE_INSTR_EXEC | \ + URJ_BSDL_MODE_IDCODE_CHECK) + +#define URJ_BSDL_MODE_INCLUDE1 (URJ_BSDL_MODE_MSG_ALWAYS) +#define URJ_BSDL_MODE_INCLUDE2 (URJ_BSDL_MODE_SYN_CHECK | \ + URJ_BSDL_MODE_INSTR_EXEC | \ + URJ_BSDL_MODE_MSG_WARN | \ + URJ_BSDL_MODE_MSG_ERR | \ + URJ_BSDL_MODE_MSG_FATAL) +#define URJ_BSDL_MODE_DETECT (URJ_BSDL_MODE_SYN_CHECK | \ + URJ_BSDL_MODE_INSTR_EXEC | \ + URJ_BSDL_MODE_IDCODE_CHECK | \ + URJ_BSDL_MODE_MSG_ALWAYS) +#define URJ_BSDL_MODE_TEST (URJ_BSDL_MODE_SYN_CHECK | \ + URJ_BSDL_MODE_MSG_ALL) +#define URJ_BSDL_MODE_DUMP (URJ_BSDL_MODE_SYN_CHECK | \ + URJ_BSDL_MODE_INSTR_PRINT | \ + URJ_BSDL_MODE_MSG_WARN | \ + URJ_BSDL_MODE_MSG_ERR | \ + URJ_BSDL_MODE_MSG_FATAL) + +#endif /* URJ_BSDL_MODE_H */ diff --git a/urjtag/include/urjtag/bssignal.h b/urjtag/include/urjtag/bssignal.h new file mode 100644 index 00000000..016b5c7f --- /dev/null +++ b/urjtag/include/urjtag/bssignal.h @@ -0,0 +1,58 @@ +/* + * $Id$ + * + * Copyright (C) 2002 ETC s.r.o. + * Copyright (C) 2003 Marcel Telka + * + * 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 , 2002, 2003. + * + */ + +#ifndef URJ_BSSIGNAL_H +#define URJ_BSSIGNAL_H + +typedef struct urj_part_signal urj_part_signal_t; + +#include "bsbit.h" + +struct urj_part_signal +{ + char *name; + char *pin; /* djf hack pin number from bsdl */ + urj_part_signal_t *next; + urj_bsbit_t *input; + urj_bsbit_t *output; +}; + +typedef struct urj_part_salias urj_part_salias_t; + +struct urj_part_salias +{ + char *name; + urj_part_salias_t *next; + urj_part_signal_t *signal; +}; + +urj_part_signal_t *urj_part_signal_alloc (const char *name); +void urj_part_signal_free (urj_part_signal_t *s); + +urj_part_salias_t *urj_part_salias_alloc (const char *name, + const urj_part_signal_t *signal); +void urj_part_salias_free (urj_part_salias_t *salias); + +#endif /* URJ_BSSIGNAL_H */ diff --git a/urjtag/include/urjtag/bus.h b/urjtag/include/urjtag/bus.h new file mode 100644 index 00000000..61bd6448 --- /dev/null +++ b/urjtag/include/urjtag/bus.h @@ -0,0 +1,46 @@ +/* + * $Id$ + * + * Bus driver interface + * 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 + * 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 , 2002. + * + */ + +#ifndef URJ_BUS_H +#define URJ_BUS_H + +#include + +#include + +typedef struct +{ + int len; + urj_bus_t **buses; +} urj_buses_t; + +extern urj_buses_t urj_buses; +extern const urj_bus_driver_t *urj_bus_drivers[]; + +void urj_bus_buses_free (void); +void urj_bus_buses_add (urj_bus_t *abus); +void urj_bus_buses_delete (urj_bus_t *abus); + +#endif /* URJ_BUS_H */ diff --git a/urjtag/include/urjtag/bus_driver.h b/urjtag/include/urjtag/bus_driver.h new file mode 100644 index 00000000..7063c8eb --- /dev/null +++ b/urjtag/include/urjtag/bus_driver.h @@ -0,0 +1,92 @@ +/* + * $Id$ + * + * Bus driver interface + * Copyright (C) 2002, 2003 ETC s.r.o. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the ETC s.r.o. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Written by Marcel Telka , 2002, 2003. + * + */ + +#ifndef URJ_BUS_DRIVER_BRUX_BUS_H +#define URJ_BUS_DRIVER_BRUX_BUS_H + +#include + +#include "chain.h" + +typedef struct +{ + const char *description; + uint32_t start; + uint64_t length; + unsigned int width; +} urj_bus_area_t; + +typedef struct urj_bus urj_bus_t; +typedef struct urj_bus_driver urj_bus_driver_t; + +struct urj_bus_driver +{ + const char *name; + const char *description; + urj_bus_t *(*new_bus) (urj_chain_t *chain, + const urj_bus_driver_t *driver, + char *cmd_params[]); + void (*free_bus) (urj_bus_t *bus); + void (*printinfo) (urj_bus_t *bus); + void (*prepare) (urj_bus_t *bus); + int (*area) (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area); + void (*read_start) (urj_bus_t *bus, uint32_t adr); + uint32_t (*read_next) (urj_bus_t *bus, uint32_t adr); + uint32_t (*read_end) (urj_bus_t *bus); + uint32_t (*read) (urj_bus_t *bus, uint32_t adr); + void (*write) (urj_bus_t *bus, uint32_t adr, uint32_t data); + int (*init) (urj_bus_t *bus); +}; + +struct urj_bus +{ + urj_chain_t *chain; + urj_part_t *part; + void *params; + int initialized; + const urj_bus_driver_t *driver; +}; + +#define URJ_BUS_PRINTINFO(bus) (bus)->driver->printinfo(bus) +#define URJ_BUS_PREPARE(bus) (bus)->driver->prepare(bus) +#define URJ_BUS_AREA(bus,adr,a) (bus)->driver->area(bus,adr,a) +#define URJ_BUS_READ_START(bus,adr) (bus)->driver->read_start(bus,adr) +#define URJ_BUS_READ_NEXT(bus,adr) (bus)->driver->read_next(bus,adr) +#define URJ_BUS_READ_END(bus) (bus)->driver->read_end(bus) +#define URJ_BUS_READ(bus,adr) (bus)->driver->read(bus,adr) +#define URJ_BUS_WRITE(bus,adr,data) (bus)->driver->write(bus,adr,data) +#define URJ_BUS_FREE(bus) (bus)->driver->free_bus(bus) +#define URJ_BUS_INIT(bus) (bus)->driver->init(bus) + +#endif /* URJ_BUS_DRIVER_BRUX_BUS_H */ diff --git a/urjtag/include/urjtag/cable.h b/urjtag/include/urjtag/cable.h new file mode 100644 index 00000000..d1327799 --- /dev/null +++ b/urjtag/include/urjtag/cable.h @@ -0,0 +1,165 @@ +/* + * $Id$ + * + * Cable driver interface + * 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 , 2003. + * + */ + +#ifndef URJ_CABLE_H +#define URJ_CABLE_H + +#include + +typedef struct urj_cable urj_cable_t; + +#include "usbconn.h" +#include "parport.h" +#include "chain.h" +#include "pod.h" + +typedef struct urj_cable_driver urj_cable_driver_t; + +typedef enum urj_cable_flush_amount +{ + URJ_TAP_CABLE_OPTIONALLY, + URJ_TAP_CABLE_TO_OUTPUT, + URJ_TAP_CABLE_COMPLETELY +} +urj_cable_flush_amount_t; + +struct urj_cable_driver +{ + const char *name; + const char *description; + int (*connect) (char *params[], urj_cable_t *cable); + void (*disconnect) (urj_cable_t *cable); + void (*cable_free) (urj_cable_t *cable); + int (*init) (urj_cable_t *); + void (*done) (urj_cable_t *); + void (*set_frequency) (urj_cable_t *, uint32_t freq); + void (*clock) (urj_cable_t *, int, int, int); + int (*get_tdo) (urj_cable_t *); + int (*transfer) (urj_cable_t *, int, char *, char *); + int (*set_signal) (urj_cable_t *, int, int); + int (*get_signal) (urj_cable_t *, urj_pod_sigsel_t); + void (*flush) (urj_cable_t *, urj_cable_flush_amount_t); + void (*help) (const char *); +}; + +typedef struct urj_cable_queue urj_cable_queue_t; + +struct urj_cable_queue +{ + enum + { + URJ_TAP_CABLE_CLOCK, + URJ_TAP_CABLE_GET_TDO, + URJ_TAP_CABLE_TRANSFER, + URJ_TAP_CABLE_SET_SIGNAL, + URJ_TAP_CABLE_GET_SIGNAL + } action; + union + { + struct + { + int tms; + int tdi; + int n; + } clock; + struct + { + urj_pod_sigsel_t sig; + int mask; + int val; + } value; + struct + { + int len; + char *in; + char *out; + } transfer; + struct + { + int len; + int res; + char *out; + } xferred; + } arg; +}; + +typedef struct urj_cable_queue_info urj_cable_queue_info_t; + +struct urj_cable_queue_info +{ + urj_cable_queue_t *data; + int max_items; + int num_items; + int next_item; + int next_free; +}; + +struct urj_cable +{ + urj_cable_driver_t *driver; + union + { + urj_usbconn_t *usb; + urj_parport_t *port; + } link; + void *params; + urj_chain_t *chain; + urj_cable_queue_info_t todo; + urj_cable_queue_info_t done; + uint32_t delay; + uint32_t frequency; +}; + +void urj_tap_cable_free (urj_cable_t *cable); +int urj_tap_cable_init (urj_cable_t *cable); +void urj_tap_cable_done (urj_cable_t *cable); +void urj_tap_cable_flush (urj_cable_t *cable, urj_cable_flush_amount_t); +void urj_tap_cable_clock (urj_cable_t *cable, int tms, int tdi, int n); +int urj_tap_cable_defer_clock (urj_cable_t *cable, int tms, int tdi, int n); +int urj_tap_cable_get_tdo (urj_cable_t *cable); +int urj_tap_cable_get_tdo_late (urj_cable_t *cable); +int urj_tap_cable_defer_get_tdo (urj_cable_t *cable); +int urj_tap_cable_set_signal (urj_cable_t *cable, int mask, int val); +int urj_tap_cable_defer_set_signal (urj_cable_t *cable, int mask, int val); +int urj_tap_cable_get_signal (urj_cable_t *cable, urj_pod_sigsel_t sig); +int urj_tap_cable_get_signal_late (urj_cable_t *cable, urj_pod_sigsel_t sig); +int urj_tap_cable_defer_get_signal (urj_cable_t *cable, urj_pod_sigsel_t sig); +int urj_tap_cable_transfer (urj_cable_t *cable, int len, char *in, char *out); +int urj_tap_cable_transfer_late (urj_cable_t *cable, char *out); +int urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in, + char *out); + +void urj_tap_cable_set_frequency (urj_cable_t *cable, uint32_t frequency); +uint32_t urj_tap_cable_get_frequency (urj_cable_t *cable); +void urj_tap_cable_wait (urj_cable_t *cable); +void urj_tap_cable_purge_queue (urj_cable_queue_info_t *q, int io); +int urj_tap_cable_add_queue_item (urj_cable_t *cable, + urj_cable_queue_info_t *q); +int urj_tap_cable_get_queue_item (urj_cable_t *cable, + urj_cable_queue_info_t *q); + +extern urj_cable_driver_t *urj_tap_cable_drivers[]; + +#endif /* URJ_CABLE_H */ diff --git a/urjtag/include/urjtag/chain.h b/urjtag/include/urjtag/chain.h new file mode 100644 index 00000000..a423e77a --- /dev/null +++ b/urjtag/include/urjtag/chain.h @@ -0,0 +1,77 @@ +/* + * $Id$ + * + * 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 , 2003. + * + */ + +#ifndef URJ_CHAIN_H +#define URJ_CHAIN_H + +#include "part.h" +#include "pod.h" + +typedef struct urj_chain urj_chain_t; + +#include "cable.h" +#include "bsdl.h" + +#define URJ_CHAIN_EXITMODE_SHIFT 0 +#define URJ_CHAIN_EXITMODE_IDLE 1 +#define URJ_CHAIN_EXITMODE_EXIT1 2 +#define URJ_CHAIN_EXITMODE_UPDATE 3 + +struct urj_chain +{ + int state; + urj_parts_t *parts; + int total_instr_len; + int active_part; + urj_cable_t *cable; + urj_bsdl_globs_t bsdl; +}; + +urj_chain_t *urj_tap_chain_alloc (void); +void urj_tap_chain_free (urj_chain_t *chain); +void urj_tap_chain_disconnect (urj_chain_t *chain); +void urj_tap_chain_clock (urj_chain_t *chain, int tms, int tdi, int n); +void urj_tap_chain_defer_clock (urj_chain_t *chain, int tms, int tdi, int n); +int urj_tap_chain_set_trst (urj_chain_t *chain, int trst); +int urj_tap_chain_get_trst (urj_chain_t *chain); +void urj_tap_chain_shift_instructions (urj_chain_t *chain); +void urj_tap_chain_shift_instructions_mode (urj_chain_t *chain, + int capture_output, int capture, + int chain_exit); +void urj_tap_chain_shift_data_registers (urj_chain_t *chain, + int capture_output); +void urj_tap_chain_shift_data_registers_mode (urj_chain_t *chain, + int capture_output, int capture, + int chain_exit); +void urj_tap_chain_flush (urj_chain_t *chain); +int urj_tap_chain_set_pod_signal (urj_chain_t *chain, int mask, int val); +int urj_tap_chain_get_pod_signal (urj_chain_t *chain, urj_pod_sigsel_t sig); + +typedef struct +{ + urj_chain_t **chains; + int size; /* allocated chains array size */ +} urj_chains_t; + +#endif /* URJ_CHAIN_H */ diff --git a/urjtag/include/urjtag/cmd.h b/urjtag/include/urjtag/cmd.h new file mode 100644 index 00000000..f709baaa --- /dev/null +++ b/urjtag/include/urjtag/cmd.h @@ -0,0 +1,54 @@ +/* + * $Id$ + * + * Copyright (C) 2003 ETC s.r.o. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the ETC s.r.o. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Written by Marcel Telka , 2003. + * + */ + +#ifndef URJ_CMD_H +#define URJ_CMD_H + +#include "chain.h" + +typedef struct +{ + char *name; + char *desc; + void (*help) (void); + int (*run) (urj_chain_t *chain, char *params[]); +} urj_cmd_t; + +extern const urj_cmd_t *urj_cmds[]; + +int urj_cmd_run (urj_chain_t *chain, char *params[]); +int urj_cmd_params (char *params[]); +int urj_cmd_get_number (char *s, unsigned int *i); +int urj_cmd_test_cable (urj_chain_t *chain); + +#endif /* URJ_CMD_H */ diff --git a/urjtag/include/urjtag/data_register.h b/urjtag/include/urjtag/data_register.h new file mode 100644 index 00000000..53c38af6 --- /dev/null +++ b/urjtag/include/urjtag/data_register.h @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * 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 + * 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 , 2002. + * + */ + +#ifndef URJ_DATA_REGISTER_H +#define URJ_DATA_REGISTER_H + +#include "tap_register.h" + +#define URJ_DATA_REGISTER_MAXLEN 32 + +typedef struct urj_data_register urj_data_register_t; + +struct urj_data_register +{ + char name[URJ_DATA_REGISTER_MAXLEN + 1]; /* (public) register name */ + urj_tap_register_t *in; /* (public) register value clocked in */ + urj_tap_register_t *out; /* (public) register value clocked out */ + urj_data_register_t *next; +}; + +urj_data_register_t *urj_part_data_register_alloc (const char *name, int len); +void urj_part_data_register_free (urj_data_register_t *dr); + +#endif /* URJ_DATA_REGISTER_H */ diff --git a/urjtag/include/urjtag/fclock.h b/urjtag/include/urjtag/fclock.h new file mode 100644 index 00000000..6c0fa274 --- /dev/null +++ b/urjtag/include/urjtag/fclock.h @@ -0,0 +1,55 @@ +/* + * fclock.h + * + * Copyright (C) 2005 Hein Roehrig + * + * 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_FCLOCK_FCLOCK_H +#define URJ_FCLOCK_FCLOCK_H + + +#ifdef __cplusplus +extern "C" +{ + +# ifndef CVOID +# define CVOID +# endif +#else /* def __cplusplus */ +# ifndef CVOID +# define CVOID void +# endif +#endif /* def __cplusplus */ + + +/* return real time in seconds starting at some arbitrary point in +time*/ +long double urj_lib_frealtime (CVOID); + +/* return the CPU time used by this process (seconds) */ +long double fcputime (CVOID); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/urjtag/include/urjtag/flash.h b/urjtag/include/urjtag/flash.h new file mode 100644 index 00000000..5b56df75 --- /dev/null +++ b/urjtag/include/urjtag/flash.h @@ -0,0 +1,103 @@ +/* + * $Id$ + * + * Copyright (C) 2003 ETC s.r.o. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the ETC s.r.o. nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Written by Marcel Telka , 2003. + * + */ + +#ifndef URJ_FLASH_H +#define URJ_FLASH_H + +#include +#include + +#include + +#if 0 +/* Following moved here from brux/cfi.h */ + +#include + +typedef struct +{ + int width; /* 1 for 8 bits, 2 for 16 bits, 4 for 32 bits, etc. */ + urj_flash_cfi_query_structure_t cfi; +} urj_flash_cfi_chip_t; +#endif + +typedef struct urj_flash_cfi_chip urj_flash_cfi_chip_t; + +typedef struct +{ + urj_bus_t *bus; + uint32_t address; + int bus_width; /* in cfi_chips, e.g. 4 for 32 bits */ + urj_flash_cfi_chip_t **cfi_chips; +} urj_flash_cfi_array_t; + +void urj_flash_cfi_array_free (urj_flash_cfi_array_t *urj_flash_cfi_array); +int urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, + urj_flash_cfi_array_t **urj_flash_cfi_array); + +/* End of brux/cfi.h */ + +typedef struct +{ + unsigned int bus_width; /* 1 for 8 bits, 2 for 16 bits, 4 for 32 bits, etc. */ + const char *name; + const char *description; + int (*autodetect) (urj_flash_cfi_array_t *urj_flash_cfi_array); + void (*print_info) (urj_flash_cfi_array_t *urj_flash_cfi_array); + int (*erase_block) (urj_flash_cfi_array_t *urj_flash_cfi_array, + uint32_t adr); + int (*unlock_block) (urj_flash_cfi_array_t *urj_flash_cfi_array, + uint32_t adr); + int (*program) (urj_flash_cfi_array_t *urj_flash_cfi_array, uint32_t adr, + uint32_t *buffer, int count); + void (*readarray) (urj_flash_cfi_array_t *urj_flash_cfi_array); +} urj_flash_driver_t; + +#define URJ_FLASH_ERROR_NOERROR 0 +#define URJ_FLASH_ERROR_INVALID_COMMAND_SEQUENCE 1 +#define URJ_FLASH_ERROR_LOW_VPEN 2 +#define URJ_FLASH_ERROR_BLOCK_LOCKED 3 +#define URJ_FLASH_ERROR_UNKNOWN 99 + +extern urj_flash_cfi_array_t *urj_flash_cfi_array; + +void urj_flash_detectflash (urj_bus_t *bus, uint32_t adr); + +void urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int); +void urj_flashmsbin (urj_bus_t *bus, FILE * f, int); + +/* end of original brux/flash.h */ + +extern urj_flash_driver_t *urj_flash_flash_drivers[]; + +#endif /* URJ_FLASH_H */ diff --git a/urjtag/include/urjtag/gettext.h b/urjtag/include/urjtag/gettext.h new file mode 100644 index 00000000..8b262f4c --- /dev/null +++ b/urjtag/include/urjtag/gettext.h @@ -0,0 +1,69 @@ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library 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 _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +#endif /* _LIBGETTEXT_H */ diff --git a/urjtag/include/urjtag/jim.h b/urjtag/include/urjtag/jim.h new file mode 100644 index 00000000..638a772e --- /dev/null +++ b/urjtag/include/urjtag/jim.h @@ -0,0 +1,131 @@ +/* + * $Id: jim.h $ + * + * Copyright (C) 2008 Kolja Waschk + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Documentation used while writing this code: + * + * http://www.inaccessnetworks.com/projects/ianjtag/jtag-intro/jtag-intro.html + * "A Brief Introduction to the JTAG Boundary Scan Interface", Nick Patavalis + * + * http://www.xjtag.com/support-jtag/jtag-technical-guide.php + * "JTAG - A technical overview", XJTAG Ltd. + * + */ + +#ifndef URJ_JIM_H +#define URJ_JIM_H 1 + +#include +#include + +typedef enum jim_tap_state +{ + URJ_JIM_RESET = 0, + URJ_JIM_SELECT_DR = 0 + 1, + URJ_JIM_CAPTURE_DR = 0 + 2, + URJ_JIM_SHIFT_DR = 0 + 3, + URJ_JIM_EXIT1_DR = 0 + 4, + URJ_JIM_PAUSE_DR = 0 + 5, + URJ_JIM_EXIT2_DR = 0 + 6, + URJ_JIM_UPDATE_DR = 0 + 7, + URJ_JIM_IDLE = 8, + URJ_JIM_SELECT_IR = 8 + 1, + URJ_JIM_CAPTURE_IR = 8 + 2, + URJ_JIM_SHIFT_IR = 8 + 3, + URJ_JIM_EXIT1_IR = 8 + 4, + URJ_JIM_PAUSE_IR = 8 + 5, + URJ_JIM_EXIT2_IR = 8 + 6, + URJ_JIM_UPDATE_IR = 8 + 7, +} +urj_jim_tap_state_t; + +typedef struct +{ + uint32_t *reg; + int len; +} urj_jim_shift_reg_t; + +typedef struct urj_jim_device +{ + struct urj_jim_device *prev; + + urj_jim_tap_state_t tap_state; + void (*tck_rise) (struct urj_jim_device * dev, int tms, int tdi, + uint8_t *shmem, size_t shmem_size); + void (*tck_fall) (struct urj_jim_device * dev, uint8_t *shmem, + size_t shmem_size); + void (*dev_free) (struct urj_jim_device * dev); + void *state; + int num_sregs; + int current_dr; + urj_jim_shift_reg_t *sreg; + int tdo; + int tdo_buffer; +} +urj_jim_device_t; + +typedef struct urj_jim_state +{ + int trst; + uint8_t *shmem; + size_t shmem_size; + urj_jim_device_t *last_device_in_chain; +} +urj_jim_state_t; + +typedef struct urj_jim_bus_device +{ + int width; /* bytes */ + int size; /* words (each bytes) */ + void *state; /* device-dependent */ + void (*init) (struct urj_jim_bus_device * x); + uint32_t (*capture) (struct urj_jim_bus_device * x, + uint32_t address, uint32_t control, + uint8_t *shmem, size_t shmem_size); + void (*update) (struct urj_jim_bus_device * x, + uint32_t address, uint32_t data, uint32_t control, + uint8_t *shmem, size_t shmem_size); + void (*free) (struct urj_jim_bus_device * x); +} +urj_jim_bus_device_t; + +typedef struct +{ + uint32_t offset; + int adr_shift; + int data_shift; + urj_jim_bus_device_t *part; +} +urj_jim_attached_part_t; + +void urj_jim_set_trst (urj_jim_state_t *s, int trst); +int urj_jim_get_trst (urj_jim_state_t *s); +int urj_jim_get_tdo (urj_jim_state_t *s); +void urj_jim_tck_rise (urj_jim_state_t *s, int tms, int tdi); +void urj_jim_tck_fall (urj_jim_state_t *s); +urj_jim_device_t *urj_jim_alloc_device (int num_sregs, const int reg_size[]); +urj_jim_state_t *urj_jim_init (void); +void urj_jim_free (urj_jim_state_t *s); +void urj_jim_print_sreg (urj_jim_shift_reg_t *r); +void urj_jim_print_tap_state (char *rof, urj_jim_device_t *dev); + +#endif diff --git a/urjtag/include/urjtag/jtag.h b/urjtag/include/urjtag/jtag.h new file mode 100644 index 00000000..cba41e1d --- /dev/null +++ b/urjtag/include/urjtag/jtag.h @@ -0,0 +1,67 @@ +/* + * $Id$ + * + * 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 , 2003. + * + */ + +#ifndef URJ_JTAG_H +#define URJ_JTAG_H + +#include +#include + +#include + +#include "chain.h" +#include "bus.h" +#include "part.h" + +#define URJ_STATUS_OK 0 +#define URJ_STATUS_FAIL 1 +#define URJ_STATUS_SYNTAX_ERROR (-1) + + +extern urj_bus_t *urj_bus; +extern int urj_big_endian; +extern int urj_debug_mode; + +/** Register the application name with cmd_jtag. + * @param argv0 is remembered as a pointer, it is not strdup()'ed. + */ +void urj_cmd_jtag_set_argv0(const char *argv0); +const char *urj_cmd_jtag_get_data_dir (void); + +int urj_cmd_jtag_parse_file (urj_chain_t *chain, const char *filename); +int urj_cmd_jtag_parse_line (urj_chain_t *chain, char *line); +int urj_cmd_jtag_parse_stream (urj_chain_t *chain, FILE * f); + +int urj_tap_detect_parts (urj_chain_t *chain, const char *db_path); +int urj_tap_manual_add (urj_chain_t *chain, int instr_len); +int urj_tap_detect_register_size (urj_chain_t *chain); +void urj_tap_discovery (urj_chain_t *chain); +void urj_tap_urj_tap_idcode (urj_chain_t *chain, unsigned int bytes); + +void urj_bus_readmem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len); +void urj_bus_writemem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len); + +void urj_flasherase (urj_bus_t *bus, uint32_t addr, int number); + +#endif /* URJ_JTAG_H */ diff --git a/urjtag/include/urjtag/parport.h b/urjtag/include/urjtag/parport.h new file mode 100644 index 00000000..b485080d --- /dev/null +++ b/urjtag/include/urjtag/parport.h @@ -0,0 +1,64 @@ +/* + * $Id$ + * + * Parallel Port Connection Driver Interface + * 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 , 2003. + * + */ + +#ifndef URJ_PARPORT_H +#define URJ_PARPORT_H + +#include + +typedef struct urj_parport urj_parport_t; + +#include "cable.h" + +typedef struct +{ + const char *type; + urj_parport_t *(*connect) (const char **, int); + void (*parport_free) (urj_parport_t *); + int (*open) (urj_parport_t *); + int (*close) (urj_parport_t *); + int (*set_data) (urj_parport_t *, uint8_t); + int (*get_data) (urj_parport_t *); + int (*get_status) (urj_parport_t *); + int (*set_control) (urj_parport_t *, uint8_t); +} urj_parport_driver_t; + +struct urj_parport +{ + urj_parport_driver_t *driver; + void *params; + urj_cable_t *cable; +}; + +int urj_tap_parport_open (urj_parport_t *port); +int urj_tap_parport_close (urj_parport_t *port); +int urj_tap_parport_set_data (urj_parport_t *port, uint8_t data); +int urj_tap_parport_get_data (urj_parport_t *port); +int urj_tap_parport_get_status (urj_parport_t *port); +int urj_tap_parport_set_control (urj_parport_t *port, uint8_t data); + +extern urj_parport_driver_t *urj_tap_parport_drivers[]; + +#endif /* URJ_PARPORT_H */ diff --git a/urjtag/include/urjtag/part.h b/urjtag/include/urjtag/part.h new file mode 100644 index 00000000..5ce852f5 --- /dev/null +++ b/urjtag/include/urjtag/part.h @@ -0,0 +1,87 @@ +/* + * $Id$ + * + * 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 + * 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 , 2002. + * + */ + +#ifndef URJ_PART_H +#define URJ_PART_H + +#include + +#include "bssignal.h" +#include "part_instruction.h" +#include "data_register.h" +#include "bsbit.h" + +#define URJ_PART_MANUFACTURER_MAXLEN 25 +#define URJ_PART_PART_MAXLEN 20 +#define URJ_PART_STEPPING_MAXLEN 8 + +typedef struct urj_part urj_part_t; + +struct urj_part +{ + urj_tap_register_t *id; + char *alias; /* djf refdes */ + char manufacturer[URJ_PART_MANUFACTURER_MAXLEN + 1]; + char part[URJ_PART_PART_MAXLEN + 1]; + char stepping[URJ_PART_STEPPING_MAXLEN + 1]; + urj_part_signal_t *signals; + urj_part_salias_t *saliases; + int instruction_length; + urj_part_instruction_t *instructions; + urj_part_instruction_t *active_instruction; + urj_data_register_t *data_registers; + int boundary_length; + urj_bsbit_t **bsbits; +}; + +urj_part_t *urj_part_alloc (const urj_tap_register_t *id); +void urj_part_free (urj_part_t *p); +urj_part_t *read_part (FILE * f, urj_tap_register_t *idr); +urj_part_instruction_t *urj_part_find_instruction (urj_part_t *p, + const char *iname); +urj_data_register_t *urj_part_find_data_register (urj_part_t *p, + const char *drname); +urj_part_signal_t *urj_part_find_signal (urj_part_t *p, + const char *signalname); +void urj_part_set_instruction (urj_part_t *p, const char *iname); +void urj_part_set_signal (urj_part_t *p, urj_part_signal_t *s, int out, + int val); +int urj_part_get_signal (urj_part_t *p, urj_part_signal_t *s); +void urj_part_print (urj_part_t *p); + +typedef struct urj_parts urj_parts_t; + +struct urj_parts +{ + int len; + urj_part_t **parts; +}; + +urj_parts_t *urj_part_parts_alloc (void); +void urj_part_parts_free (urj_parts_t *ps); +int urj_part_parts_add_part (urj_parts_t *ps, urj_part_t *p); +void urj_part_parts_set_instruction (urj_parts_t *ps, const char *iname); +void urj_part_parts_print (urj_parts_t *ps); + +#endif /* URJ_PART_H */ diff --git a/urjtag/include/urjtag/part_instruction.h b/urjtag/include/urjtag/part_instruction.h new file mode 100644 index 00000000..0f676cda --- /dev/null +++ b/urjtag/include/urjtag/part_instruction.h @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * 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 + * 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 , 2002. + * + */ + +#ifndef URJ_PART_INSTRUCTION_H +#define URJ_PART_INSTRUCTION_H + +#include "tap_register.h" +#include "data_register.h" + +#define URJ_INSTRUCTION_MAXLEN_INSTRUCTION 20 + +typedef struct urj_part_instruction urj_part_instruction_t; + +struct urj_part_instruction +{ + char name[URJ_INSTRUCTION_MAXLEN_INSTRUCTION + 1]; + urj_tap_register_t *value; + urj_tap_register_t *out; + urj_data_register_t *data_register; + urj_part_instruction_t *next; +}; + +urj_part_instruction_t *urj_part_instruction_alloc (const char *name, int len, + const char *val); +void urj_part_instruction_free (urj_part_instruction_t *i); + +#endif /* URJ_INSTRUCTION_H */ diff --git a/urjtag/include/urjtag/pod.h b/urjtag/include/urjtag/pod.h new file mode 100644 index 00000000..00868e42 --- /dev/null +++ b/urjtag/include/urjtag/pod.h @@ -0,0 +1,41 @@ +/* + * $Id$ + * + * Pod signal names + * Copyright (C) 2008 K. Waschk + * + * 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_POD_H +#define URJ_POD_H + +typedef enum urj_pod_sigsel +{ + URJ_POD_CS_NONE = 0, // no/invalid signal + URJ_POD_CS_TDI = (1 << 0), // out: JTAG/SPI data in + URJ_POD_CS_TCK = (1 << 1), // out: JTAG/SPI clock + URJ_POD_CS_TMS = (1 << 2), // out: JTAG test mode select/SPI slave select + URJ_POD_CS_TRST = (1 << 3), // out: JTAG TAP reset + URJ_POD_CS_RESET = (1 << 4), // out: system reset + URJ_POD_CS_SCK = (1 << 5), // out: I2C clock (not yet used) + URJ_POD_CS_SDA = (1 << 6), // inout: I2C data (not yet used) + URJ_POD_CS_SS = (1 << 7), // out: SPI slave select (not yet used) +} +urj_pod_sigsel_t; + +#endif /* URJ_POD_H */ diff --git a/urjtag/include/urjtag/svf.h b/urjtag/include/urjtag/svf.h new file mode 100644 index 00000000..0ec7ff2b --- /dev/null +++ b/urjtag/include/urjtag/svf.h @@ -0,0 +1,32 @@ +/* + * $Id$ + * + * Copyright (C) 2004, 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 , 2004. + * + */ + +#ifndef URJ_SVF_H +#define URJ_SVF_H + +#include "chain.h" + +void urj_svf_run (urj_chain_t *chain, FILE *, int, int, uint32_t); + +#endif /* URJ_SVF_H */ diff --git a/urjtag/include/urjtag/tap.h b/urjtag/include/urjtag/tap.h new file mode 100644 index 00000000..3c05ff72 --- /dev/null +++ b/urjtag/include/urjtag/tap.h @@ -0,0 +1,45 @@ +/* + * $Id$ + * + * 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 + * 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 , 2002. + * + */ + +#ifndef URJ_TAP_H +#define URJ_TAP_H + +#include "tap_register.h" +#include "chain.h" + +void urj_tap_reset (urj_chain_t *chain); +void urj_tap_reset_bypass (urj_chain_t *chain); +void urj_tap_capture_dr (urj_chain_t *chain); +void urj_tap_capture_ir (urj_chain_t *chain); +void urj_tap_defer_shift_register (urj_chain_t *chain, + const urj_tap_register_t *in, + urj_tap_register_t *out, int tap_exit); +void urj_tap_shift_register_output (urj_chain_t *chain, + const urj_tap_register_t *in, + urj_tap_register_t *out, int tap_exit); +void urj_tap_shift_register (urj_chain_t *chain, + const urj_tap_register_t *in, + urj_tap_register_t *out, int tap_exit); + +#endif /* URJ_TAP_H */ diff --git a/urjtag/include/urjtag/tap_register.h b/urjtag/include/urjtag/tap_register.h new file mode 100644 index 00000000..a53fe7e8 --- /dev/null +++ b/urjtag/include/urjtag/tap_register.h @@ -0,0 +1,53 @@ +/* + * $Id$ + * + * 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 , 2002, 2003. + * + */ + +#ifndef URJ_TAP_REGISTER_H +#define URJ_TAP_REGISTER_H + +typedef struct urj_tap_register +{ + char *data; /* (public, r/w) register data */ + int len; /* (public, r/o) register length */ + char *string; /* (private) string representation of register data */ +} urj_tap_register_t; + +urj_tap_register_t *urj_tap_register_alloc (int len); +urj_tap_register_t *urj_tap_register_duplicate (const urj_tap_register_t *tr); +void urj_tap_register_free (urj_tap_register_t *tr); +urj_tap_register_t *urj_tap_register_fill (urj_tap_register_t *tr, int val); +const char *urj_tap_register_get_string (const urj_tap_register_t *tr); +int urj_tap_register_all_bits_same_value (const urj_tap_register_t *tr); +urj_tap_register_t *urj_tap_register_init (urj_tap_register_t *tr, + const char *value); +int urj_tap_register_compare (const urj_tap_register_t *tr, + const urj_tap_register_t *tr2); +int urj_tap_register_match (const urj_tap_register_t *tr, const char *expr); +urj_tap_register_t *urj_tap_register_inc (urj_tap_register_t *tr); +urj_tap_register_t *urj_tap_register_dec (urj_tap_register_t *tr); +urj_tap_register_t *urj_tap_register_shift_right (urj_tap_register_t *tr, + int shift); +urj_tap_register_t *urj_tap_register_shift_left (urj_tap_register_t *tr, + int shift); + +#endif /* URJ_REGISTER_H */ diff --git a/urjtag/include/urjtag/tap_state.h b/urjtag/include/urjtag/tap_state.h new file mode 100644 index 00000000..68b41ffc --- /dev/null +++ b/urjtag/include/urjtag/tap_state.h @@ -0,0 +1,66 @@ +/* + * $Id$ + * + * 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 + * 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 , 2002. + * + */ + +#ifndef URJ_TAP_STATE_H +#define URJ_TAP_STATE_H + +#include + +#include "chain.h" + +#define URJ_TAP_STATE_DR URJ_BIT (0) +#define URJ_TAP_STATE_IR URJ_BIT (1) +#define URJ_TAP_STATE_SHIFT URJ_BIT (2) /* register shift with TMS = 0 */ +#define URJ_TAP_STATE_IDLE URJ_BIT (3) /* to Run-Test/Idle with TMS = 0 */ +#define URJ_TAP_STATE_CAPTURE URJ_BIT (4) /* Capture state */ +#define URJ_TAP_STATE_UPDATE URJ_BIT (5) /* to Update with TMS = 1 */ +#define URJ_TAP_STATE_PAUSE URJ_BIT (6) /* to Pause with TMS = 0 */ +#define URJ_TAP_STATE_RESET URJ_BIT (7) /* Test-Logic-Reset or unknown state */ + +#define URJ_TAP_STATE_UNKNOWN_STATE URJ_TAP_STATE_RESET +#define URJ_TAP_STATE_TEST_LOGIC_RESET (URJ_TAP_STATE_RESET | URJ_TAP_STATE_IDLE) +#define URJ_TAP_STATE_RUN_TEST_IDLE URJ_TAP_STATE_IDLE +#define URJ_TAP_STATE_SELECT_DR_SCAN URJ_TAP_STATE_DR +#define URJ_TAP_STATE_CAPTURE_DR (URJ_TAP_STATE_DR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_CAPTURE) +#define URJ_TAP_STATE_SHIFT_DR (URJ_TAP_STATE_DR | URJ_TAP_STATE_SHIFT) +#define URJ_TAP_STATE_EXIT1_DR (URJ_TAP_STATE_DR | URJ_TAP_STATE_UPDATE | URJ_TAP_STATE_PAUSE) +#define URJ_TAP_STATE_PAUSE_DR (URJ_TAP_STATE_DR | URJ_TAP_STATE_PAUSE) +#define URJ_TAP_STATE_EXIT2_DR (URJ_TAP_STATE_DR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_UPDATE) +#define URJ_TAP_STATE_UPDATE_DR (URJ_TAP_STATE_DR | URJ_TAP_STATE_IDLE) +#define URJ_TAP_STATE_SELECT_IR_SCAN URJ_TAP_STATE_IR +#define URJ_TAP_STATE_CAPTURE_IR (URJ_TAP_STATE_IR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_CAPTURE) +#define URJ_TAP_STATE_SHIFT_IR (URJ_TAP_STATE_IR | URJ_TAP_STATE_SHIFT) +#define URJ_TAP_STATE_EXIT1_IR (URJ_TAP_STATE_IR | URJ_TAP_STATE_UPDATE | URJ_TAP_STATE_PAUSE) +#define URJ_TAP_STATE_PAUSE_IR (URJ_TAP_STATE_IR | URJ_TAP_STATE_PAUSE) +#define URJ_TAP_STATE_EXIT2_IR (URJ_TAP_STATE_IR | URJ_TAP_STATE_SHIFT | URJ_TAP_STATE_UPDATE) +#define URJ_TAP_STATE_UPDATE_IR (URJ_TAP_STATE_IR | URJ_TAP_STATE_IDLE) + +int urj_tap_state (urj_chain_t *chain); +int urj_tap_state_init (urj_chain_t *chain); +int urj_tap_state_done (urj_chain_t *chain); +int urj_tap_state_reset (urj_chain_t *chain); +int urj_tap_state_set_trst (urj_chain_t *chain, int old_trst, int new_trst); +int urj_tap_state_clock (urj_chain_t *chain, int tms); + +#endif /* URJ_TAP_STATE_H */ diff --git a/urjtag/include/urjtag/usbconn.h b/urjtag/include/urjtag/usbconn.h new file mode 100644 index 00000000..e1351991 --- /dev/null +++ b/urjtag/include/urjtag/usbconn.h @@ -0,0 +1,72 @@ +/* + * $Id$ + * + * USB Device Connection Driver Interface + * Copyright (C) 2008 K. Waschk + * + * 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 Kolja Waschk , 2008 + * + */ + +#ifndef URJ_USBCONN_H +#define URJ_USBCONN_H + +#include +#include + +typedef struct urj_usbconn urj_usbconn_t; + +#include "cable.h" + +typedef struct +{ + char *name; + char *desc; + char *driver; + int32_t vid; + int32_t pid; +} urj_usbconn_cable_t; + +typedef struct +{ + const char *type; + urj_usbconn_t *(*connect) (const char **, int, urj_usbconn_cable_t *); + void (*free) (urj_usbconn_t *); + int (*open) (urj_usbconn_t *); + int (*close) (urj_usbconn_t *); + int (*read) (urj_usbconn_t *, uint8_t *, int); + int (*write) (urj_usbconn_t *, uint8_t *, int, int); +} urj_usbconn_driver_t; + +struct urj_usbconn +{ + urj_usbconn_driver_t *driver; + void *params; + urj_cable_t *cable; +}; + +urj_usbconn_t *usbconn_connect (const char **, int, urj_usbconn_cable_t *); +int usbconn_free (urj_usbconn_t *conn); +int urj_tap_usbconn_open (urj_usbconn_t *conn); +int urj_tap_usbconn_close (urj_usbconn_t *conn); +int urj_tap_usbconn_read (urj_usbconn_t *conn, uint8_t *buf, int len); +int urj_tap_usbconn_write (urj_usbconn_t *conn, uint8_t *buf, int len, + int recv); +extern urj_usbconn_driver_t *urj_tap_usbconn_drivers[]; + +#endif /* URJ_USBCONN_H */ diff --git a/urjtag/include/urjtag/xpcu.h b/urjtag/include/urjtag/xpcu.h new file mode 100644 index 00000000..07393341 --- /dev/null +++ b/urjtag/include/urjtag/xpcu.h @@ -0,0 +1,49 @@ +/* + * $Id$ + * + * Xilinx Platform Cable USB functions + * Copyright (C) 2008 K. Waschk + * + * 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 Kolja Waschk , 2008 + * + */ + +#ifndef URJ_XPCU_H +#define URJ_XPCU_H 1 + +#include +#include + +#define URJ_XPCU_VID 0x03FD +#define URJ_XPCU_PID 0x0008 + +struct usb_device *find_xpcu (void); +int xpcu_init (); +int xpcu_close (struct usb_dev_handle *xpcu); +int xpcu_request_28 (struct usb_dev_handle *xpcu, int value); +int xpcu_raise_ioa5 (struct usb_dev_handle *xpcu); +int xpcu_write_gpio (struct usb_dev_handle *xpcu, uint8_t bits); +int xpcu_read_gpio (struct usb_dev_handle *xpcu, uint8_t *bits); +int xpcu_bitrev_test (struct usb_dev_handle *xpcu); +int xpcu_select_gpio (struct usb_dev_handle *xpcu, int select); +int xpcu_open (struct usb_dev_handle **xpcu); +int xpcu_request_a6 (struct usb_dev_handle *xpcu, int nibbles, uint8_t *xmit, + int inlen, uint8_t *recv); + + +#endif /* URJ_XPCU_H */