[ 1984813 ] Bus driver cleanup, first step of part 4) (Hartley Sweeten)

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1277 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 17 years ago
parent 5c520db0eb
commit 2ceeefb022

@ -1,5 +1,17 @@
2008-06-09 Arnim Laeuger <arniml@users.sourceforge.net>
* src/bus/bf548_ezkit.c, src/bus/fjmem.c, src/bus/ppc405ep.c,
src/bus/sh7727.c, src/bus/prototype.c, src/bus/sa1110.c,
src/bus/ppc440gx_ebc8.c, src/bus/tx4925.c, src/bus/sh7750r.c,
src/bus/pxa2x0.c, src/bus/bf533_stamp.c, src/bus/bf533_ezkit.c,
src/bus/bf537_stamp.c, src/bus/ixp425.c, src/bus/avr32.c,
src/bus/h7202.c, src/bus/zefant-xs3.c, src/bus/mpc824x.c,
src/bus/bcm1250.c, src/bus/sharc21065l.c, src/bus/au1500.c,
src/bus/lh7a400.c, src/bus/sh7751r.c, src/bus/mpc5200.c,
src/bus/jopcyc.c, src/bus/bf561_ezkit.c, src/bus/slsup3.c,
src/bus/s3c4510x.c, src/bus/ejtag.c:
[ 1984813 ] Bus driver cleanup, first step of part 4) (Hartley Sweeten)
* src/svf/svf_flex.l, src/flash/flash.c (flashmem):
avoid '\r' in i18n strings (Hartley Sweeten)
* po/fr.po, po/rw.po, po/sk.po: remove '\r'

