diff ringtools/fc-e1gen.c @ 172:c138906889f7

fc-e1gen & e1-experiments: added global oscillator set header word
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 22 Mar 2017 21:56:33 +0000
parents cefdc6623322
children b002c7cf5d03
line wrap: on
line diff
--- a/ringtools/fc-e1gen.c	Wed Mar 22 18:21:03 2017 +0000
+++ b/ringtools/fc-e1gen.c	Wed Mar 22 21:56:33 2017 +0000
@@ -18,6 +18,7 @@
 char linebuf[512], *fields[MAX_FIELDS+1];
 int lineno, nfields;
 
+int global_osc_set;
 int start_time, osc_mask;
 u_short osc_words[8][4];
 
@@ -217,11 +218,6 @@
 			infname, lineno);
 		exit(1);
 	}
-	if (!osc_mask) {
-		fprintf(stderr, "%s line %d: no oscillators defined\n",
-			infname, lineno);
-		exit(1);
-	}
 }
 
 emit_16bit_word(word)
@@ -250,6 +246,33 @@
 	}
 }
 
+handle_global_osc_set()
+{
+	int p;
+	int oscn, osc_bit;
+
+	do
+		get_input_line();
+	while (!nfields);
+	if (strcmp(fields[0], "osc-set")) {
+		fprintf(stderr, "%s line %d: osc-set line expected\n",
+			infname, lineno);
+		exit(1);
+	}
+	if (nfields < 2) {
+		fprintf(stderr, "%s line %d: osc-set must be non-empty\n",
+			infname, lineno);
+		exit(1);
+	}
+	for (p = 1; p < nfields; p++) {
+		oscn = input_number(fields[p], 0, 7);
+		osc_bit = 1 << oscn;
+		global_osc_set |= osc_bit;
+	}
+	putc(0, outf);
+	putc(global_osc_set, outf);
+}
+
 main(argc, argv)
 	char **argv;
 {
@@ -275,6 +298,7 @@
 		exit(1);
 	}
 
+	handle_global_osc_set();
 	/* main loop */
 	for (;;) {
 		do