#include <ftdi.h>
#include <unistd.h>
#include <pthread.h>
+#include <inttypes.h>
#include "usb-driver.h"
#include "config.h"
#include "jtagkey.h"
}
}
-void jtagkey_state(unsigned char data) {
+#ifdef DEBUG
+static void jtagkey_state(unsigned char data) {
fprintf(stderr,"Pins high: ");
if (data & JTAGKEY_TCK)
fprintf(stderr,"\n");
}
+#endif
struct jtagkey_reader_arg {
int num;
unsigned char *pos = writebuf;
int len;
- DPRINTF("writing %d bytes due to %d following reads in %d chunks or full buffer\n", writepos-writebuf, nread, num);
+ DPRINTF("writing %zd bytes due to %d following reads in %d chunks or full buffer\n", writepos-writebuf, nread, num);
jtagkey_latency(BULK_LATENCY);
targ.num = writepos-pos;
if (len > USBBUFSIZE)
len = USBBUFSIZE;
- DPRINTF("combined write of %d/%d\n",len,writepos-pos);
+ DPRINTF("combined write of %d/%zd\n",len,writepos-pos);
ftdi_write_data(&ftdic, pos, len);
pos += len;
}
if (nread)
{
- DPRINTF("writing %d bytes\n", writepos-writebuf);
+ DPRINTF("writing %zd bytes\n", writepos-writebuf);
*writepos = last_data;
writepos++;
pthread_join(reader_thread, NULL);
#ifdef DEBUG
- DPRINTF("write: ");
- hexdump(writebuf, writepos-writebuf);
- DPRINTF("read: ");
- hexdump(readbuf, i);
+ hexdump(writebuf, writepos-writebuf, "->");
+ hexdump(readbuf, i, "<-");
#endif
writepos = writebuf;