diff rvinterf/lowlevel/tfc139.c @ 253:6f078c4a5506

rvinterf and friends converted to use libserial
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 21 Sep 2017 23:45:05 +0000
parents e7502631a0f9
children
line wrap: on
line diff
--- a/rvinterf/lowlevel/tfc139.c	Thu Sep 21 23:30:53 2017 +0000
+++ b/rvinterf/lowlevel/tfc139.c	Thu Sep 21 23:45:05 2017 +0000
@@ -22,7 +22,6 @@
 #include "../include/limits.h"
 
 extern int target_fd;
-extern char *baudrate_name;
 
 extern u_char rxpkt[];
 extern size_t rxpkt_len;
@@ -61,6 +60,7 @@
 static int breakin_in_progress;
 
 static char *target_tty_port;
+static char *baudrate = "57600";
 
 static void
 send_compal_memwrite(addr, payload, payload_len)
@@ -139,14 +139,13 @@
 	int c;
 	fd_set fds;
 
-	baudrate_name = "57600";	/* what C139 firmware uses */
 	while ((c = getopt(argc, argv, "a:AB:l:ms:w:")) != EOF)
 		switch (c) {
 		case 'a':
 			shellcode_load_addr = strtoul(optarg, 0, 16);
 			continue;
 		case 'B':
-			baudrate_name = optarg;
+			baudrate = optarg;
 			continue;
 		case 'l':
 			logfname = optarg;
@@ -177,8 +176,9 @@
 		fprintf(stderr, "usage error: -a option required with -s\n");
 		exit(1);
 	}
-	open_target_serial(argv[optind]);
+	open_serial_port(argv[optind]);
 	target_tty_port = argv[optind];
+	set_fixed_baudrate(baudrate);
 
 	set_serial_nonblock(0);
 	setlinebuf(stdout);