aboutsummaryrefslogtreecommitdiffstats
path: root/memdump/main.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-02-05 18:03:14 -0800
committerH. Peter Anvin <hpa@zytor.com>2010-02-05 18:03:14 -0800
commit3dededd20d70d571268417dc41edc95f0fe6602e (patch)
treea3c64b598884588323d6f0c08c9034a30f3f9b95 /memdump/main.c
parent88c00aca310b7bade07833d3021cae9da266eae7 (diff)
downloadsyslinux.git-3dededd20d70d571268417dc41edc95f0fe6602e.tar.gz
syslinux.git-3dededd20d70d571268417dc41edc95f0fe6602e.tar.xz
syslinux.git-3dededd20d70d571268417dc41edc95f0fe6602e.zip
memdump: allow outputting S-records
Allow outputting S-records, for users who only have the capability of passively monitoring a serial port as opposed to being able to capture the contents directly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'memdump/main.c')
-rw-r--r--memdump/main.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/memdump/main.c b/memdump/main.c
index 02f2a4fc..068f657e 100644
--- a/memdump/main.c
+++ b/memdump/main.c
@@ -13,8 +13,10 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <stdbool.h>
#include "mystuff.h"
#include "ymsend.h"
+#include "srecsend.h"
#include "io.h"
const char *program = "memdump";
@@ -89,10 +91,17 @@ int main(int argc, char *argv[])
.write = serial_write,
};
struct file_info finfo;
- const char serial_banner[] = "Now begin Ymodem download...\r\n";
+ const char ymodem_banner[] = "Now begin Ymodem download...\r\n";
+ bool srec = false;
+
+ if (argv[1][0] == '-') {
+ srec = argv[1][1] == 's';
+ argc--;
+ argv++;
+ }
if (argc < 4)
- die("usage: memdump port prefix start,len...");
+ die("usage: memdump [-s] port prefix start,len...");
finfo.pvt = (void *)0x400;
get_bytes(bios_ports, 8, &finfo, 0); /* Get BIOS serial ports */
@@ -110,8 +119,10 @@ int main(int argc, char *argv[])
prefix = argv[2];
- puts("Printing prefix...\n");
- sif.write(&sif, serial_banner, sizeof serial_banner - 1);
+ if (!srec) {
+ puts("Printing prefix...\n");
+ sif.write(&sif, ymodem_banner, sizeof ymodem_banner - 1);
+ }
for (i = 3; i < argc; i++) {
uint32_t start, len;
@@ -131,11 +142,16 @@ int main(int argc, char *argv[])
puts(filename);
puts("...\n");
- send_ymodem(&sif, &finfo, get_bytes);
+ if (srec)
+ send_srec(&sif, &finfo, get_bytes);
+ else
+ send_ymodem(&sif, &finfo, get_bytes);
}
- puts("Sending closing signature...\n");
- end_ymodem(&sif);
+ if (!srec) {
+ puts("Sending closing signature...\n");
+ end_ymodem(&sif);
+ }
return 0;
}