diff --git a/jtag/src/Makefile.am b/jtag/src/Makefile.am index c134070c..bad97b80 100644 --- a/jtag/src/Makefile.am +++ b/jtag/src/Makefile.am @@ -27,7 +27,7 @@ SUBDIRS = \ bin_PROGRAMS = jtag -jtag_SOURCES = jtag.c detect.c readmem.c detect.h pxa250.c pxa250.h +jtag_SOURCES = jtag.c detect.c readmem.c detect.h pxa250.c pxa250.h sa1110.c sa1110.h jtag_DEPENDENCIES = tap/libtap.a part/libpart.a diff --git a/jtag/src/pxa250.h b/jtag/src/pxa250.h new file mode 100644 index 00000000..53d1348c --- /dev/null +++ b/jtag/src/pxa250.h @@ -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. + * + */ + +#ifndef PXA250_H +#define PXA250_H + +#include + +#include "part.h" + +uint32_t pxa250_bus_read( parts *ps, uint32_t adr ); +void pxa250_bus_write( parts *ps, uint32_t adr, uint32_t data ); + +#endif /* PXA250_H */ diff --git a/jtag/src/sa1110.c b/jtag/src/sa1110.c new file mode 100644 index 00000000..0a05b911 --- /dev/null +++ b/jtag/src/sa1110.c @@ -0,0 +1,130 @@ +/* + * $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. + * + */ + +#include + +#include "part.h" + +#include "sa1110.h" + +/* SA1110 must be in position 0 */ + +static void +setup_address( part *p, uint32_t a ) +{ + int i; + char buff[10]; + + for (i = 0; i < 26; i++) { + sprintf( buff, "A%d", i ); + part_set_signal( p, buff, 1, (a >> i) & 1 ); + } +} + +static void +set_data_in( part *p ) +{ + int i; + char buff[10]; + + for (i = 0; i < 32; i++) { + sprintf( buff, "D%d", i ); + part_set_signal( p, buff, 0, 0 ); + } +} + +static void +setup_data( part *p, uint32_t d ) +{ + int i; + char buff[10]; + + for (i = 0; i < 32; i++) { + sprintf( buff, "D%d", i ); + part_set_signal( p, buff, 1, (d >> i) & 1 ); + } +} + +uint32_t +sa1110_bus_read( parts *ps, uint32_t adr ) +{ + /* see Figure 10-12 in SA doc */ + part *p = ps->parts[0]; + + part_set_signal( p, "nCS0", 1, 0 ); + part_set_signal( p, "nCS1", 1, 1 ); + part_set_signal( p, "nCS2", 1, 1 ); + part_set_signal( p, "nCS3", 1, 1 ); + part_set_signal( p, "nCS4", 1, 1 ); + part_set_signal( p, "nCS5", 1, 1 ); + part_set_signal( p, "RD_nWR", 1, 1 ); + part_set_signal( p, "nWE", 1, 1 ); /* TODO: this is probably not required */ + part_set_signal( p, "nOE", 1, 0 ); + + setup_address( p, adr ); + set_data_in( p ); + + parts_shift_data_registers( ps ); + parts_shift_data_registers( ps ); + + { + int i; + char buff[10]; + uint32_t d = 0; + + for (i = 0; i < 32; i++) { + sprintf( buff, "D%d", i ); + d |= (uint32_t) (part_get_signal( p, buff ) << i); + } + + return d; + } +} + +void +sa1110_bus_write( parts *ps, uint32_t adr, uint32_t data ) +{ + /* see Figure 10-16 in SA doc */ + part *p = ps->parts[0]; + + part_set_signal( p, "nCS0", 1, 0 ); + part_set_signal( p, "nCS1", 1, 1 ); + part_set_signal( p, "nCS2", 1, 1 ); + part_set_signal( p, "nCS3", 1, 1 ); + part_set_signal( p, "nCS4", 1, 1 ); + part_set_signal( p, "nCS5", 1, 1 ); + part_set_signal( p, "RD_nWR", 1, 0 ); + part_set_signal( p, "nWE", 1, 1 ); + part_set_signal( p, "nOE", 1, 1 ); + + setup_address( p, adr ); + setup_data( p, data ); + + parts_shift_data_registers( ps ); + + part_set_signal( p, "nWE", 1, 0 ); + parts_shift_data_registers( ps ); + part_set_signal( p, "nWE", 1, 1 ); + parts_shift_data_registers( ps ); +} diff --git a/jtag/src/sa1110.h b/jtag/src/sa1110.h new file mode 100644 index 00000000..8430fb0e --- /dev/null +++ b/jtag/src/sa1110.h @@ -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. + * + */ + +#ifndef SA1110_H +#define SA1110_H + +#include + +#include "part.h" + +uint32_t sa1110_bus_read( parts *ps, uint32_t adr ); +void sa1110_bus_write( parts *ps, uint32_t adr, uint32_t data ); + +#endif /* SA1110_H */