[ 2007630 ] Pass driver to new_bus

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1292 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Jie Zhang 17 years ago
parent 4d661eb682
commit 6edc1f842d

@ -1,3 +1,63 @@
2008-07-02 Jie Zhang <jie.zhang@analog.com>
* include/bus_driver.h (struct bus_driver): Add driver argument
to new_bus.
* src/cmd/initbus.c (cmd_initbus_run): Pass driver to new_bus.
* src/bus/bf548_ezkit.c (bf548_ezkit_bus_new): Add driver
argument and use it.
* src/bus/fjmem.c (fjmem_bus_new): Likewise.
* src/bus/ppc405ep.c (ppc405ep_bus_new): Likewise.
* src/bus/sh7727.c (sh7727_bus_new): Likewise.
* src/bus/prototype.c (prototype_bus_new): Likewise.
* src/bus/sa1110.c (sa1110_bus_new): Likewise.
* src/bus/ppc440gx_ebc8.c (ppc440gx_ebc8_bus_new): Likewise.
* src/bus/sh7750r.c (sh7750r_bus_new): Likewise.
* src/bus/tx4925.c (tx4925_bus_new): Likewise.
* src/bus/bf533_stamp.c (bf533_stamp_bus_new): Likewise.
* src/bus/bf533_ezkit.c (bf533_ezkit_bus_new): Likewise.
* src/bus/ixp425.c (ixp425_bus_new): Likewise.
* src/bus/avr32.c (avr32_bus_new): Likewise.
* src/bus/zefant-xs3.c (zefant_xs3_bus_new): Likewise.
* src/bus/h7202.c (h7202_bus_new): Likewise.
* src/bus/mpc824x.c (mpc824x_bus_new): Likewise.
* src/bus/bcm1250.c (bcm1250_bus_new): Likewise.
* src/bus/sharc21065l.c (sharc_21065L_bus_new): Likewise.
* src/bus/au1500.c (au1500_bus_new): Likewise.
* src/bus/lh7a400.c (lh7a400_bus_new): Likewise.
* src/bus/sh7751r.c (sh7751r_bus_new): Likewise.
* src/bus/mpc5200.c (mpc5200_bus_new): Likewise.
* src/bus/jopcyc.c (jopcyc_bus_new): Likewise.
* src/bus/bf561_ezkit.c (bf561_ezkit_bus_new): Likewise.
* src/bus/slsup3.c (slsup3_bus_new): Likewise.
* src/bus/s3c4510x.c (s3c4510_bus_new): Likewise.
* src/bus/ejtag.c (ejtag_bus_new): Likewise.
* src/bus/pxa2x0.c (pxa2xx_bus_new_common): Remove.
(pxa2xx_bus_new): New.
(pxa2x0_bus_new): Remove.
(pxa27x_bus_new): Remove.
(pxa2xx_bus_printinfo): New.
(pxa2x0_bus_printinfo): Remove.
(pxa27x_bus_printinfo): Remove.
(bus_driver_t pxa2x0_bus): Replace pxa2x0_bus_new with
pxa2xx_bus_new. Replace pxa2x0_bus_printinfo with
pxa2xx_bus_printinfo.
(bus_driver_t pxa27x_bus): Replace pxa27x_bus_new with
pxa2xx_bus_new. Replace pxa27x_bus_printinfo with
pxa2xx_bus_printinfo.
* src/bus/bf537_stamp.c (bf537_stamp_bus_new_1): Rename
to ...
(bf537_stamp_bus_new): ... this. And use the new driver
argument.
(bf537_ezkit_bus_new): Remove.
(bf527_ezkit_bus_new): Remove.
(bf537_stamp_bus_printinfo): Use description in bus driver.
(bf537_ezkit_bus_printinfo): Remove.
(bf527_ezkit_bus_printinfo): Remove.
(BF537_STAMP_BUS_FUNCTIONS): Define.
(bus_driver_t bf537_stamp_bus): Use BF537_STAMP_BUS_FUNCTIONS.
(bus_driver_t bf537_ezkit_bus): Likewise.
(bus_driver_t bf527_ezkit_bus): Likewise.
2008-06-28 Kolja Waschk <kawk>
* data/sigma/smp8634/smp8634, data/sigma/smp8634/STEPPINGS,

