Fix read for parts not using uuencode data transfer. v1.04
authorNathael Pajani <nathael.pajani@ed3l.fr>
Thu, 3 Oct 2013 21:44:38 +0000 (23:44 +0200)
committerNathael Pajani <nathael.pajani@ed3l.fr>
Thu, 3 Oct 2013 21:44:38 +0000 (23:44 +0200)
Make it version 1.04

isp_commands.c
lpcisp.c
lpcprog.1
lpcprog.c

index 074fe4d..34c4c28 100644 (file)
@@ -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;
index 846d197..5a317d9 100644 (file)
--- 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:
  *
index 92ae1e0..97ed7d1 100644 (file)
--- 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
index d12e682..137323a 100644 (file)
--- 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)