changeset 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 f736f3ce8310
children 64b37ad18f7a
files ringtools/e1-experiments/test1.src ringtools/e1-experiments/test2.src ringtools/fc-e1gen.c
diffstat 3 files changed, 33 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ringtools/e1-experiments/test1.src	Wed Mar 22 18:21:03 2017 +0000
+++ b/ringtools/e1-experiments/test1.src	Wed Mar 22 21:56:33 2017 +0000
@@ -1,3 +1,5 @@
+osc-set 0
+
 time 1
 osc 0 df 8135 120
 
--- a/ringtools/e1-experiments/test2.src	Wed Mar 22 18:21:03 2017 +0000
+++ b/ringtools/e1-experiments/test2.src	Wed Mar 22 21:56:33 2017 +0000
@@ -1,3 +1,5 @@
+osc-set 0
+
 time 1
 osc 0 63 32 20
 
--- 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