# HG changeset patch # User Mychaela Falconia # Date 1511027915 0 # Node ID 734b38f634dbe8bfedeb8ab7013e01b59a59ee01 # Parent b1ac1bd1dbbf2185ef08697bd8cbb2064b8107ba c1xx-calextr: output implemented diff -r b1ac1bd1dbbf -r 734b38f634db ffstools/caltools/c1xx-calextr.c --- a/ffstools/caltools/c1xx-calextr.c Sat Nov 18 17:45:10 2017 +0000 +++ b/ffstools/caltools/c1xx-calextr.c Sat Nov 18 17:58:35 2017 +0000 @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -65,6 +66,78 @@ close(fd); } +write_rx_agcparams_ascii(band, table) + struct band *band; + u_char *table; +{ + char pathname[MAXPATHLEN]; + FILE *of; + + sprintf(pathname, "%s/rx-agcparams.%s", ascii_output_dir, band->name); + of = fopen(pathname, "w"); + if (!of) { + perror(pathname); + exit(1); + } + write_rx_agcparams_table(table, of); + fclose(of); +} + +write_rx_agcparams_bin(band, table) + struct band *band; + u_char *table; +{ + char pathname[MAXPATHLEN]; + int fd; + + sprintf(pathname, "%s/rx", bin_output_dir); + mkdir_existok(pathname); + sprintf(pathname, "%s/rx/agcparams.%s", bin_output_dir, band->name); + fd = open(pathname, O_WRONLY|O_CREAT|O_TRUNC, 0666); + if (fd < 0) { + perror(pathname); + exit(1); + } + write(fd, table, 8); + close(fd); +} + +write_tx_levels_ascii(band, table) + struct band *band; + u_char *table; +{ + char pathname[MAXPATHLEN]; + FILE *of; + + sprintf(pathname, "%s/tx-levels.%s", ascii_output_dir, band->name); + of = fopen(pathname, "w"); + if (!of) { + perror(pathname); + exit(1); + } + write_tx_levels_table(table, of); + fclose(of); +} + +write_tx_levels_bin(band, table) + struct band *band; + u_char *table; +{ + char pathname[MAXPATHLEN]; + int fd; + + sprintf(pathname, "%s/tx", bin_output_dir); + mkdir_existok(pathname); + sprintf(pathname, "%s/tx/levels.%s", bin_output_dir, band->name); + fd = open(pathname, O_WRONLY|O_CREAT|O_TRUNC, 0666); + if (fd < 0) { + perror(pathname); + exit(1); + } + write(fd, table, 128); + close(fd); +} + do_rx_agcparams(band, compal_data) struct band *band; u_char *compal_data; @@ -79,7 +152,10 @@ rx_agcparams_table[5] = 0; rx_agcparams_table[6] = 44; rx_agcparams_table[7] = 0; - /* ASCII and binary write-out to be implemented */ + if (ascii_output_dir) + write_rx_agcparams_ascii(band, rx_agcparams_table); + if (bin_output_dir) + write_rx_agcparams_bin(band, rx_agcparams_table); } do_tx_levels(band, compal_data) @@ -99,7 +175,10 @@ *dp++ = n; *dp++ = 0; } - /* ASCII and binary write-out to be implemented */ + if (ascii_output_dir) + write_tx_levels_ascii(band, tx_levels_table); + if (bin_output_dir) + write_tx_levels_bin(band, tx_levels_table); } process_band_record(band, offset)