FreeCalypso > hg > freecalypso-tools
changeset 721:059649902c7f
librftab: added support for adc-cal tables
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 25 Aug 2020 07:15:02 +0000 |
parents | b73c21a2148f |
children | a58a38cae51c |
files | librftab/rftablerd.c librftab/rftablewr.c |
diffstat | 2 files changed, 49 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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},
--- 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;