@ -21,7 +21,7 @@
* Written by ZHANG WEI <zwblue@sohu.com>, 2003
*
* Documentation:
* [1] AMD, "AMD Alchemy Solutions AU1500 Processor Data Book -
* [1] AMD, "AMD Alchemy Solutions AU1500 Processor Data Book -
* Preliminary Information", June 2003, Publication ID: 30361B
*
*/
@ -60,61 +60,10 @@ typedef struct{
#define nROE ((bus_params_t *) bus->params)->nroe
#define RD ((bus_params_t *) bus->params)->rd
static void
setup_address( bus_t *bus, uint32_t a)
{
int i;
part_t *p = PART;
for( i = 0; i < 32; i++)
part_set_signal( p, RAD[i], 1, (a >>i) & 1);
}
static int au1500_bus_area(bus_t * bus, uint32_t addr, bus_area_t * area);
static void
set_data_in( bus_t *bus )
{
int i;
part_t *p = PART;
bus_area_t area;
au1500_bus_area( bus, 0, &area);
for( i = 0; i < area.width; i++ )
part_set_signal( p, RD[i], 0, 0 );
}
static uint32_t
get_data_out( bus_t *bus )
{
int i;
part_t *p = PART;
bus_area_t area;
uint32_t d = 0;
au1500_bus_area( bus, 0, &area);
for( i = 0; i < area.width; i++ )
d |= (uint32_t)(part_get_signal( p, RD[i] ) << i);
return d;
}
static void
setup_data( bus_t *bus, uint32_t d)
{
int i;
part_t *p = PART;
bus_area_t area;
au1500_bus_area( bus, 0, &area);
for( i = 0; i < area.width; i++ )
part_set_signal( p, RD[i], 1, ( d>>i ) & 1 );
}
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
@ -122,14 +71,14 @@ static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] )
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &au1500_bus;
bus->params = calloc( 1, sizeof(bus_params_t) );
if (!bus->params){
@ -190,10 +139,40 @@ static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] )
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
au1500_bus_printinfo( bus_t *bus)
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("AU1500 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static int
/**
* bus->driver->(*prepare)
*
*/
static void
au1500_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
au1500_bus_area(bus_t *bus, uint32_t addr, bus_area_t *area)
{
area->description = NULL;
@ -204,28 +183,67 @@ au1500_bus_area(bus_t *bus, uint32_t addr, bus_area_t *area)
return 0;
}
static void
au1500_bus_printinfo( bus_t *bus)
setup_address( bus_t *bus, uint32_t a)
{
int i;
part_t *p = PART;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("AU1500 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
for( i = 0; i < 32; i++)
part_set_signal( p, RAD[i], 1, (a >>i) & 1);
}
static void
au1500_bus_prepare( bus_t *bus )
set_data_in( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
int i;
part_t *p = PART;
bus_area_t area;
au1500_bus_area( bus, 0, &area);
for( i = 0; i < area.width; i++ )
part_set_signal( p, RD[i], 0, 0 );
}
static void
static uint32_t
get_data_out( bus_t *bus )
{
int i;
part_t *p = PART;
bus_area_t area;
uint32_t d = 0;
au1500_bus_area( bus, 0, &area);
for( i = 0; i < area.width; i++ )
d |= (uint32_t)(part_get_signal( p, RD[i] ) << i);
return d;
}
static void
setup_data( bus_t *bus, uint32_t d)
{
int i;
part_t *p = PART;
bus_area_t area;
au1500_bus_area( bus, 0, &area);
for( i = 0; i < area.width; i++ )
part_set_signal( p, RD[i], 1, ( d>>i ) & 1 );
}
/**
* bus->driver->(*read_start)
*
*/
static void
au1500_bus_read_start( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
@ -244,6 +262,10 @@ au1500_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
au1500_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -255,6 +277,10 @@ au1500_bus_read_next( bus_t *bus, uint32_t adr )
return get_data_out( bus );
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
au1500_bus_read_end( bus_t *bus )
{
@ -273,6 +299,10 @@ au1500_bus_read_end( bus_t *bus )
return get_data_out( bus );
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
au1500_bus_read( bus_t *bus, uint32_t adr )
{
@ -280,6 +310,10 @@ au1500_bus_read( bus_t *bus, uint32_t adr )
return au1500_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
au1500_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{

@ -418,189 +418,6 @@ nexus_memacc_write (bus_t * bus, uint32_t addr, uint32_t data, uint32_t rwcs)
/* ------------------------------------------------------------------------- */
static void
avr32_bus_printinfo (bus_t * bus)
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf (_("AVR32 multi-mode bus driver (JTAG part No. %d)\n"), i);
}
static void
avr32_bus_prepare (bus_t * bus)
{
}
static void
avr32_bus_read_start (bus_t * bus, uint32_t addr)
{
addr &= ADDR_MASK;
DBG (DBG_BASIC, _("%s:addr=%08x\n"), __FUNCTION__, addr);
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
part_set_instruction (PART, "MEMORY_WORD_ACCESS");
mwa_scan_in_instr (bus);
mwa_scan_in_addr (bus, SLAVE, addr, ACCESS_MODE_READ);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
part_set_instruction (PART, "NEXUS_ACCESS");
nexus_access_start (bus);
nexus_memacc_set_addr (bus, addr, RWCS_RD);
break;
}
}
static uint32_t
avr32_bus_read_end (bus_t * bus)
{
uint32_t data;
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
mwa_scan_out_data (bus, &data);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
nexus_memacc_read (bus, &data);
nexus_access_end (bus);
break;
}
return data;
}
static uint32_t
avr32_bus_read_next (bus_t * bus, uint32_t addr)
{
uint32_t data;
addr &= ADDR_MASK;
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
data = avr32_bus_read_end (bus);
avr32_bus_read_start (bus, addr);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
nexus_memacc_read (bus, &data);
nexus_memacc_set_addr (bus, addr, RWCS_RD);
break;
}
return data;
}
static uint32_t
avr32_bus_read (bus_t * bus, uint32_t addr)
{
uint32_t ret;
avr32_bus_read_start (bus, addr);
ret = avr32_bus_read_end (bus);
return ret;
}
static void
avr32_bus_write (bus_t * bus, uint32_t addr, uint32_t data)
{
addr &= ADDR_MASK;
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
part_set_instruction (PART, "MEMORY_WORD_ACCESS");
mwa_write_word (bus, SLAVE, addr, data);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
part_set_instruction (PART, "NEXUS_ACCESS");
nexus_access_start (bus);
nexus_memacc_write (bus, addr, data, RWCS_WR);
nexus_access_end (bus);
break;
}
}
static int
avr32_bus_area (bus_t * bus, uint32_t addr, bus_area_t * area)
{
switch (MODE)
{
case BUS_MODE_HSBC:
area->description = "HSB memory space, cached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 32;
break;
case BUS_MODE_HSBU:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 32;
break;
case BUS_MODE_x8:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 8;
break;
case BUS_MODE_x16:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 16;
break;
case BUS_MODE_x32:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 32;
break;
case BUS_MODE_OCD:
if (addr < SAB_OCD_AREA_SIZE)
{
area->description = "OCD registers";
area->start = UINT32_C (0x00000000);
area->length = SAB_OCD_AREA_SIZE;
area->width = 32;
break;
}
/* fallthrough */
default:
area->description = NULL;
area->length = UINT64_C (0x100000000);
area->width = 0;
break;
}
return 0;
}
static void
avr32_bus_setup (bus_t * bus, chain_t * chain, part_t * part,
unsigned int mode)
@ -658,6 +475,10 @@ check_instruction (part_t * part, const char *instr)
return ret;
}
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
avr32_bus_new (chain_t * chain, char *cmd_params[])
{
@ -742,6 +563,221 @@ avr32_bus_new (chain_t * chain, char *cmd_params[])
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
avr32_bus_printinfo (bus_t * bus)
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf (_("AVR32 multi-mode bus driver (JTAG part No. %d)\n"), i);
}
/**
* bus->driver->(*prepare)
*
*/
static void
avr32_bus_prepare (bus_t * bus)
{
}
/**
* bus->driver->(*area)
*
*/
static int
avr32_bus_area (bus_t * bus, uint32_t addr, bus_area_t * area)
{
switch (MODE)
{
case BUS_MODE_HSBC:
area->description = "HSB memory space, cached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 32;
break;
case BUS_MODE_HSBU:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 32;
break;
case BUS_MODE_x8:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 8;
break;
case BUS_MODE_x16:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 16;
break;
case BUS_MODE_x32:
area->description = "HSB memory space, uncached";
area->start = UINT32_C (0x00000000);
area->length = SAB_HSB_AREA_SIZE;
area->width = 32;
break;
case BUS_MODE_OCD:
if (addr < SAB_OCD_AREA_SIZE)
{
area->description = "OCD registers";
area->start = UINT32_C (0x00000000);
area->length = SAB_OCD_AREA_SIZE;
area->width = 32;
break;
}
/* fallthrough */
default:
area->description = NULL;
area->length = UINT64_C (0x100000000);
area->width = 0;
break;
}
return 0;
}
/**
* bus->driver->(*read_start)
*
*/
static void
avr32_bus_read_start (bus_t * bus, uint32_t addr)
{
addr &= ADDR_MASK;
DBG (DBG_BASIC, _("%s:addr=%08x\n"), __FUNCTION__, addr);
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
part_set_instruction (PART, "MEMORY_WORD_ACCESS");
mwa_scan_in_instr (bus);
mwa_scan_in_addr (bus, SLAVE, addr, ACCESS_MODE_READ);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
part_set_instruction (PART, "NEXUS_ACCESS");
nexus_access_start (bus);
nexus_memacc_set_addr (bus, addr, RWCS_RD);
break;
}
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
avr32_bus_read_end (bus_t * bus)
{
uint32_t data;
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
mwa_scan_out_data (bus, &data);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
nexus_memacc_read (bus, &data);
nexus_access_end (bus);
break;
}
return data;
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
avr32_bus_read_next (bus_t * bus, uint32_t addr)
{
uint32_t data;
addr &= ADDR_MASK;
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
data = avr32_bus_read_end (bus);
avr32_bus_read_start (bus, addr);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
nexus_memacc_read (bus, &data);
nexus_memacc_set_addr (bus, addr, RWCS_RD);
break;
}
return data;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
avr32_bus_read (bus_t * bus, uint32_t addr)
{
uint32_t ret;
avr32_bus_read_start (bus, addr);
ret = avr32_bus_read_end (bus);
return ret;
}
/**
* bus->driver->(*write)
*
*/
static void
avr32_bus_write (bus_t * bus, uint32_t addr, uint32_t data)
{
addr &= ADDR_MASK;
switch (MODE)
{
case BUS_MODE_OCD:
case BUS_MODE_HSBC:
case BUS_MODE_HSBU:
part_set_instruction (PART, "MEMORY_WORD_ACCESS");
mwa_write_word (bus, SLAVE, addr, data);
break;
case BUS_MODE_x8:
case BUS_MODE_x16:
case BUS_MODE_x32:
part_set_instruction (PART, "NEXUS_ACCESS");
nexus_access_start (bus);
nexus_memacc_write (bus, addr, data, RWCS_WR);
nexus_access_end (bus);
break;
}
}
const bus_driver_t avr32_bus_driver = {
"avr32",
N_("Atmel AVR32 multi-mode bus driver, requires <mode> parameter\n"

@ -1,4 +1,3 @@
//#define USE_BCM_EJTAG
/*
* $Id$
*
@ -38,9 +37,8 @@
#include "buses.h"
#include "generic_bus.h"
#ifdef USE_BCM_EJTAG
int bcm1250_ejtag_do(bus_t *, uint64_t, uint64_t, int, int, unsigned char *, int);
#endif
//#define USE_BCM_EJTAG
typedef struct {
chain_t *chain;
part_t *part;
@ -60,6 +58,121 @@ typedef struct {
#define IO_WR_L ((bus_params_t *) bus->params)->io_wr_l
#define IO_OE_L ((bus_params_t *) bus->params)->io_oe_l
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bcm1250_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = & bcm1250_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 32; i++) {
sprintf( buff, "IO_AD%d", i );
IO_AD[i] = part_find_signal( PART, buff );
if (!IO_AD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 8; i++) {
sprintf( buff, "IO_CS_L%d", i );
IO_CS_L[i] = part_find_signal( PART, buff );
if (!IO_CS_L[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
IO_RW = part_find_signal( PART, "IO_RW" );
if (!IO_RW) {
printf( _("signal '%s' not found\n"), "IO_RW" );
failed = 1;
}
IO_WR_L = part_find_signal( PART, "IO_WR_L" );
if (!IO_WR_L) {
printf( _("signal '%s' not found\n"), "IO_WR_L" );
failed = 1;
}
IO_OE_L = part_find_signal( PART, "IO_OE_L" );
if (!IO_OE_L) {
printf( _("signal '%s' not found\n"), "IO_OE_L" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bcm1250_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Broadcom BCM1250 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
bcm1250_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
bcm1250_bus_area( bus_t *bus, uint32_t addr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 8;
return 0;
}
#ifndef USE_BCM_EJTAG
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -93,19 +206,11 @@ setup_data( bus_t *bus, uint32_t d )
}
}
#ifndef USE_BCM_EJTAG
/**
* bus->driver->(*read_start)
*
*/
static void
bcm1250_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Broadcom BCM1250 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
void
bcm1250_bus_read_start( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
@ -129,7 +234,11 @@ bcm1250_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
uint32_t
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
bcm1250_bus_read_next( bus_t *bus , uint32_t adr )
{
part_t *p = PART;
@ -150,7 +259,11 @@ bcm1250_bus_read_next( bus_t *bus , uint32_t adr )
}
}
uint32_t
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
bcm1250_bus_read_end( bus_t *bus )
{
part_t *p = PART;
@ -172,7 +285,11 @@ bcm1250_bus_read_end( bus_t *bus )
}
}
uint32_t
/**
* bus->driver->(*read)
*
*/
static uint32_t
bcm1250_bus_read( bus_t *bus, uint32_t adr )
{
uint32_t i;
@ -181,7 +298,11 @@ bcm1250_bus_read( bus_t *bus, uint32_t adr )
return i;
}
void
/**
* bus->driver->(*write)
*
*/
static void
bcm1250_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
part_t *p = PART;
@ -206,156 +327,41 @@ bcm1250_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
part_set_signal( p, IO_WR_L, 1, 0 );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, IO_WR_L, 1, 1 );
chain_shift_data_registers( chain, 0 );
}
#else /* BCM_EJTAG */
#else /* #ifndef USE_BCM_EJTAG */
int addr;
uint64_t base = 0x1fc00000;
uint32_t bcm1250_bus_read(bus_t *bus, uint32_t adr ) {
unsigned char buf[32];
bcm1250_ejtag_do(bus, adr+base, 0, 1, 0, buf, 0);
return buf[adr&0x1f];
}
uint32_t bcm1250_bus_read_next(bus_t *bus, uint32_t adr ) {
uint32_t t;
t=bcm1250_bus_read(bus, addr);
addr=adr;
return t;
}
uint32_t bcm1250_bus_read_end(bus_t *bus) {
return bcm1250_bus_read(bus, addr);
}
void bcm1250_bus_read_start(bus_t *bus, uint32_t adr ) {
addr=adr;
}
void
bcm1250_bus_write( bus_t *bus, uint32_t adr, uint32_t data ) {
unsigned char buf[32];
bcm1250_ejtag_do(bus, adr+base, data, 0, 0, buf, 0);
}
#endif
static int
bcm1250_bus_area( bus_t *bus, uint32_t addr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 8;
return 0;
}
static void
bcm1250_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
static bus_t *
bcm1250_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = & bcm1250_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 32; i++) {
sprintf( buff, "IO_AD%d", i );
IO_AD[i] = part_find_signal( PART, buff );
if (!IO_AD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 8; i++) {
sprintf( buff, "IO_CS_L%d", i );
IO_CS_L[i] = part_find_signal( PART, buff );
if (!IO_CS_L[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
IO_RW = part_find_signal( PART, "IO_RW" );
if (!IO_RW) {
printf( _("signal '%s' not found\n"), "IO_RW" );
failed = 1;
}
IO_WR_L = part_find_signal( PART, "IO_WR_L" );
if (!IO_WR_L) {
printf( _("signal '%s' not found\n"), "IO_WR_L" );
failed = 1;
}
IO_OE_L = part_find_signal( PART, "IO_OE_L" );
if (!IO_OE_L) {
printf( _("signal '%s' not found\n"), "IO_OE_L" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
#ifdef USE_BCM_EJTAG
int bcm1250_ejtag_do(bus_t *bus, uint64_t ad, uint64_t da, int read, int type,
bcm1250_ejtag_do(bus_t *bus, uint64_t ad, uint64_t da, int read, int type,
unsigned char *buf, int verbose) {
part_t *p = PART;
chain_t *chain = CHAIN;
char ctrl[15]="010000000000";
char addrr[80]="0000" "111" "000"
char addrr[80]="0000" "111" "000"
"11111111111111111111111111111111"
"00000000" "00011111" "11000000" "00000000" "000";
int j, k, n, m;
uint64_t a;
if(verbose)printf("BCM1250: ejtag_do(%08Lx, %08Lx, %i, %i)\n", ad, da, read, type);
a=ad>>5;
for(j=0;j<35;j++) {
addrr[76-j]='0'+(a&1);
a>>=1;
}
j=(1<<type)-1;
for(m=10; m<42; m++) addrr[m]='0';
n=ad&(~j&0x1f);
for(m=n; m<n+(1<<type); m++) addrr[m+10]='1';
for(m=n; m<n+(1<<type); m++) addrr[m+10]='1';
ctrl[2]='0';
ctrl[3]='0';
@ -436,13 +442,13 @@ int bcm1250_ejtag_do(bus_t *bus, uint64_t ad, uint64_t da, int read, int type,
if(verbose || read) {
volatile int q;
int to;
to=5;
for(q=0;q<100;q++);
part_set_instruction( p, "DATA");
chain_shift_instructions(chain);
chain_shift_data_registers( chain, 1 );
while((p->active_instruction->data_register->out->data[276-17]==0) && to--) {
chain_shift_data_registers( chain, 1 );
}
@ -467,7 +473,64 @@ int bcm1250_ejtag_do(bus_t *bus, uint64_t ad, uint64_t da, int read, int type,
}
return 0;
}
#endif
/**
* bus->driver->(*read_start)
*
*/
static void
bcm1250_bus_read_start(bus_t *bus, uint32_t adr )
{
addr=adr;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
bcm1250_bus_read(bus_t *bus, uint32_t adr )
{
unsigned char buf[32];
bcm1250_ejtag_do(bus, adr+base, 0, 1, 0, buf, 0);
return buf[adr&0x1f];
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
bcm1250_bus_read_next(bus_t *bus, uint32_t adr )
{
uint32_t t;
t=bcm1250_bus_read(bus, addr);
addr=adr;
return t;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t bcm1250_bus_read_end(bus_t *bus)
{
return bcm1250_bus_read(bus, addr);
}
/**
* bus->driver->(*write)
*
*/
static void
bcm1250_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
unsigned char buf[32];
bcm1250_ejtag_do(bus, adr+base, data, 0, 0, buf, 0);
}
#endif /* #else #ifndef USE_BCM_EJTAG */
const bus_driver_t bcm1250_bus = {
"bcm1250",

@ -65,7 +65,163 @@ typedef struct {
#define SMS ((bus_params_t *) bus->params)->sms
#define SWE ((bus_params_t *) bus->params)->swe
static void
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf533_ezkit_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR[%d]", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA[%d]", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
AOE = part_find_signal( PART, "AOE_B" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOE_B" );
failed = 1;
}
ABE[0] = part_find_signal( PART, "ABE_B0" );
if (!ABE[0]) {
printf( _("signal '%s' not found\n"), "ABE_B0" );
failed = 1;
}
ABE[1] = part_find_signal( PART, "ABE_B1" );
if (!ABE[1]) {
printf( _("signal '%s' not found\n"), "ABE_B1" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
SMS = part_find_signal( PART, "SMS_B" );
if (!SMS) {
printf( _("signal '%s' not found\n"), "SMS_B" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf533_ezkit_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF533 EZKit compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
bf533_ezkit_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
bf533_ezkit_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
select_flash( bus_t *bus )
{
part_t *p = PART;
@ -84,7 +240,7 @@ select_flash( bus_t *bus )
part_set_signal( p, SMS, 1, 1 );
}
static void
static void
unselect_flash( bus_t *bus )
{
part_t *p = PART;
@ -134,24 +290,10 @@ setup_data( bus_t *bus, uint32_t d )
}
static void
bf533_ezkit_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF533 EZKit compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
bf533_ezkit_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
bf533_ezkit_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -168,6 +310,10 @@ bf533_ezkit_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
bf533_ezkit_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -185,6 +331,10 @@ bf533_ezkit_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
bf533_ezkit_bus_read_end( bus_t *bus )
{
@ -205,6 +355,10 @@ bf533_ezkit_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
bf533_ezkit_bus_read( bus_t *bus, uint32_t adr )
{
@ -212,6 +366,10 @@ bf533_ezkit_bus_read( bus_t *bus, uint32_t adr )
return bf533_ezkit_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
bf533_ezkit_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -235,128 +393,6 @@ bf533_ezkit_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
bf533_ezkit_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf533_ezkit_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR[%d]", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA[%d]", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
AOE = part_find_signal( PART, "AOE_B" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOE_B" );
failed = 1;
}
ABE[0] = part_find_signal( PART, "ABE_B0" );
if (!ABE[0]) {
printf( _("signal '%s' not found\n"), "ABE_B0" );
failed = 1;
}
ABE[1] = part_find_signal( PART, "ABE_B1" );
if (!ABE[1]) {
printf( _("signal '%s' not found\n"), "ABE_B1" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
SMS = part_find_signal( PART, "SMS_B" );
if (!SMS) {
printf( _("signal '%s' not found\n"), "SMS_B" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t bf533_ezkit_bus = {
"bf533_ezkit",
N_("Blackfin BF533 EZKit board bus driver"),

@ -65,7 +65,161 @@ typedef struct {
#define SMS ((bus_params_t *) bus->params)->sms
#define SWE ((bus_params_t *) bus->params)->swe
static void
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf533_stamp_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 2; i++) {
sprintf( buff, "PF%d", i );
PF[i] = part_find_signal( PART, buff );
if (!PF[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR[%d]", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA[%d]", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
AOE = part_find_signal( PART, "AOE_B" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOE_B" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
SMS = part_find_signal( PART, "SMS_B" );
if (!SMS) {
printf( _("signal '%s' not found\n"), "SMS_B" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf533_stamp_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF533 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
bf533_stamp_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
bf533_stamp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
select_flash( bus_t *bus )
{
part_t *p = PART;
@ -84,7 +238,7 @@ select_flash( bus_t *bus )
part_set_signal( p, SMS, 1, 1 );
}
static void
static void
unselect_flash( bus_t *bus )
{
part_t *p = PART;
@ -134,24 +288,10 @@ setup_data( bus_t *bus, uint32_t d )
}
static void
bf533_stamp_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF533 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
bf533_stamp_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
bf533_stamp_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -168,6 +308,10 @@ bf533_stamp_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
bf533_stamp_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -185,6 +329,10 @@ bf533_stamp_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
bf533_stamp_bus_read_end( bus_t *bus )
{
@ -205,6 +353,10 @@ bf533_stamp_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
bf533_stamp_bus_read( bus_t *bus, uint32_t adr )
{
@ -212,6 +364,10 @@ bf533_stamp_bus_read( bus_t *bus, uint32_t adr )
return bf533_stamp_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
bf533_stamp_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -235,126 +391,6 @@ bf533_stamp_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
bf533_stamp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf533_stamp_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 2; i++) {
sprintf( buff, "PF%d", i );
PF[i] = part_find_signal( PART, buff );
if (!PF[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR[%d]", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA[%d]", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
AOE = part_find_signal( PART, "AOE_B" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOE_B" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
SMS = part_find_signal( PART, "SMS_B" );
if (!SMS) {
printf( _("signal '%s' not found\n"), "SMS_B" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t bf533_stamp_bus = {
"bf533_stamp",
N_("Blackfin BF533 Stamp board bus driver"),

@ -65,6 +65,146 @@ typedef struct {
#define SMS ((bus_params_t *) bus->params)->sms
#define SWE ((bus_params_t *) bus->params)->swe
/*
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf537_stamp_bus_new_1( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR%d", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA%d", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
ARE = part_find_signal( PART, "ARE_B" );
if (!ARE) {
printf( _("signal '%s' not found\n"), "ARE_B" );
failed = 1;
}
ABE[0] = part_find_signal( PART, "ABE_B0" );
if (!ABE[0]) {
printf( _("signal '%s' not found\n"), "ABE_B0" );
failed = 1;
}
ABE[1] = part_find_signal( PART, "ABE_B1" );
if (!ABE[1]) {
printf( _("signal '%s' not found\n"), "ABE_B1" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
SMS = part_find_signal( PART, "SMS_B" );
if (!SMS) {
printf( _("signal '%s' not found\n"), "SMS_B" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*prepare)
*
*/
static void
bf537_stamp_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
bf537_stamp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
select_flash( bus_t *bus )
{
@ -134,13 +274,10 @@ setup_data( bus_t *bus, uint32_t d )
}
static void
bf537_stamp_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
bf537_stamp_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -157,6 +294,10 @@ bf537_stamp_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
bf537_stamp_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -174,6 +315,10 @@ bf537_stamp_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
bf537_stamp_bus_read_end( bus_t *bus )
{
@ -194,6 +339,10 @@ bf537_stamp_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
bf537_stamp_bus_read( bus_t *bus, uint32_t adr )
{
@ -201,6 +350,10 @@ bf537_stamp_bus_read( bus_t *bus, uint32_t adr )
return bf537_stamp_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
bf537_stamp_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -224,128 +377,12 @@ bf537_stamp_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
bf537_stamp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
bf537_stamp_bus_new_1( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR%d", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA%d", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
ARE = part_find_signal( PART, "ARE_B" );
if (!ARE) {
printf( _("signal '%s' not found\n"), "ARE_B" );
failed = 1;
}
ABE[0] = part_find_signal( PART, "ABE_B0" );
if (!ABE[0]) {
printf( _("signal '%s' not found\n"), "ABE_B0" );
failed = 1;
}
ABE[1] = part_find_signal( PART, "ABE_B1" );
if (!ABE[1]) {
printf( _("signal '%s' not found\n"), "ABE_B1" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
SMS = part_find_signal( PART, "SMS_B" );
if (!SMS) {
printf( _("signal '%s' not found\n"), "SMS_B" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
#ifdef ENABLE_BUS_BF537_STAMP
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf537_stamp_bus_new( chain_t *chain, char *cmd_params[] )
{
@ -356,6 +393,10 @@ bf537_stamp_bus_new( chain_t *chain, char *cmd_params[] )
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf537_stamp_bus_printinfo( bus_t *bus )
{
@ -382,9 +423,15 @@ const bus_driver_t bf537_stamp_bus = {
bf537_stamp_bus_write,
NULL
};
#endif
#endif /* #ifdef ENABLE_BUS_BF537_STAMP */
#ifdef ENABLE_BUS_BF537_EZKIT
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf537_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
@ -395,6 +442,10 @@ bf537_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf537_ezkit_bus_printinfo( bus_t *bus )
{
@ -421,9 +472,15 @@ const bus_driver_t bf537_ezkit_bus = {
bf537_stamp_bus_write,
NULL
};
#endif
#endif /* #ifdef ENABLE_BUS_BF537_EZKIT */
#ifdef ENABLE_BUS_BF527_EZKIT
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf527_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
@ -434,6 +491,10 @@ bf527_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf527_ezkit_bus_printinfo( bus_t *bus )
{
@ -460,6 +521,5 @@ const bus_driver_t bf527_ezkit_bus = {
bf537_stamp_bus_write,
NULL
};
#endif
#endif /* #ifdef ENABLE_BUS_BF527_EZKIT */

@ -60,6 +60,165 @@ typedef struct {
#define DCS0 ((bus_params_t *) bus->params)->dcs0
#define NCE ((bus_params_t *) bus->params)->nce
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf548_ezkit_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS%dB", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 3; i++) {
sprintf( buff, "ADDR%d", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 3; i < 9; i++) {
sprintf( buff, "PORTH_%d", i + 5);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 9; i < 24; i++) {
sprintf( buff, "PORTI_%d", i - 9);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA%d", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWEB" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWEB" );
failed = 1;
}
ARE = part_find_signal( PART, "AREB" );
if (!ARE) {
printf( _("signal '%s' not found\n"), "AREB" );
failed = 1;
}
AOE = part_find_signal( PART, "AOEB" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOEB" );
failed = 1;
}
DCS0 = part_find_signal( PART, "CS0_B" );
if (!DCS0) {
printf( _("signal '%s' not found\n"), "CS0_B" );
failed = 1;
}
NCE = part_find_signal( PART, "PORTJ_1" );
if (!NCE) {
printf( _("signal '%s' not found\n"), "PORTJ_1" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf548_ezkit_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF548 EZ-KIT compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
bf548_ezkit_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
bf548_ezkit_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
select_flash( bus_t *bus )
{
@ -117,24 +276,10 @@ setup_data( bus_t *bus, uint32_t d )
}
static void
bf548_ezkit_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF548 EZ-KIT compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
bf548_ezkit_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
bf548_ezkit_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -152,6 +297,10 @@ bf548_ezkit_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
bf548_ezkit_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -169,6 +318,10 @@ bf548_ezkit_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
bf548_ezkit_bus_read_end( bus_t *bus )
{
@ -190,6 +343,10 @@ bf548_ezkit_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
bf548_ezkit_bus_read( bus_t *bus, uint32_t adr )
{
@ -197,6 +354,10 @@ bf548_ezkit_bus_read( bus_t *bus, uint32_t adr )
return bf548_ezkit_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
bf548_ezkit_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -220,131 +381,6 @@ bf548_ezkit_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
bf548_ezkit_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf548_ezkit_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS%dB", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 3; i++) {
sprintf( buff, "ADDR%d", i + 1);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 3; i < 9; i++) {
sprintf( buff, "PORTH_%d", i + 5);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 9; i < 24; i++) {
sprintf( buff, "PORTI_%d", i - 9);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA%d", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWEB" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWEB" );
failed = 1;
}
ARE = part_find_signal( PART, "AREB" );
if (!ARE) {
printf( _("signal '%s' not found\n"), "AREB" );
failed = 1;
}
AOE = part_find_signal( PART, "AOEB" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOEB" );
failed = 1;
}
DCS0 = part_find_signal( PART, "CS0_B" );
if (!DCS0) {
printf( _("signal '%s' not found\n"), "CS0_B" );
failed = 1;
}
NCE = part_find_signal( PART, "PORTJ_1" );
if (!NCE) {
printf( _("signal '%s' not found\n"), "PORTJ_1" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t bf548_ezkit_bus = {
"bf548_ezkit",
N_("Blackfin BF548 EZ-KIT board bus driver"),

@ -65,6 +65,164 @@ typedef struct {
#define SMS ((bus_params_t *) bus->params)->sms
#define SWE ((bus_params_t *) bus->params)->swe
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf561_ezkit_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 24; i++) {
sprintf( buff, "ADDR%d", i + 2);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "ABE_B%d", i);
ABE[i] = part_find_signal( PART, buff );
if (!ABE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "DATA%d", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
AOE = part_find_signal( PART, "AOE_B" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOE_B" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
for (i = 0; i < 4; i++) {
sprintf( buff, "SMS_B%d", i );
SMS[i] = part_find_signal( PART, buff );
if (!SMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf561_ezkit_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF561 EZ-KIT compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
bf561_ezkit_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
bf561_ezkit_bus_area( bus_t *bus, uint32_t addr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
select_flash( bus_t *bus )
{
@ -145,24 +303,10 @@ setup_data( bus_t *bus, uint32_t d )
}
static void
bf561_ezkit_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF561 EZ-KIT compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
bf561_ezkit_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
bf561_ezkit_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -179,6 +323,10 @@ bf561_ezkit_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
bf561_ezkit_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -196,6 +344,10 @@ bf561_ezkit_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
bf561_ezkit_bus_read_end( bus_t *bus )
{
@ -216,6 +368,10 @@ bf561_ezkit_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
bf561_ezkit_bus_read( bus_t *bus, uint32_t adr )
{
@ -223,6 +379,10 @@ bf561_ezkit_bus_read( bus_t *bus, uint32_t adr )
return bf561_ezkit_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
bf561_ezkit_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -244,130 +404,6 @@ bf561_ezkit_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
bf561_ezkit_bus_area( bus_t *bus, uint32_t addr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &bf561_ezkit_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 4; i++) {
sprintf( buff, "AMS_B%d", i );
AMS[i] = part_find_signal( PART, buff );
if (!AMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 24; i++) {
sprintf( buff, "ADDR%d", i + 2);
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "ABE_B%d", i);
ABE[i] = part_find_signal( PART, buff );
if (!ABE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "DATA%d", i);
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AWE = part_find_signal( PART, "AWE_B" );
if (!AWE) {
printf( _("signal '%s' not found\n"), "AWE_B" );
failed = 1;
}
AOE = part_find_signal( PART, "AOE_B" );
if (!AOE) {
printf( _("signal '%s' not found\n"), "AOE_B" );
failed = 1;
}
SRAS = part_find_signal( PART, "SRAS_B" );
if (!SRAS) {
printf( _("signal '%s' not found\n"), "SRAS_B" );
failed = 1;
}
SCAS = part_find_signal( PART, "SCAS_B" );
if (!SCAS) {
printf( _("signal '%s' not found\n"), "SCAS_B" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE_B" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE_B" );
failed = 1;
}
for (i = 0; i < 4; i++) {
sprintf( buff, "SMS_B%d", i );
SMS[i] = part_find_signal( PART, buff );
if (!SMS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t bf561_ezkit_bus = {
"bf561_ezkit",
N_("Blackfin BF561 EZ-KIT board bus driver"),

@ -60,19 +60,6 @@ typedef struct {
#define EJTAG_25 1
#define EJTAG_26 2
static int ejtag_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
ejtag_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("EJTAG compatible bus driver via PrAcc (JTAG part No. %d)\n"), i );
}
/* EJTAG control register bits */
#define PerRst 20
#define PRnW 19
@ -86,6 +73,51 @@ ejtag_bus_printinfo( bus_t *bus )
#define Rocc 31
#define ProbTrap 14
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
ejtag_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ejtag_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
BP->initialized = 0;
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
ejtag_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("EJTAG compatible bus driver via PrAcc (JTAG part No. %d)\n"), i );
}
static uint32_t
reg_value( tap_register *reg )
{
@ -293,6 +325,10 @@ ejtag_bus_init( bus_t *bus )
BP->initialized = 1;
}
/**
* bus->driver->(*prepare)
*
*/
static void
ejtag_bus_prepare( bus_t *bus )
{
@ -302,6 +338,37 @@ ejtag_bus_prepare( bus_t *bus )
ejtag_bus_init( bus );
}
/**
* bus->driver->(*area)
*
*/
static int
ejtag_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if (adr < UINT32_C(0x20000000)) {
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x20000000);
area->width = 8;
} else if (adr < UINT32_C(0x40000000)) {
area->description = NULL;
area->start = UINT32_C(0x20000000);
area->length = UINT64_C(0x20000000);
area->width = 16;
} else if (adr < UINT32_C(0x60000000)) {
area->description = NULL;
area->start = UINT32_C(0x40000000);
area->length = UINT64_C(0x20000000);
area->width = 32;
} else {
area->description = NULL;
area->start = UINT32_C(0x60000000);
area->length = UINT64_C(0xa0000000);
area->width = 0;
}
return 0;
}
static int
ejtag_gen_read( uint32_t *code, uint32_t adr )
{
@ -338,6 +405,10 @@ ejtag_gen_read( uint32_t *code, uint32_t adr )
return p - code;
}
/**
* bus->driver->(*read_start)
*
*/
static void
ejtag_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -347,6 +418,10 @@ ejtag_bus_read_start( bus_t *bus, uint32_t adr )
// printf("bus_read_start: adr=0x%08x\n", adr);
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
ejtag_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -362,6 +437,10 @@ ejtag_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
ejtag_bus_read_end( bus_t *bus )
{
@ -377,6 +456,10 @@ ejtag_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
ejtag_bus_read( bus_t *bus, uint32_t adr )
{
@ -384,6 +467,10 @@ ejtag_bus_read( bus_t *bus, uint32_t adr )
return ejtag_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
ejtag_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -420,59 +507,6 @@ ejtag_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
// printf("bus_write: adr=0x%08x data=0x%08x\n", adr, data);
}
static int
ejtag_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if (adr < UINT32_C(0x20000000)) {
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x20000000);
area->width = 8;
} else if (adr < UINT32_C(0x40000000)) {
area->description = NULL;
area->start = UINT32_C(0x20000000);
area->length = UINT64_C(0x20000000);
area->width = 16;
} else if (adr < UINT32_C(0x60000000)) {
area->description = NULL;
area->start = UINT32_C(0x40000000);
area->length = UINT64_C(0x20000000);
area->width = 32;
} else {
area->description = NULL;
area->start = UINT32_C(0x60000000);
area->length = UINT64_C(0xa0000000);
area->width = 0;
}
return 0;
}
static bus_t *
ejtag_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ejtag_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
BP->initialized = 0;
return bus;
}
const bus_driver_t ejtag_bus = {
"ejtag",
N_("EJTAG compatible bus driver via PrAcc"),

File diff suppressed because it is too large Load Diff

@ -1,5 +1,5 @@
/*
* Copyright (C) 2005, Raphael Mack
* Copyright (C) 2005, Raphael Mack
* Work heavily based on file sa1110.c
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -55,6 +55,127 @@ typedef struct {
#define nRWE ((bus_params_t *) bus->params)->nRWE
#define nROE ((bus_params_t *) bus->params)->nROE
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
h7202_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &h7202_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 25; i++) {
sprintf( buff, "RA%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "RD%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nRCS%d", i );
nRCS[i] = part_find_signal( PART, buff );
if (!nRCS[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
break;
}
}
nROE = part_find_signal( PART, "nROE" );
if (!nROE) {
printf( "signal '%s' not found\n", "nROE" );
failed = 1;
}
for (i = 0; i < 4; i++){
sprintf( buff, "nRWE%d", i);
nRWE[i] = part_find_signal( PART, buff );
if (!nRWE[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
h7202_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( "H7202 compatible bus driver via BSR (JTAG part No. %d)\n", i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
h7202_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
h7202_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16; //part_get_signal( PART, part_find_signal( PART, "ROM_SEL" ) ) ? 32 : 16;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -65,8 +186,6 @@ setup_address( bus_t *bus, uint32_t a )
part_set_signal( p, A[i], 1, (a >> i) & 1 );
}
static int h7202_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
set_data_in( bus_t *bus )
{
@ -93,24 +212,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[i], 1, (d >> i) & 1 );
}
static void
h7202_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( "H7202 compatible bus driver via BSR (JTAG part No. %d)\n", i );
}
static void
h7202_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
h7202_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -131,6 +236,10 @@ h7202_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
h7202_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -152,6 +261,10 @@ h7202_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
h7202_bus_read_end( bus_t *bus )
{
@ -177,6 +290,10 @@ h7202_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
h7202_bus_read( bus_t *bus, uint32_t adr )
{
@ -184,6 +301,10 @@ h7202_bus_read( bus_t *bus, uint32_t adr )
return h7202_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
h7202_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -199,7 +320,7 @@ h7202_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
part_set_signal( p, nRCS[1], 1, 1 );
part_set_signal( p, nRCS[2], 1, 1 );
part_set_signal( p, nRCS[3], 1, 1 );
part_set_signal( p, nRWE[0], 1, 0 );
part_set_signal( p, nRWE[1], 1, 1 );
part_set_signal( p, nRWE[2], 1, 1 );
@ -219,93 +340,6 @@ h7202_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
h7202_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16; //part_get_signal( PART, part_find_signal( PART, "ROM_SEL" ) ) ? 32 : 16;
return 0;
}
static bus_t *
h7202_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &h7202_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 25; i++) {
sprintf( buff, "RA%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "RD%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nRCS%d", i );
nRCS[i] = part_find_signal( PART, buff );
if (!nRCS[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
break;
}
}
nROE = part_find_signal( PART, "nROE" );
if (!nROE) {
printf( "signal '%s' not found\n", "nROE" );
failed = 1;
}
for (i = 0; i < 4; i++){
sprintf( buff, "nRWE%d", i);
nRWE[i] = part_find_signal( PART, buff );
if (!nRWE[i]) {
printf( "signal '%s' not found\n", buff );
failed = 1;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t h7202_bus = {
"h7202",
"H7202 compatible bus driver via BSR",

@ -55,7 +55,124 @@ typedef struct {
#define EX_WR ((bus_params_t *) bus->params)->ex_wr
#define EX_RD ((bus_params_t *) bus->params)->ex_rd
static void
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
ixp425_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ixp425_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 8; i++) {
sprintf( buff, "EX_CS[%d]", i );
EX_CS[i] = part_find_signal( PART, buff );
if (!EX_CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 24; i++) {
sprintf( buff, "EX_ADDR[%d]", i );
EX_ADDR[i] = part_find_signal( PART, buff );
if (!EX_ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "EX_DATA[%d]", i );
EX_DATA[i] = part_find_signal( PART, buff );
if (!EX_DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
EX_WR = part_find_signal( PART, "EX_WR" );
if (!EX_WR) {
printf( _("signal '%s' not found\n"), "EX_WR" );
failed = 1;
}
EX_RD = part_find_signal( PART, "EX_RD" );
if (!EX_RD) {
printf( _("signal '%s' not found\n"), "EX_RD" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
ixp425_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Intel IXP425 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
ixp425_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
ixp425_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
select_flash( bus_t *bus )
{
part_t *p = PART;
@ -70,7 +187,7 @@ select_flash( bus_t *bus )
part_set_signal( p, EX_CS[7], 1, 1 );
}
static void
static void
unselect_flash( bus_t *bus )
{
part_t *p = PART;
@ -115,24 +232,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, EX_DATA[i], 1, (d >> i) & 1 );
}
static void
ixp425_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Intel IXP425 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
ixp425_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
ixp425_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -149,6 +252,10 @@ ixp425_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
ixp425_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -166,6 +273,10 @@ ixp425_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
ixp425_bus_read_end( bus_t *bus )
{
@ -186,6 +297,10 @@ ixp425_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
ixp425_bus_read( bus_t *bus, uint32_t adr )
{
@ -193,6 +308,10 @@ ixp425_bus_read( bus_t *bus, uint32_t adr )
return ixp425_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
ixp425_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -214,89 +333,6 @@ ixp425_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
ixp425_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
ixp425_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ixp425_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 8; i++) {
sprintf( buff, "EX_CS[%d]", i );
EX_CS[i] = part_find_signal( PART, buff );
if (!EX_CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 24; i++) {
sprintf( buff, "EX_ADDR[%d]", i );
EX_ADDR[i] = part_find_signal( PART, buff );
if (!EX_ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "EX_DATA[%d]", i );
EX_DATA[i] = part_find_signal( PART, buff );
if (!EX_DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
EX_WR = part_find_signal( PART, "EX_WR" );
if (!EX_WR) {
printf( _("signal '%s' not found\n"), "EX_WR" );
failed = 1;
}
EX_RD = part_find_signal( PART, "EX_RD" );
if (!EX_RD) {
printf( _("signal '%s' not found\n"), "EX_RD" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t ixp425_bus = {
"ixp425",
N_("Intel IXP425 compatible bus driver via BSR"),

@ -133,6 +133,240 @@ typedef struct {
#define SER_TXD ((bus_params_t *) bus->params)->ser_txd
#define SER_NCTS ((bus_params_t *) bus->params)->ser_ncts
static int
attach_sig( bus_t *bus, signal_t **sig, char *id )
{
int failed = 0;
*sig = part_find_signal( PART, id );
if (!*sig) {
printf( _("signal '%s' not found\n"), id );
failed = 1;
}
return failed;
}
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
jopcyc_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
int failed = 0;
component_t *comp;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &jopcyc_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
/*
* Setup RAMA
*/
comp = COMP_RAMA;
comp->ctype = RAM;
comp->cname = "RAMA";
failed |= attach_sig( bus, &(A[ 0]), "IO64" );
failed |= attach_sig( bus, &(A[ 1]), "IO66" );
failed |= attach_sig( bus, &(A[ 2]), "IO68" );
failed |= attach_sig( bus, &(A[ 3]), "IO74" );
failed |= attach_sig( bus, &(A[ 4]), "IO76" );
failed |= attach_sig( bus, &(A[ 5]), "IO107" );
failed |= attach_sig( bus, &(A[ 6]), "IO113" );
failed |= attach_sig( bus, &(A[ 7]), "IO115" );
failed |= attach_sig( bus, &(A[ 8]), "IO117" );
failed |= attach_sig( bus, &(A[ 9]), "IO119" );
failed |= attach_sig( bus, &(A[10]), "IO118" );
failed |= attach_sig( bus, &(A[11]), "IO116" );
failed |= attach_sig( bus, &(A[12]), "IO114" );
failed |= attach_sig( bus, &(A[13]), "IO108" );
failed |= attach_sig( bus, &(A[14]), "IO106" );
failed |= attach_sig( bus, &(A[15]), "IO67" );
failed |= attach_sig( bus, &(A[16]), "IO65" );
failed |= attach_sig( bus, &(A[17]), "IO63" );
A[18] = NULL;
failed |= attach_sig( bus, &(D[ 0]), "IO82" );
failed |= attach_sig( bus, &(D[ 1]), "IO84" );
failed |= attach_sig( bus, &(D[ 2]), "IO86" );
failed |= attach_sig( bus, &(D[ 3]), "IO88" );
failed |= attach_sig( bus, &(D[ 4]), "IO94" );
failed |= attach_sig( bus, &(D[ 5]), "IO98" );
failed |= attach_sig( bus, &(D[ 6]), "IO100" );
failed |= attach_sig( bus, &(D[ 7]), "IO104" );
failed |= attach_sig( bus, &(D[ 8]), "IO101" );
failed |= attach_sig( bus, &(D[ 9]), "IO99" );
failed |= attach_sig( bus, &(D[10]), "IO95" );
failed |= attach_sig( bus, &(D[11]), "IO93" );
failed |= attach_sig( bus, &(D[12]), "IO87" );
failed |= attach_sig( bus, &(D[13]), "IO85" );
failed |= attach_sig( bus, &(D[14]), "IO83" );
failed |= attach_sig( bus, &(D[15]), "IO79" );
failed |= attach_sig( bus, &(nCS), "IO78" );
failed |= attach_sig( bus, &(nOE), "IO73" );
failed |= attach_sig( bus, &(nWE), "IO105" );
failed |= attach_sig( bus, &(nLB), "IO77" );
failed |= attach_sig( bus, &(nUB), "IO75" );
nCS2 = NULL;
nRDY = NULL;
/*
* Setup RAMB
*/
comp = COMP_RAMB;
comp->ctype = RAM;
comp->cname = "RAMB";
failed |= attach_sig( bus, &(A[ 0]), "IO237" );
failed |= attach_sig( bus, &(A[ 1]), "IO235" );
failed |= attach_sig( bus, &(A[ 2]), "IO233" );
failed |= attach_sig( bus, &(A[ 3]), "IO227" );
failed |= attach_sig( bus, &(A[ 4]), "IO225" );
failed |= attach_sig( bus, &(A[ 5]), "IO194" );
failed |= attach_sig( bus, &(A[ 6]), "IO188" );
failed |= attach_sig( bus, &(A[ 7]), "IO186" );
failed |= attach_sig( bus, &(A[ 8]), "IO184" );
failed |= attach_sig( bus, &(A[ 9]), "IO182" );
failed |= attach_sig( bus, &(A[10]), "IO183" );
failed |= attach_sig( bus, &(A[11]), "IO185" );
failed |= attach_sig( bus, &(A[12]), "IO187" );
failed |= attach_sig( bus, &(A[13]), "IO193" );
failed |= attach_sig( bus, &(A[14]), "IO195" );
failed |= attach_sig( bus, &(A[15]), "IO234" );
failed |= attach_sig( bus, &(A[16]), "IO236" );
failed |= attach_sig( bus, &(A[17]), "IO238" );
A[18] = NULL;
failed |= attach_sig( bus, &(D[ 0]), "IO219" );
failed |= attach_sig( bus, &(D[ 1]), "IO217" );
failed |= attach_sig( bus, &(D[ 2]), "IO215" );
failed |= attach_sig( bus, &(D[ 3]), "IO213" );
failed |= attach_sig( bus, &(D[ 4]), "IO207" );
failed |= attach_sig( bus, &(D[ 5]), "IO203" );
failed |= attach_sig( bus, &(D[ 6]), "IO201" );
failed |= attach_sig( bus, &(D[ 7]), "IO197" );
failed |= attach_sig( bus, &(D[ 8]), "IO200" );
failed |= attach_sig( bus, &(D[ 9]), "IO202" );
failed |= attach_sig( bus, &(D[10]), "IO206" );
failed |= attach_sig( bus, &(D[11]), "IO208" );
failed |= attach_sig( bus, &(D[12]), "IO214" );
failed |= attach_sig( bus, &(D[13]), "IO216" );
failed |= attach_sig( bus, &(D[14]), "IO218" );
failed |= attach_sig( bus, &(D[15]), "IO222" );
failed |= attach_sig( bus, &(nCS), "IO223" );
failed |= attach_sig( bus, &(nOE), "IO228" );
failed |= attach_sig( bus, &(nWE), "IO196" );
failed |= attach_sig( bus, &(nLB), "IO224" );
failed |= attach_sig( bus, &(nUB), "IO226" );
nCS2 = NULL;
nRDY = NULL;
/*
* Setup FLASH
*/
comp = COMP_FLASH;
comp->ctype = FLASH;
comp->cname = "FLASH";
failed |= attach_sig( bus, &(A[ 0]), "IO47" );
failed |= attach_sig( bus, &(A[ 1]), "IO48" );
failed |= attach_sig( bus, &(A[ 2]), "IO49" );
failed |= attach_sig( bus, &(A[ 3]), "IO50" );
failed |= attach_sig( bus, &(A[ 4]), "IO125" );
failed |= attach_sig( bus, &(A[ 5]), "IO127" );
failed |= attach_sig( bus, &(A[ 6]), "IO131" );
failed |= attach_sig( bus, &(A[ 7]), "IO133" );
failed |= attach_sig( bus, &(A[ 8]), "IO158" );
failed |= attach_sig( bus, &(A[ 9]), "IO16" );
failed |= attach_sig( bus, &(A[10]), "IO20" );
failed |= attach_sig( bus, &(A[11]), "IO14" );
failed |= attach_sig( bus, &(A[12]), "IO135" );
failed |= attach_sig( bus, &(A[13]), "IO156" );
failed |= attach_sig( bus, &(A[14]), "IO144" );
failed |= attach_sig( bus, &(A[15]), "IO137" );
failed |= attach_sig( bus, &(A[16]), "IO139" );
failed |= attach_sig( bus, &(A[17]), "IO143" );
failed |= attach_sig( bus, &(A[18]), "IO141" );
failed |= attach_sig( bus, &(D[ 0]), "IO46" );
failed |= attach_sig( bus, &(D[ 1]), "IO45" );
failed |= attach_sig( bus, &(D[ 2]), "IO44" );
failed |= attach_sig( bus, &(D[ 3]), "IO165" );
failed |= attach_sig( bus, &(D[ 4]), "IO164" );
failed |= attach_sig( bus, &(D[ 5]), "IO17" );
failed |= attach_sig( bus, &(D[ 6]), "IO18" );
failed |= attach_sig( bus, &(D[ 7]), "IO19" );
D[ 8] = NULL;
D[ 9] = NULL;
D[10] = NULL;
D[11] = NULL;
D[12] = NULL;
D[13] = NULL;
D[14] = NULL;
D[15] = NULL;
failed |= attach_sig( bus, &(nWE), "IO15" );
failed |= attach_sig( bus, &(nOE), "IO24" );
failed |= attach_sig( bus, &(nCS), "IO37" );
failed |= attach_sig( bus, &(nCS2), "IO23" );
/* CLK1 is not observable :-(
failed |= attach_sig( bus, &(nRDY), "CLK1" );
*/
nRDY = NULL;
nLB = NULL;
nUB = NULL;
/*
* Setup Serial Port
*/
failed |= attach_sig( bus, &(SER_RXD), "CLK2" );
failed |= attach_sig( bus, &(SER_NRTS), "IO177" );
failed |= attach_sig( bus, &(SER_TXD), "IO178" );
failed |= attach_sig( bus, &(SER_NCTS), "CLK0" );
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
jopcyc_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("JOP.design Cyclone Board compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
setup_address( bus_t *bus, uint32_t a, component_t *comp )
@ -208,27 +442,10 @@ setup_data( bus_t *bus, uint32_t d, component_t *comp )
part_set_signal( p, D[i], 1, (d >> i) & 1 );
}
static int comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp );
/* ***************************************************************************
* jopcyc_printinfo
* ***************************************************************************/
static void
jopcyc_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("JOP.design Cyclone Board compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/* ***************************************************************************
* jopcyc_bus_prepare
* ***************************************************************************/
/**
* bus->driver->(*prepare)
*
*/
static void
jopcyc_bus_prepare( bus_t *bus )
{
@ -281,18 +498,62 @@ jopcyc_bus_prepare( bus_t *bus )
chain_shift_instructions( chain );
}
/* ***************************************************************************
* jopcyc_bus_read_start
* ***************************************************************************/
static void
jopcyc_bus_read_start( bus_t *bus, uint32_t adr )
static int
comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp )
{
part_t *p = PART;
chain_t *chain = CHAIN;
bus_area_t area;
component_t *comp;
if (adr < RAMB_START) {
area->description = "RAMA Component";
area->start = RAMA_START;
area->length = RAM_LENGTH;
area->width = RAM_DATA_WIDTH;
*comp = COMP_RAMA;
} else if (adr < FLASH_START) {
area->description = "RAMB Component";
area->start = RAMB_START;
area->length = RAM_LENGTH;
area->width = RAM_DATA_WIDTH;
*comp = COMP_RAMB;
} else if (adr < FLASH_START + FLASH_LENGTH) {
area->description = "FLASH Component";
area->start = FLASH_START;
area->length = FLASH_LENGTH;
area->width = FLASH_DATA_WIDTH;
*comp = COMP_FLASH;
} else {
area->description = "Dummy";
area->start = 2 * RAM_LENGTH + FLASH_LENGTH;
area->length = UINT64_C(0x100000000);
area->width = 0;
*comp = NULL;
}
return 0;
}
/**
* bus->driver->(*area)
*
*/
static int
jopcyc_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
component_t *comp;
return comp_bus_area( bus, adr, area, &comp );
}
/**
* bus->driver->(*read_start)
*
*/
static void
jopcyc_bus_read_start( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
chain_t *chain = CHAIN;
bus_area_t area;
component_t *comp;
comp_bus_area( bus, adr, &area, &comp );
if (!comp) {
printf( _("Address out of range\n") );
@ -314,10 +575,10 @@ jopcyc_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/* ***************************************************************************
* jopcyc_bus_read_next
* ***************************************************************************/
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
jopcyc_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -344,10 +605,10 @@ jopcyc_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/* ***************************************************************************
* jopcyc_bus_read_end
* ***************************************************************************/
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
jopcyc_bus_read_end( bus_t *bus )
{
@ -379,10 +640,10 @@ jopcyc_bus_read_end( bus_t *bus )
return d;
}
/* ***************************************************************************
* jopcyc_bus_read
* ***************************************************************************/
/**
* bus->driver->(*read)
*
*/
static uint32_t
jopcyc_bus_read( bus_t *bus, uint32_t adr )
{
@ -390,10 +651,10 @@ jopcyc_bus_read( bus_t *bus, uint32_t adr )
return jopcyc_bus_read_end( bus );
}
/* ***************************************************************************
* jopcyc_bus_write
* ***************************************************************************/
/**
* bus->driver->(*write)
*
*/
static void
jopcyc_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -432,269 +693,6 @@ jopcyc_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
/* ***************************************************************************
* jopcyc_bus_area
* ***************************************************************************/
static int
comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp )
{
if (adr < RAMB_START) {
area->description = "RAMA Component";
area->start = RAMA_START;
area->length = RAM_LENGTH;
area->width = RAM_DATA_WIDTH;
*comp = COMP_RAMA;
} else if (adr < FLASH_START) {
area->description = "RAMB Component";
area->start = RAMB_START;
area->length = RAM_LENGTH;
area->width = RAM_DATA_WIDTH;
*comp = COMP_RAMB;
} else if (adr < FLASH_START + FLASH_LENGTH) {
area->description = "FLASH Component";
area->start = FLASH_START;
area->length = FLASH_LENGTH;
area->width = FLASH_DATA_WIDTH;
*comp = COMP_FLASH;
} else {
area->description = "Dummy";
area->start = 2 * RAM_LENGTH + FLASH_LENGTH;
area->length = UINT64_C(0x100000000);
area->width = 0;
*comp = NULL;
}
return 0;
}
static int
jopcyc_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
component_t *comp;
return comp_bus_area( bus, adr, area, &comp );
}
static int
attach_sig( bus_t *bus, signal_t **sig, char *id )
{
int failed = 0;
*sig = part_find_signal( PART, id );
if (!*sig) {
printf( _("signal '%s' not found\n"), id );
failed = 1;
}
return failed;
}
static bus_t *
jopcyc_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
int failed = 0;
component_t *comp;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &jopcyc_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
/*
* Setup RAMA
*/
comp = COMP_RAMA;
comp->ctype = RAM;
comp->cname = "RAMA";
failed |= attach_sig( bus, &(A[ 0]), "IO64" );
failed |= attach_sig( bus, &(A[ 1]), "IO66" );
failed |= attach_sig( bus, &(A[ 2]), "IO68" );
failed |= attach_sig( bus, &(A[ 3]), "IO74" );
failed |= attach_sig( bus, &(A[ 4]), "IO76" );
failed |= attach_sig( bus, &(A[ 5]), "IO107" );
failed |= attach_sig( bus, &(A[ 6]), "IO113" );
failed |= attach_sig( bus, &(A[ 7]), "IO115" );
failed |= attach_sig( bus, &(A[ 8]), "IO117" );
failed |= attach_sig( bus, &(A[ 9]), "IO119" );
failed |= attach_sig( bus, &(A[10]), "IO118" );
failed |= attach_sig( bus, &(A[11]), "IO116" );
failed |= attach_sig( bus, &(A[12]), "IO114" );
failed |= attach_sig( bus, &(A[13]), "IO108" );
failed |= attach_sig( bus, &(A[14]), "IO106" );
failed |= attach_sig( bus, &(A[15]), "IO67" );
failed |= attach_sig( bus, &(A[16]), "IO65" );
failed |= attach_sig( bus, &(A[17]), "IO63" );
A[18] = NULL;
failed |= attach_sig( bus, &(D[ 0]), "IO82" );
failed |= attach_sig( bus, &(D[ 1]), "IO84" );
failed |= attach_sig( bus, &(D[ 2]), "IO86" );
failed |= attach_sig( bus, &(D[ 3]), "IO88" );
failed |= attach_sig( bus, &(D[ 4]), "IO94" );
failed |= attach_sig( bus, &(D[ 5]), "IO98" );
failed |= attach_sig( bus, &(D[ 6]), "IO100" );
failed |= attach_sig( bus, &(D[ 7]), "IO104" );
failed |= attach_sig( bus, &(D[ 8]), "IO101" );
failed |= attach_sig( bus, &(D[ 9]), "IO99" );
failed |= attach_sig( bus, &(D[10]), "IO95" );
failed |= attach_sig( bus, &(D[11]), "IO93" );
failed |= attach_sig( bus, &(D[12]), "IO87" );
failed |= attach_sig( bus, &(D[13]), "IO85" );
failed |= attach_sig( bus, &(D[14]), "IO83" );
failed |= attach_sig( bus, &(D[15]), "IO79" );
failed |= attach_sig( bus, &(nCS), "IO78" );
failed |= attach_sig( bus, &(nOE), "IO73" );
failed |= attach_sig( bus, &(nWE), "IO105" );
failed |= attach_sig( bus, &(nLB), "IO77" );
failed |= attach_sig( bus, &(nUB), "IO75" );
nCS2 = NULL;
nRDY = NULL;
/*
* Setup RAMB
*/
comp = COMP_RAMB;
comp->ctype = RAM;
comp->cname = "RAMB";
failed |= attach_sig( bus, &(A[ 0]), "IO237" );
failed |= attach_sig( bus, &(A[ 1]), "IO235" );
failed |= attach_sig( bus, &(A[ 2]), "IO233" );
failed |= attach_sig( bus, &(A[ 3]), "IO227" );
failed |= attach_sig( bus, &(A[ 4]), "IO225" );
failed |= attach_sig( bus, &(A[ 5]), "IO194" );
failed |= attach_sig( bus, &(A[ 6]), "IO188" );
failed |= attach_sig( bus, &(A[ 7]), "IO186" );
failed |= attach_sig( bus, &(A[ 8]), "IO184" );
failed |= attach_sig( bus, &(A[ 9]), "IO182" );
failed |= attach_sig( bus, &(A[10]), "IO183" );
failed |= attach_sig( bus, &(A[11]), "IO185" );
failed |= attach_sig( bus, &(A[12]), "IO187" );
failed |= attach_sig( bus, &(A[13]), "IO193" );
failed |= attach_sig( bus, &(A[14]), "IO195" );
failed |= attach_sig( bus, &(A[15]), "IO234" );
failed |= attach_sig( bus, &(A[16]), "IO236" );
failed |= attach_sig( bus, &(A[17]), "IO238" );
A[18] = NULL;
failed |= attach_sig( bus, &(D[ 0]), "IO219" );
failed |= attach_sig( bus, &(D[ 1]), "IO217" );
failed |= attach_sig( bus, &(D[ 2]), "IO215" );
failed |= attach_sig( bus, &(D[ 3]), "IO213" );
failed |= attach_sig( bus, &(D[ 4]), "IO207" );
failed |= attach_sig( bus, &(D[ 5]), "IO203" );
failed |= attach_sig( bus, &(D[ 6]), "IO201" );
failed |= attach_sig( bus, &(D[ 7]), "IO197" );
failed |= attach_sig( bus, &(D[ 8]), "IO200" );
failed |= attach_sig( bus, &(D[ 9]), "IO202" );
failed |= attach_sig( bus, &(D[10]), "IO206" );
failed |= attach_sig( bus, &(D[11]), "IO208" );
failed |= attach_sig( bus, &(D[12]), "IO214" );
failed |= attach_sig( bus, &(D[13]), "IO216" );
failed |= attach_sig( bus, &(D[14]), "IO218" );
failed |= attach_sig( bus, &(D[15]), "IO222" );
failed |= attach_sig( bus, &(nCS), "IO223" );
failed |= attach_sig( bus, &(nOE), "IO228" );
failed |= attach_sig( bus, &(nWE), "IO196" );
failed |= attach_sig( bus, &(nLB), "IO224" );
failed |= attach_sig( bus, &(nUB), "IO226" );
nCS2 = NULL;
nRDY = NULL;
/*
* Setup FLASH
*/
comp = COMP_FLASH;
comp->ctype = FLASH;
comp->cname = "FLASH";
failed |= attach_sig( bus, &(A[ 0]), "IO47" );
failed |= attach_sig( bus, &(A[ 1]), "IO48" );
failed |= attach_sig( bus, &(A[ 2]), "IO49" );
failed |= attach_sig( bus, &(A[ 3]), "IO50" );
failed |= attach_sig( bus, &(A[ 4]), "IO125" );
failed |= attach_sig( bus, &(A[ 5]), "IO127" );
failed |= attach_sig( bus, &(A[ 6]), "IO131" );
failed |= attach_sig( bus, &(A[ 7]), "IO133" );
failed |= attach_sig( bus, &(A[ 8]), "IO158" );
failed |= attach_sig( bus, &(A[ 9]), "IO16" );
failed |= attach_sig( bus, &(A[10]), "IO20" );
failed |= attach_sig( bus, &(A[11]), "IO14" );
failed |= attach_sig( bus, &(A[12]), "IO135" );
failed |= attach_sig( bus, &(A[13]), "IO156" );
failed |= attach_sig( bus, &(A[14]), "IO144" );
failed |= attach_sig( bus, &(A[15]), "IO137" );
failed |= attach_sig( bus, &(A[16]), "IO139" );
failed |= attach_sig( bus, &(A[17]), "IO143" );
failed |= attach_sig( bus, &(A[18]), "IO141" );
failed |= attach_sig( bus, &(D[ 0]), "IO46" );
failed |= attach_sig( bus, &(D[ 1]), "IO45" );
failed |= attach_sig( bus, &(D[ 2]), "IO44" );
failed |= attach_sig( bus, &(D[ 3]), "IO165" );
failed |= attach_sig( bus, &(D[ 4]), "IO164" );
failed |= attach_sig( bus, &(D[ 5]), "IO17" );
failed |= attach_sig( bus, &(D[ 6]), "IO18" );
failed |= attach_sig( bus, &(D[ 7]), "IO19" );
D[ 8] = NULL;
D[ 9] = NULL;
D[10] = NULL;
D[11] = NULL;
D[12] = NULL;
D[13] = NULL;
D[14] = NULL;
D[15] = NULL;
failed |= attach_sig( bus, &(nWE), "IO15" );
failed |= attach_sig( bus, &(nOE), "IO24" );
failed |= attach_sig( bus, &(nCS), "IO37" );
failed |= attach_sig( bus, &(nCS2), "IO23" );
/* CLK1 is not observable :-(
failed |= attach_sig( bus, &(nRDY), "CLK1" );
*/
nRDY = NULL;
nLB = NULL;
nUB = NULL;
/*
* Setup Serial Port
*/
failed |= attach_sig( bus, &(SER_RXD), "CLK2" );
failed |= attach_sig( bus, &(SER_NRTS), "IO177" );
failed |= attach_sig( bus, &(SER_TXD), "IO178" );
failed |= attach_sig( bus, &(SER_NCTS), "CLK0" );
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t jopcyc_bus = {
"jopcyc",
N_("JOP.design Cyclone Board compatible bus driver via BSR"),

@ -23,7 +23,7 @@
*
* Documentation:
*
* [1] Sharp Microelectronics, "LH7A400 Universal SOC Preliminary
* [1] Sharp Microelectronics, "LH7A400 Universal SOC Preliminary
* Users's Guide", May 2003, Reference No. SMA02010
*
*
@ -71,6 +71,152 @@ typedef struct {
#define nOE ((bus_params_t *) bus->params)->noe
#define WIDTH ((bus_params_t *) bus->params)->width
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
lh7a400_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &lh7a400_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < ADR_NUM; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < D_NUM; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < nCS_NUM; i++) {
sprintf( buff, "nCS%d", i );
nCS[i] = part_find_signal( PART, buff );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < WIDTH_NUM; i++) {
sprintf( buff, "WIDTH%d", i );
WIDTH[i] = part_find_signal( PART, buff );
if (!WIDTH[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nWE = part_find_signal( PART, "nWE0" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
lh7a400_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Sharp LH7A400 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
lh7a400_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
lh7a400_bus_area ( bus_t *bus, uint32_t adr, bus_area_t *area )
{
unsigned int width;
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x10000000);
/* we determine the size of the flash that was booted from [1] table 3.1 */
width = part_get_signal( PART, part_find_signal( PART, "WIDTH0" ) );
width |= part_get_signal( PART, part_find_signal( PART, "WIDTH1" ) ) << 1;
if (width < 0)
return -1;
switch (width) {
case 0:
area->width = 8;
break;
case 1:
area->width = 16;
break;
case 2:
case 3:
area->width = 32;
}
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -81,8 +227,6 @@ setup_address( bus_t *bus, uint32_t a )
part_set_signal( p, A[i], 1, (a >> i) & 1 );
}
static int lh7a400_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
set_data_in( bus_t *bus )
{
@ -94,7 +238,7 @@ set_data_in( bus_t *bus )
for (i = 0; i < area.width; i++)
part_set_signal( p, D[i], 0, 0 );
}
static void
@ -110,24 +254,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[i], 1, (d >> i) & 1 );
}
static void
lh7a400_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Sharp LH7A400 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
lh7a400_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
lh7a400_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -145,6 +275,10 @@ lh7a400_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
lh7a400_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -166,7 +300,11 @@ lh7a400_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
static uint32_t
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
lh7a400_bus_read_end( bus_t *bus )
{
/* see Figure 3-3 in [1] */
@ -189,6 +327,10 @@ lh7a400_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
lh7a400_bus_read( bus_t *bus, uint32_t adr )
{
@ -196,6 +338,10 @@ lh7a400_bus_read( bus_t *bus, uint32_t adr )
return lh7a400_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
lh7a400_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -220,118 +366,6 @@ lh7a400_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
lh7a400_bus_area ( bus_t *bus, uint32_t adr, bus_area_t *area )
{
unsigned int width;
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x10000000);
/* we determine the size of the flash that was booted from [1] table 3.1 */
width = part_get_signal( PART, part_find_signal( PART, "WIDTH0" ) );
width |= part_get_signal( PART, part_find_signal( PART, "WIDTH1" ) ) << 1;
if (width < 0)
return -1;
switch (width) {
case 0:
area->width = 8;
break;
case 1:
area->width = 16;
break;
case 2:
case 3:
area->width = 32;
}
return 0;
}
static bus_t *
lh7a400_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &lh7a400_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < ADR_NUM; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < D_NUM; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < nCS_NUM; i++) {
sprintf( buff, "nCS%d", i );
nCS[i] = part_find_signal( PART, buff );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < WIDTH_NUM; i++) {
sprintf( buff, "WIDTH%d", i );
WIDTH[i] = part_find_signal( PART, buff );
if (!WIDTH[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nWE = part_find_signal( PART, "nWE0" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t lh7a400_bus = {
"lh7a400",
N_("Sharp LH7A400 compatible bus driver via BSR (flash access only!)"),

@ -60,6 +60,133 @@ typedef struct {
#define nOE ((bus_params_t *) bus->params)->noe
#define D ((bus_params_t *) bus->params)->d
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
mpc5200_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
part_t *part;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &mpc5200_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = part = chain->parts->parts[chain->active_part];
/* Get the signals */
for (i = 0; i < 24; i++) {
sprintf( buff, "EXT_AD_%d", i );
AD[i] = part_find_signal( part, buff );
if (!AD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "LP_CS%d_B", i );
nCS[i] = part_find_signal( part, buff );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nWE = part_find_signal( part, "LP_RW" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "LP_RW" );
failed = 1;
}
nOE = part_find_signal( part, "LP_OE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "LP_OE" );
failed = 1;
}
for (i = 0; i < 8; i++) {
sprintf( buff, "EXT_AD_%d", i+24 );
D[i] = part_find_signal( part, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
mpc5200_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Freescale MPC5200 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
mpc5200_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
mpc5200_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if( adr < UINT32_C(0x01000000) )
{
area->description = N_("LocalPlus Bus");
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x01000000);
area->width = 8;
return 0;
}
area->description = NULL;
area->start = 0x01000000;
area->length = 0xFF000000;
area->width = 0;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -70,8 +197,6 @@ setup_address( bus_t *bus, uint32_t a )
part_set_signal( p, AD[i], 1, (a >> i) & 1 );
}
static int mpc5200_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
set_data_in( bus_t *bus, uint32_t adr )
{
@ -120,24 +245,10 @@ get_data( bus_t *bus, uint32_t adr )
return d;
}
static void
mpc5200_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Freescale MPC5200 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
mpc5200_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
mpc5200_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -159,6 +270,10 @@ mpc5200_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( CHAIN, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
mpc5200_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -172,6 +287,10 @@ mpc5200_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
mpc5200_bus_read_end( bus_t *bus )
{
@ -185,6 +304,10 @@ mpc5200_bus_read_end( bus_t *bus )
return get_data( bus, LAST_ADR );
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
mpc5200_bus_read( bus_t *bus, uint32_t adr )
{
@ -192,6 +315,10 @@ mpc5200_bus_read( bus_t *bus, uint32_t adr )
return mpc5200_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
mpc5200_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -217,99 +344,6 @@ mpc5200_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
mpc5200_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if( adr < UINT32_C(0x01000000) )
{
area->description = N_("LocalPlus Bus");
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x01000000);
area->width = 8;
return 0;
}
area->description = NULL;
area->start = 0x01000000;
area->length = 0xFF000000;
area->width = 0;
return 0;
}
static bus_t *
mpc5200_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
part_t *part;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &mpc5200_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = part = chain->parts->parts[chain->active_part];
/* Get the signals */
for (i = 0; i < 24; i++) {
sprintf( buff, "EXT_AD_%d", i );
AD[i] = part_find_signal( part, buff );
if (!AD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "LP_CS%d_B", i );
nCS[i] = part_find_signal( part, buff );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nWE = part_find_signal( part, "LP_RW" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "LP_RW" );
failed = 1;
}
nOE = part_find_signal( part, "LP_OE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "LP_OE" );
failed = 1;
}
for (i = 0; i < 8; i++) {
sprintf( buff, "EXT_AD_%d", i+24 );
D[i] = part_find_signal( part, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t mpc5200_bus = {
"mpc5200",
N_("Freescale MPC5200 compatible bus driver via BSR"),

@ -70,13 +70,288 @@ char dbgAddr = 0;
char dbgData = 0;
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
mpc824x_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
part_t *part;
signal_t *s_nfoe;
signal_t *s_sdma1;
char param[16], value[16];
char dfltWidth = 1;
dbgAddr = 0;
dbgData = 0;
REVBITS = 0;
for (i=2; cmd_params[i]; i++) {
if (strstr( cmd_params[i], "=")) {
sscanf( cmd_params[i], "%[^=]%*c%s", param, value );
if (!strcmp( "width", param )) {
if (!strcmp( "8", value )) {
BUS_WIDTH = 8;
dfltWidth = 0;
} else if (!strcmp( "32", value )) {
BUS_WIDTH = 32;
dfltWidth = 0;
}
else if (!strcmp( "64", value )) {
// BUS_WIDTH = 64; // Needs to fix, look at setup_data()
BUS_WIDTH = 32;
printf(_(" Bus width 64 exists in mpc824x, but not supported by UrJTAG currently\n"));
dfltWidth = 1;
}
else {
printf(_(" Only 8,32 and 64 bus width are supported for Banks 0 and 1\n"));
return NULL;
}
}
} else {
if (!strcmp( "revbits", cmd_params[i]))
REVBITS = 1;
if (!strcmp( "help", cmd_params[i])) {
printf(_("Usage: initbus mpc824x [width=WIDTH] [revbits] [dbgAddr] [dbgData]\n\n"
" WIDTH data bus width - 8, 32, 64 (default 8)\n"
" revbits reverse bits in data bus (default - no)\n"
" dbgAddr display address bus state (default - no)\n"
" dbgData display data bus state (default - no)\n"));
return NULL;
}
if (!strcmp( "dbgAddr", cmd_params[i]))
dbgAddr = 1;
if (!strcmp( "dbgData", cmd_params[i]))
dbgData = 1;
}
}
if (dfltWidth)
printf(_(" Using default bus width %d\n"), BUS_WIDTH);
// REVBITS = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &mpc824x_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = part = chain->parts->parts[chain->active_part];
s_nfoe = part_find_signal( part, "nFOE" );
s_sdma1 = part_find_signal( part, "SDMA1" );
part_set_signal( part, s_nfoe, 0, 0 );
part_set_signal( part, s_sdma1, 0, 0 );
part_set_instruction( part, "SAMPLE/PRELOAD" );
chain_shift_instructions( chain );
chain_shift_data_registers( chain, 0 );
part_set_instruction( part, "EXTEST" );
chain_shift_instructions( chain );
chain_shift_data_registers( chain, 1 );
boot_nFOE = part_get_signal( part, s_nfoe );
boot_SDMA1 = part_get_signal( part, s_sdma1 );
for (i = 0; i <= 10; i++) {
sprintf( buff, "SDMA%d", i );
AR[i] = part_find_signal( part, buff );
if (!AR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AR[11] = part_find_signal( part, "SDBA0" );
if (!AR[11]) {
printf( _("signal '%s' not found\n"), "SDBA0" );
failed = 1;
}
for (i = 0; i < 8; i++) {
sprintf( buff, "PAR%d", i );
AR[19 - i] = part_find_signal( part, buff );
if (!AR[19 - i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AR[20] = part_find_signal( part, "SDBA1" );
if (!AR[20]) {
printf( _("signal '%s' not found\n"), "SDBA1" );
failed = 1;
}
AR[21] = part_find_signal( part, "SDMA11" );
if (!AR[21]) {
printf( _("signal '%s' not found\n"), "SDMA11" );
failed = 1;
}
AR[22] = part_find_signal( part, "SDMA12" );
if (!AR[22]) {
printf( _("signal '%s' not found\n"), "SDMA12" );
failed = 1;
}
nRCS0 = part_find_signal( part, "nRCS0" );
if (!nRCS0) {
printf( _("signal '%s' not found\n"), "nRCS0" );
failed = 1;
}
nWE = part_find_signal( part, "nWE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nFOE = part_find_signal( part, "nFOE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nFOE" );
failed = 1;
}
/*
Freescale MPC824x uses inversed bit order ([1], p. 2-18):
msb is MDH[0] while lsb is MDH[31]
Flash chips usually use another bit orded:
msb is D[31] and lsb is D[0]
This should be rewired in the PCB (MDH[0] - D[31], ..., MDH[31] - D[0]).
Otherwise you will have to use "revbits" UrJTAG parameter and
binary files with reversed bit order.
*/
for (i = 0; i < 32; i++) { /* Needs to be fixed for 64-bit bus width */
sprintf( buff, "MDH%d", 31 - i );
D[i] = part_find_signal( part, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
mpc824x_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Motorola MPC824x compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
mpc824x_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if (adr < UINT32_C(0xFF000000)) {
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0xFF000000);
area->width = 0;
return 0;
}
if (adr < UINT32_C(0xFF800000)) {
area->description = N_("Base ROM Interface (Bank 1)");
area->start = UINT32_C(0xFF000000);
area->length = UINT64_C(0x00800000);
area->width = 0;
return 0;
}
if (boot_SDMA1 == 0) {
area->description = N_("Base ROM Interface (Bank 0)");
area->start = UINT32_C(0xFF800000);
area->length = UINT64_C(0x00800000);
area->width = BUS_WIDTH;
return 0;
}
/* extended addresing mode is disabled (SDMA1 is 1) */
if (adr < UINT32_C(0xFFC00000)) {
area->description = NULL;
area->start = UINT32_C(0xFF800000);
area->length = UINT64_C(0x00400000);
area->width = BUS_WIDTH;
return 0;
}
area->description = N_("Base ROM Interface (Bank 0)");
area->start = UINT32_C(0xFFC00000);
area->length = UINT64_C(0x00400000);
area->width = BUS_WIDTH;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
int i;
part_t *p = PART;
switch (BUS_WIDTH) {
switch (BUS_WIDTH) {
case 8:/* 8-bit data bus */
for (i = 0; i < 23; i++)
part_set_signal( p, AR[i], 1, (a >> i) & 1 );
@ -88,7 +363,7 @@ setup_address( bus_t *bus, uint32_t a )
for (i = 0; i < 20; i++)
part_set_signal( p, AR[i], 1, (a >> (i+3)) & 1 );
}
/* Just for debugging */
if (dbgAddr) {
int j, k;
@ -101,7 +376,7 @@ setup_address( bus_t *bus, uint32_t a )
printf(_("Addr [%2d:0]: %06X "), k, a);
for (i=0; i<3; i++) {
for (j=0; j<8; j++)
if ((i*8+j) >= (23 - k))
if ((i*8+j) >= (23 - k))
printf("%1d", (a >> (23 - (i*8+j)) ) & 1);
else
printf(" ");
@ -112,8 +387,6 @@ setup_address( bus_t *bus, uint32_t a )
}
static int mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
set_data_in( bus_t *bus, uint32_t adr )
{
@ -148,8 +421,8 @@ setup_data( bus_t *bus, uint32_t adr, uint32_t d )
printf(_("Data WR [%d:0]: %08X "), area.width-1, d);
int j;
int bytes =0;
if (BUS_WIDTH==8) bytes = 1;
else if (BUS_WIDTH==32) bytes = 4;
if (BUS_WIDTH==8) bytes = 1;
else if (BUS_WIDTH==32) bytes = 4;
else if (BUS_WIDTH==64) bytes = 4; /* Needs to be fixed - d is 32-bit long, so no 64 bit mode is possible */
for (i=0; i<bytes; i++) {
@ -185,42 +458,28 @@ get_data( bus_t *bus, uint32_t adr )
printf(_("Data RD [%d:0]: %08X "), area.width-1, d);
int j;
int bytes = 0;
if (BUS_WIDTH==8) bytes = 1;
else if (BUS_WIDTH==32) bytes = 4;
if (BUS_WIDTH==8) bytes = 1;
else if (BUS_WIDTH==32) bytes = 4;
else if (BUS_WIDTH==64) bytes = 4; /* Needs to be fixed - d is 32-bit long, so no 64 bit mode is possible */
for (i=0; i<bytes; i++) {
for (j=0; j<8; j++)
if (REVBITS)
printf("%1d", (d >> (BUS_WIDTH-1 - (i*8+j)) ) & 1);
else
printf("%1d", (d >> ( (i*8+j)) ) & 1);
printf(" ");
};
printf("\n");
}
return d;
}
static void
mpc824x_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Motorola MPC824x compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
if (REVBITS)
printf("%1d", (d >> (BUS_WIDTH-1 - (i*8+j)) ) & 1);
else
printf("%1d", (d >> ( (i*8+j)) ) & 1);
printf(" ");
};
printf("\n");
}
static void
mpc824x_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
return d;
}
/**
* bus->driver->(*read_start)
*
*/
static void
mpc824x_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -239,6 +498,10 @@ mpc824x_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( CHAIN, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
mpc824x_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -252,6 +515,10 @@ mpc824x_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
mpc824x_bus_read_end( bus_t *bus )
{
@ -265,6 +532,10 @@ mpc824x_bus_read_end( bus_t *bus )
return get_data( bus, LAST_ADR );
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
mpc824x_bus_read( bus_t *bus, uint32_t adr )
{
@ -272,6 +543,10 @@ mpc824x_bus_read( bus_t *bus, uint32_t adr )
return mpc824x_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
mpc824x_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -301,247 +576,6 @@ mpc824x_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
}
static int
mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if (adr < UINT32_C(0xFF000000)) {
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0xFF000000);
area->width = 0;
return 0;
}
if (adr < UINT32_C(0xFF800000)) {
area->description = N_("Base ROM Interface (Bank 1)");
area->start = UINT32_C(0xFF000000);
area->length = UINT64_C(0x00800000);
area->width = 0;
return 0;
}
if (boot_SDMA1 == 0) {
area->description = N_("Base ROM Interface (Bank 0)");
area->start = UINT32_C(0xFF800000);
area->length = UINT64_C(0x00800000);
area->width = BUS_WIDTH;
return 0;
}
/* extended addresing mode is disabled (SDMA1 is 1) */
if (adr < UINT32_C(0xFFC00000)) {
area->description = NULL;
area->start = UINT32_C(0xFF800000);
area->length = UINT64_C(0x00400000);
area->width = BUS_WIDTH;
return 0;
}
area->description = N_("Base ROM Interface (Bank 0)");
area->start = UINT32_C(0xFFC00000);
area->length = UINT64_C(0x00400000);
area->width = BUS_WIDTH;
return 0;
}
static bus_t *
mpc824x_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
part_t *part;
signal_t *s_nfoe;
signal_t *s_sdma1;
char param[16], value[16];
char dfltWidth = 1;
dbgAddr = 0;
dbgData = 0;
REVBITS = 0;
for (i=2; cmd_params[i]; i++) {
if (strstr( cmd_params[i], "=")) {
sscanf( cmd_params[i], "%[^=]%*c%s", param, value );
if (!strcmp( "width", param )) {
if (!strcmp( "8", value )) {
BUS_WIDTH = 8;
dfltWidth = 0;
} else if (!strcmp( "32", value )) {
BUS_WIDTH = 32;
dfltWidth = 0;
}
else if (!strcmp( "64", value )) {
// BUS_WIDTH = 64; // Needs to fix, look at setup_data()
BUS_WIDTH = 32;
printf(_(" Bus width 64 exists in mpc824x, but not supported by UrJTAG currently\n"));
dfltWidth = 1;
}
else {
printf(_(" Only 8,32 and 64 bus width are supported for Banks 0 and 1\n"));
return NULL;
}
}
} else {
if (!strcmp( "revbits", cmd_params[i]))
REVBITS = 1;
if (!strcmp( "help", cmd_params[i])) {
printf(_("Usage: initbus mpc824x [width=WIDTH] [revbits] [dbgAddr] [dbgData]\n\n"
" WIDTH data bus width - 8, 32, 64 (default 8)\n"
" revbits reverse bits in data bus (default - no)\n"
" dbgAddr display address bus state (default - no)\n"
" dbgData display data bus state (default - no)\n"));
return NULL;
}
if (!strcmp( "dbgAddr", cmd_params[i]))
dbgAddr = 1;
if (!strcmp( "dbgData", cmd_params[i]))
dbgData = 1;
}
}
if (dfltWidth)
printf(_(" Using default bus width %d\n"), BUS_WIDTH);
// REVBITS = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &mpc824x_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = part = chain->parts->parts[chain->active_part];
s_nfoe = part_find_signal( part, "nFOE" );
s_sdma1 = part_find_signal( part, "SDMA1" );
part_set_signal( part, s_nfoe, 0, 0 );
part_set_signal( part, s_sdma1, 0, 0 );
part_set_instruction( part, "SAMPLE/PRELOAD" );
chain_shift_instructions( chain );
chain_shift_data_registers( chain, 0 );
part_set_instruction( part, "EXTEST" );
chain_shift_instructions( chain );
chain_shift_data_registers( chain, 1 );
boot_nFOE = part_get_signal( part, s_nfoe );
boot_SDMA1 = part_get_signal( part, s_sdma1 );
for (i = 0; i <= 10; i++) {
sprintf( buff, "SDMA%d", i );
AR[i] = part_find_signal( part, buff );
if (!AR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AR[11] = part_find_signal( part, "SDBA0" );
if (!AR[11]) {
printf( _("signal '%s' not found\n"), "SDBA0" );
failed = 1;
}
for (i = 0; i < 8; i++) {
sprintf( buff, "PAR%d", i );
AR[19 - i] = part_find_signal( part, buff );
if (!AR[19 - i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
AR[20] = part_find_signal( part, "SDBA1" );
if (!AR[20]) {
printf( _("signal '%s' not found\n"), "SDBA1" );
failed = 1;
}
AR[21] = part_find_signal( part, "SDMA11" );
if (!AR[21]) {
printf( _("signal '%s' not found\n"), "SDMA11" );
failed = 1;
}
AR[22] = part_find_signal( part, "SDMA12" );
if (!AR[22]) {
printf( _("signal '%s' not found\n"), "SDMA12" );
failed = 1;
}
nRCS0 = part_find_signal( part, "nRCS0" );
if (!nRCS0) {
printf( _("signal '%s' not found\n"), "nRCS0" );
failed = 1;
}
nWE = part_find_signal( part, "nWE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nFOE = part_find_signal( part, "nFOE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nFOE" );
failed = 1;
}
/*
Freescale MPC824x uses inversed bit order ([1], p. 2-18):
msb is MDH[0] while lsb is MDH[31]
Flash chips usually use another bit orded:
msb is D[31] and lsb is D[0]
This should be rewired in the PCB (MDH[0] - D[31], ..., MDH[31] - D[0]).
Otherwise you will have to use "revbits" UrJTAG parameter and
binary files with reversed bit order.
*/
for (i = 0; i < 32; i++) { /* Needs to be fixed for 64-bit bus width */
sprintf( buff, "MDH%d", 31 - i );
D[i] = part_find_signal( part, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t mpc824x_bus = {
"mpc824x",
N_("Motorola MPC824x compatible bus driver via BSR"),

@ -53,6 +53,120 @@ typedef struct {
#define nOE ((bus_params_t *) bus->params)->noe
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
ppc405ep_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || (chain->parts->len <= chain->active_part) || (chain->active_part < 0))
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ppc405ep_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 6; i < 32; i++) {
sprintf( buff, "PerAddr%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "PerData%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
sprintf( buff, "PerCS0");
nCS = part_find_signal( PART, buff );
if (!nCS) {
printf( _("signal '%s' not found\n"), "nCS0" );
failed = 1;
}
nWE = part_find_signal( PART, "PerWBE1" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "PerOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
ppc405ep_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("IBM PowerPC 405EP compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
ppc405ep_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
ppc405ep_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -63,8 +177,6 @@ setup_address( bus_t *bus, uint32_t a )
part_set_signal( p, A[i], 1, (a >> (31-i)) & 1 );
}
static int ppc405ep_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
set_data_in( bus_t *bus )
{
@ -91,24 +203,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[15-i], 1, (d >> i) & 1 );
}
static void
ppc405ep_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("IBM PowerPC 405EP compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
ppc405ep_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
ppc405ep_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -125,6 +223,10 @@ ppc405ep_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
ppc405ep_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -145,6 +247,10 @@ ppc405ep_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
ppc405ep_bus_read_end( bus_t *bus )
{
@ -166,17 +272,25 @@ ppc405ep_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
ppc405ep_bus_read( bus_t *bus, uint32_t adr )
{
int res;
ppc405ep_bus_read_start( bus, adr );
res = ppc405ep_bus_read_end( bus );
return res;
}
/**
* bus->driver->(*write)
*
*/
static void
ppc405ep_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -199,86 +313,6 @@ ppc405ep_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
ppc405ep_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
ppc405ep_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || (chain->parts->len <= chain->active_part) || (chain->active_part < 0))
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ppc405ep_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 6; i < 32; i++) {
sprintf( buff, "PerAddr%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "PerData%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
sprintf( buff, "PerCS0");
nCS = part_find_signal( PART, buff );
if (!nCS) {
printf( _("signal '%s' not found\n"), "nCS0" );
failed = 1;
}
nWE = part_find_signal( PART, "PerWBE1" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "PerOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t ppc405ep_bus = {
"ppc405ep",
N_("IBM PowerPC 405EP compatible bus driver via BSR"),

@ -55,6 +55,120 @@ typedef struct {
#define nOE ((bus_params_t *) bus->params)->noe
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || (chain->parts->len <= chain->active_part) || (chain->active_part < 0))
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ppc440gx_ebc8_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < PPC440GX_ADDR_LINES; i++) {
sprintf( buff, "EBCADR%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < PPC440GX_DATA_LINES; i++) {
sprintf( buff, "EBCDATA%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
sprintf( buff, "EBCCS0_N");
nCS = part_find_signal( PART, buff );
if (!nCS) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
}
nWE = part_find_signal( PART, "EBCWE_N" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "EBCOE_N" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
ppc440gx_ebc8_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("IBM PowerPC 440GX 8-bit compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
ppc440gx_ebc8_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
ppc440gx_ebc8_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000); /* ??????????? */
area->width = PPC440GX_DATA_LINES;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -65,8 +179,6 @@ setup_address( bus_t *bus, uint32_t a )
part_set_signal( p, A[i], 1, (a >> (PPC440GX_ADDR_LINES-1-i)) & 1 );
}
static int ppc440gx_ebc8_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
set_data_in( bus_t *bus )
{
@ -93,24 +205,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[PPC440GX_DATA_LINES-1-i], 1, (d >> i) & 1 );
}
static void
ppc440gx_ebc8_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("IBM PowerPC 440GX 8-bit compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
ppc440gx_ebc8_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
ppc440gx_ebc8_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -127,6 +225,10 @@ ppc440gx_ebc8_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
ppc440gx_ebc8_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -147,6 +249,10 @@ ppc440gx_ebc8_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
ppc440gx_ebc8_bus_read_end( bus_t *bus )
{
@ -168,6 +274,10 @@ ppc440gx_ebc8_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
ppc440gx_ebc8_bus_read( bus_t *bus, uint32_t adr )
{
@ -175,6 +285,10 @@ ppc440gx_ebc8_bus_read( bus_t *bus, uint32_t adr )
return ppc440gx_ebc8_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
ppc440gx_ebc8_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -197,86 +311,6 @@ ppc440gx_ebc8_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
ppc440gx_ebc8_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000); /* ??????????? */
area->width = PPC440GX_DATA_LINES;
return 0;
}
static bus_t *
ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || (chain->parts->len <= chain->active_part) || (chain->active_part < 0))
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &ppc440gx_ebc8_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < PPC440GX_ADDR_LINES; i++) {
sprintf( buff, "EBCADR%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < PPC440GX_DATA_LINES; i++) {
sprintf( buff, "EBCDATA%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
sprintf( buff, "EBCCS0_N");
nCS = part_find_signal( PART, buff );
if (!nCS) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
}
nWE = part_find_signal( PART, "EBCWE_N" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "EBCOE_N" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t ppc440gx_ebc8_bus = {
"ppc440gx_ebc8",
N_("IBM PowerPC 440GX 8-bit EBC compatible bus driver via BSR"),

@ -71,164 +71,6 @@ typedef struct {
#define ASHIFT ((bus_params_t *) bus->params)->ashift
static void
setup_address( bus_t *bus, uint32_t a )
{
int i, j;
part_t *p = PART;
a >>= ASHIFT;
for ( i = 0, j = ALSBI; i < AW; i++, j += AI )
part_set_signal( p, A[j], 1, (a >> i) & 1 );
}
static int
prototype_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = DW;
return 0;
}
static void
set_data_in( bus_t *bus )
{
int i, j;
part_t *p = PART;
bus_area_t area;
prototype_bus_area( bus, 0, &area );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
part_set_signal( p, D[j], 0, 0 );
}
static void
setup_data( bus_t *bus, uint32_t d )
{
int i, j;
part_t *p = PART;
bus_area_t area;
prototype_bus_area( bus, 0, &area );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
part_set_signal( p, D[j], 1, (d >> i) & 1 );
}
static void
prototype_bus_printinfo( bus_t *bus )
{
int i;
for ( i = 0; i < CHAIN->parts->len; i++ )
if ( PART == CHAIN->parts->parts[i] )
break;
printf( _("Configurable prototype bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
prototype_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
static void
prototype_bus_read_start( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
chain_t *chain = CHAIN;
part_set_signal( p, CS, 1, CSA );
part_set_signal( p, WE, 1, WEA ? 0 : 1 );
part_set_signal( p, OE, 1, OEA );
setup_address( bus, adr );
set_data_in( bus );
chain_shift_data_registers( chain, 0 );
}
static uint32_t
prototype_bus_read_next( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
chain_t *chain = CHAIN;
int i, j;
uint32_t d = 0;
bus_area_t area;
prototype_bus_area( bus, adr, &area );
setup_address( bus, adr );
chain_shift_data_registers( chain, 1 );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
d |= (uint32_t) (part_get_signal( p, D[j] ) << i);
return d;
}
static uint32_t
prototype_bus_read_end( bus_t *bus )
{
part_t *p = PART;
chain_t *chain = CHAIN;
int i, j;
uint32_t d = 0;
bus_area_t area;
prototype_bus_area( bus, 0, &area );
part_set_signal( p, CS, 1, CSA ? 0 : 1 );
part_set_signal( p, OE, 1, OEA ? 0 : 1 );
chain_shift_data_registers( chain, 1 );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
d |= (uint32_t) (part_get_signal( p, D[j] ) << i);
return d;
}
static uint32_t
prototype_bus_read( bus_t *bus, uint32_t adr )
{
int res;
prototype_bus_read_start( bus, adr );
res = prototype_bus_read_end( bus );
return res;
}
static void
prototype_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
part_t *p = PART;
chain_t *chain = CHAIN;
part_set_signal( p, CS, 1, CSA );
part_set_signal( p, WE, 1, WEA ? 0 : 1 );
part_set_signal( p, OE, 1, OEA ? 0 : 1 );
setup_address( bus, adr );
setup_data( bus, data );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, WE, 1, WEA );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, WE, 1, WEA ? 0 : 1 );
part_set_signal( p, CS, 1, CSA ? 0 : 1 );
chain_shift_data_registers( chain, 0 );
}
static void
prototype_bus_signal_parse( char *str, char *fmt, int *inst )
{
@ -246,6 +88,10 @@ prototype_bus_signal_parse( char *str, char *fmt, int *inst )
}
}
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
prototype_bus_new( chain_t *chain, char *cmd_params[] )
{
@ -351,7 +197,7 @@ prototype_bus_new( chain_t *chain, char *cmd_params[] )
for (i = 0, j = ALSBI; i < AW; i++, j += AI ) {
sprintf( buff, afmt, j );
A[j] = part_find_signal( PART, buff );
}
}
} else {
printf( _("parameters alsb=<signal> and/or amsb=<signal> are not defined\n") );
failed = 1;
@ -379,7 +225,7 @@ prototype_bus_new( chain_t *chain, char *cmd_params[] )
for ( i = 0, j = DLSBI; i < DW; i++, j += DI ) {
sprintf( buff, dfmt, j );
D[j] = part_find_signal( PART, buff );
}
}
/* bus drivers are called with a byte address
this address needs to be adjusted by setup_address() to the memory data width */
@ -429,6 +275,194 @@ prototype_bus_new( chain_t *chain, char *cmd_params[] )
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
prototype_bus_printinfo( bus_t *bus )
{
int i;
for ( i = 0; i < CHAIN->parts->len; i++ )
if ( PART == CHAIN->parts->parts[i] )
break;
printf( _("Configurable prototype bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
prototype_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
prototype_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = DW;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
int i, j;
part_t *p = PART;
a >>= ASHIFT;
for ( i = 0, j = ALSBI; i < AW; i++, j += AI )
part_set_signal( p, A[j], 1, (a >> i) & 1 );
}
static void
set_data_in( bus_t *bus )
{
int i, j;
part_t *p = PART;
bus_area_t area;
prototype_bus_area( bus, 0, &area );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
part_set_signal( p, D[j], 0, 0 );
}
static void
setup_data( bus_t *bus, uint32_t d )
{
int i, j;
part_t *p = PART;
bus_area_t area;
prototype_bus_area( bus, 0, &area );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
part_set_signal( p, D[j], 1, (d >> i) & 1 );
}
/**
* bus->driver->(*read_start)
*
*/
static void
prototype_bus_read_start( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
chain_t *chain = CHAIN;
part_set_signal( p, CS, 1, CSA );
part_set_signal( p, WE, 1, WEA ? 0 : 1 );
part_set_signal( p, OE, 1, OEA );
setup_address( bus, adr );
set_data_in( bus );
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
prototype_bus_read_next( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
chain_t *chain = CHAIN;
int i, j;
uint32_t d = 0;
bus_area_t area;
prototype_bus_area( bus, adr, &area );
setup_address( bus, adr );
chain_shift_data_registers( chain, 1 );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
d |= (uint32_t) (part_get_signal( p, D[j] ) << i);
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
prototype_bus_read_end( bus_t *bus )
{
part_t *p = PART;
chain_t *chain = CHAIN;
int i, j;
uint32_t d = 0;
bus_area_t area;
prototype_bus_area( bus, 0, &area );
part_set_signal( p, CS, 1, CSA ? 0 : 1 );
part_set_signal( p, OE, 1, OEA ? 0 : 1 );
chain_shift_data_registers( chain, 1 );
for ( i = 0, j = DLSBI; i < DW; i++, j += DI )
d |= (uint32_t) (part_get_signal( p, D[j] ) << i);
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
prototype_bus_read( bus_t *bus, uint32_t adr )
{
int res;
prototype_bus_read_start( bus, adr );
res = prototype_bus_read_end( bus );
return res;
}
/**
* bus->driver->(*write)
*
*/
static void
prototype_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
part_t *p = PART;
chain_t *chain = CHAIN;
part_set_signal( p, CS, 1, CSA );
part_set_signal( p, WE, 1, WEA ? 0 : 1 );
part_set_signal( p, OE, 1, OEA ? 0 : 1 );
setup_address( bus, adr );
setup_data( bus, data );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, WE, 1, WEA );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, WE, 1, WEA ? 0 : 1 );
part_set_signal( p, CS, 1, CSA ? 0 : 1 );
chain_shift_data_registers( chain, 0 );
}
const bus_driver_t prototype_bus = {
"prototype",

@ -47,13 +47,13 @@
/*
* the following defines are used in proc field of the the
* the following defines are used in proc field of the the
* bus_params_t structure and are used in various functions
* below
* below
*/
#define PROC_PXA25x 1 // including px26x series
#define PROC_PXA27x 2
#define PROC_PXA27x 2
#define nCS_TOTAL 6
@ -71,10 +71,10 @@ typedef struct {
*
* Note: the setup of nCS[*] is board-specific, rather than chip-specific!
* The memory mapping and nCS[*] functions are normally set up by the boot loader.
* In our JTAG code, we manipulate the outer pins explicitly, without the help
* In our JTAG code, we manipulate the outer pins explicitly, without the help
* of the CPU's memory controller - hence the need to mimick its setup.
*
* Note that bus_area() and bus_read()/bus_write() use a window of 64MB
* Note that bus_area() and bus_read()/bus_write() use a window of 64MB
* per nCS pin (26bit addresses), which seems to be the most common option.
* For static CS[0] and CS[1] == 128 MB, the algorithms have to be modified...
*/
@ -91,7 +91,7 @@ static ncs_map_entry pxa25x_ncs_map[nCS_TOTAL] = {
};
// Default mapping with all nCS[*] GPIO pins used as nCS.
// Note that the same GPIO pins might be used e.g. for PCCard
// Note that the same GPIO pins might be used e.g. for PCCard
// service space access or PWM outputs, or some other purpose.
static ncs_map_entry pxa27x_ncs_map[nCS_TOTAL] = {
{"nCS[0]", 1, 0}, // nCS[0]
@ -137,43 +137,205 @@ typedef struct {
#define INITED ((bus_params_t *) bus->params)->inited
static void
setup_address( bus_t *bus, uint32_t a )
/*
* bus->driver->(*new_bus)
*
*/
static int
pxa2xx_bus_new_common(bus_t * bus)
{
int failed = 0;
ncs_map_entry* ncs_map = NULL;
#ifdef PREPATCHNEVER
bus_t *bus;
char buff[10];
int i;
part_t *p = PART;
for (i = 0; i < 26; i++)
part_set_signal( p, MA[i], 1, (a >> i) & 1 );
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &pxa2x0_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
#endif
int i;
char buff[10];
for (i = 0; i < 26; i++) {
sprintf( buff, "MA[%d]", i );
MA[i] = part_find_signal( PART, buff );
if (!MA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "MD[%d]", i );
MD[i] = part_find_signal( PART, buff );
if (!MD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (PROC == PROC_PXA25x) {
ncs_map = pxa25x_ncs_map;
}
else if (PROC == PROC_PXA27x) {
ncs_map = pxa27x_ncs_map;
}
else
{
printf( "BUG in the code, file %s, line %d: unknown PROC\n", __FILE__, __LINE__ );
ncs_map = pxa25x_ncs_map; // be dumb by default
}
for (i = 0; i < nCS_TOTAL; i++) {
if (ncs_map[i].enabled > 0)
{
nCS[i] = part_find_signal( PART, ncs_map[i].sig_name );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
else // disabled - this GPIO pin is unused or used for some other function
{
nCS[i] = NULL;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "DQM[%d]", i );
DQM[i] = part_find_signal( PART, buff );
if (!DQM[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDnWR = part_find_signal( PART, "RDnWR" );
if (!RDnWR) {
printf( _("signal '%s' not found\n"), "RDnWR" );
failed = 1;
}
nWE = part_find_signal( PART, "nWE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
nSDCAS = part_find_signal( PART, "nSDCAS" );
if (!nSDCAS) {
printf( _("signal '%s' not found\n"), "nSDCAS" );
failed = 1;
}
return failed;
}
static void
set_data_in( bus_t *bus, uint32_t adr )
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
pxa2x0_bus_new( chain_t *chain, char *cmd_params[] )
{
int i;
part_t *p = PART;
bus_area_t area;
bus_t *bus;
int failed = 0;
bus->driver->area( bus, adr, &area );
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
for (i = 0; i < area.width; i++)
part_set_signal( p, MD[i], 0, 0 );
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &pxa2x0_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
PROC = PROC_PXA25x;
failed = pxa2xx_bus_new_common(bus);
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
INITED = 0;
return bus;
}
static void
setup_data( bus_t *bus, uint32_t adr, uint32_t d )
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
pxa27x_bus_new( chain_t *chain, char *cmd_params[] )
{
int i;
part_t *p = PART;
bus_area_t area;
bus_t *bus;
int failed = 0;
bus->driver->area( bus, adr, &area );
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
for (i = 0; i < area.width; i++)
part_set_signal( p, MD[i], 1, (d >> i) & 1 );
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &pxa27x_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
PROC = PROC_PXA27x;
failed = pxa2xx_bus_new_common(bus);
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
INITED = 0;
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
pxa2x0_bus_printinfo( bus_t *bus )
{
@ -185,6 +347,10 @@ pxa2x0_bus_printinfo( bus_t *bus )
printf( _("Intel PXA2x0 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*printinfo)
*
*/
static void
pxa27x_bus_printinfo( bus_t *bus )
{
@ -196,6 +362,10 @@ pxa27x_bus_printinfo( bus_t *bus )
printf( _("Intel PXA27x compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*init)
*
*/
static int
pxa2xx_bus_init( bus_t *bus )
{
@ -211,7 +381,7 @@ pxa2xx_bus_init( bus_t *bus )
if (PROC == PROC_PXA25x)
{
BOOT_DEF = BOOT_DEF_PKG_TYPE |
BOOT_DEF = BOOT_DEF_PKG_TYPE |
BOOT_DEF_BOOT_SEL(part_get_signal( p, part_find_signal( p, "BOOT_SEL[2]" ) ) << 2
| part_get_signal( p, part_find_signal( p, "BOOT_SEL[1]" ) ) << 1
| part_get_signal( p, part_find_signal( p, "BOOT_SEL[0]" ) ));
@ -232,6 +402,10 @@ pxa2xx_bus_init( bus_t *bus )
return 0;
}
/**
* bus->driver->(*prepare)
*
*/
static void
pxa2xx_bus_prepare( bus_t *bus )
{
@ -241,182 +415,22 @@ pxa2xx_bus_prepare( bus_t *bus )
chain_shift_instructions( CHAIN );
}
static void
pxa2xx_bus_read_start( bus_t *bus, uint32_t adr )
{
int cs_index = 0;
chain_t *chain = CHAIN;
part_t *p = PART;
LAST_ADR = adr;
if (adr >= 0x18000000)
return;
cs_index = adr >> 26;
if (nCS[cs_index] == NULL)
return;
/* see Figure 6-13 in [1] */
part_set_signal( p, nCS[cs_index], 1, 0 );
part_set_signal( p, DQM[0], 1, 0 );
part_set_signal( p, DQM[1], 1, 0 );
part_set_signal( p, DQM[2], 1, 0 );
part_set_signal( p, DQM[3], 1, 0 );
part_set_signal( p, RDnWR, 1, 1 );
part_set_signal( p, nWE, 1, 1 );
part_set_signal( p, nOE, 1, 0 );
part_set_signal( p, nSDCAS, 1, 0 );
setup_address( bus, adr );
set_data_in( bus, adr );
chain_shift_data_registers( chain, 0 );
}
static uint32_t
pxa2xx_bus_read_next( bus_t *bus, uint32_t adr )
/**
* bus->driver->(*area)
*
*/
static int
pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
part_t *p = PART;
chain_t *chain = CHAIN;
uint32_t d;
uint32_t old_last_adr = LAST_ADR;
uint32_t tmp_addr;
int ncs_index;
(void)pxa2xx_bus_init( bus );
LAST_ADR = adr;
if (adr < UINT32_C(0x18000000)) {
int i;
bus_area_t area;
if (nCS[adr >> 26] == NULL) // avoid undefined nCS windows
return 0;
bus->driver->area( bus, adr, &area );
/* see Figure 6-13 in [1] */
setup_address( bus, adr );
chain_shift_data_registers( chain, 1 );
d = 0;
for (i = 0; i < area.width; i++)
d |= (uint32_t) (part_get_signal( p, MD[i] ) << i);
return d;
}
// anything above 0x18000000 is essentially unreachable...
if (adr < UINT32_C(0x48000000))
return 0;
if (adr < UINT32_C(0x4C000000)) {
if (old_last_adr == (MC_BASE + BOOT_DEF_OFFSET))
return BOOT_DEF;
return 0;
}
return 0;
}
static uint32_t
pxa2xx_bus_read_end( bus_t *bus )
{
part_t *p = PART;
chain_t *chain = CHAIN;
if (LAST_ADR < UINT32_C(0x18000000)) {
int i;
uint32_t d = 0;
bus_area_t area;
if (nCS[LAST_ADR >> 26] == NULL) // avoid undefined nCS windows
return 0;
bus->driver->area( bus, LAST_ADR, &area );
/* see Figure 6-13 in [1] */
part_set_signal( p, nCS[0], 1, 1 );
part_set_signal( p, nOE, 1, 1 );
part_set_signal( p, nSDCAS, 1, 1 );
chain_shift_data_registers( chain, 1 );
for (i = 0; i < area.width; i++)
d |= (uint32_t) (part_get_signal( p, MD[i] ) << i);
return d;
}
// anything above 0x18000000 is essentially unreachable...
if (LAST_ADR < UINT32_C(0x48000000))
return 0;
if (LAST_ADR < UINT32_C(0x4C000000)) {
if (LAST_ADR == (MC_BASE + BOOT_DEF_OFFSET))
return BOOT_DEF;
return 0;
}
return 0;
}
static uint32_t
pxa2xx_bus_read( bus_t *bus, uint32_t adr )
{
pxa2xx_bus_read_start( bus, adr );
return pxa2xx_bus_read_end( bus );
}
static void
pxa2xx_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
int cs_index = 0;
/* see Figure 6-17 in [1] */
part_t *p = PART;
chain_t *chain = CHAIN;
if (adr >= 0x18000000)
return;
cs_index = adr >> 26;
if (nCS[cs_index] == NULL)
return;
part_set_signal( p, nCS[cs_index], 1, 0 );
part_set_signal( p, DQM[0], 1, 0 );
part_set_signal( p, DQM[1], 1, 0 );
part_set_signal( p, DQM[2], 1, 0 );
part_set_signal( p, DQM[3], 1, 0 );
part_set_signal( p, RDnWR, 1, 0 );
part_set_signal( p, nWE, 1, 1 );
part_set_signal( p, nOE, 1, 1 );
part_set_signal( p, nSDCAS, 1, 0 );
setup_address( bus, adr );
setup_data( bus, adr, data );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, nWE, 1, 0 );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, nWE, 1, 1 );
chain_shift_data_registers( chain, 0 );
}
static int
pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
uint32_t tmp_addr;
int ncs_index;
(void)pxa2xx_bus_init( bus );
/* Static Chip Select 0 (64 MB) */
if (adr < UINT32_C(0x04000000)) {
area->description = N_("Static Chip Select 0");
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x04000000);
/* Static Chip Select 0 (64 MB) */
if (adr < UINT32_C(0x04000000)) {
area->description = N_("Static Chip Select 0");
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x04000000);
if (pxa25x_ncs_map[0].bus_width > 0)
{
@ -492,6 +506,10 @@ pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
return 0;
}
/**
* bus->driver->(*area)
*
*/
static int
pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
@ -600,189 +618,224 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
return 0;
}
//static bus_t *
//pxa2x0_bus_new( void )
static int
pxa2xx_bus_new_common(bus_t * bus)
static void
setup_address( bus_t *bus, uint32_t a )
{
int failed = 0;
ncs_map_entry* ncs_map = NULL;
#ifdef PREPATCHNEVER
bus_t *bus;
char buff[10];
int i;
part_t *p = PART;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
for (i = 0; i < 26; i++)
part_set_signal( p, MA[i], 1, (a >> i) & 1 );
}
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
static void
set_data_in( bus_t *bus, uint32_t adr )
{
int i;
part_t *p = PART;
bus_area_t area;
bus->driver = &pxa2x0_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
bus->driver->area( bus, adr, &area );
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
#endif
for (i = 0; i < area.width; i++)
part_set_signal( p, MD[i], 0, 0 );
}
static void
setup_data( bus_t *bus, uint32_t adr, uint32_t d )
{
int i;
char buff[10];
part_t *p = PART;
bus_area_t area;
for (i = 0; i < 26; i++) {
sprintf( buff, "MA[%d]", i );
MA[i] = part_find_signal( PART, buff );
if (!MA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "MD[%d]", i );
MD[i] = part_find_signal( PART, buff );
if (!MD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (PROC == PROC_PXA25x) {
ncs_map = pxa25x_ncs_map;
}
else if (PROC == PROC_PXA27x) {
ncs_map = pxa27x_ncs_map;
}
else
{
printf( "BUG in the code, file %s, line %d: unknown PROC\n", __FILE__, __LINE__ );
ncs_map = pxa25x_ncs_map; // be dumb by default
}
for (i = 0; i < nCS_TOTAL; i++) {
if (ncs_map[i].enabled > 0)
{
nCS[i] = part_find_signal( PART, ncs_map[i].sig_name );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
else // disabled - this GPIO pin is unused or used for some other function
{
nCS[i] = NULL;
}
}
bus->driver->area( bus, adr, &area );
for (i = 0; i < 4; i++) {
sprintf( buff, "DQM[%d]", i );
DQM[i] = part_find_signal( PART, buff );
if (!DQM[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDnWR = part_find_signal( PART, "RDnWR" );
if (!RDnWR) {
printf( _("signal '%s' not found\n"), "RDnWR" );
failed = 1;
}
nWE = part_find_signal( PART, "nWE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
nSDCAS = part_find_signal( PART, "nSDCAS" );
if (!nSDCAS) {
printf( _("signal '%s' not found\n"), "nSDCAS" );
failed = 1;
}
for (i = 0; i < area.width; i++)
part_set_signal( p, MD[i], 1, (d >> i) & 1 );
}
return failed;
/**
* bus->driver->(*read_start)
*
*/
static void
pxa2xx_bus_read_start( bus_t *bus, uint32_t adr )
{
int cs_index = 0;
chain_t *chain = CHAIN;
part_t *p = PART;
LAST_ADR = adr;
if (adr >= 0x18000000)
return;
cs_index = adr >> 26;
if (nCS[cs_index] == NULL)
return;
/* see Figure 6-13 in [1] */
part_set_signal( p, nCS[cs_index], 1, 0 );
part_set_signal( p, DQM[0], 1, 0 );
part_set_signal( p, DQM[1], 1, 0 );
part_set_signal( p, DQM[2], 1, 0 );
part_set_signal( p, DQM[3], 1, 0 );
part_set_signal( p, RDnWR, 1, 1 );
part_set_signal( p, nWE, 1, 1 );
part_set_signal( p, nOE, 1, 0 );
part_set_signal( p, nSDCAS, 1, 0 );
setup_address( bus, adr );
set_data_in( bus, adr );
chain_shift_data_registers( chain, 0 );
}
static bus_t *
pxa2x0_bus_new( chain_t *chain, char *cmd_params[] )
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
pxa2xx_bus_read_next( bus_t *bus, uint32_t adr )
{
bus_t *bus;
int failed = 0;
part_t *p = PART;
chain_t *chain = CHAIN;
uint32_t d;
uint32_t old_last_adr = LAST_ADR;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
LAST_ADR = adr;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
if (adr < UINT32_C(0x18000000)) {
int i;
bus_area_t area;
bus->driver = &pxa2x0_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
if (nCS[adr >> 26] == NULL) // avoid undefined nCS windows
return 0;
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
PROC = PROC_PXA25x;
bus->driver->area( bus, adr, &area );
failed = pxa2xx_bus_new_common(bus);
/* see Figure 6-13 in [1] */
setup_address( bus, adr );
chain_shift_data_registers( chain, 1 );
if (failed) {
free( bus->params );
free( bus );
return NULL;
d = 0;
for (i = 0; i < area.width; i++)
d |= (uint32_t) (part_get_signal( p, MD[i] ) << i);
return d;
}
INITED = 0;
// anything above 0x18000000 is essentially unreachable...
if (adr < UINT32_C(0x48000000))
return 0;
return bus;
if (adr < UINT32_C(0x4C000000)) {
if (old_last_adr == (MC_BASE + BOOT_DEF_OFFSET))
return BOOT_DEF;
return 0;
}
return 0;
}
static bus_t *
pxa27x_bus_new( chain_t *chain, char *cmd_params[] )
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
pxa2xx_bus_read_end( bus_t *bus )
{
bus_t *bus;
int failed = 0;
part_t *p = PART;
chain_t *chain = CHAIN;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
if (LAST_ADR < UINT32_C(0x18000000)) {
int i;
uint32_t d = 0;
bus_area_t area;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
if (nCS[LAST_ADR >> 26] == NULL) // avoid undefined nCS windows
return 0;
bus->driver = &pxa27x_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
bus->driver->area( bus, LAST_ADR, &area );
/* see Figure 6-13 in [1] */
part_set_signal( p, nCS[0], 1, 1 );
part_set_signal( p, nOE, 1, 1 );
part_set_signal( p, nSDCAS, 1, 1 );
chain_shift_data_registers( chain, 1 );
for (i = 0; i < area.width; i++)
d |= (uint32_t) (part_get_signal( p, MD[i] ) << i);
return d;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
PROC = PROC_PXA27x;
// anything above 0x18000000 is essentially unreachable...
if (LAST_ADR < UINT32_C(0x48000000))
return 0;
failed = pxa2xx_bus_new_common(bus);
if (LAST_ADR < UINT32_C(0x4C000000)) {
if (LAST_ADR == (MC_BASE + BOOT_DEF_OFFSET))
return BOOT_DEF;
if (failed) {
free( bus->params );
free( bus );
return NULL;
return 0;
}
INITED = 0;
return 0;
}
return bus;
/**
* bus->driver->(*read)
*
*/
static uint32_t
pxa2xx_bus_read( bus_t *bus, uint32_t adr )
{
pxa2xx_bus_read_start( bus, adr );
return pxa2xx_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
pxa2xx_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
int cs_index = 0;
/* see Figure 6-17 in [1] */
part_t *p = PART;
chain_t *chain = CHAIN;
if (adr >= 0x18000000)
return;
cs_index = adr >> 26;
if (nCS[cs_index] == NULL)
return;
part_set_signal( p, nCS[cs_index], 1, 0 );
part_set_signal( p, DQM[0], 1, 0 );
part_set_signal( p, DQM[1], 1, 0 );
part_set_signal( p, DQM[2], 1, 0 );
part_set_signal( p, DQM[3], 1, 0 );
part_set_signal( p, RDnWR, 1, 0 );
part_set_signal( p, nWE, 1, 1 );
part_set_signal( p, nOE, 1, 1 );
part_set_signal( p, nSDCAS, 1, 0 );
setup_address( bus, adr );
setup_data( bus, adr, data );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, nWE, 1, 0 );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, nWE, 1, 1 );
chain_shift_data_registers( chain, 0 );
}
const bus_driver_t pxa2x0_bus = {

@ -81,7 +81,7 @@ typedef struct {
** Only using nRCS0. */
signal_t *necs[4];
signal_t *nsdcs[4];
signal_t *nwbe[4]; /**< not Write Byte Enable */
signal_t *noe; /**< not Output Enable */
int dbuswidth;
@ -100,6 +100,194 @@ typedef struct {
#define dbus_width ((bus_params_t *) bus->params)->dbuswidth
/** @brief Width of Data Bus. Detected by B0SIZE[1:0] */
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
s3c4510_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &s3c4510_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
dbus_width = 16;
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 22; i++) {
sprintf( buff, "ADDR%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "XDATA%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 6; i++) {
sprintf( buff, "nRCS%d", i );
nRCS[i] = part_find_signal( PART, buff );
if (!nRCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nECS%d", i );
nECS[i] = part_find_signal( PART, buff );
if (!nECS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nRAS%d", i ); /* those are nSDCS for SDRAMs only */
nSDCS[i] = part_find_signal( PART, buff );
if (!nSDCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nWBE%d", i );
nWBE[i] = part_find_signal( PART, buff );
if (!nWBE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
s3c4510_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Samsung S3C4510B compatibile bus driver via BSR (JTAG part No. %d) RCS0=%ubit\n"), i ,dbus_width );
}
/**
* bus->driver->(*prepare)
*
*/
static void
s3c4510_bus_prepare( bus_t *bus )
{
part_t *p = PART;
chain_t *chain = CHAIN;
part_set_instruction( p, "SAMPLE/PRELOAD" );
chain_shift_instructions( chain );
chain_shift_data_registers( chain, 0 );
part_set_instruction( p, "EXTEST" );
chain_shift_instructions( chain );
}
/**
* bus->driver->(*area)
*
*/
static int
s3c4510_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
int b0size0, b0size1; // , endian;
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
// endian = part_get_signal( PART, part_find_signal( PART, "LITTLE" ));
b0size0 = part_get_signal( PART, part_find_signal( PART, "B0SIZE0" ));
b0size1 = part_get_signal( PART, part_find_signal( PART, "B0SIZE1" ));
switch ((b0size1 << 1) | b0size0) {
case 1:
area->width = dbus_width = 8;
return 0;
case 2:
area->width = dbus_width = 16;
return 0;
case 3:
area->width = dbus_width = 32;
return 0;
default:
printf( "B0SIZE[1:0]: Unknown\n" );
area->width = 0;
return -1;
}
}
static void s3c4510_bus_setup_ctrl( bus_t *bus, int mode )
{
int k;
part_t *p = PART;
for (k = 0; k < 6; k++)
part_set_signal( p, nRCS[k], 1, (mode & (1 << k)) ? 1 : 0 );
for (k = 0; k < 4; k++)
part_set_signal( p, nECS[k], 1, 1 );
for (k = 0; k < 4; k++)
part_set_signal( p, nSDCS[k], 1, 1 );
for (k = 0; k < 4; k++)
part_set_signal( p, nWBE[k], 1, (mode & (1 << (k + 8))) ? 1 : 0 );
part_set_signal( p, nOE, 1, (mode & (1 << 16)) ? 1 : 0 );
}
static void
setup_address( bus_t *bus, uint32_t a )
@ -141,52 +329,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[i], 1, 0 );
}
static void
s3c4510_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Samsung S3C4510B compatibile bus driver via BSR (JTAG part No. %d) RCS0=%ubit\n"), i ,dbus_width );
}
static void s3c4510_bus_setup_ctrl( bus_t *bus, int mode )
{
int k;
part_t *p = PART;
for (k = 0; k < 6; k++)
part_set_signal( p, nRCS[k], 1, (mode & (1 << k)) ? 1 : 0 );
for (k = 0; k < 4; k++)
part_set_signal( p, nECS[k], 1, 1 );
for (k = 0; k < 4; k++)
part_set_signal( p, nSDCS[k], 1, 1 );
for (k = 0; k < 4; k++)
part_set_signal( p, nWBE[k], 1, (mode & (1 << (k + 8))) ? 1 : 0 );
part_set_signal( p, nOE, 1, (mode & (1 << 16)) ? 1 : 0 );
}
static void
s3c4510_bus_prepare( bus_t *bus )
{
part_t *p = PART;
chain_t *chain = CHAIN;
part_set_instruction( p, "SAMPLE/PRELOAD" );
chain_shift_instructions( chain );
chain_shift_data_registers( chain, 0 );
part_set_instruction( p, "EXTEST" );
chain_shift_instructions( chain );
}
/**
* bus->driver->(*read_start)
*
*/
static void
s3c4510_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -199,6 +345,10 @@ s3c4510_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
s3c4510_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -219,6 +369,10 @@ s3c4510_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
s3c4510_bus_read_end( bus_t *bus )
{
@ -237,6 +391,10 @@ s3c4510_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
s3c4510_bus_read( bus_t *bus, uint32_t adr )
{
@ -244,12 +402,12 @@ s3c4510_bus_read( bus_t *bus, uint32_t adr )
return s3c4510_bus_read_end( bus );
}
/**
** @brief
** ROM/SRAM/FlashPage Write Access Timing
*/
* bus->driver->(*write)
*
* @brief
* ROM/SRAM/FlashPage Write Access Timing
*/
static void
s3c4510_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -266,155 +424,26 @@ s3c4510_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
default:
case 8:
s3c4510_bus_setup_ctrl( bus, 0x01fefe); /* nOE=1, nRCS0 =0, nWBE0=0 */
s3c4510_bus_setup_ctrl( bus, 0x01fefe); /* nOE=1, nRCS0 =0, nWBE0=0 */
break;
case 16:
s3c4510_bus_setup_ctrl( bus, 0x01fcfe); /* nOE=1, nRCS0 =0, nWBE0-1=0 */
s3c4510_bus_setup_ctrl( bus, 0x01fcfe); /* nOE=1, nRCS0 =0, nWBE0-1=0 */
break;
case 32:
s3c4510_bus_setup_ctrl( bus, 0x01f0fe); /* nOE=1, nRCS0 =0, nWBE0-3=0 */
s3c4510_bus_setup_ctrl( bus, 0x01f0fe); /* nOE=1, nRCS0 =0, nWBE0-3=0 */
break;
}
setup_address( bus, adr );
setup_data( bus, data );
chain_shift_data_registers( chain, 0 );
s3c4510_bus_setup_ctrl( bus, 0x01ffff); /* nOE=1, nRCS0 =1 */
chain_shift_data_registers( chain, 0 );
DEBUG_LVL2( printf("bus_write %08x @ %08x\n", data, adr); )
}
static int
s3c4510_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
int b0size0, b0size1; // , endian;
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
// endian = part_get_signal( PART, part_find_signal( PART, "LITTLE" ));
b0size0 = part_get_signal( PART, part_find_signal( PART, "B0SIZE0" ));
b0size1 = part_get_signal( PART, part_find_signal( PART, "B0SIZE1" ));
switch ((b0size1 << 1) | b0size0) {
case 1:
area->width = dbus_width = 8;
return 0;
case 2:
area->width = dbus_width = 16;
return 0;
case 3:
area->width = dbus_width = 32;
return 0;
default:
printf( "B0SIZE[1:0]: Unknown\n" );
area->width = 0;
return -1;
}
}
static bus_t *
s3c4510_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &s3c4510_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
dbus_width = 16;
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 22; i++) {
sprintf( buff, "ADDR%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "XDATA%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 6; i++) {
sprintf( buff, "nRCS%d", i );
nRCS[i] = part_find_signal( PART, buff );
if (!nRCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nECS%d", i );
nECS[i] = part_find_signal( PART, buff );
if (!nECS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nRAS%d", i ); /* those are nSDCS for SDRAMs only */
nSDCS[i] = part_find_signal( PART, buff );
if (!nSDCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "nWBE%d", i );
nWBE[i] = part_find_signal( PART, buff );
if (!nWBE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
DEBUG_LVL2( printf("bus_write %08x @ %08x\n", data, adr); )
}
const bus_driver_t s3c4510_bus = {

@ -60,6 +60,128 @@ typedef struct {
#define nWE ((bus_params_t *) bus->params)->nwe
#define nOE ((bus_params_t *) bus->params)->noe
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
sa1110_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sa1110_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 6; i++) {
sprintf( buff, "nCS%d", i );
nCS[i] = part_find_signal( PART, buff );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RD_nWR = part_find_signal( PART, "RD_nWR" );
if (!RD_nWR) {
printf( _("signal '%s' not found\n"), "RD_nWR" );
failed = 1;
}
nWE = part_find_signal( PART, "nWE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
sa1110_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Intel SA-1110 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
sa1110_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
sa1110_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = part_get_signal( PART, part_find_signal( PART, "ROM_SEL" ) ) ? 32 : 16;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -70,8 +192,6 @@ setup_address( bus_t *bus, uint32_t a )
part_set_signal( p, A[i], 1, (a >> i) & 1 );
}
static int sa1110_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void
set_data_in( bus_t *bus )
{
@ -98,24 +218,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[i], 1, (d >> i) & 1 );
}
static void
sa1110_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Intel SA-1110 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
sa1110_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
sa1110_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -139,6 +245,10 @@ sa1110_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
sa1110_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -160,6 +270,10 @@ sa1110_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
sa1110_bus_read_end( bus_t *bus )
{
@ -187,6 +301,10 @@ sa1110_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
sa1110_bus_read( bus_t *bus, uint32_t adr )
{
@ -194,6 +312,10 @@ sa1110_bus_read( bus_t *bus, uint32_t adr )
return sa1110_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
sa1110_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -228,94 +350,6 @@ sa1110_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
sa1110_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = part_get_signal( PART, part_find_signal( PART, "ROM_SEL" ) ) ? 32 : 16;
return 0;
}
static bus_t *
sa1110_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sa1110_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 6; i++) {
sprintf( buff, "nCS%d", i );
nCS[i] = part_find_signal( PART, buff );
if (!nCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RD_nWR = part_find_signal( PART, "RD_nWR" );
if (!RD_nWR) {
printf( _("signal '%s' not found\n"), "RD_nWR" );
failed = 1;
}
nWE = part_find_signal( PART, "nWE" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
nOE = part_find_signal( PART, "nOE" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t sa1110_bus = {
"sa1110",
N_("Intel SA-1110 compatible bus driver via BSR"),

@ -61,7 +61,158 @@ typedef struct {
#define MD3 ((bus_params_t *) bus->params)->md3
#define MD4 ((bus_params_t *) bus->params)->md4
static int sh7727_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
sh7727_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sh7727_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 7; i++) {
if (i == 1)
continue;
sprintf( buff, "CS%d", i );
CS[i] = part_find_signal( PART, buff );
if (!CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "WE%d", i );
WE[i] = part_find_signal( PART, buff );
if (!WE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDWR = part_find_signal( PART, "RDWR" );
if (!RDWR) {
printf( _("signal '%s' not found\n"), "RDWR" );
failed = 1;
}
RD = part_find_signal( PART, "RD" );
if (!RD) {
printf( _("signal '%s' not found\n"), "RD" );
failed = 1;
}
MD3 = part_find_signal( PART, "MD3" );
if (!MD3) {
printf( _("signal '%s' not found\n"), "MD3" );
failed = 1;
}
MD4 = part_find_signal( PART, "MD4" );
if (!MD4) {
printf( _("signal '%s' not found\n"), "MD4" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
sh7727_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Hitachi SH7727 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
sh7727_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
sh7727_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
part_t *p = PART;
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
switch (part_get_signal( p, MD4 ) << 1 | part_get_signal( p, MD3 )) {
case 1:
area->width = 8;
return 0;
case 2:
area->width = 16;
return 0;
case 3:
area->width = 32;
return 0;
default:
printf( _("Error: Invalid bus width (MD3 = MD4 = 0)!\n") );
area->width = 0;
return -1;
}
}
static void
setup_address( bus_t *bus, uint32_t a )
@ -99,24 +250,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[i], 1, (d >> i) & 1 );
}
static void
sh7727_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Hitachi SH7727 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
sh7727_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
sh7727_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -147,6 +284,10 @@ sh7727_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( CHAIN, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
sh7727_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -154,7 +295,7 @@ sh7727_bus_read_next( bus_t *bus, uint32_t adr )
int i;
uint32_t d = 0;
bus_area_t area;
sh7727_bus_area( bus, 0, &area );
setup_address( bus, adr );
@ -166,6 +307,10 @@ sh7727_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
sh7727_bus_read_end( bus_t *bus )
{
@ -192,6 +337,10 @@ sh7727_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
sh7727_bus_read( bus_t *bus, uint32_t adr )
{
@ -199,6 +348,10 @@ sh7727_bus_read( bus_t *bus, uint32_t adr )
return sh7727_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
sh7727_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -234,134 +387,15 @@ sh7727_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
part_set_signal( p, WE[1], 1, 0 );
part_set_signal( p, WE[2], 1, 0 );
part_set_signal( p, WE[3], 1, 0 );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, WE[0], 1, 1 );
part_set_signal( p, WE[1], 1, 1 );
part_set_signal( p, WE[2], 1, 1 );
part_set_signal( p, WE[3], 1, 1 );
chain_shift_data_registers( chain, 0 );
}
static int
sh7727_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
part_t *p = PART;
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
switch (part_get_signal( p, MD4 ) << 1 | part_get_signal( p, MD3 )) {
case 1:
area->width = 8;
return 0;
case 2:
area->width = 16;
return 0;
case 3:
area->width = 32;
return 0;
default:
printf( _("Error: Invalid bus width (MD3 = MD4 = 0)!\n") );
area->width = 0;
return -1;
}
}
static bus_t *
sh7727_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sh7727_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 7; i++) {
if (i == 1)
continue;
sprintf( buff, "CS%d", i );
CS[i] = part_find_signal( PART, buff );
if (!CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "WE%d", i );
WE[i] = part_find_signal( PART, buff );
if (!WE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDWR = part_find_signal( PART, "RDWR" );
if (!RDWR) {
printf( _("signal '%s' not found\n"), "RDWR" );
failed = 1;
}
RD = part_find_signal( PART, "RD" );
if (!RD) {
printf( _("signal '%s' not found\n"), "RD" );
failed = 1;
}
MD3 = part_find_signal( PART, "MD3" );
if (!MD3) {
printf( _("signal '%s' not found\n"), "MD3" );
failed = 1;
}
MD4 = part_find_signal( PART, "MD4" );
if (!MD4) {
printf( _("signal '%s' not found\n"), "MD4" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
chain_shift_data_registers( chain, 0 );
}
const bus_driver_t sh7727_bus = {

@ -61,6 +61,142 @@ typedef struct {
#define RDWR2 ((bus_params_t *) bus->params)->rdwr2
#define RD2 ((bus_params_t *) bus->params)->rd2
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
sh7750r_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sh7750r_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 7; i++) {
sprintf( buff, "CS%d", i );
CS[i] = part_find_signal( PART, buff );
if (!CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 8; i++) {
sprintf( buff, "WE%d", i );
WE[i] = part_find_signal( PART, buff );
if (!WE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDWR = part_find_signal( PART, "RDWR" );
if (!RDWR) {
printf( _("signal '%s' not found\n"), "RDWR" );
failed = 1;
}
RD = part_find_signal( PART, "RD" );
if (!RD) {
printf( _("signal '%s' not found\n"), "RD" );
failed = 1;
}
RDWR2 = part_find_signal( PART, "RDWR2" );
if (!RDWR2) {
printf( _("signal '%s' not found\n"), "RDWR2" );
failed = 1;
}
RD2 = part_find_signal( PART, "RD2" );
if (!RD2) {
printf( _("signal '%s' not found\n"), "RD2" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
sh7750r_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Hitachi SH7750R compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
sh7750r_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
sh7750r_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 32;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -91,24 +227,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[i], 1, (d >> i) & 1 );
}
static void
sh7750r_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Hitachi SH7750R compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
sh7750r_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
sh7750r_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -141,6 +263,10 @@ sh7750r_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( CHAIN, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
sh7750r_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -157,6 +283,10 @@ sh7750r_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
sh7750r_bus_read_end( bus_t *bus )
{
@ -186,6 +316,10 @@ sh7750r_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
sh7750r_bus_read( bus_t *bus, uint32_t adr )
{
@ -193,6 +327,10 @@ sh7750r_bus_read( bus_t *bus, uint32_t adr )
return sh7750r_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
sh7750r_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -231,117 +369,15 @@ sh7750r_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
part_set_signal( p, WE[1], 1, 0 );
part_set_signal( p, WE[2], 1, 0 );
part_set_signal( p, WE[3], 1, 0 );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, WE[0], 1, 1 );
part_set_signal( p, WE[1], 1, 1 );
part_set_signal( p, WE[2], 1, 1 );
part_set_signal( p, WE[3], 1, 1 );
chain_shift_data_registers( chain, 0 );
}
static int
sh7750r_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 32;
return 0;
}
static bus_t *
sh7750r_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sh7750r_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 7; i++) {
sprintf( buff, "CS%d", i );
CS[i] = part_find_signal( PART, buff );
if (!CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 8; i++) {
sprintf( buff, "WE%d", i );
WE[i] = part_find_signal( PART, buff );
if (!WE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDWR = part_find_signal( PART, "RDWR" );
if (!RDWR) {
printf( _("signal '%s' not found\n"), "RDWR" );
failed = 1;
}
RD = part_find_signal( PART, "RD" );
if (!RD) {
printf( _("signal '%s' not found\n"), "RD" );
failed = 1;
}
RDWR2 = part_find_signal( PART, "RDWR2" );
if (!RDWR2) {
printf( _("signal '%s' not found\n"), "RDWR2" );
failed = 1;
}
RD2 = part_find_signal( PART, "RD2" );
if (!RD2) {
printf( _("signal '%s' not found\n"), "RD2" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
chain_shift_data_registers( chain, 0 );
}
const bus_driver_t sh7750r_bus = {

@ -59,6 +59,132 @@ typedef struct {
#define RD ((bus_params_t *) bus->params)->rd
#define BS ((bus_params_t *) bus->params)->bs
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
sh7751r_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sh7751r_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 7; i++) {
sprintf( buff, "CS%d", i );
CS[i] = part_find_signal( PART, buff );
if (!CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "WE%d", i );
WE[i] = part_find_signal( PART, buff );
if (!WE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDWR = part_find_signal( PART, "RD_WR" );
if (!RDWR) {
printf( _("signal '%s' not found\n"), "RDWR" );
failed = 1;
}
RD = part_find_signal( PART, "RD_CASS_FRAME" );
if (!RD) {
printf( _("signal '%s' not found\n"), "RD" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
sh7751r_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Hitachi SH7751R compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
sh7751r_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
sh7751r_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -89,25 +215,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, D[i], 1, (d >> i) & 1 );
}
static void
sh7751r_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Hitachi SH7751R compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
sh7751r_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
sh7751r_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -138,6 +249,10 @@ sh7751r_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( CHAIN, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
sh7751r_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -154,6 +269,10 @@ sh7751r_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
sh7751r_bus_read_end( bus_t *bus )
{
@ -182,6 +301,10 @@ sh7751r_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
sh7751r_bus_read( bus_t *bus, uint32_t adr )
{
@ -189,6 +312,10 @@ sh7751r_bus_read( bus_t *bus, uint32_t adr )
return sh7751r_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
sh7751r_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -224,107 +351,15 @@ sh7751r_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
part_set_signal( p, WE[1], 1, 0 );
part_set_signal( p, WE[2], 1, 0 );
part_set_signal( p, WE[3], 1, 0 );
chain_shift_data_registers( chain, 0 );
part_set_signal( p, WE[0], 1, 1 );
part_set_signal( p, WE[1], 1, 1 );
part_set_signal( p, WE[2], 1, 1 );
part_set_signal( p, WE[3], 1, 1 );
chain_shift_data_registers( chain, 0 );
}
static int
sh7751r_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
sh7751r_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sh7751r_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 26; i++) {
sprintf( buff, "A%d", i );
A[i] = part_find_signal( PART, buff );
if (!A[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 32; i++) {
sprintf( buff, "D%d", i );
D[i] = part_find_signal( PART, buff );
if (!D[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 7; i++) {
sprintf( buff, "CS%d", i );
CS[i] = part_find_signal( PART, buff );
if (!CS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "WE%d", i );
WE[i] = part_find_signal( PART, buff );
if (!WE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
RDWR = part_find_signal( PART, "RD_WR" );
if (!RDWR) {
printf( _("signal '%s' not found\n"), "RDWR" );
failed = 1;
}
RD = part_find_signal( PART, "RD_CASS_FRAME" );
if (!RD) {
printf( _("signal '%s' not found\n"), "RD" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
chain_shift_data_registers( chain, 0 );
}
const bus_driver_t sh7751r_bus = {

@ -64,10 +64,130 @@ typedef struct
#define nWE ((bus_params_t *) bus->params)->nwe
#define nOE ((bus_params_t *) bus->params)->noe
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sharc_21065L_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR%d", i );
MA[i] = part_find_signal( PART, buff );
if (!MA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 8; i++) {
sprintf( buff, "DATA%d", i );
MD[i] = part_find_signal( PART, buff );
if (!MD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
BMS = part_find_signal( PART, "BMS_B" );
if (!BMS) {
printf( _("signal '%s' not found\n"), "BMS_B" );
failed = 1;
}
nWE = part_find_signal( PART, "WR_B" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "WR_B" );
failed = 1;
}
nOE = part_find_signal( PART, "RD_B" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "RD_B" );
failed = 1;
}
static void setup_address( bus_t *bus, uint32_t a )
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void sharc_21065L_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Analog Device's SHARC 21065L compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
sharc_21065L_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
sharc_21065L_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
/* BMS (512 KB) */
if (adr < UINT32_C(0x080000)) {
area->description = N_("Boot Memory Select");
area->start = UINT32_C(0x000000);
area->length = UINT64_C(0x080000);
area->width = 8;
return 0;
}
area->description = NULL;
area->start = UINT32_C(0xffffffff);
area->length = UINT64_C(0x080000);
area->width = 0;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
{
int i;
part_t *p = PART;
@ -76,10 +196,8 @@ static void setup_address( bus_t *bus, uint32_t a )
part_set_signal( p, MA[i], 1, (a >> i) & 1 );
}
static int sharc_21065L_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
static void set_data_in( bus_t *bus, uint32_t adr )
static void
set_data_in( bus_t *bus, uint32_t adr )
{
int i;
part_t *p = PART;
@ -92,7 +210,8 @@ static void set_data_in( bus_t *bus, uint32_t adr )
}
static void setup_data( bus_t *bus, uint32_t adr, uint32_t d )
static void
setup_data( bus_t *bus, uint32_t adr, uint32_t d )
{
int i;
part_t *p = PART;
@ -104,25 +223,12 @@ static void setup_data( bus_t *bus, uint32_t adr, uint32_t d )
part_set_signal( p, MD[i], 1, (d >> i) & 1 );
}
static void sharc_21065L_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Analog Device's SHARC 21065L compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void sharc_21065L_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
static void sharc_21065L_bus_read_start( bus_t *bus, uint32_t adr )
/**
* bus->driver->(*read_start)
*
*/
static void
sharc_21065L_bus_read_start( bus_t *bus, uint32_t adr )
{
chain_t *chain = CHAIN;
part_t *p = PART;
@ -142,8 +248,12 @@ static void sharc_21065L_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
static uint32_t sharc_21065L_bus_read_next( bus_t *bus, uint32_t adr )
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
sharc_21065L_bus_read_next( bus_t *bus, uint32_t adr )
{
part_t *p = PART;
chain_t *chain = CHAIN;
@ -171,8 +281,12 @@ static uint32_t sharc_21065L_bus_read_next( bus_t *bus, uint32_t adr )
return 0;
}
static uint32_t sharc_21065L_bus_read_end( bus_t *bus )
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
sharc_21065L_bus_read_end( bus_t *bus )
{
part_t *p = PART;
chain_t *chain = CHAIN;
@ -200,15 +314,23 @@ static uint32_t sharc_21065L_bus_read_end( bus_t *bus )
return 0;
}
static uint32_t sharc_21065L_bus_read( bus_t *bus, uint32_t adr )
/**
* bus->driver->(*read)
*
*/
static uint32_t
sharc_21065L_bus_read( bus_t *bus, uint32_t adr )
{
sharc_21065L_bus_read_start( bus, adr );
return sharc_21065L_bus_read_end( bus );
}
static void sharc_21065L_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
/**
* bus->driver->(*write)
*
*/
static void
sharc_21065L_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
part_t *p = PART;
chain_t *chain = CHAIN;
@ -232,96 +354,6 @@ static void sharc_21065L_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int sharc_21065L_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
/* BMS (512 KB) */
if (adr < UINT32_C(0x080000)) {
area->description = N_("Boot Memory Select");
area->start = UINT32_C(0x000000);
area->length = UINT64_C(0x080000);
area->width = 8;
return 0;
}
area->description = NULL;
area->start = UINT32_C(0xffffffff);
area->length = UINT64_C(0x080000);
area->width = 0;
return 0;
}
static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &sharc_21065L_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
for (i = 0; i < 19; i++) {
sprintf( buff, "ADDR%d", i );
MA[i] = part_find_signal( PART, buff );
if (!MA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 8; i++) {
sprintf( buff, "DATA%d", i );
MD[i] = part_find_signal( PART, buff );
if (!MD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
BMS = part_find_signal( PART, "BMS_B" );
if (!BMS) {
printf( _("signal '%s' not found\n"), "BMS_B" );
failed = 1;
}
nWE = part_find_signal( PART, "WR_B" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "WR_B" );
failed = 1;
}
nOE = part_find_signal( PART, "RD_B" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "RD_B" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t sharc_21065L_bus = {
"SHARC_21065L",
N_("SHARC_21065L compatible bus driver via BSR"),

@ -88,7 +88,198 @@ typedef struct {
#define LCDSTART 0x0300000
#define LCDSIZE 0x0100000
static int slsup3_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area );
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
slsup3_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
part_t *part;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &slsup3_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = part = chain->parts->parts[chain->active_part];
for(i = 0; i < 20 ; i++) {
sprintf( buff, "IO%d", addrbusio[i] );
AD[i] = part_find_signal( part, buff );
if (!AD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for(i = 0; i < 16 ; i++) {
sprintf( buff, "IO%d", databusio[i] );
DQ[i] = part_find_signal( part, buff );
if (!DQ[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nOE = part_find_signal( part, "IO118" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
nSRce = part_find_signal( part, "IO116" );
if (!nSRce) {
printf( _("signal '%s' not found\n"), "nSRce" );
failed = 1;
}
nSDce = part_find_signal( part, "IO119" );
if (!nSDce) {
printf( _("signal '%s' not found\n"), "nSDce" );
failed = 1;
}
nFLce = part_find_signal( part, "IO117" );
if (!nFLce) {
printf( _("signal '%s' not found\n"), "nFLce" );
failed = 1;
}
nFLbyte = part_find_signal( part, "IO115" );
if (!nFLbyte) {
printf( _("signal '%s' not found\n"), "nFLbyte" );
failed = 1;
}
nFLby = part_find_signal( part, "IO80" );
if (!nFLby) {
printf( _("signal '%s' not found\n"), "nFLby" );
failed = 1;
}
nWE = part_find_signal( part, "IO79" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
SDclk = part_find_signal( part, "IO11" );
if (!SDclk) {
printf( _("signal '%s' not found\n"), "SDclk" );
failed = 1;
}
LCDe = part_find_signal( part, "IO50" );
if (!LCDe) {
printf( _("signal '%s' not found\n"), "LCDe" );
failed = 1;
}
LCDrs = part_find_signal( part, "IO108" );
if (!LCDrs) {
printf( _("signal '%s' not found\n"), "LCDrs" );
failed = 1;
}
LCDrw = part_find_signal( part, "IO73" );
if (!LCDrw) {
printf( _("signal '%s' not found\n"), "LCDrw" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
slsup3_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("SLS UP3 bus driver via BSR (JTAG part No. %d)\n"), i );
}
/**
* bus->driver->(*prepare)
*
*/
static void
slsup3_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
slsup3_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if ((adr >= FLASHSTART) && (adr < (FLASHSTART + FLASHSIZE))) {
area->description = N_("Flash Memory (2 MByte) byte mode");
area->start = FLASHSTART;
area->length = FLASHSIZE;
area->width = 8; /* 16 */
return 0;
}
if ((adr >= SRAMSTART) && (adr < (SRAMSTART + SRAMSIZE))) {
area->description = N_("SRAM 128KByte (64K x 16)");
area->start = SRAMSTART;
area->length = SRAMSIZE;
area->width = 16;
return 0;
}
if ((adr >= LCDSTART) && (adr < (LCDSTART + LCDSIZE))) {
area->description = N_("LCD Display (RS select by A0)");
area->start = LCDSTART;
area->length = LCDSIZE;
area->width = 8;
return 0;
}
area->description = NULL;
area->start = UINT32_C(0x0400000);
area->length = UINT64_C(0xFFC00000);
area->width = 0;
return 0;
}
static void
setup_address( bus_t *bus, uint32_t a )
@ -171,24 +362,10 @@ get_data( bus_t *bus, uint32_t adr )
return d;
}
static void
slsup3_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("SLS UP3 bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
slsup3_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
slsup3_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -203,11 +380,11 @@ slsup3_bus_read_start( bus_t *bus, uint32_t adr )
part_set_signal( p, nFLbyte, 1, 0);
part_set_signal( p, nWE, 1, 1);
part_set_signal( p, SDclk, 1, 0);
part_set_signal( p, LCDe, 1, 0);
part_set_signal( p, LCDe, 1, 0);
part_set_signal( p, LCDrw, 1, 1);
setup_address( bus, adr );
if ((adr >= LCDSTART) && (adr < (LCDSTART + LCDSIZE))) {
part_set_signal( p, LCDe, 1, 1);
chain_shift_data_registers( CHAIN, 0 );
@ -220,6 +397,10 @@ slsup3_bus_read_start( bus_t *bus, uint32_t adr )
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
slsup3_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -244,6 +425,10 @@ slsup3_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
slsup3_bus_read_end( bus_t *bus )
{
@ -265,16 +450,24 @@ slsup3_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
slsup3_bus_read( bus_t *bus, uint32_t adr )
{
uint32_t d;
slsup3_bus_read_start( bus, adr );
d = slsup3_bus_read_end( bus );
return d;
}
/**
* bus->driver->(*write)
*
*/
static void
slsup3_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -311,165 +504,6 @@ slsup3_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
}
}
static int
slsup3_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
if ((adr >= FLASHSTART) && (adr < (FLASHSTART + FLASHSIZE))) {
area->description = N_("Flash Memory (2 MByte) byte mode");
area->start = FLASHSTART;
area->length = FLASHSIZE;
area->width = 8; /* 16 */
return 0;
}
if ((adr >= SRAMSTART) && (adr < (SRAMSTART + SRAMSIZE))) {
area->description = N_("SRAM 128KByte (64K x 16)");
area->start = SRAMSTART;
area->length = SRAMSIZE;
area->width = 16;
return 0;
}
if ((adr >= LCDSTART) && (adr < (LCDSTART + LCDSIZE))) {
area->description = N_("LCD Display (RS select by A0)");
area->start = LCDSTART;
area->length = LCDSIZE;
area->width = 8;
return 0;
}
area->description = NULL;
area->start = UINT32_C(0x0400000);
area->length = UINT64_C(0xFFC00000);
area->width = 0;
return 0;
}
static bus_t *
slsup3_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[10];
int i;
int failed = 0;
part_t *part;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &slsup3_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = part = chain->parts->parts[chain->active_part];
for(i = 0; i < 20 ; i++) {
sprintf( buff, "IO%d", addrbusio[i] );
AD[i] = part_find_signal( part, buff );
if (!AD[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for(i = 0; i < 16 ; i++) {
sprintf( buff, "IO%d", databusio[i] );
DQ[i] = part_find_signal( part, buff );
if (!DQ[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
nOE = part_find_signal( part, "IO118" );
if (!nOE) {
printf( _("signal '%s' not found\n"), "nOE" );
failed = 1;
}
nSRce = part_find_signal( part, "IO116" );
if (!nSRce) {
printf( _("signal '%s' not found\n"), "nSRce" );
failed = 1;
}
nSDce = part_find_signal( part, "IO119" );
if (!nSDce) {
printf( _("signal '%s' not found\n"), "nSDce" );
failed = 1;
}
nFLce = part_find_signal( part, "IO117" );
if (!nFLce) {
printf( _("signal '%s' not found\n"), "nFLce" );
failed = 1;
}
nFLbyte = part_find_signal( part, "IO115" );
if (!nFLbyte) {
printf( _("signal '%s' not found\n"), "nFLbyte" );
failed = 1;
}
nFLby = part_find_signal( part, "IO80" );
if (!nFLby) {
printf( _("signal '%s' not found\n"), "nFLby" );
failed = 1;
}
nWE = part_find_signal( part, "IO79" );
if (!nWE) {
printf( _("signal '%s' not found\n"), "nWE" );
failed = 1;
}
SDclk = part_find_signal( part, "IO11" );
if (!SDclk) {
printf( _("signal '%s' not found\n"), "SDclk" );
failed = 1;
}
LCDe = part_find_signal( part, "IO50" );
if (!LCDe) {
printf( _("signal '%s' not found\n"), "LCDe" );
failed = 1;
}
LCDrs = part_find_signal( part, "IO108" );
if (!LCDrs) {
printf( _("signal '%s' not found\n"), "LCDrs" );
failed = 1;
}
LCDrw = part_find_signal( part, "IO73" );
if (!LCDrw) {
printf( _("signal '%s' not found\n"), "LCDrw" );
failed = 1;
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t slsup3_bus = {
"slsup3",
N_("SLS UP3 compatible bus driver via BSR"),

@ -62,9 +62,145 @@ typedef struct {
#define ADDR ((bus_params_t *) bus->params)->addr
#define DATA ((bus_params_t *) bus->params)->data
// the number of bytes wide that the TX4925
// CS0 signal is set to by the external
// config resistors on A13/A12 at reset
// 1, 2, or 4 are legal values
#define TX4925_FLASH_CS_WIDTH 2
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
tx4925_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &tx4925_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
OE = part_find_signal( PART, "OE" );
if (!OE) {
printf( _("signal '%s' not found\n"), "OE" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE" );
failed = 1;
}
for (i = 0; i < 4; i++) {
sprintf( buff, "ROMCE_%d", i );
ROMCE[i] = part_find_signal( PART, buff );
if (!ROMCE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "SDCS_%d", i );
SDCS[i] = part_find_signal( PART, buff );
if (!SDCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 20; i++) {
sprintf( buff, "ADDR_%d", i );
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA_%d", i );
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
tx4925_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Toshiba TX4925 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
/**
* bus->driver->(*prepare)
*
*/
static void
tx4925_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*area)
*
*/
static int
tx4925_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static void
select_flash( bus_t *bus )
{
part_t *p = PART;
@ -79,7 +215,7 @@ select_flash( bus_t *bus )
part_set_signal( p, SDCS[3], 1, 1 );
}
static void
static void
unselect_flash( bus_t *bus )
{
part_t *p = PART;
@ -94,14 +230,6 @@ unselect_flash( bus_t *bus )
part_set_signal( p, SDCS[3], 1, 1 );
}
// the number of bytes wide that the TX4925
// CS0 signal is set to by the external
// config resistors on A13/A12 at reset
// 1, 2, or 4 are legal values
#define TX4925_FLASH_CS_WIDTH 2
static void
setup_address( bus_t *bus, uint32_t a )
{
@ -133,24 +261,10 @@ setup_data( bus_t *bus, uint32_t d )
part_set_signal( p, DATA[i], 1, (d >> i) & 1 );
}
static void
tx4925_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Toshiba TX4925 compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
static void
tx4925_bus_prepare( bus_t *bus )
{
part_set_instruction( PART, "EXTEST" );
chain_shift_instructions( CHAIN );
}
/**
* bus->driver->(*read_start)
*
*/
static void
tx4925_bus_read_start( bus_t *bus, uint32_t adr )
{
@ -167,6 +281,10 @@ tx4925_bus_read_start( bus_t *bus, uint32_t adr )
chain_shift_data_registers( chain, 0 );
}
/**
* bus->driver->(*read_next)
*
*/
static uint32_t
tx4925_bus_read_next( bus_t *bus, uint32_t adr )
{
@ -184,6 +302,10 @@ tx4925_bus_read_next( bus_t *bus, uint32_t adr )
return d;
}
/**
* bus->driver->(*read_end)
*
*/
static uint32_t
tx4925_bus_read_end( bus_t *bus )
{
@ -204,6 +326,10 @@ tx4925_bus_read_end( bus_t *bus )
return d;
}
/**
* bus->driver->(*read)
*
*/
static uint32_t
tx4925_bus_read( bus_t *bus, uint32_t adr )
{
@ -211,6 +337,10 @@ tx4925_bus_read( bus_t *bus, uint32_t adr )
return tx4925_bus_read_end( bus );
}
/**
* bus->driver->(*write)
*
*/
static void
tx4925_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
{
@ -232,103 +362,6 @@ tx4925_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
static int
tx4925_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area )
{
area->description = NULL;
area->start = UINT32_C(0x00000000);
area->length = UINT64_C(0x100000000);
area->width = 16;
return 0;
}
static bus_t *
tx4925_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
char buff[15];
int i;
int failed = 0;
if (!chain || !chain->parts || chain->parts->len <= chain->active_part || chain->active_part < 0)
return NULL;
bus = calloc( 1, sizeof (bus_t) );
if (!bus)
return NULL;
bus->driver = &tx4925_bus;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
return NULL;
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
OE = part_find_signal( PART, "OE" );
if (!OE) {
printf( _("signal '%s' not found\n"), "OE" );
failed = 1;
}
SWE = part_find_signal( PART, "SWE" );
if (!SWE) {
printf( _("signal '%s' not found\n"), "SWE" );
failed = 1;
}
for (i = 0; i < 4; i++) {
sprintf( buff, "ROMCE_%d", i );
ROMCE[i] = part_find_signal( PART, buff );
if (!ROMCE[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 4; i++) {
sprintf( buff, "SDCS_%d", i );
SDCS[i] = part_find_signal( PART, buff );
if (!SDCS[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 20; i++) {
sprintf( buff, "ADDR_%d", i );
ADDR[i] = part_find_signal( PART, buff );
if (!ADDR[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
for (i = 0; i < 16; i++) {
sprintf( buff, "DATA_%d", i );
DATA[i] = part_find_signal( PART, buff );
if (!DATA[i]) {
printf( _("signal '%s' not found\n"), buff );
failed = 1;
break;
}
}
if (failed) {
free( bus->params );
free( bus );
return NULL;
}
return bus;
}
const bus_driver_t tx4925_bus = {
"tx4925",
N_("Toshiba TX4925 compatible bus driver via BSR"),

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save