# HG changeset patch # User Mychaela Falconia # Date 1598339702 0 # Node ID 059649902c7fbc23335c44334f2860c3c2ea5513 # Parent b73c21a2148f67e324eff46b4710f8253a6431c2 librftab: added support for adc-cal tables diff -r b73c21a2148f -r 059649902c7f librftab/rftablerd.c --- a/librftab/rftablerd.c Tue Aug 25 06:28:44 2020 +0000 +++ b/librftab/rftablerd.c Tue Aug 25 07:15:02 2020 +0000 @@ -99,6 +99,31 @@ } static +read_adccal_table() +{ + u_char tmpbuf[36], *finalbuf; + int i, rc; + + finalbuf = writeptr; + writeptr = tmpbuf; + for (i = 0; i < 18; i++) { + rc = process_number(2); + if (rc) + return(rc); + } + writeptr = finalbuf; + for (i = 0; i < 9; i++) { + *writeptr++ = tmpbuf[i*4]; + *writeptr++ = tmpbuf[i*4 + 1]; + } + for (i = 0; i < 9; i++) { + *writeptr++ = tmpbuf[i*4 + 2]; + *writeptr++ = tmpbuf[i*4 + 3]; + } + return ensure_eof(); +} + +static read_agc_table() { int i, rc; @@ -302,6 +327,7 @@ char *kw; int (*handler)(); } table_formats[] = { + {"adc-cal", read_adccal_table}, {"agc-table", read_agc_table}, {"afcparams", read_afcparams}, {"agc-global-params", read_agc_global_params}, diff -r b73c21a2148f -r 059649902c7f librftab/rftablewr.c --- a/librftab/rftablewr.c Tue Aug 25 06:28:44 2020 +0000 +++ b/librftab/rftablewr.c Tue Aug 25 07:15:02 2020 +0000 @@ -37,6 +37,29 @@ } void +write_adccal_table(bin, outf) + u_char *bin; + FILE *outf; +{ + fputs("rf_table adc-cal\n\n", outf); + fprintf(outf, "%5u %6d\t# Vbat\n", get_u16(bin), get_s16(bin + 18)); + fprintf(outf, "%5u %6d\t# Vchg\n", get_u16(bin + 2), get_s16(bin + 20)); + fprintf(outf, "%5u %6d\t# Ichg\n", get_u16(bin + 4), get_s16(bin + 22)); + fprintf(outf, "%5u %6d\t# Vbackup\n", get_u16(bin + 6), + get_s16(bin + 24)); + fprintf(outf, "%5u %6d\t# ADIN1\n", get_u16(bin + 8), + get_s16(bin + 26)); + fprintf(outf, "%5u %6d\t# ADIN2\n", get_u16(bin + 10), + get_s16(bin + 28)); + fprintf(outf, "%5u %6d\t# ADIN3\n", get_u16(bin + 12), + get_s16(bin + 30)); + fprintf(outf, "%5u %6d\t# RF Temp\n", get_u16(bin + 14), + get_s16(bin + 32)); + fprintf(outf, "%5u %6d\t# ADIN5\n", get_u16(bin + 16), + get_s16(bin + 34)); +} + +void write_afcparams_table(bin, outf) u_char *bin; FILE *outf;