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
master
Rutger Hofman 16 years ago
parent d7adb29de7
commit 7384c11cab

@ -1,3 +1,13 @@
2009-05-18 Rutger Hofman <rfhh>
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 <arniml>
* src/flash/amd.c: added Winbond W19B320AT/B flash chip

@ -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 <signal.h>], [
#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)

@ -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 */

@ -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 */

@ -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

@ -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;
}

@ -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)
{

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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 = {

@ -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;

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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++)

@ -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;
}

@ -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");

@ -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;
}

@ -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;
}

@ -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;
}

@ -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:

@ -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;

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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);

@ -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;
}

@ -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)
{

@ -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];

@ -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)
{

@ -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;
}

@ -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;

@ -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

@ -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)
{

@ -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;
}

@ -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)
{

@ -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;

@ -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;

@ -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);
}

@ -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)

@ -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)

@ -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;
}

@ -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);

@ -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);
}

@ -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)

@ -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)
{

@ -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;

@ -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;

@ -24,10 +24,11 @@
#include <sysdep.h>
#include <unistd.h>
// #include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <urjtag/error.h>
#include <urjtag/cmd.h>
@ -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;
}

@ -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)

@ -38,7 +38,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h> /* usleep */
// #include <unistd.h> /* usleep */
#include <sys/time.h> // nanosleep
#include <urjtag/log.h>
#include <urjtag/error.h>
@ -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)
{

@ -32,7 +32,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
// #include <unistd.h> /* usleep */
#include <sys/time.h> // nanosleep
#include <urjtag/log.h>
#include <urjtag/error.h>
@ -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;
}

@ -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;
}

@ -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);
}
}

@ -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++)
{

@ -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;
}

@ -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;
}

@ -41,6 +41,7 @@ endif
libjtaglib_la_SOURCES = \
fclock.c \
usleep.c \
$(libiberty_sources)
AM_CFLAGS = $(WARNINGCFLAGS)

@ -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

@ -49,6 +49,9 @@
#include <urjtag/data_register.h>
#include <urjtag/cmd.h>
#include <urjtag/svf.h>
#if defined __MINGW32__ || ! defined HAVE_SIGACTION_SA_ONESHOT
#include <urjtag/fclock.h>
#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;

@ -31,7 +31,7 @@
%option bison-locations
%{
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

@ -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;
}
}

@ -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;

@ -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;

@ -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;
}

@ -24,7 +24,7 @@
#include <sysdep.h>
#include <strings.h>
#include <string.h>
#include <stddef.h>
#include <urjtag/usbconn.h>

@ -53,4 +53,8 @@
#define swprintf _snwprintf
#endif
#ifndef HAVE_USLEEP
int usleep (long unsigned usec);
#endif
#endif /* SYSDEP_H */

Loading…
Cancel
Save