@ -47,11 +47,12 @@ typedef struct {
} bus_area_t;
typedef struct bus bus_t;
typedef struct bus_driver bus_driver_t;
typedef struct bus_driver {
struct bus_driver {
const char *name;
const char *description;
bus_t *(*new_bus)( chain_t *chain, char *cmd_params[] );
bus_t *(*new_bus)( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] );
void (*free_bus)( bus_t *bus );
void (*printinfo)( bus_t *bus );
void (*prepare)( bus_t *bus );
@ -62,7 +63,7 @@ typedef struct bus_driver {
uint32_t (*read)( bus_t *bus, uint32_t adr );
void (*write)( bus_t *bus, uint32_t adr, uint32_t data );
int (*init) (bus_t *bus);
} bus_driver_t;
};
struct bus {
chain_t *chain;

@ -59,7 +59,7 @@ typedef struct{
* bus->driver->(*new_bus)
*
*/
static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] )
static bus_t *au1500_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -71,7 +71,7 @@ static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &au1500_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof(bus_params_t) );
if (!bus->params){
free(bus);

@ -475,7 +475,7 @@ check_instruction (part_t * part, const char *instr)
*
*/
static bus_t *
avr32_bus_new (chain_t * chain, char *cmd_params[])
avr32_bus_new (chain_t * chain, const bus_driver_t *driver, char *cmd_params[])
{
bus_t *bus;
part_t *part;
@ -541,7 +541,7 @@ avr32_bus_new (chain_t * chain, char *cmd_params[])
if (!bus)
return NULL;
bus->driver = &avr32_bus_driver;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params)
{

@ -58,7 +58,7 @@ typedef struct {
*
*/
static bus_t *
bcm1250_bus_new( chain_t *chain, char *cmd_params[] )
bcm1250_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -70,7 +70,7 @@ bcm1250_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = & bcm1250_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -66,7 +66,7 @@ typedef struct {
*
*/
static bus_t *
bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
bf533_ezkit_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -78,7 +78,7 @@ bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &bf533_ezkit_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -66,7 +66,7 @@ typedef struct {
*
*/
static bus_t *
bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] )
bf533_stamp_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -78,7 +78,7 @@ bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &bf533_stamp_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -66,7 +66,7 @@ typedef struct {
*
*/
static bus_t *
bf537_stamp_bus_new_1( chain_t *chain, char *cmd_params[] )
bf537_stamp_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -78,6 +78,7 @@ bf537_stamp_bus_new_1( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
@ -286,8 +287,6 @@ bf537_stamp_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
part_t *p = PART;
chain_t *chain = CHAIN;
// printf("Writing %04X to %08X...\n", data, adr);
select_flash( bus );
part_set_signal( p, ARE, 1, 1 );
@ -303,22 +302,6 @@ bf537_stamp_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
chain_shift_data_registers( chain, 0 );
}
#ifdef ENABLE_BUS_BF537_STAMP
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
bf537_stamp_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
bus = bf537_stamp_bus_new_1 (chain, cmd_params);
if (bus)
bus->driver = &bf537_stamp_bus;
return bus;
}
/**
* bus->driver->(*printinfo)
*
@ -331,121 +314,48 @@ bf537_stamp_bus_printinfo( bus_t *bus )
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Blackfin BF537 Stamp compatible bus driver via BSR (JTAG part No. %d)\n"), i );
printf( _("%s (JTAG part No. %d)\n"), bus->driver->description, i );
}
#define BF537_STAMP_BUS_FUNCTIONS \
bf537_stamp_bus_new, \
generic_bus_free, \
bf537_stamp_bus_printinfo, \
generic_bus_prepare_extest, \
bf537_stamp_bus_area, \
bf537_stamp_bus_read_start, \
bf537_stamp_bus_read_next, \
bf537_stamp_bus_read_end, \
generic_bus_read, \
bf537_stamp_bus_write, \
generic_bus_no_init
#ifdef ENABLE_BUS_BF537_STAMP
const bus_driver_t bf537_stamp_bus = {
"bf537_stamp",
N_("Blackfin BF537 Stamp board bus driver"),
bf537_stamp_bus_new,
generic_bus_free,
bf537_stamp_bus_printinfo,
generic_bus_prepare_extest,
bf537_stamp_bus_area,
bf537_stamp_bus_read_start,
bf537_stamp_bus_read_next,
bf537_stamp_bus_read_end,
generic_bus_read,
bf537_stamp_bus_write,
generic_bus_no_init
N_("Blackfin BF537 Stamp board bus driver via BSR"),
BF537_STAMP_BUS_FUNCTIONS
};
#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[] )
{
bus_t *bus;
bus = bf537_stamp_bus_new_1 (chain, cmd_params);
if (bus)
bus->driver = &bf537_ezkit_bus;
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf537_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 BF537 EZ-KIT compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
const bus_driver_t bf537_ezkit_bus = {
"bf537_ezkit",
N_("Blackfin BF537 EZ-KIT board bus driver"),
bf537_ezkit_bus_new,
generic_bus_free,
bf537_ezkit_bus_printinfo,
generic_bus_prepare_extest,
bf537_stamp_bus_area,
bf537_stamp_bus_read_start,
bf537_stamp_bus_read_next,
bf537_stamp_bus_read_end,
generic_bus_read,
bf537_stamp_bus_write,
generic_bus_no_init
N_("Blackfin BF537 EZ-KIT board bus driver via BSR"),
BF537_STAMP_BUS_FUNCTIONS
};
#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[] )
{
bus_t *bus;
bus = bf537_stamp_bus_new_1 (chain, cmd_params);
if (bus)
bus->driver = &bf527_ezkit_bus;
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
bf527_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 BF527 EZ-KIT compatible bus driver via BSR (JTAG part No. %d)\n"), i );
}
const bus_driver_t bf527_ezkit_bus = {
"bf527_ezkit",
N_("Blackfin BF527 EZ-KIT board bus driver"),
bf527_ezkit_bus_new,
generic_bus_free,
bf527_ezkit_bus_printinfo,
generic_bus_prepare_extest,
bf537_stamp_bus_area,
bf537_stamp_bus_read_start,
bf537_stamp_bus_read_next,
bf537_stamp_bus_read_end,
generic_bus_read,
bf537_stamp_bus_write,
generic_bus_no_init
N_("Blackfin BF527 EZ-KIT board bus driver via BSR"),
BF537_STAMP_BUS_FUNCTIONS
};
#endif /* #ifdef ENABLE_BUS_BF527_EZKIT */

@ -61,7 +61,7 @@ typedef struct {
*
*/
static bus_t *
bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
bf548_ezkit_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -73,7 +73,7 @@ bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &bf548_ezkit_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -66,7 +66,7 @@ typedef struct {
*
*/
static bus_t *
bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
bf561_ezkit_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -78,7 +78,7 @@ bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &bf561_ezkit_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -72,7 +72,7 @@ typedef struct {
*
*/
static bus_t *
ejtag_bus_new( chain_t *chain, char *cmd_params[] )
ejtag_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
@ -80,7 +80,7 @@ ejtag_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &ejtag_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -347,7 +347,7 @@ fjmem_query_blocks( chain_t *chain, part_t *part, bus_t *bus )
*
*/
static bus_t *
fjmem_bus_new( chain_t *chain, char *params[] )
fjmem_bus_new( chain_t *chain, const bus_driver_t *driver, char *params[] )
{
bus_t *bus = NULL;
int failed = 0;
@ -392,7 +392,7 @@ fjmem_bus_new( chain_t *chain, char *params[] )
if (!bus)
return NULL;
bus->driver = &fjmem_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -56,7 +56,7 @@ typedef struct {
*
*/
static bus_t *
h7202_bus_new( chain_t *chain, char *cmd_params[] )
h7202_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -68,7 +68,7 @@ h7202_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &h7202_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -56,7 +56,7 @@ typedef struct {
*
*/
static bus_t *
ixp425_bus_new( chain_t *chain, char *cmd_params[] )
ixp425_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -68,7 +68,7 @@ ixp425_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &ixp425_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -134,7 +134,7 @@ typedef struct {
*
*/
static bus_t *
jopcyc_bus_new( chain_t *chain, char *cmd_params[] )
jopcyc_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -145,7 +145,7 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &jopcyc_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -72,7 +72,7 @@ typedef struct {
*
*/
static bus_t *
lh7a400_bus_new( chain_t *chain, char *cmd_params[] )
lh7a400_bus_new( chain_t *chain, const const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -84,7 +84,7 @@ lh7a400_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &lh7a400_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -61,7 +61,7 @@ typedef struct {
*
*/
static bus_t *
mpc5200_bus_new( chain_t *chain, char *cmd_params[] )
mpc5200_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -73,7 +73,7 @@ mpc5200_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &mpc5200_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -71,7 +71,7 @@ char dbgData = 0;
*
*/
static bus_t *
mpc824x_bus_new( chain_t *chain, char *cmd_params[] )
mpc824x_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -145,7 +145,7 @@ mpc824x_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &mpc824x_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -54,7 +54,7 @@ typedef struct {
*
*/
static bus_t *
ppc405ep_bus_new( chain_t *chain, char *cmd_params[] )
ppc405ep_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -66,7 +66,7 @@ ppc405ep_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &ppc405ep_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -56,7 +56,7 @@ typedef struct {
*
*/
static bus_t *
ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] )
ppc440gx_ebc8_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -68,7 +68,7 @@ ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &ppc440gx_ebc8_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -89,7 +89,7 @@ prototype_bus_signal_parse( char *str, char *fmt, int *inst )
*
*/
static bus_t *
prototype_bus_new( chain_t *chain, char *cmd_params[] )
prototype_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
signal_t *sig;
@ -102,7 +102,7 @@ prototype_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &prototype_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -133,26 +133,28 @@ typedef struct {
#define INITED ((bus_params_t *) bus->params)->inited
/*
/**
* bus->driver->(*new_bus)
*
*/
static int
pxa2xx_bus_new_common(bus_t * bus)
static bus_t *
pxa2xx_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
part_t *part;
bus_t *bus;
ncs_map_entry* ncs_map = NULL;
char buff[10];
int i;
int failed = 0;
#ifdef PREPATCHNEVER
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 = &pxa2x0_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
@ -160,9 +162,16 @@ pxa2xx_bus_new_common(bus_t * bus)
}
CHAIN = chain;
PART = chain->parts->parts[chain->active_part];
#endif
part = PART;
PART = part = chain->parts->parts[chain->active_part];
if (strcmp (driver->name, "pxa2x0") == 0)
PROC = PROC_PXA25x;
else if (strcmp (driver->name, "pxa27x") == 0)
PROC = PROC_PXA27x;
else {
free (bus->params);
free (bus);
return NULL;
}
for (i = 0; i < 26; i++) {
sprintf( buff, "MA[%d]", i );
@ -208,39 +217,6 @@ pxa2xx_bus_new_common(bus_t * bus)
failed |= generic_bus_attach_sig( part, &(nSDCAS), "nSDCAS" );
return failed;
}
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
pxa2x0_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
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 = &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 );
@ -250,73 +226,19 @@ pxa2x0_bus_new( chain_t *chain, char *cmd_params[] )
return bus;
}
/**
* bus->driver->(*new_bus)
*
*/
static bus_t *
pxa27x_bus_new( chain_t *chain, char *cmd_params[] )
{
bus_t *bus;
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 = &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;
}
return bus;
}
/**
* bus->driver->(*printinfo)
*
*/
static void
pxa2x0_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
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 )
pxa2xx_bus_printinfo( bus_t *bus )
{
int i;
for (i = 0; i < CHAIN->parts->len; i++)
if (PART == CHAIN->parts->parts[i])
break;
printf( _("Intel PXA27x compatible bus driver via BSR (JTAG part No. %d)\n"), i );
printf( _("%s (JTAG part No. %d)\n"), bus->driver->description, i );
}
/**
@ -769,9 +691,9 @@ pxa2xx_bus_write( bus_t *bus, uint32_t adr, uint32_t data )
const bus_driver_t pxa2x0_bus = {
"pxa2x0",
N_("Intel PXA2x0 compatible bus driver via BSR"),
pxa2x0_bus_new,
pxa2xx_bus_new,
generic_bus_free,
pxa2x0_bus_printinfo,
pxa2xx_bus_printinfo,
generic_bus_prepare_extest,
pxa2xx_bus_area,
pxa2xx_bus_read_start,
@ -785,9 +707,9 @@ const bus_driver_t pxa2x0_bus = {
const bus_driver_t pxa27x_bus = {
"pxa27x",
N_("Intel PXA27x compatible bus driver via BSR"),
pxa27x_bus_new,
pxa2xx_bus_new,
generic_bus_free,
pxa27x_bus_printinfo,
pxa2xx_bus_printinfo,
generic_bus_prepare_extest,
pxa27x_bus_area,
pxa2xx_bus_read_start,

@ -101,7 +101,7 @@ typedef struct {
*
*/
static bus_t *
s3c4510_bus_new( chain_t *chain, char *cmd_params[] )
s3c4510_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -113,7 +113,7 @@ s3c4510_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &s3c4510_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -61,7 +61,7 @@ typedef struct {
*
*/
static bus_t *
sa1110_bus_new( chain_t *chain, char *cmd_params[] )
sa1110_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -73,7 +73,7 @@ sa1110_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &sa1110_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -62,7 +62,7 @@ typedef struct {
*
*/
static bus_t *
sh7727_bus_new( chain_t *chain, char *cmd_params[] )
sh7727_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -74,7 +74,7 @@ sh7727_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &sh7727_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -62,7 +62,7 @@ typedef struct {
*
*/
static bus_t *
sh7750r_bus_new( chain_t *chain, char *cmd_params[] )
sh7750r_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -74,7 +74,7 @@ sh7750r_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &sh7750r_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -60,7 +60,7 @@ typedef struct {
*
*/
static bus_t *
sh7751r_bus_new( chain_t *chain, char *cmd_params[] )
sh7751r_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -72,7 +72,7 @@ sh7751r_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &sh7751r_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -62,7 +62,7 @@ typedef struct {
* bus->driver->(*new_bus)
*
*/
static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] )
static bus_t *sharc_21065L_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -74,7 +74,7 @@ static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &sharc_21065L_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -89,7 +89,7 @@ typedef struct {
*
*/
static bus_t *
slsup3_bus_new( chain_t *chain, char *cmd_params[] )
slsup3_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -101,7 +101,7 @@ slsup3_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &slsup3_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -70,7 +70,7 @@ typedef struct {
*
*/
static bus_t *
tx4925_bus_new( chain_t *chain, char *cmd_params[] )
tx4925_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -82,7 +82,7 @@ tx4925_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &tx4925_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );

@ -152,7 +152,7 @@ typedef struct {
*
*/
static bus_t *
zefant_xs3_bus_new( chain_t *chain, char *cmd_params[] )
zefant_xs3_bus_new( chain_t *chain, const bus_driver_t *driver, char *cmd_params[] )
{
bus_t *bus;
part_t *part;
@ -164,10 +164,10 @@ zefant_xs3_bus_new( chain_t *chain, char *cmd_params[] )
if (!bus)
return NULL;
bus->driver = &zefant_xs3_bus;
bus->driver = driver;
bus->params = calloc( 1, sizeof (bus_params_t) );
if (!bus->params) {
free( bus );
free( bus );\
return NULL;
}

@ -54,7 +54,7 @@ cmd_initbus_run( chain_t *chain, char *params[] )
for (i = 0; bus_drivers[i] != NULL; i++) {
if (strcasecmp( bus_drivers[i]->name, params[1] ) == 0) {
bus_t *bus = bus_drivers[i]->new_bus( chain, params );
bus_t *bus = bus_drivers[i]->new_bus( chain, bus_drivers[i], params );
if (bus == NULL) {
printf( _("bus alloc/attach failed!\n") );
return 1;

Loading…
Cancel
Save