From: Nathael Pajani Date: Thu, 3 Oct 2013 21:44:38 +0000 (+0200) Subject: Fix read for parts not using uuencode data transfer. X-Git-Tag: v1.04 X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=d02fdfe98c7bdec1eb7962f5bb916d102ed97eeb;p=soft%2Ftools%2Flpctools Fix read for parts not using uuencode data transfer. Make it version 1.04 --- diff --git a/isp_commands.c b/isp_commands.c index 074fe4d..34c4c28 100644 --- a/isp_commands.c +++ b/isp_commands.c @@ -387,19 +387,17 @@ int isp_read_memory(char* data, uint32_t addr, unsigned int count, unsigned int } if (uuencoded == 0) { - if (SERIAL_BUFSIZE < count) { - printf("Error when trying to read %u bytes of memory, buffer too small.\n", count); - printf("Read %d max bytes at a time.\n", SERIAL_BUFSIZE); - return -7; - } - len = isp_serial_read(buf, SERIAL_BUFSIZE, count); + len = isp_serial_read(data, count, count); if (len <= 0) { printf("Error reading memory.\n"); return -6; } + if (len == (int)count) { + return len; + } /* Wait some time before reading possible remaining data */ usleep( 1000 ); - len += isp_serial_read((buf + len), (SERIAL_BUFSIZE - len), count); + len += isp_serial_read((data + len), (count - len), (count - len)); if (len < 0) { /* Length may be null, as we may already have received everything */ printf("Error reading memory.\n"); return -5; diff --git a/lpcisp.c b/lpcisp.c index 846d197..5a317d9 100644 --- a/lpcisp.c +++ b/lpcisp.c @@ -34,7 +34,7 @@ #include "isp_commands.h" #define PROG_NAME "LPC ISP" -#define VERSION "1.03" +#define VERSION "1.04" /* short explanation on exit values: * diff --git a/lpcprog.1 b/lpcprog.1 index 92ae1e0..97ed7d1 100644 --- a/lpcprog.1 +++ b/lpcprog.1 @@ -1,4 +1,4 @@ -.TH LPCPROG "1" "August 2013" "LPC Tools 1.03" "User development Tools" +.TH LPCPROG "1" "August 2013" "LPC Tools 1.04" "User development Tools" .SH NAME lpcprog \- NXP's LPC micro-controllers flasher .SH SYNOPSIS diff --git a/lpcprog.c b/lpcprog.c index d12e682..137323a 100644 --- a/lpcprog.c +++ b/lpcprog.c @@ -37,7 +37,7 @@ #include "parts.h" #define PROG_NAME "LPC ISP Prog tool" -#define VERSION "1.03" +#define VERSION "1.04" void help(char *prog_name)