changeset 340:435e041897f2

fluid-mnf/machine.c: passes compilation
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 13 Mar 2020 02:47:52 +0000
parents 77c86062e253
children 1cd24530c0ae
files fluid-mnf/machine.c
diffstat 1 files changed, 30 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/fluid-mnf/machine.c	Fri Mar 13 02:33:21 2020 +0000
+++ b/fluid-mnf/machine.c	Fri Mar 13 02:47:52 2020 +0000
@@ -15,13 +15,13 @@
 #include "flash.h"
 #include "target.h"
 #include "fileio.h"
-#include "../target/protocol.h"
+#include "protocol.h"
 #include "misc.h"
 #include "lz.h"
 #include "trace.h"
 // Secure Calypso Plus
-#include "../inc/ram_load.h"
-#include "../inc/secure_types.h"
+#include "calplus/ram_load.h"
+#include "calplus/secure_types.h"
 
 #include <stdio.h>
 #include <malloc.h>
@@ -1507,7 +1507,7 @@
     uint32 addr, cksum, mycksum;
     uint16 word;
     uint8  data[4];
-    int index = 0, chunks, n, i, j;
+    int img_index = 0, chunks, n, i, j;
     int line = -1;
     struct {
         uint32 index;
@@ -1533,26 +1533,26 @@
 
         for (i = 0; i < n; i++) {
             // Find next used entry in image_map
-            while (image_map[index] != 'x' && index < image_map_size)
-                index++;
-
-            if (index == image_map_size)
+            while (image_map[img_index] != 'x' && img_index < image_map_size)
+                img_index++;
+
+            if (img_index == image_map_size)
                 break;
 
-            addr = index * image_chunk_size;
-            block[i].index   = index;
+            addr = img_index * image_chunk_size;
+            block[i].index   = img_index;
             block[i].addr    = addr;
 
             buf += buf_put4(buf, addr);
 
-            index++;
+            img_index++;
         }
         target_send(sendbuf, buf - sendbuf);
 
         // Compute checksums while we wait for reply
         for (i = 0; i < n; i++) {
-            index = block[i].index;
-            addr  = block[i].addr;
+            img_index = block[i].index;
+            addr = block[i].addr;
             for (j = 0, mycksum = 0; j < image_chunk_size; j += 2) {
                 word = (image[addr + j + 1] << 8) | image[addr + j + 0];
                 mycksum += word * ((addr + j) & 0xFFFF);
@@ -1567,17 +1567,17 @@
             target_recv(data, 4);
             cksum   = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24);
             mycksum = block[i].mycksum;
-            index   = block[i].index;
+            img_index = block[i].index;
 
             if (cksum == mycksum)
-                image_map[index] = 'c';
+                image_map[img_index] = 'c';
 
             if (arg_checksum_show) {
                 // This is a far from perfect dump of checksums... We don't know
                 // the exact block number of each checksum in a line.
-                if (line != (int) index / 4) {
-                    flowf(NORMAL, "\n%4d:", index);
-                    line = index / 4;
+                if (line != (int) img_index / 4) {
+                    flowf(NORMAL, "\n%4d:", img_index);
+                    line = img_index / 4;
                 }
                 if (cksum == mycksum)
                     flowf(NORMAL, "%08X          ", cksum);
@@ -1586,10 +1586,10 @@
 
             }
             else if (arg_verbose >= VERBOSE) {
-                flowf(VERBOSE, "%c", (image_map[index] == 'c' ? 'c' : '.'));
+                flowf(VERBOSE, "%c", (image_map[img_index] == 'c' ? 'c' : '.'));
             }
         }
-        index++;
+        img_index++;
         chunks -= n;
     }
     time_checksum = (stopwatch_stop(time_checksum) + 50) / 100;
@@ -1604,7 +1604,7 @@
 
 int time_program;
 int programs_recv, programs_send, erasures;
-int index, src_size;
+int img_index, src_size;
 uint32 dst;
 char *src;
 
@@ -1621,7 +1621,7 @@
     char ch;
 
     programs_recv = programs_send = erasures = 0;
-    index = 0;
+    img_index = 0;
 
     // Prepare erase
     erase_list_size = sectors = sector_map_init();
@@ -1796,13 +1796,13 @@
     int oldindex;
 
     // Find next used entry in image_map
-    while (index < image_map_size && image_map[index] != 'x')
-        index++;
-
-    oldindex = index;
-
-    if (index < image_map_size) {
-        dst = index * image_chunk_size;
+    while (img_index < image_map_size && image_map[img_index] != 'x')
+        img_index++;
+
+    oldindex = img_index;
+
+    if (img_index < image_map_size) {
+        dst = img_index * image_chunk_size;
         if (arg_compress) {
             src_size = compress(src, &image[dst], image_chunk_size);
         }
@@ -1810,7 +1810,7 @@
             src = &image[dst];
             src_size = image_chunk_size;
         }
-        index++;
+        img_index++;
     }
     else {
         dst = 0xFFFFFFFF;