From 684ef2f9f7db4c8494c8efbc9b080adf797e2175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Fri, 27 Jun 2008 19:57:27 +0000 Subject: [PATCH] [ 1984813 ] Bus driver cleanup Separate (*init) and (*prepare) functions (Hartley Sweeten) git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1288 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 17 +++++++++++++++++ jtag/doc/UrJTAG.txt | 9 ++++++++- jtag/include/bus_driver.h | 2 ++ jtag/src/bus/au1500.c | 2 +- jtag/src/bus/avr32.c | 4 +++- jtag/src/bus/bcm1250.c | 2 +- jtag/src/bus/bf533_ezkit.c | 2 +- jtag/src/bus/bf533_stamp.c | 2 +- jtag/src/bus/bf537_stamp.c | 6 +++--- jtag/src/bus/bf548_ezkit.c | 2 +- jtag/src/bus/bf561_ezkit.c | 2 +- jtag/src/bus/ejtag.c | 16 ++++++---------- jtag/src/bus/fjmem.c | 5 ++++- jtag/src/bus/generic_bus.c | 15 +++++++++++++++ jtag/src/bus/generic_bus.h | 1 + jtag/src/bus/h7202.c | 2 +- jtag/src/bus/ixp425.c | 2 +- jtag/src/bus/jopcyc.c | 15 ++++++++------- jtag/src/bus/lh7a400.c | 2 +- jtag/src/bus/mpc5200.c | 2 +- jtag/src/bus/mpc824x.c | 2 +- jtag/src/bus/ppc405ep.c | 2 +- jtag/src/bus/ppc440gx_ebc8.c | 2 +- jtag/src/bus/prototype.c | 2 +- jtag/src/bus/pxa2x0.c | 29 ++++------------------------- jtag/src/bus/s3c4510x.c | 15 ++++++++------- jtag/src/bus/sa1110.c | 2 +- jtag/src/bus/sh7727.c | 2 +- jtag/src/bus/sh7750r.c | 2 +- jtag/src/bus/sh7751r.c | 2 +- jtag/src/bus/sharc21065l.c | 2 +- jtag/src/bus/slsup3.c | 2 +- jtag/src/bus/tx4925.c | 2 +- jtag/src/bus/zefant-xs3.c | 15 ++++++++------- jtag/src/cmd/initbus.c | 4 +++- 35 files changed, 111 insertions(+), 84 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 69ce3496..55291c67 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,20 @@ +2008-06-27 Arnim Laeuger + + * UrJTAG.txt: update of bus driver init() function + * include/bus_driver.h, src/cmd/initbus.c, 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/generic_bus.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, src/bus/generic_bus.h: + [ 1984813 ] Bus driver cleanup, separate (*init) and (*prepare) + functions (Hartley Sweeten) + 2008-06-24 Jie Zhang From Michael Hennerich diff --git a/jtag/doc/UrJTAG.txt b/jtag/doc/UrJTAG.txt index 0d735ba9..f0b074a8 100644 --- a/jtag/doc/UrJTAG.txt +++ b/jtag/doc/UrJTAG.txt @@ -1243,11 +1243,18 @@ IMPORTANT: Address parameters to the functions listed above specify always byte locations, independent of the actual data width. The bus driver has to adjust the address on its own if required. -===== Initialization ===== +===== Creation ===== Upon calling of its bus_new() function, the driver allocates a "bus_t" structure and performs all required internal initializations. +===== Initialization ===== + +After creation of the new "bus_t" structure, the bus_init() function will +be called to give the driver the possibility to initialize it's internal +states or BSR bits as required. Such functionality has been split from +bus_new() since some drivers require to re-initialize during runtime. + ===== Cleaning up ===== The driver is supposed to free all allocated memory (including its "bus_t" diff --git a/jtag/include/bus_driver.h b/jtag/include/bus_driver.h index c45a6644..1214d41d 100644 --- a/jtag/include/bus_driver.h +++ b/jtag/include/bus_driver.h @@ -68,6 +68,7 @@ struct bus { chain_t *chain; part_t *part; void *params; + int initialized; const bus_driver_t *driver; }; @@ -75,6 +76,7 @@ extern bus_t *bus; #define CHAIN bus->chain #define PART bus->part +#define INITIALIZED bus->initialized #define bus_printinfo(bus) bus->driver->printinfo(bus) #define bus_prepare(bus) bus->driver->prepare(bus) diff --git a/jtag/src/bus/au1500.c b/jtag/src/bus/au1500.c index a84a4493..d0340f69 100644 --- a/jtag/src/bus/au1500.c +++ b/jtag/src/bus/au1500.c @@ -305,6 +305,6 @@ const bus_driver_t au1500_bus = { au1500_bus_read_end, generic_bus_read, au1500_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/avr32.c b/jtag/src/bus/avr32.c index 2855c0d1..b18c5138 100644 --- a/jtag/src/bus/avr32.c +++ b/jtag/src/bus/avr32.c @@ -577,6 +577,8 @@ avr32_bus_printinfo (bus_t * bus) static void avr32_bus_prepare (bus_t * bus) { + if (!INITIALIZED) + bus_init( bus ); } /** @@ -774,5 +776,5 @@ const bus_driver_t avr32_bus_driver = { avr32_bus_read_end, generic_bus_read, avr32_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/bcm1250.c b/jtag/src/bus/bcm1250.c index a107da3c..66c8c4f1 100644 --- a/jtag/src/bus/bcm1250.c +++ b/jtag/src/bus/bcm1250.c @@ -500,6 +500,6 @@ const bus_driver_t bcm1250_bus = { bcm1250_bus_read, #endif bcm1250_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/bf533_ezkit.c b/jtag/src/bus/bf533_ezkit.c index 8360c852..389cf14a 100644 --- a/jtag/src/bus/bf533_ezkit.c +++ b/jtag/src/bus/bf533_ezkit.c @@ -332,5 +332,5 @@ const bus_driver_t bf533_ezkit_bus = { bf533_ezkit_bus_read_end, generic_bus_read, bf533_ezkit_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/bf533_stamp.c b/jtag/src/bus/bf533_stamp.c index a49088ad..886475f2 100644 --- a/jtag/src/bus/bf533_stamp.c +++ b/jtag/src/bus/bf533_stamp.c @@ -333,5 +333,5 @@ const bus_driver_t bf533_stamp_bus = { bf533_stamp_bus_read_end, generic_bus_read, bf533_stamp_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/bf537_stamp.c b/jtag/src/bus/bf537_stamp.c index cb2d41ba..a69cf9f7 100644 --- a/jtag/src/bus/bf537_stamp.c +++ b/jtag/src/bus/bf537_stamp.c @@ -347,7 +347,7 @@ const bus_driver_t bf537_stamp_bus = { bf537_stamp_bus_read_end, generic_bus_read, bf537_stamp_bus_write, - NULL + generic_bus_no_init }; #endif /* #ifdef ENABLE_BUS_BF537_STAMP */ @@ -396,7 +396,7 @@ const bus_driver_t bf537_ezkit_bus = { bf537_stamp_bus_read_end, generic_bus_read, bf537_stamp_bus_write, - NULL + generic_bus_no_init }; #endif /* #ifdef ENABLE_BUS_BF537_EZKIT */ @@ -445,7 +445,7 @@ const bus_driver_t bf527_ezkit_bus = { bf537_stamp_bus_read_end, generic_bus_read, bf537_stamp_bus_write, - NULL + generic_bus_no_init }; #endif /* #ifdef ENABLE_BUS_BF527_EZKIT */ diff --git a/jtag/src/bus/bf548_ezkit.c b/jtag/src/bus/bf548_ezkit.c index 03fad218..a3b82072 100644 --- a/jtag/src/bus/bf548_ezkit.c +++ b/jtag/src/bus/bf548_ezkit.c @@ -321,5 +321,5 @@ const bus_driver_t bf548_ezkit_bus = { bf548_ezkit_bus_read_end, generic_bus_read, bf548_ezkit_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/bf561_ezkit.c b/jtag/src/bus/bf561_ezkit.c index 3e13ed90..5a44720a 100644 --- a/jtag/src/bus/bf561_ezkit.c +++ b/jtag/src/bus/bf561_ezkit.c @@ -344,5 +344,5 @@ const bus_driver_t bf561_ezkit_bus = { bf561_ezkit_bus_read_end, generic_bus_read, bf561_ezkit_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/ejtag.c b/jtag/src/bus/ejtag.c index 1f799c3d..cfaea719 100644 --- a/jtag/src/bus/ejtag.c +++ b/jtag/src/bus/ejtag.c @@ -42,7 +42,6 @@ #include "generic_bus.h" typedef struct { - int initialized; uint32_t impcode; /* EJTAG Implementation Register */ uint16_t adr_hi; /* cached high bits of $3 */ } bus_params_t; @@ -90,7 +89,6 @@ ejtag_bus_new( chain_t *chain, char *cmd_params[] ) CHAIN = chain; PART = chain->parts->parts[chain->active_part]; - BP->initialized = 0; return bus; } @@ -156,14 +154,14 @@ ejtag_run_pracc( bus_t *bus, const uint32_t *code, unsigned int len ) printf( _("%s(%d) Reset occurred, ctrl=%s\n"), __FILE__, __LINE__, register_get_string( ejctrl->out ) ); - BP->initialized = 0; + INITIALIZED = 0; break; } if (! ejctrl->out->data[PrAcc]) { printf( _("%s(%d) No processor access, ctrl=%s\n"), __FILE__, __LINE__, register_get_string( ejctrl->out ) ); - BP->initialized = 0; + INITIALIZED = 0; break; } @@ -314,7 +312,7 @@ ejtag_bus_init( bus_t *bus ) ejtag_run_pracc( bus, code, 4 ); BP->adr_hi = 0; - BP->initialized = 1; + INITIALIZED = 1; } /** @@ -324,10 +322,8 @@ ejtag_bus_init( bus_t *bus ) static void ejtag_bus_prepare( bus_t *bus ) { - if (BP->initialized) - return; - - ejtag_bus_init( bus ); + if (!INITIALIZED) + bus_init( bus ); } /** @@ -501,5 +497,5 @@ const bus_driver_t ejtag_bus = { ejtag_bus_read_end, generic_bus_read, ejtag_bus_write, - NULL + ejtag_bus_init }; diff --git a/jtag/src/bus/fjmem.c b/jtag/src/bus/fjmem.c index f5d37412..2ed60a55 100644 --- a/jtag/src/bus/fjmem.c +++ b/jtag/src/bus/fjmem.c @@ -480,6 +480,9 @@ fjmem_bus_printinfo( bus_t *bus ) static void fjmem_bus_prepare( bus_t *bus ) { + if (!INITIALIZED) + bus_init( bus ); + /* ensure FJMEM_INST is active */ part_set_instruction( PART, FJMEM_INST_NAME ); chain_shift_instructions( CHAIN ); @@ -719,7 +722,7 @@ const bus_driver_t fjmem_bus = { fjmem_bus_read_end, generic_bus_read, fjmem_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/generic_bus.c b/jtag/src/bus/generic_bus.c index 3d9ddbab..5a816385 100644 --- a/jtag/src/bus/generic_bus.c +++ b/jtag/src/bus/generic_bus.c @@ -53,6 +53,18 @@ generic_bus_free( bus_t *bus ) free( bus ); } +/** + * bus->driver->(*init) + * + */ +int +generic_bus_no_init( bus_t *bus ) +{ + INITIALIZED = 1; + + return 0; +} + /** * bus->driver->(*prepare) * @@ -60,6 +72,9 @@ generic_bus_free( bus_t *bus ) void generic_bus_prepare_extest( bus_t *bus ) { + if (!INITIALIZED) + bus_init( bus ); + part_set_instruction( PART, "EXTEST" ); chain_shift_instructions( CHAIN ); } diff --git a/jtag/src/bus/generic_bus.h b/jtag/src/bus/generic_bus.h index 212ccd4c..edc46192 100644 --- a/jtag/src/bus/generic_bus.h +++ b/jtag/src/bus/generic_bus.h @@ -30,6 +30,7 @@ int generic_bus_attach_sig( part_t *part, signal_t **sig, char *id ); void generic_bus_free( bus_t *bus ); +int generic_bus_no_init( bus_t *bus ); void generic_bus_prepare_extest( bus_t *bus ); uint32_t generic_bus_read( bus_t *bus, uint32_t adr ); diff --git a/jtag/src/bus/h7202.c b/jtag/src/bus/h7202.c index 7494488b..d25706bc 100644 --- a/jtag/src/bus/h7202.c +++ b/jtag/src/bus/h7202.c @@ -305,5 +305,5 @@ const bus_driver_t h7202_bus = { h7202_bus_read_end, generic_bus_read, h7202_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/ixp425.c b/jtag/src/bus/ixp425.c index e5c0072f..630f807b 100644 --- a/jtag/src/bus/ixp425.c +++ b/jtag/src/bus/ixp425.c @@ -299,5 +299,5 @@ const bus_driver_t ixp425_bus = { ixp425_bus_read_end, generic_bus_read, ixp425_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/jopcyc.c b/jtag/src/bus/jopcyc.c index 6f1c9688..362b9e80 100644 --- a/jtag/src/bus/jopcyc.c +++ b/jtag/src/bus/jopcyc.c @@ -423,11 +423,11 @@ setup_data( bus_t *bus, uint32_t d, component_t *comp ) } /** - * bus->driver->(*prepare) + * bus->driver->(*init) * */ -static void -jopcyc_bus_prepare( bus_t *bus ) +static int +jopcyc_bus_init( bus_t *bus ) { part_t *p = PART; chain_t *chain = CHAIN; @@ -474,8 +474,9 @@ jopcyc_bus_prepare( bus_t *bus ) chain_shift_data_registers( chain, 0 ); - part_set_instruction( p, "EXTEST" ); - chain_shift_instructions( chain ); + INITIALIZED = 1; + + return 0; } static int @@ -668,14 +669,14 @@ const bus_driver_t jopcyc_bus = { jopcyc_bus_new, generic_bus_free, jopcyc_bus_printinfo, - jopcyc_bus_prepare, + generic_bus_prepare_extest, jopcyc_bus_area, jopcyc_bus_read_start, jopcyc_bus_read_next, jopcyc_bus_read_end, generic_bus_read, jopcyc_bus_write, - NULL + jopcyc_bus_init }; diff --git a/jtag/src/bus/lh7a400.c b/jtag/src/bus/lh7a400.c index d0f9c838..1d00f902 100644 --- a/jtag/src/bus/lh7a400.c +++ b/jtag/src/bus/lh7a400.c @@ -328,5 +328,5 @@ const bus_driver_t lh7a400_bus = { lh7a400_bus_read_end, generic_bus_read, lh7a400_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/mpc5200.c b/jtag/src/bus/mpc5200.c index ad677d90..86bb34e6 100644 --- a/jtag/src/bus/mpc5200.c +++ b/jtag/src/bus/mpc5200.c @@ -309,5 +309,5 @@ const bus_driver_t mpc5200_bus = { mpc5200_bus_read_end, generic_bus_read, mpc5200_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/mpc824x.c b/jtag/src/bus/mpc824x.c index cd8b5f51..b6238132 100644 --- a/jtag/src/bus/mpc824x.c +++ b/jtag/src/bus/mpc824x.c @@ -521,5 +521,5 @@ const bus_driver_t mpc824x_bus = { mpc824x_bus_read_end, generic_bus_read, mpc824x_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/ppc405ep.c b/jtag/src/bus/ppc405ep.c index f70a6dc8..70c03a11 100644 --- a/jtag/src/bus/ppc405ep.c +++ b/jtag/src/bus/ppc405ep.c @@ -275,5 +275,5 @@ const bus_driver_t ppc405ep_bus = { ppc405ep_bus_read_end, generic_bus_read, ppc405ep_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/ppc440gx_ebc8.c b/jtag/src/bus/ppc440gx_ebc8.c index 25426e9a..f337cb91 100644 --- a/jtag/src/bus/ppc440gx_ebc8.c +++ b/jtag/src/bus/ppc440gx_ebc8.c @@ -277,5 +277,5 @@ const bus_driver_t ppc440gx_ebc8_bus = { ppc440gx_ebc8_bus_read_end, generic_bus_read, ppc440gx_ebc8_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/prototype.c b/jtag/src/bus/prototype.c index fe9aae46..7d8454ab 100644 --- a/jtag/src/bus/prototype.c +++ b/jtag/src/bus/prototype.c @@ -446,6 +446,6 @@ const bus_driver_t prototype_bus = { prototype_bus_read_end, generic_bus_read, prototype_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/pxa2x0.c b/jtag/src/bus/pxa2x0.c index 82247d17..cc6f79fb 100644 --- a/jtag/src/bus/pxa2x0.c +++ b/jtag/src/bus/pxa2x0.c @@ -247,8 +247,6 @@ pxa2x0_bus_new( chain_t *chain, char *cmd_params[] ) return NULL; } - INITED = 0; - return bus; } @@ -288,8 +286,6 @@ pxa27x_bus_new( chain_t *chain, char *cmd_params[] ) return NULL; } - INITED = 0; - return bus; } @@ -333,9 +329,6 @@ pxa2xx_bus_init( bus_t *bus ) chain_t *chain = CHAIN; part_t *p = PART; - if (INITED == 1) - return 0; - part_set_instruction( p, "SAMPLE/PRELOAD" ); chain_shift_instructions( chain ); chain_shift_data_registers( chain, 1 ); @@ -358,23 +351,11 @@ pxa2xx_bus_init( bus_t *bus ) part_set_instruction( p, "BYPASS" ); chain_shift_instructions( chain ); - INITED = 1; + INITIALIZED = 1; return 0; } -/** - * bus->driver->(*prepare) - * - */ -static void -pxa2xx_bus_prepare( bus_t *bus ) -{ - (void)pxa2xx_bus_init( bus ); - - generic_bus_prepare_extest( bus ); -} - /** * bus->driver->(*area) * @@ -384,7 +365,6 @@ 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)) { @@ -475,7 +455,6 @@ pxa27x_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)) { @@ -793,14 +772,14 @@ const bus_driver_t pxa2x0_bus = { pxa2x0_bus_new, generic_bus_free, pxa2x0_bus_printinfo, - pxa2xx_bus_prepare, + generic_bus_prepare_extest, pxa2xx_bus_area, pxa2xx_bus_read_start, pxa2xx_bus_read_next, pxa2xx_bus_read_end, generic_bus_read, pxa2xx_bus_write, - NULL /* patch 909598 call pxax0_bus_init, but the patch fails and doesnt look compatible */ + pxa2xx_bus_init }; const bus_driver_t pxa27x_bus = { @@ -809,7 +788,7 @@ const bus_driver_t pxa27x_bus = { pxa27x_bus_new, generic_bus_free, pxa27x_bus_printinfo, - pxa2xx_bus_prepare, + generic_bus_prepare_extest, pxa27x_bus_area, pxa2xx_bus_read_start, pxa2xx_bus_read_next, diff --git a/jtag/src/bus/s3c4510x.c b/jtag/src/bus/s3c4510x.c index 1b7aad0b..e62902b8 100644 --- a/jtag/src/bus/s3c4510x.c +++ b/jtag/src/bus/s3c4510x.c @@ -182,11 +182,11 @@ s3c4510_bus_printinfo( bus_t *bus ) } /** - * bus->driver->(*prepare) + * bus->driver->(*init) * */ -static void -s3c4510_bus_prepare( bus_t *bus ) +static int +s3c4510_bus_init( bus_t *bus ) { part_t *p = PART; chain_t *chain = CHAIN; @@ -195,8 +195,9 @@ s3c4510_bus_prepare( bus_t *bus ) chain_shift_instructions( chain ); chain_shift_data_registers( chain, 0 ); - part_set_instruction( p, "EXTEST" ); - chain_shift_instructions( chain ); + INITIALIZED = 1; + + return 0; } /** @@ -405,14 +406,14 @@ const bus_driver_t s3c4510_bus = { s3c4510_bus_new, generic_bus_free, s3c4510_bus_printinfo, - s3c4510_bus_prepare, + generic_bus_prepare_extest, s3c4510_bus_area, s3c4510_bus_read_start, s3c4510_bus_read_next, s3c4510_bus_read_end, generic_bus_read, s3c4510_bus_write, - NULL + s3c4510_bus_init }; diff --git a/jtag/src/bus/sa1110.c b/jtag/src/bus/sa1110.c index c981459f..89fe1552 100644 --- a/jtag/src/bus/sa1110.c +++ b/jtag/src/bus/sa1110.c @@ -313,5 +313,5 @@ const bus_driver_t sa1110_bus = { sa1110_bus_read_end, generic_bus_read, sa1110_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/sh7727.c b/jtag/src/bus/sh7727.c index f7341246..696fba71 100644 --- a/jtag/src/bus/sh7727.c +++ b/jtag/src/bus/sh7727.c @@ -354,5 +354,5 @@ const bus_driver_t sh7727_bus = { sh7727_bus_read_end, generic_bus_read, sh7727_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/sh7750r.c b/jtag/src/bus/sh7750r.c index 89324555..ca35dce8 100644 --- a/jtag/src/bus/sh7750r.c +++ b/jtag/src/bus/sh7750r.c @@ -336,5 +336,5 @@ const bus_driver_t sh7750r_bus = { sh7750r_bus_read_end, generic_bus_read, sh7750r_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/sh7751r.c b/jtag/src/bus/sh7751r.c index 335bd936..3480d09a 100644 --- a/jtag/src/bus/sh7751r.c +++ b/jtag/src/bus/sh7751r.c @@ -324,5 +324,5 @@ const bus_driver_t sh7751r_bus = { sh7751r_bus_read_end, generic_bus_read, sh7751r_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/sharc21065l.c b/jtag/src/bus/sharc21065l.c index 966ce6a1..1a4dcab5 100644 --- a/jtag/src/bus/sharc21065l.c +++ b/jtag/src/bus/sharc21065l.c @@ -317,5 +317,5 @@ const bus_driver_t sharc_21065L_bus = { sharc_21065L_bus_read_end, generic_bus_read, sharc_21065L_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/slsup3.c b/jtag/src/bus/slsup3.c index 51bd4d24..011336d3 100644 --- a/jtag/src/bus/slsup3.c +++ b/jtag/src/bus/slsup3.c @@ -431,5 +431,5 @@ const bus_driver_t slsup3_bus = { slsup3_bus_read_end, generic_bus_read, slsup3_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/tx4925.c b/jtag/src/bus/tx4925.c index 48da737c..8ac01a75 100644 --- a/jtag/src/bus/tx4925.c +++ b/jtag/src/bus/tx4925.c @@ -319,5 +319,5 @@ const bus_driver_t tx4925_bus = { tx4925_bus_read_end, generic_bus_read, tx4925_bus_write, - NULL + generic_bus_no_init }; diff --git a/jtag/src/bus/zefant-xs3.c b/jtag/src/bus/zefant-xs3.c index 78572513..8fde679d 100644 --- a/jtag/src/bus/zefant-xs3.c +++ b/jtag/src/bus/zefant-xs3.c @@ -545,11 +545,11 @@ eeprom_disable_device( chain_t *chain, part_t *p, component_t *comp ) } /** - * bus->driver->(*prepare) + * bus->driver->(*init) * */ -static void -zefant_xs3_bus_prepare( bus_t *bus ) +static int +zefant_xs3_bus_init( bus_t *bus ) { part_t *p = PART; chain_t *chain = CHAIN; @@ -605,8 +605,9 @@ zefant_xs3_bus_prepare( bus_t *bus ) chain_shift_data_registers( chain, 0 ); - part_set_instruction( p, "EXTEST" ); - chain_shift_instructions( chain ); + INITIALIZED = 1; + + return 0; } static int @@ -945,14 +946,14 @@ const bus_driver_t zefant_xs3_bus = { zefant_xs3_bus_new, generic_bus_free, zefant_xs3_bus_printinfo, - zefant_xs3_bus_prepare, + generic_bus_prepare_extest, zefant_xs3_bus_area, zefant_xs3_bus_read_start, zefant_xs3_bus_read_next, zefant_xs3_bus_read_end, generic_bus_read, zefant_xs3_bus_write, - NULL + zefant_xs3_bus_init }; diff --git a/jtag/src/cmd/initbus.c b/jtag/src/cmd/initbus.c index 395f47a3..d4324e91 100644 --- a/jtag/src/cmd/initbus.c +++ b/jtag/src/cmd/initbus.c @@ -56,10 +56,12 @@ cmd_initbus_run( chain_t *chain, char *params[] ) if (strcasecmp( bus_drivers[i]->name, params[1] ) == 0) { bus_t *bus = bus_drivers[i]->new_bus( chain, params ); if (bus == NULL) { - printf( _("bus initialization failed!\n") ); + printf( _("bus alloc/attach failed!\n") ); return 1; } buses_add( bus ); + if (bus_init( bus )) + printf( _("bus initialization failed!\n") ); return 1; } }