From 7384c11cab90c8ba98ba684d5e8787867bc4f3d0 Mon Sep 17 00:00:00 2001 From: Rutger Hofman Date: Mon, 18 May 2009 11:18:33 +0000 Subject: [PATCH] Make it compile for my eCos BlackFin checkout. - numerous casts because "%zd" ever requires a size_t, even for a manifest constant; and because a uint32_t should be cast to a long unsigned to be printed with "%lu" (long unsigned is at least 32-bit) - move include/urjtag/urjtag.h to include/urjtag/urjtag.h.in and only export .h files for modules actually configured: USB, SVF, BSDL are only conditionally exported git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1601 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 10 +++ urjtag/configure.ac | 14 ++++ urjtag/include/urjtag/cmd.h | 2 +- .../include/urjtag/{urjtag.h => urjtag.h.in} | 11 ++- urjtag/src/bsdl/Makefile.am | 3 +- urjtag/src/bus/au1500.c | 4 +- urjtag/src/bus/avr32.c | 36 ++++++---- urjtag/src/bus/bcm1250.c | 4 +- urjtag/src/bus/bf533_ezkit.c | 4 +- urjtag/src/bus/bf533_stamp.c | 4 +- urjtag/src/bus/bf537_stamp.c | 4 +- urjtag/src/bus/bf548_ezkit.c | 4 +- urjtag/src/bus/bf561_ezkit.c | 4 +- urjtag/src/bus/bscoach.c | 4 +- urjtag/src/bus/buses.c | 2 +- urjtag/src/bus/ejtag.c | 67 ++++++++--------- urjtag/src/bus/ejtag_dma.c | 16 ++--- urjtag/src/bus/fjmem.c | 8 +-- urjtag/src/bus/h7202.c | 4 +- urjtag/src/bus/ixp425.c | 4 +- urjtag/src/bus/ixp435.c | 4 +- urjtag/src/bus/jopcyc.c | 4 +- urjtag/src/bus/lh7a400.c | 6 +- urjtag/src/bus/mpc5200.c | 6 +- urjtag/src/bus/mpc824x.c | 22 +++--- urjtag/src/bus/ppc405ep.c | 4 +- urjtag/src/bus/ppc440gx_ebc8.c | 4 +- urjtag/src/bus/prototype.c | 4 +- urjtag/src/bus/pxa2x0.c | 8 +-- urjtag/src/bus/readmem.c | 9 ++- urjtag/src/bus/s3c4510x.c | 4 +- urjtag/src/bus/sa1110.c | 4 +- urjtag/src/bus/sh7727.c | 4 +- urjtag/src/bus/sh7750r.c | 4 +- urjtag/src/bus/sh7751r.c | 4 +- urjtag/src/bus/sharc21065l.c | 4 +- urjtag/src/bus/slsup3.c | 4 +- urjtag/src/bus/tx4925.c | 4 +- urjtag/src/bus/writemem.c | 11 +-- urjtag/src/bus/zefant-xs3.c | 4 +- urjtag/src/cmd/cmd_addpart.c | 2 +- urjtag/src/cmd/cmd_bit.c | 4 +- urjtag/src/cmd/cmd_bus.c | 2 +- urjtag/src/cmd/cmd_cable.c | 2 +- urjtag/src/cmd/cmd_cmd.c | 6 +- urjtag/src/cmd/cmd_debug.c | 2 +- urjtag/src/cmd/cmd_detectflash.c | 2 +- urjtag/src/cmd/cmd_dr.c | 2 +- urjtag/src/cmd/cmd_eraseflash.c | 4 +- urjtag/src/cmd/cmd_flashmem.c | 2 +- urjtag/src/cmd/cmd_frequency.c | 9 +-- urjtag/src/cmd/cmd_idcode.c | 4 +- urjtag/src/cmd/cmd_include.c | 2 +- urjtag/src/cmd/cmd_instruction.c | 2 +- urjtag/src/cmd/cmd_part.c | 4 +- urjtag/src/cmd/cmd_peekpoke.c | 14 ++-- urjtag/src/cmd/cmd_print.c | 8 +-- urjtag/src/cmd/cmd_readmem.c | 4 +- urjtag/src/cmd/cmd_register.c | 2 +- urjtag/src/cmd/cmd_set.c | 2 +- urjtag/src/cmd/cmd_test.c | 2 +- urjtag/src/cmd/cmd_usleep.c | 9 ++- urjtag/src/cmd/cmd_writemem.c | 4 +- urjtag/src/flash/amd.c | 71 ++++++++++++------- urjtag/src/flash/amd_flash.c | 43 +++++++---- urjtag/src/flash/cfi.c | 7 +- urjtag/src/flash/detectflash.c | 30 ++++---- urjtag/src/flash/flash.c | 42 ++++++----- urjtag/src/flash/intel.c | 14 ++-- urjtag/src/flash/jedec.c | 6 +- urjtag/src/lib/Makefile.am | 1 + urjtag/src/svf/Makefile.am | 3 +- urjtag/src/svf/svf.c | 10 ++- urjtag/src/svf/svf_flex.l | 2 +- urjtag/src/tap/cable.c | 6 +- urjtag/src/tap/cable/cmd_xfer.c | 2 +- urjtag/src/tap/cable/generic.c | 9 +-- urjtag/src/tap/detect.c | 2 +- urjtag/src/tap/usbconn.c | 2 +- urjtag/sysdep.h | 4 ++ 80 files changed, 394 insertions(+), 281 deletions(-) rename urjtag/include/urjtag/{urjtag.h => urjtag.h.in} (92%) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 541a7f04..7c4a8bdd 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,3 +1,13 @@ +2009-05-18 Rutger Hofman + + Make it compile for my eCos BlackFin checkout. + - numerous casts because "%zd" ever requires a size_t, even for a manifest + constant; and because a uint32_t should be cast to a long unsigned to be + printed with "%lu" (long unsigned is at least 32-bit) + - include/urjtag/urjtag.h, include/urjtag/urjtag.h.in: rename to only + export .h files for modules actually configured: USB, SVF, BSDL are + only conditionally exported + 2009-05-18 Arnim Laeuger * src/flash/amd.c: added Winbond W19B320AT/B flash chip diff --git a/urjtag/configure.ac b/urjtag/configure.ac index d5f44494..7a948b4f 100644 --- a/urjtag/configure.ac +++ b/urjtag/configure.ac @@ -79,6 +79,7 @@ AC_CONFIG_FILES( AM_MAINTAINER_MODE AM_CONFIG_HEADER(config.h) +AM_CONFIG_HEADER(include/urjtag/urjtag.h) AC_GNU_SOURCE @@ -108,6 +109,19 @@ AC_CHECK_FUNCS(swprintf) AC_CHECK_FUNC(clock_gettime, [], [ AC_CHECK_LIB(rt, clock_gettime) ]) +AC_CHECK_FUNCS(usleep) +AC_CHECK_FUNCS(nanosleep) + +dnl check for sigaction with SA_ONESHOT or SA_RESETHAND +AC_TRY_COMPILE([#include ], [ +#ifndef SA_ONESHOT +# define SA_ONESHOT SA_RESETHAND +#endif +int sa_flags = SA_ONESHOT; +], +[AC_DEFINE([HAVE_SIGACTION_SA_ONESHOT], [1], [Have a defined SA_ONESHOT])], +[]) + AC_CHECK_HEADERS([linux/ppdev.h], [HAVE_LINUX_PPDEV_H="yes"]) AC_CHECK_HEADERS([dev/ppbus/ppi.h], [HAVE_DEV_PPBUS_PPI_H="yes"]) AC_CHECK_HEADERS(stropts.h) diff --git a/urjtag/include/urjtag/cmd.h b/urjtag/include/urjtag/cmd.h index 7b1c3c36..0c6d4dba 100644 --- a/urjtag/include/urjtag/cmd.h +++ b/urjtag/include/urjtag/cmd.h @@ -59,6 +59,6 @@ char *urj_cmd_find_next (const char *text, int state); /* @@@@ RFHH candidate to become local in src/cmd/ after cable refactor */ int urj_cmd_params (char *params[]); /* @@@@ RFHH candidate to become local in src/cmd/ after cable refactor */ -int urj_cmd_get_number (const char *s, unsigned int *i); +int urj_cmd_get_number (const char *s, long unsigned *i); #endif /* URJ_CMD_H */ diff --git a/urjtag/include/urjtag/urjtag.h b/urjtag/include/urjtag/urjtag.h.in similarity index 92% rename from urjtag/include/urjtag/urjtag.h rename to urjtag/include/urjtag/urjtag.h.in index 1046c551..7da5dd47 100644 --- a/urjtag/include/urjtag/urjtag.h +++ b/urjtag/include/urjtag/urjtag.h.in @@ -26,11 +26,17 @@ #ifndef URJ_URJTAG_H #define URJ_URJTAG_H +#undef ENABLE_BSDL +#undef ENABLE_SVF +#undef HAVE_LIBUSB + #include "types.h" #include "bitmask.h" #include "bsbit.h" +#if ENABLE_BSDL #include "bsdl.h" #include "bsdl_mode.h" +#endif #include "bssignal.h" #include "bus.h" #include "bus_driver.h" @@ -47,12 +53,15 @@ #include "part.h" #include "part_instruction.h" #include "pod.h" +#if ENABLE_SVF #include "svf.h" +#endif #include "tap.h" #include "tap_register.h" #include "tap_state.h" -#include "urjtag.h" +#if HAVE_LIBUSB #include "usbconn.h" #include "xpcu.h" +#endif #endif /* URJ_URJTAG_H */ diff --git a/urjtag/src/bsdl/Makefile.am b/urjtag/src/bsdl/Makefile.am index 668ac71d..08c44449 100644 --- a/urjtag/src/bsdl/Makefile.am +++ b/urjtag/src/bsdl/Makefile.am @@ -50,8 +50,7 @@ AM_CFLAGS = $(WARNINGCFLAGS) libbsdl_flex_la_CFLAGS = \ $(AM_CFLAGS) \ - -Wno-unused-function \ - -Werror=missing-prototypes -Wno-error=missing-prototypes + -Wno-error # additional dependencies # - all files depend on bsdl_config.h which dynamically generated diff --git a/urjtag/src/bus/au1500.c b/urjtag/src/bus/au1500.c index a4a9a769..5a0e118f 100644 --- a/urjtag/src/bus/au1500.c +++ b/urjtag/src/bus/au1500.c @@ -74,7 +74,7 @@ au1500_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -84,7 +84,7 @@ au1500_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/avr32.c b/urjtag/src/bus/avr32.c index aac5bcbe..34889877 100644 --- a/urjtag/src/bus/avr32.c +++ b/urjtag/src/bus/avr32.c @@ -194,8 +194,9 @@ mwa_scan_in_addr (urj_bus_t *bus, unsigned int slave, uint32_t addr, int mode) urj_tap_register_t *r = bus->part->active_instruction->data_register->in; int i; - DBG (DBG_BASIC, _("%s: slave=%01x, addr=%08x, %s\n"), - __FUNCTION__, slave, addr, + DBG (DBG_BASIC, _("%s: slave=%01x, addr=%08lx, %s\n"), + __FUNCTION__, slave, + (long unsigned) addr, (mode == ACCESS_MODE_READ) ? "READ" : "WRITE"); /* set slave bits */ @@ -219,7 +220,8 @@ mwa_scan_in_data (urj_bus_t *bus, uint32_t data) urj_tap_register_t *r = bus->part->active_instruction->data_register->in; int i; - DBG (DBG_BASIC, _("%s: data=%08x\n"), __FUNCTION__, data); + DBG (DBG_BASIC, _("%s: data=%08lx\n"), __FUNCTION__, + (long unsigned) data); register_set_bit (r, 0, 0); register_set_bit (r, 1, 0); @@ -244,7 +246,8 @@ mwa_scan_out_data (urj_bus_t *bus, uint32_t *pdata) for (i = 0; i < 32; i++) data |= register_get_bit (r, i) << i; - DBG (DBG_BASIC, _("%s: data=%08x\n"), __FUNCTION__, data); + DBG (DBG_BASIC, _("%s: data=%08lx\n"), __FUNCTION__, + (long unsigned) data); *pdata = data; } @@ -287,7 +290,8 @@ nexus_access_set_addr (urj_bus_t *bus, uint32_t addr, int mode) urj_tap_register_t *r = bus->part->active_instruction->data_register->in; int i; - DBG (DBG_BASIC, _("%s: addr=%08x, mode=%s\n"), __FUNCTION__, addr, + DBG (DBG_BASIC, _("%s: addr=%08lx, mode=%s\n"), __FUNCTION__, + (long unsigned) addr, (mode == ACCESS_MODE_READ) ? "READ" : "WRITE"); urj_tap_register_fill (r, 0); @@ -316,7 +320,8 @@ nexus_access_read_data (urj_bus_t *bus, uint32_t *pdata) for (i = 0; i < 32; i++) data |= register_get_bit (r, i) << i; - DBG (DBG_BASIC, _("%s: data=%08x\n"), __FUNCTION__, data); + DBG (DBG_BASIC, _("%s: data=%08lx\n"), __FUNCTION__, + (long unsigned) data); *pdata = data; } @@ -327,7 +332,8 @@ nexus_access_write_data (urj_bus_t *bus, uint32_t data) urj_tap_register_t *r = bus->part->active_instruction->data_register->in; int i; - DBG (DBG_BASIC, _("%s: data=%08x\n"), __FUNCTION__, data); + DBG (DBG_BASIC, _("%s: data=%08lx\n"), __FUNCTION__, + (long unsigned) data); register_set_bit (r, 0, 0); register_set_bit (r, 1, 0); @@ -375,7 +381,8 @@ nexus_memacc_read (urj_bus_t *bus, uint32_t *data) } while (status == 0); - DBG (DBG_BASIC, _("%s: read status %08x\n"), __FUNCTION__, status); + DBG (DBG_BASIC, _("%s: read status %08lx\n"), __FUNCTION__, + (long unsigned) status); ret = ACCESS_STATUS_OK; switch (status) @@ -384,7 +391,7 @@ nexus_memacc_read (urj_bus_t *bus, uint32_t *data) nexus_reg_read (bus, OCD_REG_RWD, data); break; default: - ERR ("read failed, status=%d\n", status); + ERR ("read failed, status=%lu\n", (long unsigned) status); *data = 0xffffffff; ret = ACCESS_STATUS_ERR; break; @@ -407,12 +414,13 @@ nexus_memacc_write (urj_bus_t *bus, uint32_t addr, uint32_t data, nexus_reg_read (bus, OCD_REG_RWCS, &status); status &= (OCD_RWCS_ERR | OCD_RWCS_DV); - DBG (DBG_BASIC, _("%s: status=%08x\n"), __FUNCTION__, status); + DBG (DBG_BASIC, _("%s: status=%08lx\n"), __FUNCTION__, + (long unsigned) status); ret = ACCESS_STATUS_OK; if (status) { - ERR ("write failed, status=%d\n", status); + ERR ("write failed, status=%lu\n", (long unsigned) status); ret = ACCESS_STATUS_ERR; } @@ -550,7 +558,7 @@ avr32_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -560,7 +568,7 @@ avr32_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } @@ -664,7 +672,7 @@ avr32_bus_read_start (urj_bus_t *bus, uint32_t addr) { addr &= ADDR_MASK; - DBG (DBG_BASIC, _("%s:addr=%08x\n"), __FUNCTION__, addr); + DBG (DBG_BASIC, _("%s:addr=%08lx\n"), __FUNCTION__, (long unsigned) addr); switch (MODE) { diff --git a/urjtag/src/bus/bcm1250.c b/urjtag/src/bus/bcm1250.c index 2efa2eb8..7bece199 100644 --- a/urjtag/src/bus/bcm1250.c +++ b/urjtag/src/bus/bcm1250.c @@ -72,7 +72,7 @@ bcm1250_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -82,7 +82,7 @@ bcm1250_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/bf533_ezkit.c b/urjtag/src/bus/bf533_ezkit.c index 07e990fb..630cc361 100644 --- a/urjtag/src/bus/bf533_ezkit.c +++ b/urjtag/src/bus/bf533_ezkit.c @@ -80,7 +80,7 @@ bf533_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -90,7 +90,7 @@ bf533_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/bf533_stamp.c b/urjtag/src/bus/bf533_stamp.c index 8e42cc85..c6166051 100644 --- a/urjtag/src/bus/bf533_stamp.c +++ b/urjtag/src/bus/bf533_stamp.c @@ -80,7 +80,7 @@ bf533_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -90,7 +90,7 @@ bf533_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/bf537_stamp.c b/urjtag/src/bus/bf537_stamp.c index 5b4ee4b1..f3ebea86 100644 --- a/urjtag/src/bus/bf537_stamp.c +++ b/urjtag/src/bus/bf537_stamp.c @@ -80,7 +80,7 @@ bf537_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -90,7 +90,7 @@ bf537_stamp_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/bf548_ezkit.c b/urjtag/src/bus/bf548_ezkit.c index f64cb266..c79a489a 100644 --- a/urjtag/src/bus/bf548_ezkit.c +++ b/urjtag/src/bus/bf548_ezkit.c @@ -75,7 +75,7 @@ bf548_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -85,7 +85,7 @@ bf548_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/bf561_ezkit.c b/urjtag/src/bus/bf561_ezkit.c index d0231c36..201fca54 100644 --- a/urjtag/src/bus/bf561_ezkit.c +++ b/urjtag/src/bus/bf561_ezkit.c @@ -80,7 +80,7 @@ bf561_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -90,7 +90,7 @@ bf561_ezkit_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/bscoach.c b/urjtag/src/bus/bscoach.c index bc51faa3..edcc2dad 100644 --- a/urjtag/src/bus/bscoach.c +++ b/urjtag/src/bus/bscoach.c @@ -78,7 +78,7 @@ flashbscoach_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -88,7 +88,7 @@ flashbscoach_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/buses.c b/urjtag/src/bus/buses.c index 11fd4115..133b6451 100644 --- a/urjtag/src/bus/buses.c +++ b/urjtag/src/bus/buses.c @@ -176,7 +176,7 @@ urj_bus_buses_add (urj_bus_t *abus) { /* @@@@ RFHH add status return */ urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); printf (_("Out of memory\n")); return; } diff --git a/urjtag/src/bus/ejtag.c b/urjtag/src/bus/ejtag.c index 1a58c03e..cee059ec 100644 --- a/urjtag/src/bus/ejtag.c +++ b/urjtag/src/bus/ejtag.c @@ -125,7 +125,7 @@ ejtag_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -135,7 +135,7 @@ ejtag_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } @@ -230,8 +230,8 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len) addr = reg_value (ejaddr->out); if (addr & 3) { - printf (_("%s(%d) PrAcc bad alignment: addr=0x%08x\n"), - __FILE__, __LINE__, addr); + printf (_("%s(%d) PrAcc bad alignment: addr=0x%08lx\n"), + __FILE__, __LINE__, (long unsigned) addr); addr &= ~3; } @@ -245,7 +245,7 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len) urj_tap_chain_shift_data_registers (bus->chain, 1); data = reg_value (ejdata->out); #if 0 - printf (_("%s(%d) PrAcc write: addr=0x%08x data=0x%08x\n"), + printf (_("%s(%d) PrAcc write: addr=0x%08lx data=0x%08lx\n"), __FILE__, __LINE__, addr, data); #endif if (addr == UINT32_C (0xff200000)) @@ -255,8 +255,9 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len) } else { - printf (_("%s(%d) Unknown write addr=0x%08x data=0x%08x\n"), - __FILE__, __LINE__, addr, data); + printf (_("%s(%d) Unknown write addr=0x%08lx data=0x%08lx\n"), + __FILE__, __LINE__, (long unsigned) addr, + (long unsigned) data); } } else @@ -273,7 +274,7 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len) ejdata->in->data[i] = (data >> i) & 1; } #if 0 - printf ("%s(%d) PrAcc read: addr=0x%08x data=0x%08x\n", + printf ("%s(%d) PrAcc read: addr=0x%08lx data=0x%08lx\n", __FILE__, __LINE__, addr, data); #endif urj_tap_chain_shift_data_registers (bus->chain, 0); @@ -324,8 +325,8 @@ ejtag_bus_init (urj_bus_t *bus) urj_tap_chain_shift_instructions (bus->chain); urj_tap_chain_shift_data_registers (bus->chain, 0); //Write urj_tap_chain_shift_data_registers (bus->chain, 1); //Read - printf ("ImpCode=%s %08X\n", urj_tap_register_get_string (ejimpl->out), - reg_value (ejimpl->out)); + printf ("ImpCode=%s %08lX\n", urj_tap_register_get_string (ejimpl->out), + (long unsigned) reg_value (ejimpl->out)); BP->impcode = reg_value (ejimpl->out); switch (EJTAG_VER) @@ -343,7 +344,7 @@ ejtag_bus_init (urj_bus_t *bus) printf ("EJTAG version: 3.1\n"); break; default: - printf ("EJTAG version: unknown (%d)\n", EJTAG_VER); + printf ("EJTAG version: unknown (%lu)\n", EJTAG_VER); } printf ("EJTAG Implementation flags:%s%s%s%s%s%s%s\n", (BP->impcode & (1 << 28)) ? " R3k" : " R4k", @@ -382,7 +383,7 @@ ejtag_bus_init (urj_bus_t *bus) //Set to Debug Control Register Address, 0xFF300000 urj_tap_register_init (ejaddr->in, "11111111001100000000000000000000"); -// printf("Write to ejaddr->in =%s %08X\n",urj_tap_register_get_string( ejaddr->in),reg_value( ejaddr->in ) ); +// printf("Write to ejaddr->in =%s %08lX\n",urj_tap_register_get_string( ejaddr->in),reg_value( ejaddr->in ) ); urj_tap_chain_shift_data_registers (bus->chain, 0); //Write // printf("Select EJTAG CONTROL Register\n"); urj_part_set_instruction (bus->part, "EJTAG_CONTROL"); @@ -396,8 +397,8 @@ ejtag_bus_init (urj_bus_t *bus) ejctrl->in->data[DrWn] = 1; // 9-------| ejctrl->in->data[Dsz1] = 1; // 8-------| DMA_WORD = 0x00000100 = Bit8 urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead -// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); -// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); +// printf("Write To ejctrl->in =%s %08lX\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); +// printf("Read From ejctrl->out =%s %08lX\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); do { // printf("Wait for DStrt to clear\n"); @@ -409,8 +410,8 @@ ejtag_bus_init (urj_bus_t *bus) ejctrl->in->data[DmaAcc] = 1; // 17----|| ejctrl->in->data[ProbEn] = 1; // 15-----| urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead -// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); -// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); +// printf("Write To ejctrl->in =%s %08lX\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); +// printf("Read From ejctrl->out =%s %08lX\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); } while (ejctrl->out->data[DStrt] == 1); // printf("Select EJTAG DATA Register\n"); @@ -418,8 +419,8 @@ ejtag_bus_init (urj_bus_t *bus) urj_tap_chain_shift_instructions (bus->chain); urj_tap_register_fill (ejdata->in, 0); // Clear Register urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead -// printf( "Write To ejdata->in =%s %08X\n", urj_tap_register_get_string( ejdata->in), reg_value( ejdata->in ) ); -// printf( "Read From ejdata->out =%s %08X\n", urj_tap_register_get_string( ejdata->out),reg_value( ejdata->out ) ); +// printf( "Write To ejdata->in =%s %08lX\n", urj_tap_register_get_string( ejdata->in), reg_value( ejdata->in ) ); +// printf( "Read From ejdata->out =%s %08lX\n", urj_tap_register_get_string( ejdata->out),reg_value( ejdata->out ) ); // printf("Select EJTAG CONTROL Register\n"); urj_part_set_instruction (bus->part, "EJTAG_CONTROL"); urj_tap_chain_shift_instructions (bus->chain); @@ -428,8 +429,8 @@ ejtag_bus_init (urj_bus_t *bus) ejctrl->in->data[PrAcc] = 1; // 18----|| ejctrl->in->data[ProbEn] = 1; // 15-----| urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead -// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); -// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); +// printf("Write To ejctrl->in =%s %08lX\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); +// printf("Read From ejctrl->out =%s %08lX\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); if (ejctrl->out->data[DeRR] == 1) { printf ("DMA READ ERROR\n"); @@ -438,7 +439,7 @@ ejtag_bus_init (urj_bus_t *bus) urj_tap_register_init (ejdata->in, urj_tap_register_get_string (ejdata->out)); ejdata->in->data[MemProt] = 0; -// printf( "Need to Write ejdata-> =%s %08X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) ); +// printf( "Need to Write ejdata-> =%s %08lX\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) ); // Now the Write // printf("Set Address To Write To\n"); @@ -447,14 +448,14 @@ ejtag_bus_init (urj_bus_t *bus) urj_tap_chain_shift_instructions (bus->chain); urj_tap_register_init (ejaddr->in, "11111111001100000000000000000000"); -// printf("Write to ejaddr->in =%s %08X\n",urj_tap_register_get_string( ejaddr->in), reg_value( ejaddr->in ) ); +// printf("Write to ejaddr->in =%s %08lX\n",urj_tap_register_get_string( ejaddr->in), reg_value( ejaddr->in ) ); //This appears to be a write with NO Read urj_tap_chain_shift_data_registers (bus->chain, 0); //Write // printf("Select EJTAG DATA Register\n"); urj_part_set_instruction (bus->part, "EJTAG_DATA"); urj_tap_chain_shift_instructions (bus->chain); //The value is already in ejdata->in, so write it -// printf("Write To ejdata->in =%s %08X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) ); +// printf("Write To ejdata->in =%s %08lX\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) ); urj_tap_chain_shift_data_registers (bus->chain, 0); //Write // printf("Select EJTAG CONTROL Register\n"); urj_part_set_instruction (bus->part, "EJTAG_CONTROL"); @@ -468,8 +469,8 @@ ejtag_bus_init (urj_bus_t *bus) ejctrl->in->data[ProbEn] = 1; // 15 ejctrl->in->data[PrAcc] = 1; // 18 urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read -// printf("Write to ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); -// printf("Read from ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) ); +// printf("Write to ejctrl->in =%s %08lX\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); +// printf("Read from ejctrl->out =%s %08lX\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) ); do { // printf("Wait for DStrt to clear\n"); @@ -480,8 +481,8 @@ ejtag_bus_init (urj_bus_t *bus) ejctrl->in->data[ProbEn] = 1; // 15 ejctrl->in->data[PrAcc] = 1; // 18 urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read -// printf("Write to ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); -// printf("Read from ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) ); +// printf("Write to ejctrl->in =%s %08lX\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) ); +// printf("Read from ejctrl->out =%s %08lX\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) ); } while (ejctrl->out->data[DStrt] == 1); // printf("Select EJTAG CONTROL Register\n"); @@ -492,8 +493,8 @@ ejtag_bus_init (urj_bus_t *bus) ejctrl->in->data[PrAcc] = 1; // 18----|| ejctrl->in->data[ProbEn] = 1; // 15-----| urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read -// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) ); -// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); +// printf("Write To ejctrl->in =%s %08lX\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) ); +// printf("Read From ejctrl->out =%s %08lX\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) ); if (ejctrl->out->data[DeRR] == 1) { printf ("DMA WRITE ERROR\n"); @@ -648,7 +649,7 @@ ejtag_bus_read_start (urj_bus_t *bus, uint32_t adr) uint32_t code[3]; ejtag_run_pracc (bus, code, ejtag_gen_read (bus, code, adr)); - // printf("URJ_BUS_READ_START: adr=0x%08x\n", adr); + // printf("URJ_BUS_READ_START: adr=0x%08lx\n", adr); } /** @@ -666,7 +667,7 @@ ejtag_bus_read_next (urj_bus_t *bus, uint32_t adr) d = ejtag_run_pracc (bus, code, p - code); - // printf("URJ_BUS_READ_NEXT: adr=0x%08x data=0x%08x\n", adr, d); + // printf("URJ_BUS_READ_NEXT: adr=0x%08lx data=0x%08lx\n", adr, d); return d; } @@ -685,7 +686,7 @@ ejtag_bus_read_end (urj_bus_t *bus) d = ejtag_run_pracc (bus, code, 2); - // printf("URJ_BUS_READ_END: data=0x%08x\n", d); + // printf("URJ_BUS_READ_END: data=0x%08lx\n", d); return d; } @@ -728,7 +729,7 @@ ejtag_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data) ejtag_run_pracc (bus, code, p - code); - // printf("URJ_BUS_WRITE: adr=0x%08x data=0x%08x\n", adr, data); + // printf("URJ_BUS_WRITE: adr=0x%08lx data=0x%08lx\n", adr, data); } const urj_bus_driver_t urj_bus_ejtag_bus = { diff --git a/urjtag/src/bus/ejtag_dma.c b/urjtag/src/bus/ejtag_dma.c index aa400a9d..5f3dc8be 100644 --- a/urjtag/src/bus/ejtag_dma.c +++ b/urjtag/src/bus/ejtag_dma.c @@ -98,7 +98,7 @@ ejtag_dma_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -108,7 +108,7 @@ ejtag_dma_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } @@ -425,7 +425,7 @@ ejtag_dma_bus_init (urj_bus_t *bus) printf ("EJTAG version: 2.6\n"); break; default: - printf ("EJTAG version: unknown (%d)\n", EJTAG_VER); + printf ("EJTAG version: unknown (%lu)\n", EJTAG_VER); } printf ("EJTAG Implementation flags:%s%s%s%s%s%s%s\n", (BP->impcode & (1 << 28)) ? " R3k" : " R4k", @@ -632,7 +632,7 @@ ejtag_dma_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data) * bus->driver->(*read) * */ -static unsigned int +static uint32_t ejtag_dma_bus_read (urj_bus_t *bus, uint32_t adr) { int data = ejtag_dma_read (bus, adr, get_sz (adr)); @@ -640,7 +640,7 @@ ejtag_dma_bus_read (urj_bus_t *bus, uint32_t adr) return data; } -static unsigned int _data_read; +static uint32_t _data_read; /** * bus->driver->(*read_start) * @@ -657,10 +657,10 @@ ejtag_dma_bus_read_start (urj_bus_t *bus, uint32_t adr) * bus->driver->(*read_next) * */ -static unsigned int +static uint32_t ejtag_dma_bus_read_next (urj_bus_t *bus, uint32_t adr) { - unsigned int tmp_value = _data_read; + uint32_t tmp_value = _data_read; _data_read = ejtag_dma_read (bus, adr, get_sz (adr)); //printf("%s:adr=0x%x, got=0x%x\n",__FUNCTION__,adr,_data_read); return tmp_value; @@ -670,7 +670,7 @@ ejtag_dma_bus_read_next (urj_bus_t *bus, uint32_t adr) * bus->driver->(*read_end) * */ -static unsigned int +static uint32_t ejtag_dma_bus_read_end (urj_bus_t *bus) { return _data_read; diff --git a/urjtag/src/bus/fjmem.c b/urjtag/src/bus/fjmem.c index 021db3ac..8fff4b78 100644 --- a/urjtag/src/bus/fjmem.c +++ b/urjtag/src/bus/fjmem.c @@ -311,7 +311,7 @@ fjmem_query_blocks (urj_chain_t *chain, urj_part_t *part, urj_bus_t *bus) if ((bl = calloc (1, sizeof (block_param_t))) == NULL) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); printf (_("out of memory\n")); failed |= 1; break; @@ -407,7 +407,7 @@ fjmem_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, opcode = value; if (strcasecmp (params[idx], "len") == 0) { - unsigned int tmp; + long unsigned tmp; urj_cmd_get_number (value, &tmp); fjmem_reg_len = (int) tmp; } @@ -426,7 +426,7 @@ fjmem_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -436,7 +436,7 @@ fjmem_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/h7202.c b/urjtag/src/bus/h7202.c index cd0f38a8..3f8e5500 100644 --- a/urjtag/src/bus/h7202.c +++ b/urjtag/src/bus/h7202.c @@ -70,7 +70,7 @@ h7202_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -80,7 +80,7 @@ h7202_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/ixp425.c b/urjtag/src/bus/ixp425.c index 45275324..567fcd19 100644 --- a/urjtag/src/bus/ixp425.c +++ b/urjtag/src/bus/ixp425.c @@ -70,7 +70,7 @@ ixp425_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -80,7 +80,7 @@ ixp425_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/ixp435.c b/urjtag/src/bus/ixp435.c index d39c381c..50c29509 100644 --- a/urjtag/src/bus/ixp435.c +++ b/urjtag/src/bus/ixp435.c @@ -70,7 +70,7 @@ ixp435_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -80,7 +80,7 @@ ixp435_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/jopcyc.c b/urjtag/src/bus/jopcyc.c index d122ba20..9b7fb0e0 100644 --- a/urjtag/src/bus/jopcyc.c +++ b/urjtag/src/bus/jopcyc.c @@ -150,7 +150,7 @@ jopcyc_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -160,7 +160,7 @@ jopcyc_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/lh7a400.c b/urjtag/src/bus/lh7a400.c index f5e5f4c0..778641e3 100644 --- a/urjtag/src/bus/lh7a400.c +++ b/urjtag/src/bus/lh7a400.c @@ -86,7 +86,7 @@ lh7a400_bus_new (urj_chain_t *chain, const const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -96,7 +96,7 @@ lh7a400_bus_new (urj_chain_t *chain, const const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } @@ -169,6 +169,7 @@ lh7a400_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area) area->description = NULL; area->start = UINT32_C (0x00000000); area->length = UINT64_C (0x10000000); + area->width = -1; // some gcc versions detect uninitialised use /* we determine the size of the flash that was booted from [1] table 3.1 */ width = @@ -214,6 +215,7 @@ set_data_in (urj_bus_t *bus) urj_part_t *p = bus->part; urj_bus_area_t area; + // @@@@ RFHH check result lh7a400_bus_area (bus, 0, &area); for (i = 0; i < area.width; i++) diff --git a/urjtag/src/bus/mpc5200.c b/urjtag/src/bus/mpc5200.c index 673024be..0d20dc82 100644 --- a/urjtag/src/bus/mpc5200.c +++ b/urjtag/src/bus/mpc5200.c @@ -44,7 +44,7 @@ #define LPC_NUM_CS 6 #define LPC_NUM_AD 32 #define LPC_ADDR_TO_CS(a) ((a) >> bp->lpc_num_ad) -#define LPC_ADDR_SIZE (((unsigned long long) 1 << bp->lpc_num_ad) * LPC_NUM_CS) +#define LPC_ADDR_SIZE (((long unsigned long) 1 << bp->lpc_num_ad) * LPC_NUM_CS) typedef struct { @@ -87,7 +87,7 @@ mpc5200_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -97,7 +97,7 @@ mpc5200_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/mpc824x.c b/urjtag/src/bus/mpc824x.c index dbfd7de8..1b0e810b 100644 --- a/urjtag/src/bus/mpc824x.c +++ b/urjtag/src/bus/mpc824x.c @@ -159,7 +159,7 @@ mpc824x_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -169,7 +169,7 @@ mpc824x_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } @@ -362,12 +362,12 @@ setup_address (urj_bus_t *bus, uint32_t a) return; } - printf (_("Addr [%2d:0]: %06X "), k, a); + printf (_("Addr [%2d:0]: %06lX "), k, (long unsigned) a); for (i = 0; i < 3; i++) { for (j = 0; j < 8; j++) if ((i * 8 + j) >= (23 - k)) - printf ("%1d", (a >> (23 - (i * 8 + j))) & 1); + printf ("%1lu", (a >> (23 - (i * 8 + j))) & 1); else printf (" "); printf (" "); @@ -411,7 +411,8 @@ setup_data (urj_bus_t *bus, uint32_t adr, uint32_t d) /* Just for debugging */ if (dbgData) { - printf (_("Data WR [%d:0]: %08X "), area.width - 1, d); + printf (_("Data WR [%d:0]: %08lX "), area.width - 1, + (long unsigned) d); int j; int bytes = 0; if (BUS_WIDTH == 8) @@ -425,9 +426,9 @@ setup_data (urj_bus_t *bus, uint32_t adr, uint32_t d) { for (j = 0; j < 8; j++) if (REVBITS) - printf ("%1d", (d >> (BUS_WIDTH - 1 - (i * 8 + j))) & 1); + printf ("%1lu", (d >> (BUS_WIDTH - 1 - (i * 8 + j))) & 1); else - printf ("%1d", (d >> ((i * 8 + j))) & 1); + printf ("%1lu", (d >> ((i * 8 + j))) & 1); printf (" "); } printf ("\n"); @@ -454,7 +455,8 @@ get_data (urj_bus_t *bus, uint32_t adr) /* Just for debugging */ if (dbgData) { - printf (_("Data RD [%d:0]: %08X "), area.width - 1, d); + printf (_("Data RD [%d:0]: %08lX "), area.width - 1, + (long unsigned) d); int j; int bytes = 0; if (BUS_WIDTH == 8) @@ -468,9 +470,9 @@ get_data (urj_bus_t *bus, uint32_t adr) { for (j = 0; j < 8; j++) if (REVBITS) - printf ("%1d", (d >> (BUS_WIDTH - 1 - (i * 8 + j))) & 1); + printf ("%1lu", (d >> (BUS_WIDTH - 1 - (i * 8 + j))) & 1); else - printf ("%1d", (d >> ((i * 8 + j))) & 1); + printf ("%1lu", (d >> ((i * 8 + j))) & 1); printf (" "); } printf ("\n"); diff --git a/urjtag/src/bus/ppc405ep.c b/urjtag/src/bus/ppc405ep.c index c212fb52..f43b90b7 100644 --- a/urjtag/src/bus/ppc405ep.c +++ b/urjtag/src/bus/ppc405ep.c @@ -68,7 +68,7 @@ ppc405ep_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -78,7 +78,7 @@ ppc405ep_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/ppc440gx_ebc8.c b/urjtag/src/bus/ppc440gx_ebc8.c index b6de60da..bdd22dd3 100644 --- a/urjtag/src/bus/ppc440gx_ebc8.c +++ b/urjtag/src/bus/ppc440gx_ebc8.c @@ -70,7 +70,7 @@ ppc440gx_ebc8_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -80,7 +80,7 @@ ppc440gx_ebc8_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/prototype.c b/urjtag/src/bus/prototype.c index 5aa590d4..0e924979 100644 --- a/urjtag/src/bus/prototype.c +++ b/urjtag/src/bus/prototype.c @@ -105,7 +105,7 @@ prototype_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -114,7 +114,7 @@ prototype_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus->params) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } diff --git a/urjtag/src/bus/pxa2x0.c b/urjtag/src/bus/pxa2x0.c index b5751150..60fecf0a 100644 --- a/urjtag/src/bus/pxa2x0.c +++ b/urjtag/src/bus/pxa2x0.c @@ -160,7 +160,7 @@ pxa2xx_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -170,7 +170,7 @@ pxa2xx_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } @@ -358,7 +358,7 @@ pxa2xx_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area) case 5: case 6: case 7: - printf ("TODO - BOOT_SEL: %d\n", + printf ("TODO - BOOT_SEL: %lu\n", get_BOOT_DEF_BOOT_SEL (BOOT_DEF)); return URJ_STATUS_FAIL; default: @@ -457,7 +457,7 @@ pxa27x_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area) case 5: case 6: case 7: - printf ("TODO - BOOT_SEL: %d\n", + printf ("TODO - BOOT_SEL: %lu\n", get_BOOT_DEF_BOOT_SEL (BOOT_DEF)); return URJ_STATUS_FAIL; default: diff --git a/urjtag/src/bus/readmem.c b/urjtag/src/bus/readmem.c index 4651a78e..f11271ce 100644 --- a/urjtag/src/bus/readmem.c +++ b/urjtag/src/bus/readmem.c @@ -74,8 +74,10 @@ urj_bus_readmem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len) addr = addr & (~(step - 1)); len = (len + step - 1) & (~(step - 1)); - urj_log (URJ_LOG_LEVEL_NORMAL, _("address: 0x%08X\n"), addr); - urj_log (URJ_LOG_LEVEL_NORMAL, _("length: 0x%08X\n"), len); + urj_log (URJ_LOG_LEVEL_NORMAL, _("address: 0x%08lX\n"), + (long unsigned) addr); + urj_log (URJ_LOG_LEVEL_NORMAL, _("length: 0x%08lX\n"), + (long unsigned) len); if (len == 0) { @@ -108,7 +110,8 @@ urj_bus_readmem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len) if ((bc >= BSIZE) || (a >= end)) { - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X"), a); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX"), + (long unsigned) a); urj_log (URJ_LOG_LEVEL_NORMAL, "\r"); fwrite (b, bc, 1, f); bc = 0; diff --git a/urjtag/src/bus/s3c4510x.c b/urjtag/src/bus/s3c4510x.c index 40da89de..7a605328 100644 --- a/urjtag/src/bus/s3c4510x.c +++ b/urjtag/src/bus/s3c4510x.c @@ -116,7 +116,7 @@ s3c4510_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -126,7 +126,7 @@ s3c4510_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/sa1110.c b/urjtag/src/bus/sa1110.c index 174add16..620d25e6 100644 --- a/urjtag/src/bus/sa1110.c +++ b/urjtag/src/bus/sa1110.c @@ -75,7 +75,7 @@ sa1110_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -85,7 +85,7 @@ sa1110_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/sh7727.c b/urjtag/src/bus/sh7727.c index e92588f2..ffff7a3e 100644 --- a/urjtag/src/bus/sh7727.c +++ b/urjtag/src/bus/sh7727.c @@ -76,7 +76,7 @@ sh7727_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -86,7 +86,7 @@ sh7727_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/sh7750r.c b/urjtag/src/bus/sh7750r.c index ae40c52a..a8485904 100644 --- a/urjtag/src/bus/sh7750r.c +++ b/urjtag/src/bus/sh7750r.c @@ -76,7 +76,7 @@ sh7750r_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -85,7 +85,7 @@ sh7750r_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/sh7751r.c b/urjtag/src/bus/sh7751r.c index 84ed38e3..008f3f2b 100644 --- a/urjtag/src/bus/sh7751r.c +++ b/urjtag/src/bus/sh7751r.c @@ -75,7 +75,7 @@ sh7751r_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } @@ -85,7 +85,7 @@ sh7751r_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/sharc21065l.c b/urjtag/src/bus/sharc21065l.c index cf120312..c50538d0 100644 --- a/urjtag/src/bus/sharc21065l.c +++ b/urjtag/src/bus/sharc21065l.c @@ -78,7 +78,7 @@ sharc_21065L_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -88,7 +88,7 @@ sharc_21065L_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/slsup3.c b/urjtag/src/bus/slsup3.c index 6941ff46..453f08e3 100644 --- a/urjtag/src/bus/slsup3.c +++ b/urjtag/src/bus/slsup3.c @@ -110,7 +110,7 @@ slsup3_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -120,7 +120,7 @@ slsup3_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/tx4925.c b/urjtag/src/bus/tx4925.c index bf8267b9..0514fd89 100644 --- a/urjtag/src/bus/tx4925.c +++ b/urjtag/src/bus/tx4925.c @@ -84,7 +84,7 @@ tx4925_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -94,7 +94,7 @@ tx4925_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/bus/writemem.c b/urjtag/src/bus/writemem.c index aa92e8cc..3b116746 100644 --- a/urjtag/src/bus/writemem.c +++ b/urjtag/src/bus/writemem.c @@ -68,8 +68,10 @@ urj_bus_writemem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len) addr = addr & (~(step - 1)); len = (len + step - 1) & (~(step - 1)); - urj_log (URJ_LOG_LEVEL_NORMAL, _("address: 0x%08X\n"), addr); - urj_log (URJ_LOG_LEVEL_NORMAL, _("length: 0x%08X\n"), len); + urj_log (URJ_LOG_LEVEL_NORMAL, _("address: 0x%08lX\n"), + (long unsigned) addr); + urj_log (URJ_LOG_LEVEL_NORMAL, _("length: 0x%08lX\n"), + (long unsigned) len); if (len == 0) { @@ -89,7 +91,8 @@ urj_bus_writemem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len) /* Read one block of data */ if (bc < step) { - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X"), a); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX"), + (long unsigned) a); urj_log (URJ_LOG_LEVEL_NORMAL, "\r"); fflush (stdout); if (bc != 0) @@ -97,7 +100,7 @@ urj_bus_writemem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len) if (feof (f)) { printf (_("Unexpected end of file!\n")); - printf (_("Addr: 0x%08X\n"), a); + printf (_("Addr: 0x%08lX\n"), (long unsigned) a); break; } bc = fread (b, 1, BSIZE, f); diff --git a/urjtag/src/bus/zefant-xs3.c b/urjtag/src/bus/zefant-xs3.c index fd73cdb6..008e42df 100644 --- a/urjtag/src/bus/zefant-xs3.c +++ b/urjtag/src/bus/zefant-xs3.c @@ -169,7 +169,7 @@ zefant_xs3_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, if (!bus) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_bus_t)); + (size_t) 1, sizeof (urj_bus_t)); return NULL; } @@ -179,7 +179,7 @@ zefant_xs3_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, { free (bus); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (bus_params_t)); + (size_t) 1, sizeof (bus_params_t)); return NULL; } diff --git a/urjtag/src/cmd/cmd_addpart.c b/urjtag/src/cmd/cmd_addpart.c index 08bbe496..19606fc8 100644 --- a/urjtag/src/cmd/cmd_addpart.c +++ b/urjtag/src/cmd/cmd_addpart.c @@ -37,7 +37,7 @@ static int cmd_addpart_run (urj_chain_t *chain, char *params[]) { - unsigned int len; + long unsigned len; if (urj_cmd_params (params) != 2) { diff --git a/urjtag/src/cmd/cmd_bit.c b/urjtag/src/cmd/cmd_bit.c index 43c8027d..481adec4 100644 --- a/urjtag/src/cmd/cmd_bit.c +++ b/urjtag/src/cmd/cmd_bit.c @@ -56,10 +56,10 @@ static int cmd_bit_run (urj_chain_t *chain, char *params[]) { urj_part_t *part; - unsigned int bit; + long unsigned bit; int type; int safe; - unsigned int control; + long unsigned control; unsigned int parameters = urj_cmd_params (params); char command[1024]; diff --git a/urjtag/src/cmd/cmd_bus.c b/urjtag/src/cmd/cmd_bus.c index 6b0be667..62b9efdf 100644 --- a/urjtag/src/cmd/cmd_bus.c +++ b/urjtag/src/cmd/cmd_bus.c @@ -38,7 +38,7 @@ static int cmd_bus_run (urj_chain_t *chain, char *params[]) { - unsigned int n; + long unsigned n; if (urj_cmd_params (params) != 2) { diff --git a/urjtag/src/cmd/cmd_cable.c b/urjtag/src/cmd/cmd_cable.c index 41c247e1..f1716823 100644 --- a/urjtag/src/cmd/cmd_cable.c +++ b/urjtag/src/cmd/cmd_cable.c @@ -114,7 +114,7 @@ cmd_cable_run (urj_chain_t *chain, char *params[]) if (!cable) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_cable_t)); + (size_t) 1, sizeof (urj_cable_t)); return URJ_STATUS_FAIL; } diff --git a/urjtag/src/cmd/cmd_cmd.c b/urjtag/src/cmd/cmd_cmd.c index e6c45a8e..68452f0a 100644 --- a/urjtag/src/cmd/cmd_cmd.c +++ b/urjtag/src/cmd/cmd_cmd.c @@ -186,7 +186,7 @@ urj_cmd_params (char *params[]) } int -urj_cmd_get_number (const char *s, unsigned int *i) +urj_cmd_get_number (const char *s, long unsigned *i) { int n; int r; @@ -201,12 +201,12 @@ urj_cmd_get_number (const char *s, unsigned int *i) l = strlen (s); n = -1; - r = sscanf (s, "0x%x%n", i, &n); + r = sscanf (s, "0x%lx%n", i, &n); if (r == 1 && n == l) return URJ_STATUS_OK; n = -1; - r = sscanf (s, "%u%n", i, &n); + r = sscanf (s, "%lu%n", i, &n); if (r == 1 && n == l) return URJ_STATUS_OK; diff --git a/urjtag/src/cmd/cmd_debug.c b/urjtag/src/cmd/cmd_debug.c index 19c588ca..36383f83 100644 --- a/urjtag/src/cmd/cmd_debug.c +++ b/urjtag/src/cmd/cmd_debug.c @@ -38,7 +38,7 @@ static int cmd_debug_run (urj_chain_t *chain, char *params[]) { - unsigned int i; + long unsigned i; // @@@@ RFHH change this to control the urj_log level // @@@@ RFHH urj_debug_mode isn't used anyway diff --git a/urjtag/src/cmd/cmd_detectflash.c b/urjtag/src/cmd/cmd_detectflash.c index b92ff920..8192eab9 100644 --- a/urjtag/src/cmd/cmd_detectflash.c +++ b/urjtag/src/cmd/cmd_detectflash.c @@ -37,7 +37,7 @@ static int cmd_detectflash_run (urj_chain_t *chain, char *params[]) { - uint32_t adr; + long unsigned adr; if (urj_cmd_params (params) != 2) { diff --git a/urjtag/src/cmd/cmd_dr.c b/urjtag/src/cmd/cmd_dr.c index 460035f9..b314ac45 100644 --- a/urjtag/src/cmd/cmd_dr.c +++ b/urjtag/src/cmd/cmd_dr.c @@ -98,7 +98,7 @@ cmd_dr_run (urj_chain_t *chain, char *params[]) if (r->len != strlen (params[1])) { urj_error_set (URJ_ERROR_OUT_OF_BOUNDS, - _("%s: register length %d mismatch: %d"), + _("%s: register length %d mismatch: %zd"), "dr", r->len, strlen (params[1])); return URJ_STATUS_FAIL; } diff --git a/urjtag/src/cmd/cmd_eraseflash.c b/urjtag/src/cmd/cmd_eraseflash.c index f8a6eb3a..20277b24 100644 --- a/urjtag/src/cmd/cmd_eraseflash.c +++ b/urjtag/src/cmd/cmd_eraseflash.c @@ -39,8 +39,8 @@ static int cmd_eraseflash_run (urj_chain_t *chain, char *params[]) { - uint32_t adr = 0; - unsigned int number = 0; + long unsigned adr = 0; + long unsigned number = 0; if (urj_cmd_params (params) != 3) { diff --git a/urjtag/src/cmd/cmd_flashmem.c b/urjtag/src/cmd/cmd_flashmem.c index 6b3b5b28..0e667ae3 100644 --- a/urjtag/src/cmd/cmd_flashmem.c +++ b/urjtag/src/cmd/cmd_flashmem.c @@ -42,7 +42,7 @@ cmd_flashmem_run (urj_chain_t *chain, char *params[]) { int msbin; int noverify = 0; - uint32_t adr = 0; + long unsigned adr = 0; FILE *f; int paramc = urj_cmd_params (params); int r; diff --git a/urjtag/src/cmd/cmd_frequency.c b/urjtag/src/cmd/cmd_frequency.c index a62cfb0d..6b762a08 100644 --- a/urjtag/src/cmd/cmd_frequency.c +++ b/urjtag/src/cmd/cmd_frequency.c @@ -37,7 +37,7 @@ static int cmd_frequency_run (urj_chain_t *chain, char *params[]) { - unsigned int freq; + long unsigned freq; if (urj_cmd_test_cable (chain) != URJ_STATUS_OK) return URJ_STATUS_FAIL; @@ -52,15 +52,16 @@ cmd_frequency_run (urj_chain_t *chain, char *params[]) if (urj_cmd_params (params) == 1) { - urj_log (URJ_LOG_LEVEL_NORMAL, _("Current TCK frequency is %u Hz\n"), - urj_tap_cable_get_frequency (chain->cable)); + urj_log (URJ_LOG_LEVEL_NORMAL, _("Current TCK frequency is %lu Hz\n"), + (long unsigned) urj_tap_cable_get_frequency (chain->cable)); return URJ_STATUS_OK; } if (urj_cmd_get_number (params[1], &freq) != URJ_STATUS_OK) return URJ_STATUS_FAIL; - urj_log (URJ_LOG_LEVEL_NORMAL, _("Setting TCK frequency to %u Hz\n"), freq); + urj_log (URJ_LOG_LEVEL_NORMAL, _("Setting TCK frequency to %lu Hz\n"), + freq); urj_tap_cable_set_frequency (chain->cable, freq); return URJ_STATUS_OK; diff --git a/urjtag/src/cmd/cmd_idcode.c b/urjtag/src/cmd/cmd_idcode.c index 20bd7a4d..54b37e00 100644 --- a/urjtag/src/cmd/cmd_idcode.c +++ b/urjtag/src/cmd/cmd_idcode.c @@ -35,7 +35,7 @@ static int cmd_idcode_run (urj_chain_t *chain, char *params[]) { - unsigned int bytes = 0; + long unsigned bytes = 0; if (urj_cmd_params (params) > 2) { @@ -52,7 +52,7 @@ cmd_idcode_run (urj_chain_t *chain, char *params[]) if (urj_cmd_test_cable (chain) != URJ_STATUS_OK) return URJ_STATUS_FAIL; - urj_log (URJ_LOG_LEVEL_NORMAL, _("Reading %d bytes of idcode\n"), bytes); + urj_log (URJ_LOG_LEVEL_NORMAL, _("Reading %lu bytes of idcode\n"), bytes); return urj_tap_idcode (chain, bytes); } diff --git a/urjtag/src/cmd/cmd_include.c b/urjtag/src/cmd/cmd_include.c index 22ae96de..b3548775 100644 --- a/urjtag/src/cmd/cmd_include.c +++ b/urjtag/src/cmd/cmd_include.c @@ -42,7 +42,7 @@ static int cmd_include_or_script_run (urj_chain_t *chain, int is_include, char *params[]) { int i; - unsigned int j = 1; + long unsigned j = 1; int r = URJ_STATUS_OK; if (urj_cmd_params (params) < 2) diff --git a/urjtag/src/cmd/cmd_instruction.c b/urjtag/src/cmd/cmd_instruction.c index b349ac2f..4c9b0427 100644 --- a/urjtag/src/cmd/cmd_instruction.c +++ b/urjtag/src/cmd/cmd_instruction.c @@ -40,7 +40,7 @@ static int cmd_instruction_run (urj_chain_t *chain, char *params[]) { urj_part_t *part; - unsigned int len; + long unsigned len; urj_part_instruction_t *i; if (urj_cmd_test_cable (chain) != URJ_STATUS_OK) diff --git a/urjtag/src/cmd/cmd_part.c b/urjtag/src/cmd/cmd_part.c index 0ba6ca87..8523b6b2 100644 --- a/urjtag/src/cmd/cmd_part.c +++ b/urjtag/src/cmd/cmd_part.c @@ -39,7 +39,7 @@ static int cmd_part_run (urj_chain_t *chain, char *params[]) { - unsigned int n; + long unsigned n; if (urj_cmd_params (params) > 3) { @@ -116,7 +116,7 @@ cmd_part_run (urj_chain_t *chain, char *params[]) if (n >= chain->parts->len) { urj_error_set (URJ_ERROR_INVALID, - _("%s: invalid part number %d, max %d"), "part", + _("%s: invalid part number %lu, max %d"), "part", n, chain->parts->len); return URJ_STATUS_FAIL; } diff --git a/urjtag/src/cmd/cmd_peekpoke.c b/urjtag/src/cmd/cmd_peekpoke.c index 118ec5fd..4ac80cdc 100644 --- a/urjtag/src/cmd/cmd_peekpoke.c +++ b/urjtag/src/cmd/cmd_peekpoke.c @@ -37,7 +37,8 @@ static int cmd_peek_run (urj_chain_t *chain, char *params[]) { - uint32_t adr, val; + long unsigned adr; + uint32_t val; int pars, j = 1; urj_bus_area_t area; @@ -76,16 +77,19 @@ cmd_peek_run (urj_chain_t *chain, char *params[]) case 8: val &= 0xff; urj_log (URJ_LOG_LEVEL_NORMAL, - _("URJ_BUS_READ(0x%08x) = 0x%02X (%i)\n"), adr, val, val); + _("URJ_BUS_READ(0x%08lx) = 0x%02lX (%li)\n"), adr, + (long unsigned) val, (long unsigned) val); break; case 16: val &= 0xffff; urj_log (URJ_LOG_LEVEL_NORMAL, - _("URJ_BUS_READ(0x%08x) = 0x%04X (%i)\n"), adr, val, val); + _("URJ_BUS_READ(0x%08lx) = 0x%04lX (%li)\n"), adr, + (long unsigned) val, (long unsigned) val); break; default: urj_log (URJ_LOG_LEVEL_NORMAL, - _("URJ_BUS_READ(0x%08x) = 0x%08X (%i)\n"), adr, val, val); + _("URJ_BUS_READ(0x%08lx) = 0x%08lX (%li)\n"), adr, + (long unsigned) val, (long unsigned) val); } } while (++j != pars); @@ -117,7 +121,7 @@ const urj_cmd_t urj_cmd_peek = { static int cmd_poke_run (urj_chain_t *chain, char *params[]) { - uint32_t adr, val; + long unsigned adr, val; urj_bus_area_t area; /*urj_bus_t *bus = part_get_active_bus(chain); */ int k = 1, pars = urj_cmd_params (params); diff --git a/urjtag/src/cmd/cmd_print.c b/urjtag/src/cmd/cmd_print.c index 14f6da55..c3859670 100644 --- a/urjtag/src/cmd/cmd_print.c +++ b/urjtag/src/cmd/cmd_print.c @@ -233,14 +233,14 @@ cmd_print_run (urj_chain_t *chain, char *params[]) { if (area.description != NULL) urj_log (URJ_LOG_LEVEL_NORMAL, - _("\tstart: 0x%08X, length: 0x%08llX, data width: %d bit, (%s)\n"), - area.start, + _("\tstart: 0x%08lX, length: 0x%08llX, data width: %d bit, (%s)\n"), + (long unsigned) area.start, (long long unsigned int) area.length, area.width, _(area.description)); else urj_log (URJ_LOG_LEVEL_NORMAL, - _("\tstart: 0x%08X, length: 0x%08llX, data width: %d bit\n"), - area.start, + _("\tstart: 0x%08lX, length: 0x%08llX, data width: %d bit\n"), + (long unsigned) area.start, (long long unsigned int) area.length, area.width); } diff --git a/urjtag/src/cmd/cmd_readmem.c b/urjtag/src/cmd/cmd_readmem.c index 293317f5..241d9e2d 100644 --- a/urjtag/src/cmd/cmd_readmem.c +++ b/urjtag/src/cmd/cmd_readmem.c @@ -39,8 +39,8 @@ static int cmd_readmem_run (urj_chain_t *chain, char *params[]) { - uint32_t adr; - uint32_t len; + long unsigned adr; + long unsigned len; FILE *f; if (urj_cmd_params (params) != 4) diff --git a/urjtag/src/cmd/cmd_register.c b/urjtag/src/cmd/cmd_register.c index 7c9c402b..6e5847d8 100644 --- a/urjtag/src/cmd/cmd_register.c +++ b/urjtag/src/cmd/cmd_register.c @@ -42,7 +42,7 @@ static int cmd_register_run (urj_chain_t *chain, char *params[]) { urj_part_t *part; - unsigned int len; + long unsigned len; if (urj_cmd_params (params) != 3) { diff --git a/urjtag/src/cmd/cmd_set.c b/urjtag/src/cmd/cmd_set.c index 20285355..6d2f5c33 100644 --- a/urjtag/src/cmd/cmd_set.c +++ b/urjtag/src/cmd/cmd_set.c @@ -40,7 +40,7 @@ static int cmd_set_run (urj_chain_t *chain, char *params[]) { int dir; - unsigned int data = 0; + long unsigned data = 0; urj_part_signal_t *s; urj_part_t *part; diff --git a/urjtag/src/cmd/cmd_test.c b/urjtag/src/cmd/cmd_test.c index 602e0585..ea916706 100644 --- a/urjtag/src/cmd/cmd_test.c +++ b/urjtag/src/cmd/cmd_test.c @@ -42,7 +42,7 @@ static int cmd_test_run (urj_chain_t *chain, char *params[]) { int data; - unsigned int i; + long unsigned i; urj_part_signal_t *s; urj_part_t *part; diff --git a/urjtag/src/cmd/cmd_usleep.c b/urjtag/src/cmd/cmd_usleep.c index b266bc4f..4724bb3d 100644 --- a/urjtag/src/cmd/cmd_usleep.c +++ b/urjtag/src/cmd/cmd_usleep.c @@ -24,10 +24,11 @@ #include -#include +// #include #include #include +#include #include #include @@ -37,7 +38,7 @@ static int cmd_usleep_run (urj_chain_t *chain, char *params[]) { - unsigned int usecs; + long unsigned usecs; if (urj_cmd_params (params) != 2) { @@ -50,7 +51,9 @@ cmd_usleep_run (urj_chain_t *chain, char *params[]) if (urj_cmd_get_number (params[1], &usecs) != URJ_STATUS_OK) return URJ_STATUS_FAIL; - usleep (usecs); + // usleep (usecs); + struct timespec req = { 0, usecs * 1000 }; + nanosleep (&req, NULL); return URJ_STATUS_OK; } diff --git a/urjtag/src/cmd/cmd_writemem.c b/urjtag/src/cmd/cmd_writemem.c index b1cf5aae..7e95d070 100644 --- a/urjtag/src/cmd/cmd_writemem.c +++ b/urjtag/src/cmd/cmd_writemem.c @@ -37,8 +37,8 @@ static int cmd_writemem_run (urj_chain_t *chain, char *params[]) { - uint32_t adr; - uint32_t len; + long unsigned adr; + long unsigned len; FILE *f; if (urj_cmd_params (params) != 4) diff --git a/urjtag/src/flash/amd.c b/urjtag/src/flash/amd.c index a5c53d01..bb9e0071 100644 --- a/urjtag/src/flash/amd.c +++ b/urjtag/src/flash/amd.c @@ -38,7 +38,8 @@ #include #include #include -#include /* usleep */ +// #include /* usleep */ +#include // nanosleep #include #include @@ -148,14 +149,17 @@ amdstatus29 (urj_flash_cfi_array_t *cfi_array, uint32_t adr, { data1 = URJ_BUS_READ (bus, adr << o); data1 = URJ_BUS_READ (bus, adr << o); - urj_log (URJ_LOG_LEVEL_DEBUG, "amdstatus %d: %04X (%04X) = %04X\n", - timeout, data1, (data1 & dq7mask), bit7); + urj_log (URJ_LOG_LEVEL_DEBUG, "amdstatus %d: %04lX (%04lX) = %04lX\n", + timeout, (long unsigned) data1, + (long unsigned) (data1 & dq7mask), (long unsigned) bit7); if (((data1 & dq7mask) == dq7mask) == bit7) /* FIXME: This looks non-portable */ return URJ_STATUS_OK; if ((data1 & dq5mask) == dq5mask) break; - usleep (100); + // usleep (100); + struct timespec req = { 0, 100 * 1000 }; + nanosleep (&req, NULL); } data1 = URJ_BUS_READ (bus, adr << o); @@ -186,17 +190,21 @@ amdstatus (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data) uint32_t data1 = URJ_BUS_READ (bus, adr); uint32_t data2 = URJ_BUS_READ (bus, adr); - urj_log (URJ_LOG_LEVEL_DEBUG, "amdstatus %d: %04X/%04X %04X/%04X \n", - timeout, data1, data2, (data1 & togglemask), - (data2 & togglemask)); + urj_log (URJ_LOG_LEVEL_DEBUG, + "amdstatus %d: %04lX/%04lX %04lX/%04lX \n", + timeout, (long unsigned) data1, (long unsigned) data2, + (long unsigned) (data1 & togglemask), + (long unsigned) (data2 & togglemask)); if ((data1 & togglemask) == (data2 & togglemask)) return URJ_STATUS_OK; /* if ( (data1 & dq5mask) != 0 ) TODO */ /* return URJ_STATUS_OK; */ - urj_log (URJ_LOG_LEVEL_DEBUG, "amdstatus %d: %04X/%04X\n", - timeout, data1, data2); - usleep (100); + urj_log (URJ_LOG_LEVEL_DEBUG, "amdstatus %d: %04lX/%04lX\n", + timeout, (long unsigned)data1, (long unsigned)data2); + // usleep (100); + struct timespec req = { 0, 100 * 1000 }; + nanosleep (&req, NULL); } urj_error_set (URJ_ERROR_FLASH, "hardware failure"); @@ -229,9 +237,10 @@ amdstatus (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data) urj_log (URJ_LOG_LEVEL_DEBUG, - "amdstatus %d: %04X/%04X %04X/%04X \n", - timeout, data1, data2, (data1 & togglemask), - (data2 & togglemask)); + "amdstatus %d: %04lX/%04lX %04lX/%04lX \n", + timeout, (long unsigned) data1, (long unsigned) data2, + (long unsigned) (data1 & togglemask), + (long unsigned) (data2 & togglemask)); /* Work around an issue with RTL8181: toggle bits don't toggle when reading the same flash address repeatedly without any other memory access in between. Other @@ -247,11 +256,13 @@ amdstatus (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int data) /* if ( (data1 & dq5mask) != 0 ) TODO */ /* return URJ_STATUS_OK; */ if (urj_log_status.level <= URJ_LOG_LEVEL_DEBUG) - urj_log (URJ_LOG_LEVEL_DEBUG, "amdstatus %d: %04X/%04X\n", - timeout, data1, data2); + urj_log (URJ_LOG_LEVEL_DEBUG, "amdstatus %d: %04lX/%04lX\n", + timeout, (long unsigned) data1, (long unsigned) data2); else urj_log (URJ_LOG_LEVEL_NORMAL, "."); - usleep (100); + // usleep (100); + struct timespec req = { 0, 100 * 1000 }; + nanosleep (&req, NULL); data1 = data2; } @@ -417,7 +428,8 @@ amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr) urj_bus_t *bus = cfi_array->bus; int o = amd_flash_address_shift (cfi_array); - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08X\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08lX\n", + (long unsigned) adr); /* urj_log (URJ_LOG_LEVEL_NORMAL, "protected: %d\n", amdisprotected(ps, cfi_array, adr)); */ @@ -430,11 +442,13 @@ amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr) if (amdstatus (cfi_array, adr, 0xffff) == URJ_STATUS_OK) { - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08X DONE\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08lX DONE\n", + (long unsigned) adr); amd_flash_read_array (cfi_array); /* AMD reset */ return URJ_STATUS_OK; } - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08X FAILED\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08lX FAILED\n", + (long unsigned) adr); /* Read Array */ amd_flash_read_array (cfi_array); /* AMD reset */ @@ -445,7 +459,8 @@ amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr) static int amd_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr) { - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_unlock_block 0x%08X IGNORE\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_unlock_block 0x%08lX IGNORE\n", + (long unsigned) adr); return URJ_STATUS_OK; } @@ -457,8 +472,8 @@ amd_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr, urj_bus_t *bus = cfi_array->bus; int o = amd_flash_address_shift (cfi_array); - urj_log (URJ_LOG_LEVEL_DEBUG, "\nflash_program 0x%08X = 0x%08X\n", - adr, data); + urj_log (URJ_LOG_LEVEL_DEBUG, "\nflash_program 0x%08lX = 0x%08lX\n", + (long unsigned) adr, (long unsigned) data); URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, program */ URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055); @@ -489,14 +504,17 @@ amd_program_buffer_status (urj_flash_cfi_array_t *cfi_array, uint32_t adr, { data1 = URJ_BUS_READ (bus, adr); urj_log (URJ_LOG_LEVEL_DEBUG, - "amd_program_buffer_status %d: %04X (%04X) = %04X\n", - timeout, data1, (data1 & dq7mask), bit7); + "amd_program_buffer_status %d: %04lX (%04lX) = %04lX\n", + timeout, (long unsigned) data1, + (long unsigned) (data1 & dq7mask), (long unsigned) bit7); if ((data1 & dq7mask) == bit7) return URJ_STATUS_OK; if ((data1 & dq5mask) == dq5mask) break; - usleep (100); + // usleep (100); + struct timespec req = { 0, 100 * 1000 }; + nanosleep (&req, NULL); } data1 = URJ_BUS_READ (bus, adr); @@ -520,7 +538,8 @@ amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr, int offset = 0; urj_log (URJ_LOG_LEVEL_DEBUG, - "\nflash_program_buffer 0x%08X, count 0x%08X\n", adr, count); + "\nflash_program_buffer 0x%08lX, count 0x%08X\n", + (long unsigned) adr, count); while (count > 0) { diff --git a/urjtag/src/flash/amd_flash.c b/urjtag/src/flash/amd_flash.c index f744309d..e3485ba2 100644 --- a/urjtag/src/flash/amd_flash.c +++ b/urjtag/src/flash/amd_flash.c @@ -32,7 +32,8 @@ #include #include #include -#include +// #include /* usleep */ +#include // nanosleep #include #include @@ -71,7 +72,7 @@ static struct { - unsigned long flash; + long unsigned flash; unsigned short algorithm; unsigned short unlock_bypass; } @@ -97,7 +98,7 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, if (!*cfi_array) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) failed", - 1, sizeof (urj_flash_cfi_array_t)); + (size_t) 1, sizeof (urj_flash_cfi_array_t)); return URJ_STATUS_FAIL; } @@ -147,7 +148,7 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, if (!(*cfi_array)->cfi_chips) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - ba, sizeof (urj_flash_cfi_chip_t *)); + (size_t) ba, sizeof (urj_flash_cfi_chip_t *)); return URJ_STATUS_FAIL; } for (i = 0; i < ba; i++) @@ -156,7 +157,7 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, if (!(*cfi_array)->cfi_chips[i]) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_flash_cfi_chip_t)); + (size_t) 1, sizeof (urj_flash_cfi_chip_t)); return URJ_STATUS_FAIL; } (*cfi_array)->cfi_chips[i]->width = 1; //ba; @@ -227,7 +228,9 @@ amd_29xx040_status (urj_bus_t *bus, uint32_t adr, unsigned short data) return URJ_STATUS_FAIL; } } - usleep (50); + // usleep (50); + struct timespec req = { 0, 50 * 1000 }; + nanosleep (&req, NULL); } urj_error_set (URJ_ERROR_FLASH, "hardware failure"); @@ -292,7 +295,9 @@ amd_29xx040_read_array (urj_flash_cfi_array_t *cfi_array) cfi_array->address + 0x555, 0x90); URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x2AA, 0x00); - usleep (100); + // usleep (100); + struct timespec req = { 0, 100 * 1000 }; + nanosleep (&req, NULL); var_forced_detection.unlock_bypass = AMD_STANDARD_MODE; } URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x0, 0x0F0); /* AMD reset */ @@ -306,7 +311,8 @@ amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array, { urj_bus_t *bus = cfi_array->bus; - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08X\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08lX\n", + (long unsigned) adr); /* urj_log (URJ_LOG_LEVEL_NORMAL, "protected: %d\n", amdisprotected(ps, adr)); */ @@ -314,7 +320,9 @@ amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array, { URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0x90); URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x00); - usleep (100); + // usleep (100); + struct timespec req = { 0, 100 * 1000 }; + nanosleep (&req, NULL); var_forced_detection.unlock_bypass = AMD_STANDARD_MODE; } @@ -330,11 +338,13 @@ amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array, if (amd_29xx040_status (bus, adr, 0xff) == URJ_STATUS_OK) { - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08X DONE\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08lX DONE\n", + (long unsigned) adr); amd_29xx040_read_array (cfi_array); /* AMD reset */ return URJ_STATUS_OK; } - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08X FAILED\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_erase_block 0x%08lX FAILED\n", + (long unsigned) adr); /* Read Array */ amd_29xx040_read_array (cfi_array); /* AMD reset */ @@ -349,8 +359,8 @@ amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array, int status; urj_bus_t *bus = cfi_array->bus; - urj_log (URJ_LOG_LEVEL_DETAIL, "\nflash_program 0x%08X = 0x%08X\n", - adr, data); + urj_log (URJ_LOG_LEVEL_DETAIL, "\nflash_program 0x%08lX = 0x%08lX\n", + (long unsigned) adr, (long unsigned) data); if (var_forced_detection.algorithm == AMD_BYPASS_UNLOCK_ALGORITHM) { @@ -359,7 +369,9 @@ amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array, URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xaa); URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x55); URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0x20); - usleep (1000); + // usleep (1000); + struct timespec req = { 0, 100 * 1000 }; + nanosleep (&req, NULL); var_forced_detection.unlock_bypass = AMD_BYPASS_UNLOCK_MODE; } } @@ -400,7 +412,8 @@ static int amd_29xx040_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr) { - urj_log (URJ_LOG_LEVEL_NORMAL, "flash_unlock_block 0x%08X IGNORE\n", adr); + urj_log (URJ_LOG_LEVEL_NORMAL, "flash_unlock_block 0x%08lX IGNORE\n", + (long unsigned) adr); return URJ_STATUS_OK; } diff --git a/urjtag/src/flash/cfi.c b/urjtag/src/flash/cfi.c index b5764dfe..4614a15d 100644 --- a/urjtag/src/flash/cfi.c +++ b/urjtag/src/flash/cfi.c @@ -91,7 +91,7 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, if (!*cfi_array) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_flash_cfi_array_t)); + (size_t) 1, sizeof (urj_flash_cfi_array_t)); return URJ_STATUS_FAIL; } @@ -166,7 +166,7 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, { write1 (0, CFI_CMD_READ_ARRAY1); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_flash_cfi_chip_t)); + (size_t) 1, sizeof (urj_flash_cfi_chip_t)); return URJ_STATUS_FAIL; } cfi = &(*cfi_array)->cfi_chips[d / 8]->cfi; @@ -305,7 +305,8 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, { write1 (0, CFI_CMD_READ_ARRAY1); urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_flash_cfi_amd_pri_extened_query_structure_t) + (size_t) 1, + sizeof (urj_flash_cfi_amd_pri_extened_query_structure_t) + num_of_banks * sizeof (uint8_t)); return URJ_STATUS_FAIL; } diff --git a/urjtag/src/flash/detectflash.c b/urjtag/src/flash/detectflash.c index b877be2d..cd1967f5 100644 --- a/urjtag/src/flash/detectflash.c +++ b/urjtag/src/flash/detectflash.c @@ -181,28 +181,28 @@ urj_flash_detectflash (urj_log_level_t ll, urj_bus_t *bus, uint32_t adr) urj_log (ll, _("\tVpp [Programming] Supply Maximum Write/Erase voltage: %d mV\n"), cfi->system_interface_info.vpp_max_wev); urj_log (ll, _("\tTypical timeout per single byte/word program: %d us\n"), - cfi->system_interface_info.typ_single_write_timeout); + (int) cfi->system_interface_info.typ_single_write_timeout); urj_log (ll, _("\tTypical timeout for maximum-size multi-byte program: %d us\n"), - cfi->system_interface_info.typ_buffer_write_timeout); + (int) cfi->system_interface_info.typ_buffer_write_timeout); urj_log (ll, _("\tTypical timeout per individual block erase: %d ms\n"), - cfi->system_interface_info.typ_block_erase_timeout); + (int) cfi->system_interface_info.typ_block_erase_timeout); urj_log (ll, _("\tTypical timeout for full chip erase: %d ms\n"), - cfi->system_interface_info.typ_chip_erase_timeout); + (int) cfi->system_interface_info.typ_chip_erase_timeout); urj_log (ll, _("\tMaximum timeout for byte/word program: %d us\n"), - cfi->system_interface_info.max_single_write_timeout); + (int) cfi->system_interface_info.max_single_write_timeout); urj_log (ll, _("\tMaximum timeout for multi-byte program: %d us\n"), - cfi->system_interface_info.max_buffer_write_timeout); + (int) cfi->system_interface_info.max_buffer_write_timeout); urj_log (ll, _("\tMaximum timeout per individual block erase: %d ms\n"), - cfi->system_interface_info.max_block_erase_timeout); + (int) cfi->system_interface_info.max_block_erase_timeout); urj_log (ll, _("\tMaximum timeout for chip erase: %d ms\n"), - cfi->system_interface_info.max_chip_erase_timeout); + (int) cfi->system_interface_info.max_chip_erase_timeout); /* see 4.3.4 in [1] */ urj_log (ll, _("Device geometry definition:\n")); urj_log (ll, _("\tDevice Size: %d B (%d KiB, %d MiB)\n"), - cfi->device_geometry.device_size, - cfi->device_geometry.device_size / 1024, - cfi->device_geometry.device_size / (1024 * 1024)); + (int) cfi->device_geometry.device_size, + (int) (cfi->device_geometry.device_size / 1024), + (int) (cfi->device_geometry.device_size / (1024 * 1024))); /* see section 4 in [2] */ switch (cfi->device_geometry.device_interface) { @@ -228,7 +228,7 @@ urj_flash_detectflash (urj_log_level_t ll, urj_bus_t *bus, uint32_t adr) urj_log (ll, _("\tFlash Device Interface Code description: 0x%04X (%s)\n"), cfi->device_geometry.device_interface, _(s)); urj_log (ll, _("\tMaximum number of bytes in multi-byte program: %d\n"), - cfi->device_geometry.max_bytes_write); + (int) cfi->device_geometry.max_bytes_write); urj_log (ll, _("\tNumber of Erase Block Regions within device: %d\n"), cfi->device_geometry.number_of_erase_regions); urj_log (ll, _("\tErase Block Region Information:\n")); @@ -239,12 +239,12 @@ urj_flash_detectflash (urj_log_level_t ll, urj_bus_t *bus, uint32_t adr) { urj_log (ll, _("\t\tRegion %d:\n"), i); urj_log (ll, _("\t\t\tErase Block Size: %d B (%d KiB)\n"), - cfi->device_geometry.erase_block_regions[i]. + (int) cfi->device_geometry.erase_block_regions[i]. erase_block_size, - cfi->device_geometry.erase_block_regions[i]. + (int) cfi->device_geometry.erase_block_regions[i]. erase_block_size / 1024); urj_log (ll, _("\t\t\tNumber of Erase Blocks: %d\n"), - cfi->device_geometry.erase_block_regions[i]. + (int) cfi->device_geometry.erase_block_regions[i]. number_of_erase_blocks); } } diff --git a/urjtag/src/flash/flash.c b/urjtag/src/flash/flash.c index c4768619..966fd332 100644 --- a/urjtag/src/flash/flash.c +++ b/urjtag/src/flash/flash.c @@ -169,8 +169,8 @@ urj_flashmsbin (urj_bus_t *bus, FILE *f, int noverify) return URJ_STATUS_FAIL; } urj_log (URJ_LOG_LEVEL_NORMAL, - _("record: start = 0x%08X, len = 0x%08X, checksum = 0x%08X\n"), - a, l, c); + _("record: start = 0x%08lX, len = 0x%08lX, checksum = 0x%08lX\n"), + (long unsigned) a, (long unsigned) l, (long unsigned) c); if ((a == 0) && (c == 0)) break; if (l & 3) @@ -183,7 +183,8 @@ urj_flashmsbin (urj_bus_t *bus, FILE *f, int noverify) { uint32_t data; - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X"), a); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX"), + (long unsigned) a); urj_log (URJ_LOG_LEVEL_NORMAL, "\r"); // @@@@ RFHH check error state fread (&data, sizeof data, 1, f); @@ -221,8 +222,8 @@ urj_flashmsbin (urj_bus_t *bus, FILE *f, int noverify) return URJ_STATUS_FAIL; } urj_log (URJ_LOG_LEVEL_NORMAL, - _("record: start = 0x%08X, len = 0x%08X, checksum = 0x%08X\n"), - a, l, c); + _("record: start = 0x%08lX, len = 0x%08lX, checksum = 0x%08lX\n"), + (long unsigned) a, (long unsigned) l, (long unsigned) c); if ((a == 0) && (c == 0)) break; if (l & 3) @@ -235,7 +236,8 @@ urj_flashmsbin (urj_bus_t *bus, FILE *f, int noverify) { uint32_t data, readed; - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X"), a); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX"), + (long unsigned) a); urj_log (URJ_LOG_LEVEL_NORMAL, "\r"); // @@@@ RFHH check error state? fread (&data, sizeof data, 1, f); @@ -243,8 +245,9 @@ urj_flashmsbin (urj_bus_t *bus, FILE *f, int noverify) if (data != readed) { urj_error_set (URJ_ERROR_FLASH_PROGRAM, - _("verify error: 0x%08X vs. 0x%08X at addr %08X"), - readed, data, a); + _("verify error: 0x%08lX vs. 0x%08lX at addr %08lX"), + (long unsigned) readed, (long unsigned) data, + (long unsigned) a); return URJ_STATUS_FAIL; } a += 4; @@ -366,7 +369,8 @@ urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int noverify) int j; if ((adr & (BSIZE - 1)) == 0) { - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X"), adr); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX"), + (long unsigned) adr); urj_log (URJ_LOG_LEVEL_NORMAL, "\r"); } @@ -394,8 +398,8 @@ urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int noverify) } free (erased); - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X\n"), - adr - flash_driver->bus_width); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX\n"), + (long unsigned) adr - flash_driver->bus_width); flash_driver->readarray (urj_flash_cfi_array); @@ -422,7 +426,8 @@ urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int noverify) int j; if ((adr & 0xFF) == 0) { - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X"), adr); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX"), + (long unsigned) adr); urj_log (URJ_LOG_LEVEL_NORMAL, "\r"); } @@ -437,15 +442,16 @@ urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int noverify) if (data != readed) { urj_error_set (URJ_ERROR_FLASH_PROGRAM, - _("addr: 0x%08X\n verify error:\nread: 0x%08X\nexpected: 0x%08X\n"), - adr, readed, data); + _("addr: 0x%08lX\n verify error:\nread: 0x%08lX\nexpected: 0x%08lX\n"), + (long unsigned) adr, (long unsigned) readed, + (long unsigned) data); return URJ_STATUS_FAIL; } adr += flash_driver->bus_width; } } - urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08X\nDone.\n"), - adr - flash_driver->bus_width); + urj_log (URJ_LOG_LEVEL_NORMAL, _("addr: 0x%08lX\nDone.\n"), + (long unsigned) adr - flash_driver->bus_width); return URJ_STATUS_OK; } @@ -471,8 +477,8 @@ urj_flasherase (urj_bus_t *bus, uint32_t addr, int number) chip_width = urj_flash_cfi_array->cfi_chips[0]->width; urj_log (URJ_LOG_LEVEL_NORMAL, - _("\nErasing %d Flash block%s from address 0x%x\n"), number, - number > 1 ? "s" : "", addr); + _("\nErasing %d Flash block%s from address 0x%lx\n"), number, + number > 1 ? "s" : "", (long unsigned) addr); for (i = 1; i <= number; i++) { diff --git a/urjtag/src/flash/intel.c b/urjtag/src/flash/intel.c index c0f7f427..2a0913a9 100644 --- a/urjtag/src/flash/intel.c +++ b/urjtag/src/flash/intel.c @@ -133,7 +133,8 @@ _intel_flash_print_info (urj_log_level_t ll, urj_flash_cfi_array_t *cfi_array, urj_log (ll, _("Manufacturer: %s\n"), STD_MICN_MICRON_TECHNOLOGY); break; default: - urj_log (ll, _("Unknown manufacturer (0x%04X)!\n"), mid); + urj_log (ll, _("Unknown manufacturer (0x%04lX)!\n"), + (long unsigned) mid); break; } @@ -190,7 +191,7 @@ _intel_flash_print_info (urj_log_level_t ll, urj_flash_cfi_array_t *cfi_array, urj_log (ll, "GE28F256L18B\n"); break; default: - urj_log (ll, _("Unknown (0x%02X)!\n"), cid); + urj_log (ll, _("Unknown (0x%02lX)!\n"), (long unsigned) cid); break; } @@ -425,7 +426,8 @@ intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr) if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) { - urj_error_set (URJ_ERROR_FLASH_ERASE, "sr = 0x%08X", sr); + urj_error_set (URJ_ERROR_FLASH_ERASE, "sr = 0x%08lX", + (long unsigned) sr); return URJ_STATUS_FAIL; } @@ -453,7 +455,8 @@ intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array, if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) { - urj_error_set (URJ_ERROR_FLASH_UNLOCK, "sr = 0x%08X", sr); + urj_error_set (URJ_ERROR_FLASH_UNLOCK, "sr = 0x%08lX", + (long unsigned) sr); return URJ_STATUS_FAIL; } @@ -478,7 +481,8 @@ intel_flash_program32_single (urj_flash_cfi_array_t *cfi_array, if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) { - urj_error_set (URJ_ERROR_FLASH_PROGRAM, "sr = 0x%08X", sr); + urj_error_set (URJ_ERROR_FLASH_PROGRAM, "sr = 0x%08lX", + (long unsigned) sr); return URJ_STATUS_FAIL; } diff --git a/urjtag/src/flash/jedec.c b/urjtag/src/flash/jedec.c index 12f7d707..b7927edf 100644 --- a/urjtag/src/flash/jedec.c +++ b/urjtag/src/flash/jedec.c @@ -414,7 +414,7 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, if (!*cfi_array) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_flash_cfi_array_t)); + (size_t) 1, sizeof (urj_flash_cfi_array_t)); return URJ_STATUS_FAIL; } @@ -435,7 +435,7 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, if (!(*cfi_array)->cfi_chips) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_flash_cfi_chip_t *) * ba); + (size_t) 1, sizeof (urj_flash_cfi_chip_t *) * ba); return URJ_STATUS_FAIL; } @@ -443,7 +443,7 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, if (!(*cfi_array)->cfi_chips[0]) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - 1, sizeof (urj_flash_cfi_chip_t)); + (size_t) 1, sizeof (urj_flash_cfi_chip_t)); return URJ_STATUS_FAIL; } diff --git a/urjtag/src/lib/Makefile.am b/urjtag/src/lib/Makefile.am index aa2b897c..ed32b1fd 100644 --- a/urjtag/src/lib/Makefile.am +++ b/urjtag/src/lib/Makefile.am @@ -41,6 +41,7 @@ endif libjtaglib_la_SOURCES = \ fclock.c \ + usleep.c \ $(libiberty_sources) AM_CFLAGS = $(WARNINGCFLAGS) diff --git a/urjtag/src/svf/Makefile.am b/urjtag/src/svf/Makefile.am index 5695057e..5ad0171a 100644 --- a/urjtag/src/svf/Makefile.am +++ b/urjtag/src/svf/Makefile.am @@ -42,8 +42,7 @@ AM_CFLAGS = $(WARNINGCFLAGS) libsvf_flex_la_CFLAGS = \ $(AM_CFLAGS) \ - -Wno-unused-function \ - -Werror=missing-prototypes -Wno-error=missing-prototypes + -Wno-error svf_bison.h: svf_bison.c diff --git a/urjtag/src/svf/svf.c b/urjtag/src/svf/svf.c index 3db8f386..39b932ef 100644 --- a/urjtag/src/svf/svf.c +++ b/urjtag/src/svf/svf.c @@ -49,6 +49,9 @@ #include #include #include +#if defined __MINGW32__ || ! defined HAVE_SIGACTION_SA_ONESHOT +#include +#endif #include "svf.h" @@ -545,7 +548,7 @@ urj_svf_all_care (char **string, double number) if (!(ptr = calloc (num + 1, sizeof (char)))) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, _("calloc(%zd,%zd) fails"), - num + 1, sizeof (char)); + (size_t) (num + 1), sizeof (char)); return URJ_STATUS_FAIL; } memset (ptr, 'F', num); @@ -624,13 +627,14 @@ urj_svf_hxr (enum generic_irdr_coding ir_dr, struct ths_params *params) return URJ_STATUS_OK; } - +#if ! (defined __MINGW32__ || ! defined HAVE_SIGACTION_SA_ONESHOT) static int max_time_reached; static void sigalrm_handler (int signal) { max_time_reached = 1; } +#endif /* *************************************************************************** @@ -713,7 +717,7 @@ urj_svf_runtest (urj_chain_t *chain, urj_svf_parser_priv_t *priv, urj_svf_goto_state (chain, priv->runtest_run_state); -#ifdef __MINGW32__ +#if defined __MINGW32__ || ! defined HAVE_SIGACTION_SA_ONESHOT if (params->max_time > 0.0) { double maxt = urj_lib_frealtime () + params->max_time; diff --git a/urjtag/src/svf/svf_flex.l b/urjtag/src/svf/svf_flex.l index 12dca470..7afda935 100644 --- a/urjtag/src/svf/svf_flex.l +++ b/urjtag/src/svf/svf_flex.l @@ -31,7 +31,7 @@ %option bison-locations %{ -#include +#include #include #include diff --git a/urjtag/src/tap/cable.c b/urjtag/src/tap/cable.c index 149be0e7..f25473eb 100644 --- a/urjtag/src/tap/cable.c +++ b/urjtag/src/tap/cable.c @@ -566,7 +566,8 @@ urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in, ibuf = malloc (len); if (ibuf == NULL) { - urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", len); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + (size_t) len); return URJ_STATUS_FAIL; } @@ -576,7 +577,8 @@ urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in, if (obuf == NULL) { free (ibuf); - urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", len); + urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails", + (size_t) len); return URJ_STATUS_FAIL; } } diff --git a/urjtag/src/tap/cable/cmd_xfer.c b/urjtag/src/tap/cable/cmd_xfer.c index 7b06b6a4..419d55c9 100644 --- a/urjtag/src/tap/cable/cmd_xfer.c +++ b/urjtag/src/tap/cable/cmd_xfer.c @@ -228,7 +228,7 @@ urj_tap_cable_cx_cmd_queue (urj_tap_cable_cx_cmd_root_t *cmd_root, if (cmd == NULL) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd)/malloc(%zd) fails", - sizeof (urj_tap_cable_cx_cmd_t), 64); + sizeof (urj_tap_cable_cx_cmd_t), (size_t) 64); } return cmd; diff --git a/urjtag/src/tap/cable/generic.c b/urjtag/src/tap/cable/generic.c index 9e77118a..cada586c 100644 --- a/urjtag/src/tap/cable/generic.c +++ b/urjtag/src/tap/cable/generic.c @@ -398,8 +398,8 @@ urj_tap_cable_generic_set_frequency (urj_cable_t *cable, return; urj_log (URJ_LOG_LEVEL_NORMAL, - "requested frequency %u, now calibrating delay loop\n", - new_frequency); + "requested frequency %lu, now calibrating delay loop\n", + (long unsigned) new_frequency); while (1) { @@ -428,8 +428,9 @@ urj_tap_cable_generic_set_frequency (urj_cable_t *cable, continue; } real_frequency = (long double) loops / (end - start); - urj_log (URJ_LOG_LEVEL_NORMAL, "new real frequency %Lg, delay %u\n", - real_frequency, delay); + urj_log (URJ_LOG_LEVEL_NORMAL, + "new real frequency %Lg, delay %lu\n", + real_frequency, (long unsigned) delay); new_delay = (long double) delay *real_frequency / new_frequency; diff --git a/urjtag/src/tap/detect.c b/urjtag/src/tap/detect.c index f3b69fad..32152b1f 100644 --- a/urjtag/src/tap/detect.c +++ b/urjtag/src/tap/detect.c @@ -471,7 +471,7 @@ urj_tap_manual_add (urj_chain_t *chain, int instr_len) if (str == NULL) { urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "calloc(%zd,%zd) fails", - instr_len + 1, sizeof (char)); + (size_t) instr_len + 1, sizeof (char)); return -1; } diff --git a/urjtag/src/tap/usbconn.c b/urjtag/src/tap/usbconn.c index 237644dd..e76dd58b 100644 --- a/urjtag/src/tap/usbconn.c +++ b/urjtag/src/tap/usbconn.c @@ -24,7 +24,7 @@ #include -#include +#include #include #include diff --git a/urjtag/sysdep.h b/urjtag/sysdep.h index 26cc51c4..aec3a5d7 100644 --- a/urjtag/sysdep.h +++ b/urjtag/sysdep.h @@ -53,4 +53,8 @@ #define swprintf _snwprintf #endif +#ifndef HAVE_USLEEP +int usleep (long unsigned usec); +#endif + #endif /* SYSDEP_H */