diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 8b28d33e..ba5a8887 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,16 @@ +2008-06-11 Arnim Laeuger + + * src/bus/bf548_ezkit.c, src/bus/ppc405ep.c, src/bus/sh7727.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/h7202.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: + [ 1984813 ] Bus driver cleanup, second step of part 2) (Hartley Sweeten) + use generic_bus_attach_sig() in all bus drivers + 2008-06-10 Arnim Laeuger * src/bus/generic_bus.c, src/bus/generic_bus.h, src/bus/zefant-xs3.c: diff --git a/jtag/src/bus/au1500.c b/jtag/src/bus/au1500.c index 1d291d3e..0a8802c8 100644 --- a/jtag/src/bus/au1500.c +++ b/jtag/src/bus/au1500.c @@ -67,6 +67,7 @@ typedef struct{ static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -87,49 +88,26 @@ static bus_t *au1500_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = part = chain->parts->parts[chain->active_part]; for(i=0; i<32; i++){ sprintf( buff, "RAD%d", i); - RAD[i] = part_find_signal( PART, buff); - if(!RAD[i]){ - printf( _("signal '%s' not found\n"), buff ); - failed =1; - break; - } + failed |= generic_bus_attach_sig( part, &(RAD[i]), buff ); } for(i=0; i<4; i++){ sprintf( buff, "RCE_N%d", i); - nRCS[i] = part_find_signal( PART, buff); - if(!nRCS[i]){ - printf( _("signal '%s' not found\n"), buff ); - failed =1; - break; - } + failed |= generic_bus_attach_sig( part, &(nRCS[i]), buff ); } - nRWE = part_find_signal( PART, "RWE_N" ); - if (!nRWE) { - printf( _("signal '%s' not found\n"), "RWE_N" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nRWE), "RWE_N" ); - nROE = part_find_signal( PART, "ROE_N" ); - if (!nROE) { - printf( _("signal '%s' not found\n"), "ROE_N" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nROE), "ROE_N" ); for(i=0; i<32; i++){ sprintf( buff, "RD%d", i); - RD[i] = part_find_signal( PART, buff); - if(!RD[i]){ - printf( _("signal '%s' not found\n"), buff); - failed =1; - break; - } + failed |= generic_bus_attach_sig( part, &(RD[i]), buff ); } if (failed) { diff --git a/jtag/src/bus/bcm1250.c b/jtag/src/bus/bcm1250.c index 501f2ed1..c65b9850 100644 --- a/jtag/src/bus/bcm1250.c +++ b/jtag/src/bus/bcm1250.c @@ -66,6 +66,7 @@ static bus_t * bcm1250_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -85,42 +86,24 @@ bcm1250_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(IO_AD[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(IO_CS_L[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(IO_RW), "IO_RW" ); + + failed |= generic_bus_attach_sig( part, &(IO_WR_L), "IO_WR_L" ); + + failed |= generic_bus_attach_sig( part, &(IO_OE_L), "IO_OE_L" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/bf533_ezkit.c b/jtag/src/bus/bf533_ezkit.c index 6d0ccadc..ba300108 100644 --- a/jtag/src/bus/bf533_ezkit.c +++ b/jtag/src/bus/bf533_ezkit.c @@ -73,6 +73,7 @@ static bus_t * bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -92,84 +93,38 @@ bf533_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(AMS[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(DATA[i]), buff ); } - AWE = part_find_signal( PART, "AWE_B" ); - if (!AWE) { - printf( _("signal '%s' not found\n"), "AWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AWE), "AWE_B" ); - AOE = part_find_signal( PART, "AOE_B" ); - if (!AOE) { - printf( _("signal '%s' not found\n"), "AOE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AOE), "AOE_B" ); - ABE[0] = part_find_signal( PART, "ABE_B0" ); - if (!ABE[0]) { - printf( _("signal '%s' not found\n"), "ABE_B0" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(ABE[0]), "ABE_B0" ); - ABE[1] = part_find_signal( PART, "ABE_B1" ); - if (!ABE[1]) { - printf( _("signal '%s' not found\n"), "ABE_B1" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(ABE[1]), "ABE_B1" ); - SRAS = part_find_signal( PART, "SRAS_B" ); - if (!SRAS) { - printf( _("signal '%s' not found\n"), "SRAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SRAS), "SRAS_B" ); - SCAS = part_find_signal( PART, "SCAS_B" ); - if (!SCAS) { - printf( _("signal '%s' not found\n"), "SCAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SCAS), "SCAS_B" ); - SWE = part_find_signal( PART, "SWE_B" ); - if (!SWE) { - printf( _("signal '%s' not found\n"), "SWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SWE), "SWE_B" ); - SMS = part_find_signal( PART, "SMS_B" ); - if (!SMS) { - printf( _("signal '%s' not found\n"), "SMS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SMS), "SMS_B" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/bf533_stamp.c b/jtag/src/bus/bf533_stamp.c index bc1d9ad8..f8f163d1 100644 --- a/jtag/src/bus/bf533_stamp.c +++ b/jtag/src/bus/bf533_stamp.c @@ -73,6 +73,7 @@ static bus_t * bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -92,82 +93,39 @@ bf533_stamp_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(PF[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(AMS[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(DATA[i]), buff ); } - AWE = part_find_signal( PART, "AWE_B" ); - if (!AWE) { - printf( _("signal '%s' not found\n"), "AWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AWE), "AWE_B" ); - AOE = part_find_signal( PART, "AOE_B" ); - if (!AOE) { - printf( _("signal '%s' not found\n"), "AOE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AOE), "AOE_B" ); - SRAS = part_find_signal( PART, "SRAS_B" ); - if (!SRAS) { - printf( _("signal '%s' not found\n"), "SRAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SRAS), "SRAS_B" ); - SCAS = part_find_signal( PART, "SCAS_B" ); - if (!SCAS) { - printf( _("signal '%s' not found\n"), "SCAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SCAS), "SCAS_B" ); - SWE = part_find_signal( PART, "SWE_B" ); - if (!SWE) { - printf( _("signal '%s' not found\n"), "SWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SWE), "SWE_B" ); - SMS = part_find_signal( PART, "SMS_B" ); - if (!SMS) { - printf( _("signal '%s' not found\n"), "SMS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SMS), "SMS_B" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/bf537_stamp.c b/jtag/src/bus/bf537_stamp.c index ec0fde59..3f86d4b2 100644 --- a/jtag/src/bus/bf537_stamp.c +++ b/jtag/src/bus/bf537_stamp.c @@ -73,6 +73,7 @@ static bus_t * bf537_stamp_bus_new_1( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -91,84 +92,38 @@ bf537_stamp_bus_new_1( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(AMS[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(DATA[i]), buff ); } - AWE = part_find_signal( PART, "AWE_B" ); - if (!AWE) { - printf( _("signal '%s' not found\n"), "AWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AWE), "AWE_B" ); - ARE = part_find_signal( PART, "ARE_B" ); - if (!ARE) { - printf( _("signal '%s' not found\n"), "ARE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(ARE), "ARE_B" ); - ABE[0] = part_find_signal( PART, "ABE_B0" ); - if (!ABE[0]) { - printf( _("signal '%s' not found\n"), "ABE_B0" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(ABE[0]), "ABE_B0" ); - ABE[1] = part_find_signal( PART, "ABE_B1" ); - if (!ABE[1]) { - printf( _("signal '%s' not found\n"), "ABE_B1" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(ABE[1]), "ABE_B1" ); - SRAS = part_find_signal( PART, "SRAS_B" ); - if (!SRAS) { - printf( _("signal '%s' not found\n"), "SRAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SRAS), "SRAS_B" ); - SCAS = part_find_signal( PART, "SCAS_B" ); - if (!SCAS) { - printf( _("signal '%s' not found\n"), "SCAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SCAS), "SCAS_B" ); - SWE = part_find_signal( PART, "SWE_B" ); - if (!SWE) { - printf( _("signal '%s' not found\n"), "SWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SWE), "SWE_B" ); - SMS = part_find_signal( PART, "SMS_B" ); - if (!SMS) { - printf( _("signal '%s' not found\n"), "SMS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SMS), "SMS_B" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/bf548_ezkit.c b/jtag/src/bus/bf548_ezkit.c index de0590f7..bb507483 100644 --- a/jtag/src/bus/bf548_ezkit.c +++ b/jtag/src/bus/bf548_ezkit.c @@ -68,6 +68,7 @@ static bus_t * bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -87,87 +88,42 @@ bf548_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(AMS[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(DATA[i]), buff ); } - AWE = part_find_signal( PART, "AWEB" ); - if (!AWE) { - printf( _("signal '%s' not found\n"), "AWEB" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AWE), "AWEB" ); - ARE = part_find_signal( PART, "AREB" ); - if (!ARE) { - printf( _("signal '%s' not found\n"), "AREB" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(ARE), "AREB" ); - AOE = part_find_signal( PART, "AOEB" ); - if (!AOE) { - printf( _("signal '%s' not found\n"), "AOEB" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AOE), "AOEB" ); - DCS0 = part_find_signal( PART, "CS0_B" ); - if (!DCS0) { - printf( _("signal '%s' not found\n"), "CS0_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(DCS0), "CS0_B" ); - NCE = part_find_signal( PART, "PORTJ_1" ); - if (!NCE) { - printf( _("signal '%s' not found\n"), "PORTJ_1" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(NCE), "PORTJ_1" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/bf561_ezkit.c b/jtag/src/bus/bf561_ezkit.c index c977848e..481fb41f 100644 --- a/jtag/src/bus/bf561_ezkit.c +++ b/jtag/src/bus/bf561_ezkit.c @@ -73,6 +73,7 @@ static bus_t * bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -92,86 +93,41 @@ bf561_ezkit_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(AMS[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ABE[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(DATA[i]), buff ); } - AWE = part_find_signal( PART, "AWE_B" ); - if (!AWE) { - printf( _("signal '%s' not found\n"), "AWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AWE), "AWE_B" ); - AOE = part_find_signal( PART, "AOE_B" ); - if (!AOE) { - printf( _("signal '%s' not found\n"), "AOE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(AOE), "AOE_B" ); - SRAS = part_find_signal( PART, "SRAS_B" ); - if (!SRAS) { - printf( _("signal '%s' not found\n"), "SRAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SRAS), "SRAS_B" ); - SCAS = part_find_signal( PART, "SCAS_B" ); - if (!SCAS) { - printf( _("signal '%s' not found\n"), "SCAS_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SCAS), "SCAS_B" ); - SWE = part_find_signal( PART, "SWE_B" ); - if (!SWE) { - printf( _("signal '%s' not found\n"), "SWE_B" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SWE), "SWE_B" ); 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; - } + failed |= generic_bus_attach_sig( part, &(SMS[i]), buff ); } if (failed) { diff --git a/jtag/src/bus/h7202.c b/jtag/src/bus/h7202.c index b86fb41c..4a546d4f 100644 --- a/jtag/src/bus/h7202.c +++ b/jtag/src/bus/h7202.c @@ -63,6 +63,7 @@ static bus_t * h7202_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -82,48 +83,28 @@ h7202_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(nRCS[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(nROE), "nROE" ); + 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; - } + failed |= generic_bus_attach_sig( part, &(nRWE[i]), buff ); } if (failed) { diff --git a/jtag/src/bus/ixp425.c b/jtag/src/bus/ixp425.c index 8af59484..5589db48 100644 --- a/jtag/src/bus/ixp425.c +++ b/jtag/src/bus/ixp425.c @@ -63,6 +63,7 @@ static bus_t * ixp425_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -82,46 +83,27 @@ ixp425_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(EX_CS[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(EX_ADDR[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(EX_DATA[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(EX_WR), "EX_WR" ); + + failed |= generic_bus_attach_sig( part, &(EX_RD), "EX_RD" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/jopcyc.c b/jtag/src/bus/jopcyc.c index 28ad46c0..b5ba20c5 100644 --- a/jtag/src/bus/jopcyc.c +++ b/jtag/src/bus/jopcyc.c @@ -133,20 +133,6 @@ 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) * @@ -155,6 +141,7 @@ static bus_t * jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; int failed = 0; component_t *comp; @@ -173,7 +160,7 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = part = chain->parts->parts[chain->active_part]; /* * Setup RAMA @@ -182,48 +169,48 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) 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" ); + failed |= generic_bus_attach_sig( part, &(A[ 0]), "IO64" ); + failed |= generic_bus_attach_sig( part, &(A[ 1]), "IO66" ); + failed |= generic_bus_attach_sig( part, &(A[ 2]), "IO68" ); + failed |= generic_bus_attach_sig( part, &(A[ 3]), "IO74" ); + failed |= generic_bus_attach_sig( part, &(A[ 4]), "IO76" ); + failed |= generic_bus_attach_sig( part, &(A[ 5]), "IO107" ); + failed |= generic_bus_attach_sig( part, &(A[ 6]), "IO113" ); + failed |= generic_bus_attach_sig( part, &(A[ 7]), "IO115" ); + failed |= generic_bus_attach_sig( part, &(A[ 8]), "IO117" ); + failed |= generic_bus_attach_sig( part, &(A[ 9]), "IO119" ); + failed |= generic_bus_attach_sig( part, &(A[10]), "IO118" ); + failed |= generic_bus_attach_sig( part, &(A[11]), "IO116" ); + failed |= generic_bus_attach_sig( part, &(A[12]), "IO114" ); + failed |= generic_bus_attach_sig( part, &(A[13]), "IO108" ); + failed |= generic_bus_attach_sig( part, &(A[14]), "IO106" ); + failed |= generic_bus_attach_sig( part, &(A[15]), "IO67" ); + failed |= generic_bus_attach_sig( part, &(A[16]), "IO65" ); + failed |= generic_bus_attach_sig( part, &(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" ); + failed |= generic_bus_attach_sig( part, &(D[ 0]), "IO82" ); + failed |= generic_bus_attach_sig( part, &(D[ 1]), "IO84" ); + failed |= generic_bus_attach_sig( part, &(D[ 2]), "IO86" ); + failed |= generic_bus_attach_sig( part, &(D[ 3]), "IO88" ); + failed |= generic_bus_attach_sig( part, &(D[ 4]), "IO94" ); + failed |= generic_bus_attach_sig( part, &(D[ 5]), "IO98" ); + failed |= generic_bus_attach_sig( part, &(D[ 6]), "IO100" ); + failed |= generic_bus_attach_sig( part, &(D[ 7]), "IO104" ); + failed |= generic_bus_attach_sig( part, &(D[ 8]), "IO101" ); + failed |= generic_bus_attach_sig( part, &(D[ 9]), "IO99" ); + failed |= generic_bus_attach_sig( part, &(D[10]), "IO95" ); + failed |= generic_bus_attach_sig( part, &(D[11]), "IO93" ); + failed |= generic_bus_attach_sig( part, &(D[12]), "IO87" ); + failed |= generic_bus_attach_sig( part, &(D[13]), "IO85" ); + failed |= generic_bus_attach_sig( part, &(D[14]), "IO83" ); + failed |= generic_bus_attach_sig( part, &(D[15]), "IO79" ); + + failed |= generic_bus_attach_sig( part, &(nCS), "IO78" ); + failed |= generic_bus_attach_sig( part, &(nOE), "IO73" ); + failed |= generic_bus_attach_sig( part, &(nWE), "IO105" ); + failed |= generic_bus_attach_sig( part, &(nLB), "IO77" ); + failed |= generic_bus_attach_sig( part, &(nUB), "IO75" ); nCS2 = NULL; nRDY = NULL; @@ -234,48 +221,48 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) 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" ); + failed |= generic_bus_attach_sig( part, &(A[ 0]), "IO237" ); + failed |= generic_bus_attach_sig( part, &(A[ 1]), "IO235" ); + failed |= generic_bus_attach_sig( part, &(A[ 2]), "IO233" ); + failed |= generic_bus_attach_sig( part, &(A[ 3]), "IO227" ); + failed |= generic_bus_attach_sig( part, &(A[ 4]), "IO225" ); + failed |= generic_bus_attach_sig( part, &(A[ 5]), "IO194" ); + failed |= generic_bus_attach_sig( part, &(A[ 6]), "IO188" ); + failed |= generic_bus_attach_sig( part, &(A[ 7]), "IO186" ); + failed |= generic_bus_attach_sig( part, &(A[ 8]), "IO184" ); + failed |= generic_bus_attach_sig( part, &(A[ 9]), "IO182" ); + failed |= generic_bus_attach_sig( part, &(A[10]), "IO183" ); + failed |= generic_bus_attach_sig( part, &(A[11]), "IO185" ); + failed |= generic_bus_attach_sig( part, &(A[12]), "IO187" ); + failed |= generic_bus_attach_sig( part, &(A[13]), "IO193" ); + failed |= generic_bus_attach_sig( part, &(A[14]), "IO195" ); + failed |= generic_bus_attach_sig( part, &(A[15]), "IO234" ); + failed |= generic_bus_attach_sig( part, &(A[16]), "IO236" ); + failed |= generic_bus_attach_sig( part, &(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" ); + failed |= generic_bus_attach_sig( part, &(D[ 0]), "IO219" ); + failed |= generic_bus_attach_sig( part, &(D[ 1]), "IO217" ); + failed |= generic_bus_attach_sig( part, &(D[ 2]), "IO215" ); + failed |= generic_bus_attach_sig( part, &(D[ 3]), "IO213" ); + failed |= generic_bus_attach_sig( part, &(D[ 4]), "IO207" ); + failed |= generic_bus_attach_sig( part, &(D[ 5]), "IO203" ); + failed |= generic_bus_attach_sig( part, &(D[ 6]), "IO201" ); + failed |= generic_bus_attach_sig( part, &(D[ 7]), "IO197" ); + failed |= generic_bus_attach_sig( part, &(D[ 8]), "IO200" ); + failed |= generic_bus_attach_sig( part, &(D[ 9]), "IO202" ); + failed |= generic_bus_attach_sig( part, &(D[10]), "IO206" ); + failed |= generic_bus_attach_sig( part, &(D[11]), "IO208" ); + failed |= generic_bus_attach_sig( part, &(D[12]), "IO214" ); + failed |= generic_bus_attach_sig( part, &(D[13]), "IO216" ); + failed |= generic_bus_attach_sig( part, &(D[14]), "IO218" ); + failed |= generic_bus_attach_sig( part, &(D[15]), "IO222" ); + + failed |= generic_bus_attach_sig( part, &(nCS), "IO223" ); + failed |= generic_bus_attach_sig( part, &(nOE), "IO228" ); + failed |= generic_bus_attach_sig( part, &(nWE), "IO196" ); + failed |= generic_bus_attach_sig( part, &(nLB), "IO224" ); + failed |= generic_bus_attach_sig( part, &(nUB), "IO226" ); nCS2 = NULL; nRDY = NULL; @@ -286,34 +273,34 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) 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" ); + failed |= generic_bus_attach_sig( part, &(A[ 0]), "IO47" ); + failed |= generic_bus_attach_sig( part, &(A[ 1]), "IO48" ); + failed |= generic_bus_attach_sig( part, &(A[ 2]), "IO49" ); + failed |= generic_bus_attach_sig( part, &(A[ 3]), "IO50" ); + failed |= generic_bus_attach_sig( part, &(A[ 4]), "IO125" ); + failed |= generic_bus_attach_sig( part, &(A[ 5]), "IO127" ); + failed |= generic_bus_attach_sig( part, &(A[ 6]), "IO131" ); + failed |= generic_bus_attach_sig( part, &(A[ 7]), "IO133" ); + failed |= generic_bus_attach_sig( part, &(A[ 8]), "IO158" ); + failed |= generic_bus_attach_sig( part, &(A[ 9]), "IO16" ); + failed |= generic_bus_attach_sig( part, &(A[10]), "IO20" ); + failed |= generic_bus_attach_sig( part, &(A[11]), "IO14" ); + failed |= generic_bus_attach_sig( part, &(A[12]), "IO135" ); + failed |= generic_bus_attach_sig( part, &(A[13]), "IO156" ); + failed |= generic_bus_attach_sig( part, &(A[14]), "IO144" ); + failed |= generic_bus_attach_sig( part, &(A[15]), "IO137" ); + failed |= generic_bus_attach_sig( part, &(A[16]), "IO139" ); + failed |= generic_bus_attach_sig( part, &(A[17]), "IO143" ); + failed |= generic_bus_attach_sig( part, &(A[18]), "IO141" ); + + failed |= generic_bus_attach_sig( part, &(D[ 0]), "IO46" ); + failed |= generic_bus_attach_sig( part, &(D[ 1]), "IO45" ); + failed |= generic_bus_attach_sig( part, &(D[ 2]), "IO44" ); + failed |= generic_bus_attach_sig( part, &(D[ 3]), "IO165" ); + failed |= generic_bus_attach_sig( part, &(D[ 4]), "IO164" ); + failed |= generic_bus_attach_sig( part, &(D[ 5]), "IO17" ); + failed |= generic_bus_attach_sig( part, &(D[ 6]), "IO18" ); + failed |= generic_bus_attach_sig( part, &(D[ 7]), "IO19" ); D[ 8] = NULL; D[ 9] = NULL; D[10] = NULL; @@ -323,13 +310,13 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) 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" ); + failed |= generic_bus_attach_sig( part, &(nWE), "IO15" ); + failed |= generic_bus_attach_sig( part, &(nOE), "IO24" ); + failed |= generic_bus_attach_sig( part, &(nCS), "IO37" ); + failed |= generic_bus_attach_sig( part, &(nCS2), "IO23" ); /* CLK1 is not observable :-( - failed |= attach_sig( bus, &(nRDY), "CLK1" ); + failed |= generic_bus_attach_sig( part, &(nRDY), "CLK1" ); */ nRDY = NULL; @@ -339,10 +326,10 @@ jopcyc_bus_new( chain_t *chain, char *cmd_params[] ) /* * 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" ); + failed |= generic_bus_attach_sig( part, &(SER_RXD), "CLK2" ); + failed |= generic_bus_attach_sig( part, &(SER_NRTS), "IO177" ); + failed |= generic_bus_attach_sig( part, &(SER_TXD), "IO178" ); + failed |= generic_bus_attach_sig( part, &(SER_NCTS), "CLK0" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/lh7a400.c b/jtag/src/bus/lh7a400.c index cfd98610..f4564ed5 100644 --- a/jtag/src/bus/lh7a400.c +++ b/jtag/src/bus/lh7a400.c @@ -79,6 +79,7 @@ static bus_t * lh7a400_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -98,55 +99,32 @@ lh7a400_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(nCS[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(WIDTH[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(nWE), "nWE0" ); + + failed |= generic_bus_attach_sig( part, &(nOE), "nOE" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/mpc5200.c b/jtag/src/bus/mpc5200.c index ed0b9f02..6effd750 100644 --- a/jtag/src/bus/mpc5200.c +++ b/jtag/src/bus/mpc5200.c @@ -68,10 +68,10 @@ static bus_t * mpc5200_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; 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; @@ -93,40 +93,21 @@ mpc5200_bus_new( chain_t *chain, char *cmd_params[] ) /* 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; - } + failed |= generic_bus_attach_sig( part, &(AD[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(nCS[i]), buff ); } + + failed |= generic_bus_attach_sig( part, &(nWE), "LP_RW" ); + + failed |= generic_bus_attach_sig( part, &(nOE), "LP_OE" ); + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } if (failed) { diff --git a/jtag/src/bus/mpc824x.c b/jtag/src/bus/mpc824x.c index 96e714d2..545028e2 100644 --- a/jtag/src/bus/mpc824x.c +++ b/jtag/src/bus/mpc824x.c @@ -78,10 +78,10 @@ static bus_t * mpc824x_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; - part_t *part; signal_t *s_nfoe; signal_t *s_sdma1; @@ -182,59 +182,27 @@ mpc824x_bus_new( chain_t *chain, char *cmd_params[] ) 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; + failed |= generic_bus_attach_sig( part, &(AR[i]), buff ); } + + failed |= generic_bus_attach_sig( part, &(AR[11]), "SDBA0" ); + 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; + failed |= generic_bus_attach_sig( part, &(AR[19 - i]), buff ); } + failed |= generic_bus_attach_sig( part, &(AR[20]), "SDBA1" ); - 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; - } + failed |= generic_bus_attach_sig( part, &(AR[21]), "SDMA11" ); + + failed |= generic_bus_attach_sig( part, &(AR[22]), "SDMA12" ); + + failed |= generic_bus_attach_sig( part, &(nRCS0), "nRCS0" ); + + failed |= generic_bus_attach_sig( part, &(nWE), "nWE" ); + + failed |= generic_bus_attach_sig( part, &(nFOE), "nFOE" ); /* Freescale MPC824x uses inversed bit order ([1], p. 2-18): @@ -249,12 +217,7 @@ mpc824x_bus_new( chain_t *chain, char *cmd_params[] ) 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } if (failed) { diff --git a/jtag/src/bus/ppc405ep.c b/jtag/src/bus/ppc405ep.c index fc1ac720..a9a5a1d2 100644 --- a/jtag/src/bus/ppc405ep.c +++ b/jtag/src/bus/ppc405ep.c @@ -61,6 +61,7 @@ static bus_t * ppc405ep_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -80,43 +81,24 @@ ppc405ep_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(nCS), "PerCS0" ); + + failed |= generic_bus_attach_sig( part, &(nWE), "PerWBE1" ); + + failed |= generic_bus_attach_sig( part, &(nOE), "PerOE" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/ppc440gx_ebc8.c b/jtag/src/bus/ppc440gx_ebc8.c index 232fce4d..7b8f18d4 100644 --- a/jtag/src/bus/ppc440gx_ebc8.c +++ b/jtag/src/bus/ppc440gx_ebc8.c @@ -63,6 +63,7 @@ static bus_t * ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -82,43 +83,24 @@ ppc440gx_ebc8_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(nCS), "EBCCS0_N" ); + + failed |= generic_bus_attach_sig( part, &(nWE), "EBCWE_N" ); + + failed |= generic_bus_attach_sig( part, &(nOE), "EBCOE_N" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/pxa2x0.c b/jtag/src/bus/pxa2x0.c index c5a82eb0..e7586b9f 100644 --- a/jtag/src/bus/pxa2x0.c +++ b/jtag/src/bus/pxa2x0.c @@ -144,12 +144,13 @@ typedef struct { static int pxa2xx_bus_new_common(bus_t * bus) { - int failed = 0; + part_t *part; ncs_map_entry* ncs_map = NULL; -#ifdef PREPATCHNEVER - bus_t *bus; 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; @@ -168,26 +169,16 @@ pxa2xx_bus_new_common(bus_t * bus) CHAIN = chain; PART = chain->parts->parts[chain->active_part]; #endif - int i; - char buff[10]; + part = PART; 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; - } + failed |= generic_bus_attach_sig( part, &(MA[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(MD[i]), buff ); } if (PROC == PROC_PXA25x) { @@ -202,14 +193,8 @@ pxa2xx_bus_new_common(bus_t * bus) 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; - } + if (ncs_map[i].enabled > 0) { + failed |= generic_bus_attach_sig( part, &(nCS[i]), ncs_map[i].sig_name ); } else // disabled - this GPIO pin is unused or used for some other function { @@ -219,34 +204,17 @@ pxa2xx_bus_new_common(bus_t * bus) 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; + failed |= generic_bus_attach_sig( part, &(DQM[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(RDnWR), "RDnWR" ); + + failed |= generic_bus_attach_sig( part, &(nWE), "nWE" ); + + failed |= generic_bus_attach_sig( part, &(nOE), "nOE" ); + + failed |= generic_bus_attach_sig( part, &(nSDCAS), "nSDCAS" ); + return failed; } diff --git a/jtag/src/bus/s3c4510x.c b/jtag/src/bus/s3c4510x.c index 2300d877..e9e615f2 100644 --- a/jtag/src/bus/s3c4510x.c +++ b/jtag/src/bus/s3c4510x.c @@ -108,6 +108,7 @@ static bus_t * s3c4510_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -129,69 +130,39 @@ s3c4510_bus_new( chain_t *chain, char *cmd_params[] ) dbus_width = 16; CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(nRCS[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(nECS[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(nSDCS[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(nWBE[i]), buff ); } - nOE = part_find_signal( PART, "nOE" ); - if (!nOE) { - printf( _("signal '%s' not found\n"), "nOE" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nOE), "nOE" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/sa1110.c b/jtag/src/bus/sa1110.c index 06c06d2b..720ce9bb 100644 --- a/jtag/src/bus/sa1110.c +++ b/jtag/src/bus/sa1110.c @@ -68,6 +68,7 @@ static bus_t * sa1110_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -87,51 +88,29 @@ sa1110_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(nCS[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(RD_nWR), "RD_nWR" ); + + failed |= generic_bus_attach_sig( part, &(nWE), "nWE" ); + + failed |= generic_bus_attach_sig( part, &(nOE), "nOE" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/sh7727.c b/jtag/src/bus/sh7727.c index 63f05432..643389c3 100644 --- a/jtag/src/bus/sh7727.c +++ b/jtag/src/bus/sh7727.c @@ -69,6 +69,7 @@ static bus_t * sh7727_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -88,67 +89,38 @@ sh7727_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(CS[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(WE[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(RDWR), "RDWR" ); + + failed |= generic_bus_attach_sig( part, &(RD), "RD" ); + + failed |= generic_bus_attach_sig( part, &(MD3), "MD3" ); + + failed |= generic_bus_attach_sig( part, &(MD4), "MD4" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/sh7750r.c b/jtag/src/bus/sh7750r.c index 177f54a3..3657af24 100644 --- a/jtag/src/bus/sh7750r.c +++ b/jtag/src/bus/sh7750r.c @@ -69,6 +69,7 @@ static bus_t * sh7750r_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -88,65 +89,36 @@ sh7750r_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(CS[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(WE[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(RDWR), "RDWR" ); + + failed |= generic_bus_attach_sig( part, &(RD), "RD" ); + + failed |= generic_bus_attach_sig( part, &(RDWR2), "RDWR2" ); + + failed |= generic_bus_attach_sig( part, &(RD2), "RD2" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/sh7751r.c b/jtag/src/bus/sh7751r.c index 22bb3515..03d0b4c9 100644 --- a/jtag/src/bus/sh7751r.c +++ b/jtag/src/bus/sh7751r.c @@ -67,6 +67,7 @@ static bus_t * sh7751r_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[10]; int i; int failed = 0; @@ -86,55 +87,32 @@ sh7751r_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(A[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(D[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(CS[i]), buff ); } + 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; + failed |= generic_bus_attach_sig( part, &(WE[i]), buff ); } + failed |= generic_bus_attach_sig( part, &(RDWR), "RD_WR" ); + + failed |= generic_bus_attach_sig( part, &(RD), "RD_CASS_FRAME" ); + if (failed) { free( bus->params ); free( bus ); diff --git a/jtag/src/bus/sharc21065l.c b/jtag/src/bus/sharc21065l.c index d138188c..618f76cc 100644 --- a/jtag/src/bus/sharc21065l.c +++ b/jtag/src/bus/sharc21065l.c @@ -71,6 +71,7 @@ typedef struct static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -90,43 +91,23 @@ static bus_t *sharc_21065L_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = 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; - } + failed |= generic_bus_attach_sig( part, &(MA[i]), buff ); } + 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; - } + failed |= generic_bus_attach_sig( part, &(MD[i]), buff ); } - 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; - } + failed |= generic_bus_attach_sig( part, &(BMS), "BMS_B" ); + + failed |= generic_bus_attach_sig( part, &(nWE), "WR_B" ); + failed |= generic_bus_attach_sig( part, &(nOE), "RD_B" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/slsup3.c b/jtag/src/bus/slsup3.c index 1e258ad7..8da456d1 100644 --- a/jtag/src/bus/slsup3.c +++ b/jtag/src/bus/slsup3.c @@ -96,10 +96,10 @@ static bus_t * slsup3_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; 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; @@ -120,89 +120,35 @@ slsup3_bus_new( chain_t *chain, char *cmd_params[] ) 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; - } + failed |= generic_bus_attach_sig( part, &(AD[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(DQ[i]), buff ); } - nOE = part_find_signal( part, "IO118" ); - if (!nOE) { - printf( _("signal '%s' not found\n"), "nOE" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nOE), "IO118" ); - nSRce = part_find_signal( part, "IO116" ); - if (!nSRce) { - printf( _("signal '%s' not found\n"), "nSRce" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nSRce), "IO116" ); - nSDce = part_find_signal( part, "IO119" ); - if (!nSDce) { - printf( _("signal '%s' not found\n"), "nSDce" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nSDce), "IO119" ); - nFLce = part_find_signal( part, "IO117" ); - if (!nFLce) { - printf( _("signal '%s' not found\n"), "nFLce" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nFLce), "IO117" ); - nFLbyte = part_find_signal( part, "IO115" ); - if (!nFLbyte) { - printf( _("signal '%s' not found\n"), "nFLbyte" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nFLbyte), "IO115" ); - nFLby = part_find_signal( part, "IO80" ); - if (!nFLby) { - printf( _("signal '%s' not found\n"), "nFLby" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nFLby), "IO80" ); - nWE = part_find_signal( part, "IO79" ); - if (!nWE) { - printf( _("signal '%s' not found\n"), "nWE" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(nWE), "IO79" ); - SDclk = part_find_signal( part, "IO11" ); - if (!SDclk) { - printf( _("signal '%s' not found\n"), "SDclk" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SDclk), "IO11" ); - LCDe = part_find_signal( part, "IO50" ); - if (!LCDe) { - printf( _("signal '%s' not found\n"), "LCDe" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(LCDe), "IO50" ); - LCDrs = part_find_signal( part, "IO108" ); - if (!LCDrs) { - printf( _("signal '%s' not found\n"), "LCDrs" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(LCDrs), "IO108" ); - LCDrw = part_find_signal( part, "IO73" ); - if (!LCDrw) { - printf( _("signal '%s' not found\n"), "LCDrw" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(LCDrw), "IO73" ); if (failed) { free( bus->params ); diff --git a/jtag/src/bus/tx4925.c b/jtag/src/bus/tx4925.c index fabe359d..ce61d9de 100644 --- a/jtag/src/bus/tx4925.c +++ b/jtag/src/bus/tx4925.c @@ -77,6 +77,7 @@ static bus_t * tx4925_bus_new( chain_t *chain, char *cmd_params[] ) { bus_t *bus; + part_t *part; char buff[15]; int i; int failed = 0; @@ -96,58 +97,30 @@ tx4925_bus_new( chain_t *chain, char *cmd_params[] ) } CHAIN = chain; - PART = chain->parts->parts[chain->active_part]; + PART = part = chain->parts->parts[chain->active_part]; - OE = part_find_signal( PART, "OE" ); - if (!OE) { - printf( _("signal '%s' not found\n"), "OE" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(OE), "OE" ); - SWE = part_find_signal( PART, "SWE" ); - if (!SWE) { - printf( _("signal '%s' not found\n"), "SWE" ); - failed = 1; - } + failed |= generic_bus_attach_sig( part, &(SWE), "SWE" ); 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; - } + failed |= generic_bus_attach_sig( part, &(ROMCE[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(SDCS[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(ADDR[i]), buff ); } 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; - } + failed |= generic_bus_attach_sig( part, &(DATA[i]), buff ); } if (failed) {