diff cmu200/main.c @ 0:bd62be88259d

initial import of rfcal code and docs from freecalypso-tools repository
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 May 2017 18:49:35 +0000
parents
children 6d7079a81e8b
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmu200/main.c	Sat May 20 18:49:35 2017 +0000
@@ -0,0 +1,35 @@
+/*
+ * This module contains the main() function for fc-cmu200d.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int target_fd;
+
+static char default_socket_pathname[] = "/tmp/fc_rftest_socket";
+
+char *bind_socket_pathname;
+
+main(argc, argv)
+	char **argv;
+{
+	if (argc < 3 || argc > 4) {
+		fprintf(stderr,
+			"usage: %s serial-port baud [socket-pathname]\n",
+			argv[0]);
+		exit(1);
+	}
+	open_target_serial(argv[1], argv[2]);
+	set_serial_nonblock(0);
+	init_cmu200();
+	if (argc > 3)
+		bind_socket_pathname = argv[3];
+	else
+		bind_socket_pathname = default_socket_pathname;
+	create_listener_socket();
+	for (;;) {
+		get_socket_connection();
+		handle_session();
+	}
+}