comparison loadtools/chainload.c @ 651:6bb41b4d39ed

fc-xram number of records per batch made baudrate-dependent
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 02 Mar 2020 03:39:46 +0000
parents bf840c984113
children 9f5a3e9e6294
comparison
equal deleted inserted replaced
650:bf840c984113 651:6bb41b4d39ed
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <strings.h> 10 #include <strings.h>
11 #include <time.h> 11 #include <time.h>
12 #include "../libserial/baudrate.h"
12 #include "srecreader.h" 13 #include "srecreader.h"
13 14
14 extern int target_fd; 15 extern int target_fd;
15 16
16 struct srecreader xramimage; 17 struct srecreader xramimage;
69 "%s line %d: S3 record has zero data length\n", 70 "%s line %d: S3 record has zero data length\n",
70 xramimage.filename, xramimage.lineno); 71 xramimage.filename, xramimage.lineno);
71 exit(1); 72 exit(1);
72 } 73 }
73 if (!rec_count) { 74 if (!rec_count) {
74 printf("Each \'.\' is 100 S-records\n"); 75 printf("Each \'.\' is %d S-records\n",
76 current_baud_rate->xram_records);
75 time(&start_time); 77 time(&start_time);
76 } 78 }
77 reclen = xramimage.datalen + 6; 79 reclen = xramimage.datalen + 6;
78 if (write(target_fd, xramimage.record, reclen) != reclen) { 80 if (write(target_fd, xramimage.record, reclen) != reclen) {
79 perror("binary write to target"); 81 perror("binary write to target");
80 exit(1); 82 exit(1);
81 } 83 }
82 rec_count++; 84 rec_count++;
83 if (rec_count % 100 == 0) { 85 if (rec_count % current_baud_rate->xram_records == 0) {
84 scratch[0] = 0x05; /* ENQ */ 86 scratch[0] = 0x05; /* ENQ */
85 write(target_fd, scratch, 1); 87 write(target_fd, scratch, 1);
86 if (collect_binblock_from_target(scratch, 3, 1)) 88 if (collect_binblock_from_target(scratch, 3, 1))
87 exit(1); 89 exit(1);
88 expect_conf[1] = rec_count >> 8; 90 expect_conf[1] = rec_count >> 8;