diff sw/mcsi-rxtx/main.c @ 7:8a386263dd51

fc-mcsi-rxtx skeleton put together
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 28 Oct 2024 01:44:28 +0000
parents sw/mcsi-rx/main.c@de85c3680d7e
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sw/mcsi-rxtx/main.c	Mon Oct 28 01:44:28 2024 +0000
@@ -0,0 +1,36 @@
+/*
+ * Main module for fc-mcsi-rxtx program: interactive, modeled after fc-shell.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int ttyhacks, dflag;
+
+main(argc, argv)
+	char **argv;
+{
+	extern int optind;
+	int c;
+
+	while ((c = getopt(argc, argv, "d")) != EOF) {
+		switch (c) {
+		case 'd':
+			dflag++;
+			continue;
+		default:
+		usage:
+			fprintf(stderr, "usage: %s [-d] ttyport\n", argv[0]);
+			exit(1);
+		}
+	}
+	if (argc != optind + 1)
+		goto usage;
+	open_serial_port(argv[optind]);
+	set_serial_baudrate(187500);
+	init_serial_flush();
+	ttyhacks = isatty(0) && !dflag;
+	tty_init();
+	main_loop();		/* does not return */
+}