changeset 297:b1ac1bd1dbbf

c1xx-calextr: table conversion implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 18 Nov 2017 17:45:10 +0000
parents 77d561735b07
children 734b38f634db
files ffstools/caltools/c1xx-calextr.c
diffstat 1 files changed, 39 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ffstools/caltools/c1xx-calextr.c	Sat Nov 18 17:30:26 2017 +0000
+++ b/ffstools/caltools/c1xx-calextr.c	Sat Nov 18 17:45:10 2017 +0000
@@ -65,6 +65,43 @@
 	close(fd);
 }
 
+do_rx_agcparams(band, compal_data)
+	struct band *band;
+	u_char *compal_data;
+{
+	u_char rx_agcparams_table[8];
+
+	bcopy(compal_data, rx_agcparams_table, 2);
+	/* the remaining fields are constants unchanged from TI */
+	rx_agcparams_table[2] = 40;
+	rx_agcparams_table[3] = 0;
+	rx_agcparams_table[4] = 40;
+	rx_agcparams_table[5] = 0;
+	rx_agcparams_table[6] = 44;
+	rx_agcparams_table[7] = 0;
+	/* ASCII and binary write-out to be implemented */
+}
+
+do_tx_levels(band, compal_data)
+	struct band *band;
+	u_char *compal_data;
+{
+	u_char tx_levels_table[128], *sp, *dp;
+	unsigned num_levels, n;
+
+	bzero(tx_levels_table, sizeof tx_levels_table);
+	num_levels = band->end_plnum - band->start_plnum;
+	sp = compal_data;
+	dp = tx_levels_table + band->start_plnum * 4;
+	for (n = 0; n < num_levels; n++) {
+		*dp++ = *sp++;
+		*dp++ = *sp++;
+		*dp++ = n;
+		*dp++ = 0;
+	}
+	/* ASCII and binary write-out to be implemented */
+}
+
 process_band_record(band, offset)
 	struct band *band;
 	unsigned offset;
@@ -84,7 +121,8 @@
 		printf("bad magic3, skipping\n");
 		return(-1);
 	}
-	/* Rx GMagic and Tx levels extraction to be filled */
+	do_rx_agcparams(band, record + 4);
+	do_tx_levels(band, record + band->magic2_offset + 12);
 	return(0);
 }