FreeCalypso > hg > freecalypso-tools
annotate librftab/rftablewr.c @ 844:4694c7686ccd
fc-tmsync: add mpr command
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 31 Jul 2021 21:57:48 +0000 |
parents | 059649902c7f |
children |
rev | line source |
---|---|
138
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Here we implement the writing of RF tables into ASCII text files |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * in our defined format. This module will also be linked by the |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * standalone fc-cal2text utility, hence our code here needs to be |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * independent of rvinterf and fc-tmsh specifics. |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 */ |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <sys/types.h> |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdint.h> |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <endian.h> |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 static unsigned |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 get_u32(bin) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 return le32toh(*(uint32_t *)bin); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 static unsigned |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 get_u16(bin) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 return le16toh(*(uint16_t *)bin); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 static int |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 get_s16(bin) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 int i; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 i = le16toh(*(uint16_t *)bin); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 if (i >= 32768) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 i -= 65536; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 return(i); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 void |
721
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
40 write_adccal_table(bin, outf) |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
41 u_char *bin; |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
42 FILE *outf; |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
43 { |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
44 fputs("rf_table adc-cal\n\n", outf); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
45 fprintf(outf, "%5u %6d\t# Vbat\n", get_u16(bin), get_s16(bin + 18)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
46 fprintf(outf, "%5u %6d\t# Vchg\n", get_u16(bin + 2), get_s16(bin + 20)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
47 fprintf(outf, "%5u %6d\t# Ichg\n", get_u16(bin + 4), get_s16(bin + 22)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
48 fprintf(outf, "%5u %6d\t# Vbackup\n", get_u16(bin + 6), |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
49 get_s16(bin + 24)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
50 fprintf(outf, "%5u %6d\t# ADIN1\n", get_u16(bin + 8), |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
51 get_s16(bin + 26)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
52 fprintf(outf, "%5u %6d\t# ADIN2\n", get_u16(bin + 10), |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
53 get_s16(bin + 28)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
54 fprintf(outf, "%5u %6d\t# ADIN3\n", get_u16(bin + 12), |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
55 get_s16(bin + 30)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
56 fprintf(outf, "%5u %6d\t# RF Temp\n", get_u16(bin + 14), |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
57 get_s16(bin + 32)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
58 fprintf(outf, "%5u %6d\t# ADIN5\n", get_u16(bin + 16), |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
59 get_s16(bin + 34)); |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
60 } |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
61 |
059649902c7f
librftab: added support for adc-cal tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
289
diff
changeset
|
62 void |
138
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 write_afcparams_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 fputs("rf_table afcparams\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 /* 32-bit parameters */ |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 fprintf(outf, "%10u\t# psi_sta_inv\n", get_u32(bin)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 fprintf(outf, "%10u\t# psi_st\n", get_u32(bin + 4)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 fprintf(outf, "%10u\t# psi_st_32\n", get_u32(bin + 8)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 fprintf(outf, "%10u\t# psi_st_inv\n\n", get_u32(bin + 12)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 /* 16-bit parameters */ |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 fprintf(outf, "%10d\t# dac_center\n", get_s16(bin + 16)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 fprintf(outf, "%10d\t# dac_min\n", get_s16(bin + 18)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 fprintf(outf, "%10d\t# dac_max\n", get_s16(bin + 20)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 fprintf(outf, "%10d\t# snr_thr\n", get_s16(bin + 22)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 write_agcwords_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 int i, j; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 u_char *p = bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 fputs("rf_table agc-table\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 for (i = 0; i < 4; i++) { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 for (j = 0; j < 5; j++) { |
146
1782fbfa4860
rftablewr.c: agc-table write: eliminate leading space in the output
Mychaela Falconia <falcon@freecalypso.org>
parents:
145
diff
changeset
|
91 if (j) |
1782fbfa4860
rftablewr.c: agc-table write: eliminate leading space in the output
Mychaela Falconia <falcon@freecalypso.org>
parents:
145
diff
changeset
|
92 putc(' ', outf); |
1782fbfa4860
rftablewr.c: agc-table write: eliminate leading space in the output
Mychaela Falconia <falcon@freecalypso.org>
parents:
145
diff
changeset
|
93 fprintf(outf, "0x%04X", get_u16(p)); |
138
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 p += 2; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 putc('\n', outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 write_agcglobals_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 fputs("rf_table agc-global-params\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 fprintf(outf, "%5u\t# low_agc_noise_thr\n", get_u16(bin)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 fprintf(outf, "%5u\t# high_agc_sat_thr\n", get_u16(bin + 2)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 fprintf(outf, "%5u\t# low_agc\n", get_u16(bin + 4)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 fprintf(outf, "%5u\t# high_agc\n", get_u16(bin + 6)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 write_il2agc_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 int idx; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 fputs("rf_table il2agc\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 for (idx = 0; idx < 121; idx++) |
145
04b5aaee06c0
rftablewr.c: bug in the il2agc table output
Mychaela Falconia <falcon@freecalypso.org>
parents:
144
diff
changeset
|
121 fprintf(outf, "%3u\t# IL=%d\n", bin[idx], -idx); |
138
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 write_tx_levels_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 int i; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 u_char *p = bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 fputs("rf_table tx-levels\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 fputs("# Fields in each entry: apc, ramp_index, chan_cal_index\n\n", |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 for (i = 0; i < 32; i++) { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 fprintf(outf, "%5u %3u %3u\t# entry %d\n", |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 get_u16(p), p[2], p[3], i); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 p += 4; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 write_tx_calchan_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 int i, j; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 u_char *p = bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 |
144
d0e482314513
rftablewr.c: better line break structure in the tx-calchan table
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
150 fputs("rf_table tx-calchan\n", outf); |
138
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 for (i = 0; i < 4; i++) { |
144
d0e482314513
rftablewr.c: better line break structure in the tx-calchan table
Mychaela Falconia <falcon@freecalypso.org>
parents:
141
diff
changeset
|
152 fprintf(outf, "\n# Channel calibration table %d:\n\n", i); |
138
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 for (j = 0; j < 8; j++) { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 fprintf(outf, "%5u %6d\n", get_u16(p), get_s16(p + 2)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 p += 4; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 write_tx_caltemp_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 int i; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 u_char *p = bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 fputs("rf_table tx-caltemp\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 for (i = 0; i < 5; i++) { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 fprintf(outf, "%6d %6d %6d %6d\n", get_s16(p), get_s16(p + 2), |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 get_s16(p + 4), get_s16(p + 6)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 p += 8; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 write_rx_calchan_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 int i; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 u_char *p = bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 fputs("rf_table rx-calchan\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 for (i = 0; i < 10; i++) { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 fprintf(outf, "%5u %6d\n", get_u16(p), get_s16(p + 2)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 p += 4; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 write_rx_caltemp_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 int i; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 u_char *p = bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 fputs("rf_table rx-caltemp\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 for (i = 0; i < 11; i++) { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 fprintf(outf, "%6d %6d\n", get_s16(p), get_s16(p + 2)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 p += 4; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 } |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 void |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 write_rx_agcparams_table(bin, outf) |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 u_char *bin; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 FILE *outf; |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 { |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 fputs("rf_table rx-agc-params\n\n", outf); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 fprintf(outf, "%5u\t# g_magic\n", get_u16(bin)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 fprintf(outf, "%5u\t# lna_att\n", get_u16(bin + 2)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 fprintf(outf, "%5u\t# lna_switch_thr_low\n", get_u16(bin + 4)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 fprintf(outf, "%5u\t# lna_switch_thr_high\n", get_u16(bin + 6)); |
3803f838e1f3
RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 } |
141
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
217 |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
218 void |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
219 write_tx_ramp(bin, outf) |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
220 u_char *bin; |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
221 FILE *outf; |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
222 { |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
223 int i; |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
224 |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
225 fputs("ramp-up ", outf); |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
226 for (i = 0; i < 16; i++) |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
227 fprintf(outf, " %3u", bin[i]); |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
228 putc('\n', outf); |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
229 fputs("ramp-down", outf); |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
230 for (i = 0; i < 16; i++) |
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
231 fprintf(outf, " %3u", bin[i+16]); |
147
d2a79b68789b
rftablewr.c: forgot the newline at the end of the ramp-down output
Mychaela Falconia <falcon@freecalypso.org>
parents:
146
diff
changeset
|
232 putc('\n', outf); |
141
6b01d4ef85c3
fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
138
diff
changeset
|
233 } |
282
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
234 |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
235 void |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
236 write_tx_ramps_table(bin, outf) |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
237 u_char *bin; |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
238 FILE *outf; |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
239 { |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
240 int i; |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
241 u_char *p = bin; |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
242 |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
243 fputs("rf_table tx-ramps\n", outf); |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
244 for (i = 0; i < 16; i++) { |
289
329c31f7c797
fc-cal2text changed to emit Tx ramps for each band as a single table
Mychaela Falconia <falcon@freecalypso.org>
parents:
282
diff
changeset
|
245 fprintf(outf, "\n# Tx ramp template %d:\n\n", i); |
282
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
246 write_tx_ramp(p, outf); |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
247 p += 32; |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
248 } |
90c475877d34
librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents:
280
diff
changeset
|
249 } |