From a76a13a6325e3fb0ece0929bebb440284ee66895 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Fri, 26 Sep 2008 22:14:08 +0000 Subject: [PATCH] [ 2102453 ] Use macros for std return values instead of literals started with the bus driver stack git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1366 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 28 +++++++++++++++++++++++----- jtag/include/jtag.h | 5 +++++ jtag/src/bus/au1500.c | 2 +- jtag/src/bus/avr32.c | 2 +- jtag/src/bus/bcm1250.c | 4 ++-- jtag/src/bus/bf533_ezkit.c | 2 +- jtag/src/bus/bf533_stamp.c | 2 +- jtag/src/bus/bf537_stamp.c | 2 +- jtag/src/bus/bf548_ezkit.c | 2 +- jtag/src/bus/bf561_ezkit.c | 2 +- jtag/src/bus/ejtag.c | 2 +- jtag/src/bus/fjmem.c | 2 +- jtag/src/bus/generic_bus.c | 8 +++++--- jtag/src/bus/h7202.c | 2 +- jtag/src/bus/ixp425.c | 2 +- jtag/src/bus/jopcyc.c | 4 ++-- jtag/src/bus/lh7a400.c | 4 ++-- jtag/src/bus/mpc5200.c | 4 ++-- jtag/src/bus/mpc824x.c | 10 +++++----- jtag/src/bus/ppc405ep.c | 2 +- jtag/src/bus/ppc440gx_ebc8.c | 2 +- jtag/src/bus/prototype.c | 2 +- jtag/src/bus/pxa2x0.c | 34 +++++++++++++++++----------------- jtag/src/bus/readmem.c | 2 +- jtag/src/bus/s3c4510x.c | 10 +++++----- jtag/src/bus/sa1110.c | 2 +- jtag/src/bus/sh7727.c | 8 ++++---- jtag/src/bus/sh7750r.c | 2 +- jtag/src/bus/sh7751r.c | 2 +- jtag/src/bus/sharc21065l.c | 4 ++-- jtag/src/bus/slsup3.c | 8 ++++---- jtag/src/bus/tx4925.c | 2 +- jtag/src/bus/writemem.c | 2 +- jtag/src/bus/zefant-xs3.c | 4 ++-- jtag/src/cmd/detect.c | 2 +- jtag/src/cmd/initbus.c | 2 +- jtag/src/cmd/print.c | 2 +- jtag/src/flash/amd_flash.c | 3 ++- jtag/src/flash/cfi.c | 3 ++- jtag/src/flash/intel.c | 7 ++++--- jtag/src/flash/jedec.c | 3 ++- jtag/src/flash/jedec_exp.c | 3 ++- 42 files changed, 115 insertions(+), 85 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 1740be48..50d70004 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,13 +1,31 @@ +2008-09-27 Arnim Laeuger + + * include/jtag.h, src/cmd/detect.c, src/cmd/initbus.c, + src/cmd/print.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/readmem.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/writemem.c, src/bus/s3c4510x.c, src/bus/ejtag.c, + src/flash/amd_flash.c, src/flash/cfi.c, src/flash/jedec_exp.c, + src/flash/jedec.c, src/flash/intel.c: + [ 2102453 ] Use macros for std return values instead of literals + 2008-09-16 Mike Frysinger - * data/analog/bf527/STEPPINGS: Add bf527 0.2. - * data/analog/bf533/STEPPINGS: Add bf533 0.5 and 0.6. - * data/analog/bf548/STEPPINGS: Add bf548 0.2. + * data/analog/bf527/STEPPINGS: Add bf527 0.2. + * data/analog/bf533/STEPPINGS: Add bf533 0.5 and 0.6. + * data/analog/bf548/STEPPINGS: Add bf548 0.2. 2008-09-15 Arnim Laeuger - * src/svf/svf.h, src/svf/svf_flex.l: SVF player fix for - [ 2112823 ] Conversion with strtod and similar influenced by locale + * src/svf/svf.h, src/svf/svf_flex.l: SVF player fix for + [ 2112823 ] Conversion with strtod and similar influenced by locale 2008-09-14 Kolja Waschk diff --git a/jtag/include/jtag.h b/jtag/include/jtag.h index 23ac5226..52b452d8 100644 --- a/jtag/include/jtag.h +++ b/jtag/include/jtag.h @@ -34,6 +34,11 @@ #include "bus.h" #include "part.h" +#define URJTAG_STATUS_OK 0 +#define URJTAG_STATUS_FAIL 1 +#define URJTAG_STATUS_SYNTAX_ERROR -1 + + extern bus_t *bus; extern int big_endian; extern int debug_mode; diff --git a/jtag/src/bus/au1500.c b/jtag/src/bus/au1500.c index ccf6bb73..6167f501 100644 --- a/jtag/src/bus/au1500.c +++ b/jtag/src/bus/au1500.c @@ -140,7 +140,7 @@ au1500_bus_area(bus_t *bus, uint32_t addr, bus_area_t *area) area->width = part_get_signal( PART, part_find_signal( PART, "ROMSIZ" ) ) ? 16 : 32; - return 0; + return URJTAG_STATUS_OK; } diff --git a/jtag/src/bus/avr32.c b/jtag/src/bus/avr32.c index 0f5e4972..58a7375b 100644 --- a/jtag/src/bus/avr32.c +++ b/jtag/src/bus/avr32.c @@ -636,7 +636,7 @@ avr32_bus_area (bus_t * bus, uint32_t addr, bus_area_t * area) break; } - return 0; + return URJTAG_STATUS_OK; } /** diff --git a/jtag/src/bus/bcm1250.c b/jtag/src/bus/bcm1250.c index 625e85a9..d2d3a025 100644 --- a/jtag/src/bus/bcm1250.c +++ b/jtag/src/bus/bcm1250.c @@ -132,7 +132,7 @@ bcm1250_bus_area( bus_t *bus, uint32_t addr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 8; - return 0; + return URJTAG_STATUS_OK; } #ifndef USE_BCM_EJTAG @@ -422,7 +422,7 @@ bcm1250_ejtag_do(bus_t *bus, uint64_t ad, uint64_t da, int read, int type, printf("\n"); } } - return 0; + return URJTAG_STATUS_OK; } /** diff --git a/jtag/src/bus/bf533_ezkit.c b/jtag/src/bus/bf533_ezkit.c index d7188ef8..db8d48c6 100644 --- a/jtag/src/bus/bf533_ezkit.c +++ b/jtag/src/bus/bf533_ezkit.c @@ -155,7 +155,7 @@ bf533_ezkit_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/bf533_stamp.c b/jtag/src/bus/bf533_stamp.c index e9ca9a6e..cf5b24fe 100644 --- a/jtag/src/bus/bf533_stamp.c +++ b/jtag/src/bus/bf533_stamp.c @@ -156,7 +156,7 @@ bf533_stamp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/bf537_stamp.c b/jtag/src/bus/bf537_stamp.c index b54768cc..0bed5ece 100644 --- a/jtag/src/bus/bf537_stamp.c +++ b/jtag/src/bus/bf537_stamp.c @@ -140,7 +140,7 @@ bf537_stamp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/bf548_ezkit.c b/jtag/src/bus/bf548_ezkit.c index 91228207..de137675 100644 --- a/jtag/src/bus/bf548_ezkit.c +++ b/jtag/src/bus/bf548_ezkit.c @@ -154,7 +154,7 @@ bf548_ezkit_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/bf561_ezkit.c b/jtag/src/bus/bf561_ezkit.c index 03c3d013..e952d0e4 100644 --- a/jtag/src/bus/bf561_ezkit.c +++ b/jtag/src/bus/bf561_ezkit.c @@ -158,7 +158,7 @@ bf561_ezkit_bus_area( bus_t *bus, uint32_t addr, bus_area_t *area ) area->start = UINT32_C(0x00000000); area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/ejtag.c b/jtag/src/bus/ejtag.c index 273cd48c..37096c86 100644 --- a/jtag/src/bus/ejtag.c +++ b/jtag/src/bus/ejtag.c @@ -354,7 +354,7 @@ ejtag_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0xa0000000); area->width = 0; } - return 0; + return URJTAG_STATUS_OK; } static int diff --git a/jtag/src/bus/fjmem.c b/jtag/src/bus/fjmem.c index 763e7e6f..176bc95c 100644 --- a/jtag/src/bus/fjmem.c +++ b/jtag/src/bus/fjmem.c @@ -522,7 +522,7 @@ block_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, block_param_t **bl_m bl = bl->next; } - return 0; + return URJTAG_STATUS_OK; } /** diff --git a/jtag/src/bus/generic_bus.c b/jtag/src/bus/generic_bus.c index 5a816385..20fb41a3 100644 --- a/jtag/src/bus/generic_bus.c +++ b/jtag/src/bus/generic_bus.c @@ -26,17 +26,19 @@ #include +#include + #include "generic_bus.h" int generic_bus_attach_sig( part_t *part, signal_t **sig, char *id ) { - int failed = 0; + int failed = URJTAG_STATUS_OK; *sig = part_find_signal( part, id ); if (!*sig) { printf( _("signal '%s' not found\n"), id ); - failed = 1; + failed = URJTAG_STATUS_FAIL; } return failed; @@ -62,7 +64,7 @@ generic_bus_no_init( bus_t *bus ) { INITIALIZED = 1; - return 0; + return URJTAG_STATUS_OK; } /** diff --git a/jtag/src/bus/h7202.c b/jtag/src/bus/h7202.c index ce0b309b..f4dfa3e4 100644 --- a/jtag/src/bus/h7202.c +++ b/jtag/src/bus/h7202.c @@ -136,7 +136,7 @@ h7202_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; //part_get_signal( PART, part_find_signal( PART, "ROM_SEL" ) ) ? 32 : 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/ixp425.c b/jtag/src/bus/ixp425.c index 551ddb92..d083c0e6 100644 --- a/jtag/src/bus/ixp425.c +++ b/jtag/src/bus/ixp425.c @@ -133,7 +133,7 @@ ixp425_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/jopcyc.c b/jtag/src/bus/jopcyc.c index c15eca67..80d9f21c 100644 --- a/jtag/src/bus/jopcyc.c +++ b/jtag/src/bus/jopcyc.c @@ -476,7 +476,7 @@ jopcyc_bus_init( bus_t *bus ) INITIALIZED = 1; - return 0; + return URJTAG_STATUS_OK; } static int @@ -508,7 +508,7 @@ comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp ) *comp = NULL; } - return 0; + return URJTAG_STATUS_OK; } /** diff --git a/jtag/src/bus/lh7a400.c b/jtag/src/bus/lh7a400.c index 93b70b65..26c94624 100644 --- a/jtag/src/bus/lh7a400.c +++ b/jtag/src/bus/lh7a400.c @@ -160,7 +160,7 @@ lh7a400_bus_area ( bus_t *bus, uint32_t adr, bus_area_t *area ) width |= part_get_signal( PART, part_find_signal( PART, "WIDTH1" ) ) << 1; if (width < 0) - return -1; + return URJTAG_STATUS_FAIL; switch (width) { case 0: @@ -174,7 +174,7 @@ lh7a400_bus_area ( bus_t *bus, uint32_t adr, bus_area_t *area ) area->width = 32; } - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/mpc5200.c b/jtag/src/bus/mpc5200.c index d35df19a..e79af9f0 100644 --- a/jtag/src/bus/mpc5200.c +++ b/jtag/src/bus/mpc5200.c @@ -140,14 +140,14 @@ mpc5200_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->start = UINT32_C(0x00000000); area->length = UINT64_C(0x01000000); area->width = 8; - return 0; + return URJTAG_STATUS_OK; } area->description = NULL; area->start = 0x01000000; area->length = 0xFF000000; area->width = 0; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/mpc824x.c b/jtag/src/bus/mpc824x.c index c356b10b..29bd9f1c 100644 --- a/jtag/src/bus/mpc824x.c +++ b/jtag/src/bus/mpc824x.c @@ -249,7 +249,7 @@ mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0xFF000000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } if (adr < UINT32_C(0xFF800000)) { @@ -258,7 +258,7 @@ mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x00800000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } if (boot_SDMA1 == 0) { @@ -267,7 +267,7 @@ mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x00800000); area->width = BUS_WIDTH; - return 0; + return URJTAG_STATUS_OK; } /* extended addresing mode is disabled (SDMA1 is 1) */ @@ -277,7 +277,7 @@ mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x00400000); area->width = BUS_WIDTH; - return 0; + return URJTAG_STATUS_OK; } area->description = N_("Base ROM Interface (Bank 0)"); @@ -285,7 +285,7 @@ mpc824x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x00400000); area->width = BUS_WIDTH; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/ppc405ep.c b/jtag/src/bus/ppc405ep.c index 645f8770..484d340b 100644 --- a/jtag/src/bus/ppc405ep.c +++ b/jtag/src/bus/ppc405ep.c @@ -128,7 +128,7 @@ ppc405ep_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/ppc440gx_ebc8.c b/jtag/src/bus/ppc440gx_ebc8.c index 4ef2d93a..6aa21946 100644 --- a/jtag/src/bus/ppc440gx_ebc8.c +++ b/jtag/src/bus/ppc440gx_ebc8.c @@ -130,7 +130,7 @@ ppc440gx_ebc8_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); /* ??????????? */ area->width = PPC440GX_DATA_LINES; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/prototype.c b/jtag/src/bus/prototype.c index 334bd92c..66e70b96 100644 --- a/jtag/src/bus/prototype.c +++ b/jtag/src/bus/prototype.c @@ -295,7 +295,7 @@ prototype_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = DW; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/pxa2x0.c b/jtag/src/bus/pxa2x0.c index 9cb1561b..4843d93a 100644 --- a/jtag/src/bus/pxa2x0.c +++ b/jtag/src/bus/pxa2x0.c @@ -275,7 +275,7 @@ pxa2xx_bus_init( bus_t *bus ) INITIALIZED = 1; - return 0; + return URJTAG_STATUS_OK; } /** @@ -317,13 +317,13 @@ pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) case 6: case 7: printf( "TODO - BOOT_SEL: %d\n", get_BOOT_DEF_BOOT_SEL(BOOT_DEF) ); - return -1; + return URJTAG_STATUS_FAIL; default: printf( "BUG in the code, file %s, line %d.\n", __FILE__, __LINE__ ); - return -1; + return URJTAG_STATUS_FAIL; } } - return 0; + return URJTAG_STATUS_OK; } /* Static Chip Select 1..5 (per 64 MB) */ @@ -338,7 +338,7 @@ pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x04000000); area->width = pxa25x_ncs_map[ncs_index].bus_width; - return 0; + return URJTAG_STATUS_OK; } } @@ -348,7 +348,7 @@ pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x30000000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } if (adr < UINT32_C(0x4C000000)) { @@ -357,7 +357,7 @@ pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x04000000); area->width = 32; - return 0; + return URJTAG_STATUS_OK; } area->description = NULL; @@ -365,7 +365,7 @@ pxa2xx_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0xB4000000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } /** @@ -407,13 +407,13 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) case 6: case 7: printf( "TODO - BOOT_SEL: %d\n", get_BOOT_DEF_BOOT_SEL(BOOT_DEF) ); - return -1; + return URJTAG_STATUS_FAIL; default: printf( "BUG in the code, file %s, line %d.\n", __FILE__, __LINE__ ); - return -1; + return URJTAG_STATUS_FAIL; } } - return 0; + return URJTAG_STATUS_OK; } /* Static Chip Select 1..5 (per 64 MB) */ @@ -430,7 +430,7 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x04000000); area->width = pxa27x_ncs_map[ncs_index].bus_width; - return 0; + return URJTAG_STATUS_OK; } //else printf( "no match\n"); } @@ -441,7 +441,7 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x28000000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } if (adr < UINT32_C(0x60000000)) { @@ -450,7 +450,7 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x20000000); area->width = 32; - return 0; + return URJTAG_STATUS_OK; } if (adr < UINT32_C(0xA0000000)) { @@ -459,7 +459,7 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x40000000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } if (adr < UINT32_C(0xB0000000)) { @@ -468,7 +468,7 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x10000000); area->width = 32; - return 0; + return URJTAG_STATUS_OK; } area->description = NULL; @@ -476,7 +476,7 @@ pxa27x_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x50000000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/readmem.c b/jtag/src/bus/readmem.c index f6d8480b..876a2c60 100644 --- a/jtag/src/bus/readmem.c +++ b/jtag/src/bus/readmem.c @@ -58,7 +58,7 @@ readmem( bus_t *bus, FILE *f, uint32_t addr, uint32_t len ) bus_prepare( bus ); - if (bus_area( bus, addr, &area ) != 0) { + if (bus_area( bus, addr, &area ) != URJTAG_STATUS_OK) { printf( _("Error: Bus width detection failed\n") ); return; } diff --git a/jtag/src/bus/s3c4510x.c b/jtag/src/bus/s3c4510x.c index 9c0ce9c9..8a7c55e2 100644 --- a/jtag/src/bus/s3c4510x.c +++ b/jtag/src/bus/s3c4510x.c @@ -197,7 +197,7 @@ s3c4510_bus_init( bus_t *bus ) INITIALIZED = 1; - return 0; + return URJTAG_STATUS_OK; } /** @@ -220,17 +220,17 @@ s3c4510_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) switch ((b0size1 << 1) | b0size0) { case 1: area->width = dbus_width = 8; - return 0; + return URJTAG_STATUS_OK; case 2: area->width = dbus_width = 16; - return 0; + return URJTAG_STATUS_OK; case 3: area->width = dbus_width = 32; - return 0; + return URJTAG_STATUS_OK; default: printf( "B0SIZE[1:0]: Unknown\n" ); area->width = 0; - return -1; + return URJTAG_STATUS_FAIL; } } diff --git a/jtag/src/bus/sa1110.c b/jtag/src/bus/sa1110.c index 4e2318d6..d10fa8b2 100644 --- a/jtag/src/bus/sa1110.c +++ b/jtag/src/bus/sa1110.c @@ -140,7 +140,7 @@ sa1110_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = part_get_signal( PART, part_find_signal( PART, "ROM_SEL" ) ) ? 32 : 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/sh7727.c b/jtag/src/bus/sh7727.c index 8de79bd1..bcf1534a 100644 --- a/jtag/src/bus/sh7727.c +++ b/jtag/src/bus/sh7727.c @@ -154,17 +154,17 @@ sh7727_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) switch (part_get_signal( p, MD4 ) << 1 | part_get_signal( p, MD3 )) { case 1: area->width = 8; - return 0; + return URJTAG_STATUS_OK; case 2: area->width = 16; - return 0; + return URJTAG_STATUS_OK; case 3: area->width = 32; - return 0; + return URJTAG_STATUS_OK; default: printf( _("Error: Invalid bus width (MD3 = MD4 = 0)!\n") ); area->width = 0; - return -1; + return URJTAG_STATUS_FAIL; } } diff --git a/jtag/src/bus/sh7750r.c b/jtag/src/bus/sh7750r.c index e4f7e4a5..a70be795 100644 --- a/jtag/src/bus/sh7750r.c +++ b/jtag/src/bus/sh7750r.c @@ -148,7 +148,7 @@ sh7750r_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 32; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/sh7751r.c b/jtag/src/bus/sh7751r.c index ba4defb8..f216b5ea 100644 --- a/jtag/src/bus/sh7751r.c +++ b/jtag/src/bus/sh7751r.c @@ -142,7 +142,7 @@ sh7751r_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/sharc21065l.c b/jtag/src/bus/sharc21065l.c index 288c4e51..b6e0d47b 100644 --- a/jtag/src/bus/sharc21065l.c +++ b/jtag/src/bus/sharc21065l.c @@ -137,14 +137,14 @@ sharc_21065L_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x080000); area->width = 8; - return 0; + return URJTAG_STATUS_OK; } area->description = NULL; area->start = UINT32_C(0xffffffff); area->length = UINT64_C(0x080000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/slsup3.c b/jtag/src/bus/slsup3.c index 012c0af6..697f467f 100644 --- a/jtag/src/bus/slsup3.c +++ b/jtag/src/bus/slsup3.c @@ -180,7 +180,7 @@ slsup3_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = FLASHSIZE; area->width = 8; /* 16 */ - return 0; + return URJTAG_STATUS_OK; } if ((adr >= SRAMSTART) && (adr < (SRAMSTART + SRAMSIZE))) { @@ -189,7 +189,7 @@ slsup3_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = SRAMSIZE; area->width = 16; - return 0; + return URJTAG_STATUS_OK; } if ((adr >= LCDSTART) && (adr < (LCDSTART + LCDSIZE))) { @@ -198,7 +198,7 @@ slsup3_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = LCDSIZE; area->width = 8; - return 0; + return URJTAG_STATUS_OK; } area->description = NULL; @@ -206,7 +206,7 @@ slsup3_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0xFFC00000); area->width = 0; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/tx4925.c b/jtag/src/bus/tx4925.c index 6ef0b70f..2bacadb2 100644 --- a/jtag/src/bus/tx4925.c +++ b/jtag/src/bus/tx4925.c @@ -152,7 +152,7 @@ tx4925_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area ) area->length = UINT64_C(0x100000000); area->width = 16; - return 0; + return URJTAG_STATUS_OK; } static void diff --git a/jtag/src/bus/writemem.c b/jtag/src/bus/writemem.c index 1259b560..35f724da 100644 --- a/jtag/src/bus/writemem.c +++ b/jtag/src/bus/writemem.c @@ -52,7 +52,7 @@ writemem( bus_t *bus, FILE *f, uint32_t addr, uint32_t len ) bus_prepare( bus ); - if (bus_area( bus, addr, &area ) != 0) { + if (bus_area( bus, addr, &area ) != URJTAG_STATUS_OK) { printf( _("Error: Bus width detection failed\n") ); return; } diff --git a/jtag/src/bus/zefant-xs3.c b/jtag/src/bus/zefant-xs3.c index dc381cd5..190538ad 100644 --- a/jtag/src/bus/zefant-xs3.c +++ b/jtag/src/bus/zefant-xs3.c @@ -607,7 +607,7 @@ zefant_xs3_bus_init( bus_t *bus ) INITIALIZED = 1; - return 0; + return URJTAG_STATUS_OK; } static int @@ -651,7 +651,7 @@ comp_bus_area( bus_t *bus, uint32_t adr, bus_area_t *area, component_t **comp ) *comp = NULL; } - return 0; + return URJTAG_STATUS_OK; } /** diff --git a/jtag/src/cmd/detect.c b/jtag/src/cmd/detect.c index ca972b33..40494933 100644 --- a/jtag/src/cmd/detect.c +++ b/jtag/src/cmd/detect.c @@ -68,7 +68,7 @@ cmd_detect_run( chain_t *chain, char *params[] ) abus = buses.buses[i]; if(abus->driver->init) { - if(abus->driver->init(abus)) + if(abus->driver->init(abus) != URJTAG_STATUS_OK) return -1; } } diff --git a/jtag/src/cmd/initbus.c b/jtag/src/cmd/initbus.c index ef12227f..ad1cc139 100644 --- a/jtag/src/cmd/initbus.c +++ b/jtag/src/cmd/initbus.c @@ -60,7 +60,7 @@ cmd_initbus_run( chain_t *chain, char *params[] ) return 1; } buses_add( bus ); - if (bus_init( bus )) + if (bus_init( bus ) != URJTAG_STATUS_OK) printf( _("bus initialization failed!\n") ); return 1; } diff --git a/jtag/src/cmd/print.c b/jtag/src/cmd/print.c index ea1882f7..3c46323b 100644 --- a/jtag/src/cmd/print.c +++ b/jtag/src/cmd/print.c @@ -134,7 +134,7 @@ cmd_print_run( chain_t *chain, char *params[] ) bus_printinfo( bus ); for (a = 0; a < UINT64_C(0x100000000); a = area.start + area.length) { - if (bus_area( bus, a, &area ) != 0) { + if (bus_area( bus, a, &area ) != URJTAG_STATUS_OK) { printf( _("Error in bus area discovery at 0x%08llX\n"), (long long unsigned int)a ); break; } diff --git a/jtag/src/flash/amd_flash.c b/jtag/src/flash/amd_flash.c index c5599418..44083784 100644 --- a/jtag/src/flash/amd_flash.c +++ b/jtag/src/flash/amd_flash.c @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -123,7 +124,7 @@ int amd_detect(bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ) (*cfi_array)->bus = bus; (*cfi_array)->address = 0; - if (bus_area( bus, adr+0, &area ) != 0) + if (bus_area( bus, adr+0, &area ) != URJTAG_STATUS_OK) return -8; /* bus width detection failed */ unsigned int bw = area.width; int ba,i; diff --git a/jtag/src/flash/cfi.c b/jtag/src/flash/cfi.c index ec7ab190..3345330a 100644 --- a/jtag/src/flash/cfi.c +++ b/jtag/src/flash/cfi.c @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -79,7 +80,7 @@ cfi_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ) (*cfi_array)->bus = bus; (*cfi_array)->address = adr; - if (bus_area( bus, adr, &area ) != 0) + if (bus_area( bus, adr, &area ) != URJTAG_STATUS_OK) return -8; /* bus width detection failed */ bw = area.width; if (bw != 8 && bw != 16 && bw != 32) diff --git a/jtag/src/flash/intel.c b/jtag/src/flash/intel.c index 3e1bbb38..b21df7ed 100644 --- a/jtag/src/flash/intel.c +++ b/jtag/src/flash/intel.c @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -58,7 +59,7 @@ intel_flash_autodetect32( cfi_array_t *cfi_array ) { bus_area_t area; - if (bus_area( cfi_array->bus, cfi_array->address, &area ) != 0) + if (bus_area( cfi_array->bus, cfi_array->address, &area ) != URJTAG_STATUS_OK) return 0; return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_MITSUBISHI_SCS) @@ -73,7 +74,7 @@ intel_flash_autodetect( cfi_array_t *cfi_array ) { bus_area_t area; - if (bus_area( cfi_array->bus, cfi_array->address, &area ) != 0) + if (bus_area( cfi_array->bus, cfi_array->address, &area ) != URJTAG_STATUS_OK) return 0; return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_MITSUBISHI_SCS) @@ -88,7 +89,7 @@ intel_flash_autodetect8( cfi_array_t *cfi_array ) { bus_area_t area; - if (bus_area( cfi_array->bus, cfi_array->address, &area ) != 0) + if (bus_area( cfi_array->bus, cfi_array->address, &area ) != URJTAG_STATUS_OK) return 0; return ((cfi_array->cfi_chips[0]->cfi.identification_string.pri_id_code == CFI_VENDOR_MITSUBISHI_SCS) diff --git a/jtag/src/flash/jedec.c b/jtag/src/flash/jedec.c index 1be49197..3c687c52 100644 --- a/jtag/src/flash/jedec.c +++ b/jtag/src/flash/jedec.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -383,7 +384,7 @@ jedec_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ) (*cfi_array)->bus = bus; (*cfi_array)->address = adr; - if (bus_area( bus, adr, &area ) != 0) + if (bus_area( bus, adr, &area ) != URJTAG_STATUS_OK) return -8; /* bus width detection failed */ bw = area.width; if (bw != 8 && bw != 16 && bw != 32) diff --git a/jtag/src/flash/jedec_exp.c b/jtag/src/flash/jedec_exp.c index 622bef09..b0ce01bf 100644 --- a/jtag/src/flash/jedec_exp.c +++ b/jtag/src/flash/jedec_exp.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -45,7 +46,7 @@ jedec_exp_detect( bus_t *bus, uint32_t adr, cfi_array_t **cfi_array ) (*cfi_array)->bus = bus; (*cfi_array)->address = adr; - if (bus_area( bus, adr, &area ) != 0) + if (bus_area( bus, adr, &area ) != URJTAG_STATUS_OK) return -8; /* bus width detection failed */ bw = area.width;