From 0fb204f3ee81229f2b09f8e73de75f6f9bf19643 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Sat, 12 Oct 2002 12:10:57 +0000 Subject: [PATCH] Moved from include module. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@186 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/include/.cvsignore | 0 jtag/include/Makefile.am | 35 ++++++++++++++++ jtag/include/bsbit.h | 53 ++++++++++++++++++++++++ jtag/include/ctrl.h | 39 ++++++++++++++++++ jtag/include/data_register.h | 44 ++++++++++++++++++++ jtag/include/instruction.h | 45 ++++++++++++++++++++ jtag/include/part.h | 80 ++++++++++++++++++++++++++++++++++++ jtag/include/register.h | 43 +++++++++++++++++++ jtag/include/signal.h | 42 +++++++++++++++++++ jtag/include/state.h | 64 +++++++++++++++++++++++++++++ jtag/include/tap.h | 36 ++++++++++++++++ 11 files changed, 481 insertions(+) create mode 100644 jtag/include/.cvsignore create mode 100644 jtag/include/Makefile.am create mode 100644 jtag/include/bsbit.h create mode 100644 jtag/include/ctrl.h create mode 100644 jtag/include/data_register.h create mode 100644 jtag/include/instruction.h create mode 100644 jtag/include/part.h create mode 100644 jtag/include/register.h create mode 100644 jtag/include/signal.h create mode 100644 jtag/include/state.h create mode 100644 jtag/include/tap.h diff --git a/jtag/include/.cvsignore b/jtag/include/.cvsignore new file mode 100644 index 00000000..e69de29b diff --git a/jtag/include/Makefile.am b/jtag/include/Makefile.am new file mode 100644 index 00000000..102641cf --- /dev/null +++ b/jtag/include/Makefile.am @@ -0,0 +1,35 @@ +# +# $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. +# + +SUBDIRS = + +noinst_HEADERS = \ + bsbit.h \ + ctrl.h \ + data_register.h \ + instruction.h \ + part.h \ + register.h \ + signal.h \ + state.h \ + tap.h \ diff --git a/jtag/include/bsbit.h b/jtag/include/bsbit.h new file mode 100644 index 00000000..caeac993 --- /dev/null +++ b/jtag/include/bsbit.h @@ -0,0 +1,53 @@ +/* + * $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 BSBIT_H +#define BSBIT_H + +typedef struct bsbit bsbit; + +#include + +#define BSBIT_INPUT 1 +#define BSBIT_OUTPUT 2 +#define BSBIT_CONTROL 3 +#define BSBIT_INTERNAL 4 + +#define BSBIT_STATE_Z (-1) + +struct bsbit { + int bit; + char *name; + int type; + signal *signal; + int safe; /* safe value */ + int control; /* -1 for none */ + int control_value; + int control_state; +}; + +bsbit *bsbit_alloc( int bit, const char *name, int type, signal* signals, int safe ); +void bsbit_free( bsbit *b ); + +#endif /* BSBIT_H */ diff --git a/jtag/include/ctrl.h b/jtag/include/ctrl.h new file mode 100644 index 00000000..93e5c10b --- /dev/null +++ b/jtag/include/ctrl.h @@ -0,0 +1,39 @@ +/* + * $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 CTRL_H +#define CTRL_H + +/* + * low level tap functions, hardware dependent + */ +void tap_init( void ); +void tap_done( void ); + +void tap_clock( int tms, int tdi ); +int tap_get_tdo( void ); + +void tap_set_trst( int new_trst ); + +#endif /* CTRL_H */ diff --git a/jtag/include/data_register.h b/jtag/include/data_register.h new file mode 100644 index 00000000..da417e43 --- /dev/null +++ b/jtag/include/data_register.h @@ -0,0 +1,44 @@ +/* + * $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 DATA_REGISTER_H +#define DATA_REGISTER_H + +#include + +#define MAXLEN_DATA_REGISTER 10 + +typedef struct data_register data_register; + +struct data_register { + char name[MAXLEN_DATA_REGISTER + 1]; /* (public) register name */ + tap_register *in; /* (public) register value clocked in */ + tap_register *out; /* (public) register value clocked out */ + data_register *next; +}; + +data_register *data_register_alloc( const char *name, int len ); +void data_register_free( data_register *dr ); + +#endif /* DATA_REGISTER_H */ diff --git a/jtag/include/instruction.h b/jtag/include/instruction.h new file mode 100644 index 00000000..40908d65 --- /dev/null +++ b/jtag/include/instruction.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 INSTRUCTION_H +#define INSTRUCTION_H + +#include +#include + +#define MAXLEN_INSTRUCTION 20 + +typedef struct instruction instruction; + +struct instruction { + char name[MAXLEN_INSTRUCTION + 1]; + tap_register *value; + data_register *data_register; + instruction *next; +}; + +instruction *instruction_alloc( const char *name, int len, const char *val ); +void instruction_free( instruction *i ); + +#endif /* INSTRUCTION_H */ diff --git a/jtag/include/part.h b/jtag/include/part.h new file mode 100644 index 00000000..87cc5792 --- /dev/null +++ b/jtag/include/part.h @@ -0,0 +1,80 @@ +/* + * $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 PART_H +#define PART_H + +#include + +#include +#include +#include +#include + +#define MAXLEN_MANUFACTURER 20 +#define MAXLEN_PART 20 +#define MAXLEN_STEPPING 8 + +typedef struct part part; + +struct part { + char manufacturer[MAXLEN_MANUFACTURER + 1]; + char part[MAXLEN_PART + 1]; + char stepping[MAXLEN_STEPPING + 1]; + signal *signals; + int instruction_length; + instruction *instructions; + instruction *active_instruction; + data_register *data_registers; + int boundary_length; + bsbit **bsbits; +}; + +part *part_alloc( void ); +void part_free( part *p ); +part *read_part( FILE *f, tap_register *idr ); +instruction *part_find_instruction( part *p, const char *iname ); +data_register *part_find_data_register( part *p, const char *drname ); +void part_set_instruction( part *p, const char *iname ); +void part_shift_instruction( part *p, int exit ); +void part_shift_data_register( part *p, int exit ); +void part_set_signal( part *p, const char *pname, int out, int val ); +int part_get_signal( part *p, const char *pname ); + +typedef struct parts parts; + +struct parts { + int len; + part **parts; +}; + +parts *parts_alloc( void ); +void parts_free( parts *ps ); +int parts_add_part( parts *ps, part *p ); +void parts_set_instruction( parts *ps, const char *iname ); +void parts_shift_instructions( parts *ps ); +void parts_shift_data_registers( parts *ps ); +void parts_print( parts *ps, int header ); + +#endif /* PART_H */ diff --git a/jtag/include/register.h b/jtag/include/register.h new file mode 100644 index 00000000..11d3a0b9 --- /dev/null +++ b/jtag/include/register.h @@ -0,0 +1,43 @@ +/* + * $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 REGISTER_H +#define REGISTER_H + +typedef struct tap_register { + char *data; /* (public, r/w) register data */ + int len; /* (public, r/o) register length */ + char *string; /* (private) string representation of register data */ +} tap_register; + +tap_register *register_alloc( int len ); +tap_register *register_duplicate( const tap_register *tr ); +void register_free( tap_register *tr ); +tap_register *register_fill( tap_register *tr, int val ); +const char *register_get_string( const tap_register *tr ); +tap_register *register_init( tap_register *tr, const char *value ); +int register_compare( const tap_register *tr, const tap_register *tr2 ); +int register_match( const tap_register *tr, const char *expr ); + +#endif /* REGISTER_H */ diff --git a/jtag/include/signal.h b/jtag/include/signal.h new file mode 100644 index 00000000..05d50ed7 --- /dev/null +++ b/jtag/include/signal.h @@ -0,0 +1,42 @@ +/* + * $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 SIGNAL_H +#define SIGNAL_H + +typedef struct signal signal; + +#include + +struct signal { + char *name; + signal *next; + bsbit *input; + bsbit *output; +}; + +signal *signal_alloc( const char *name ); +void signal_free( signal *s ); + +#endif /* SIGNAL_H */ diff --git a/jtag/include/state.h b/jtag/include/state.h new file mode 100644 index 00000000..1a8dfb3d --- /dev/null +++ b/jtag/include/state.h @@ -0,0 +1,64 @@ +/* + * $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 STATE_H +#define STATE_H + +#include + +#define TAPSTAT_DR bit(0) +#define TAPSTAT_IR bit(1) +#define TAPSTAT_SHIFT bit(2) /* register shift with TMS = 0 */ +#define TAPSTAT_IDLE bit(3) /* to Run-Test/Idle with TMS = 0 */ +#define TAPSTAT_CAPTURE bit(4) /* Capture state */ +#define TAPSTAT_UPDATE bit(5) /* to Update with TMS = 1 */ +#define TAPSTAT_PAUSE bit(6) /* to Pause with TMS = 0 */ +#define TAPSTAT_RESET bit(7) /* Test-Logic-Reset or unknown state */ + +#define Unknown_State (TAPSTAT_RESET) +#define Test_Logic_Reset (TAPSTAT_RESET | TAPSTAT_IDLE) +#define Run_Test_Idle (TAPSTAT_IDLE) +#define Select_DR_Scan (TAPSTAT_DR) +#define Capture_DR (TAPSTAT_DR | TAPSTAT_SHIFT | TAPSTAT_CAPTURE) +#define Shift_DR (TAPSTAT_DR | TAPSTAT_SHIFT) +#define Exit1_DR (TAPSTAT_DR | TAPSTAT_UPDATE | TAPSTAT_PAUSE) +#define Pause_DR (TAPSTAT_DR | TAPSTAT_PAUSE) +#define Exit2_DR (TAPSTAT_DR | TAPSTAT_SHIFT | TAPSTAT_UPDATE) +#define Update_DR (TAPSTAT_DR | TAPSTAT_IDLE) +#define Select_IR_Scan (TAPSTAT_IR) +#define Capture_IR (TAPSTAT_IR | TAPSTAT_SHIFT | TAPSTAT_CAPTURE) +#define Shift_IR (TAPSTAT_IR | TAPSTAT_SHIFT) +#define Exit1_IR (TAPSTAT_IR | TAPSTAT_UPDATE | TAPSTAT_PAUSE) +#define Pause_IR (TAPSTAT_IR | TAPSTAT_PAUSE) +#define Exit2_IR (TAPSTAT_IR | TAPSTAT_SHIFT | TAPSTAT_UPDATE) +#define Update_IR (TAPSTAT_IR | TAPSTAT_IDLE) + +int tap_state( void ); +int tap_state_init( void ); +int tap_state_done( void ); +int tap_state_set_trst( int trst ); +int tap_state_get_trst( void ); +int tap_state_clock( int tms ); + +#endif /* STATE_H */ diff --git a/jtag/include/tap.h b/jtag/include/tap.h new file mode 100644 index 00000000..57b50fff --- /dev/null +++ b/jtag/include/tap.h @@ -0,0 +1,36 @@ +/* + * $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 TAP_H +#define TAP_H + +#include + +void tap_reset( void ); +void tap_capture_dr( void ); +void tap_capture_ir( void ); +void tap_shift_register( const tap_register *in, tap_register *out, int exit ); +void write_command( const tap_register *c, tap_register *cout, int len ); + +#endif /* TAP_H */