annotate librftab/rftablewr.c @ 715:631b096108cd

CHANGES: fc-loadtool Intel OTP additions documented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 06 Jun 2020 17:46:41 +0000
parents 329c31f7c797
children 059649902c7f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 write_afcparams_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 FILE *outf;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 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
45 /* 32-bit parameters */
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 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
47 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
48 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
49 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
50 /* 16-bit parameters */
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 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
52 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
53 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
54 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
55 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 write_agcwords_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 FILE *outf;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 int i, j;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 u_char *p = bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 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
66 for (i = 0; i < 4; i++) {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 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
68 if (j)
1782fbfa4860 rftablewr.c: agc-table write: eliminate leading space in the output
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
69 putc(' ', outf);
1782fbfa4860 rftablewr.c: agc-table write: eliminate leading space in the output
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
70 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
71 p += 2;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 putc('\n', outf);
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 write_agcglobals_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 FILE *outf;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 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
83 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
84 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
85 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
86 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
87 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 write_il2agc_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 FILE *outf;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 int idx;
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 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
97 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
98 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
99 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 write_tx_levels_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 FILE *outf;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 int i;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 u_char *p = bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 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
110 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
111 outf);
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 for (i = 0; i < 32; i++) {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 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
114 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
115 p += 4;
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 }
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 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 write_tx_calchan_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 FILE *outf;
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 int i, j;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 u_char *p = bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126
144
d0e482314513 rftablewr.c: better line break structure in the tx-calchan table
Mychaela Falconia <falcon@freecalypso.org>
parents: 141
diff changeset
127 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
128 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
129 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
130 for (j = 0; j < 8; j++) {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 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
132 p += 4;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 write_tx_caltemp_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 FILE *outf;
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 int i;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 u_char *p = bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 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
146 for (i = 0; i < 5; i++) {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 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
148 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
149 p += 8;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 write_rx_calchan_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 FILE *outf;
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 int i;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 u_char *p = bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 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
162 for (i = 0; i < 10; i++) {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 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
164 p += 4;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 }
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 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 write_rx_caltemp_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 FILE *outf;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 int i;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 u_char *p = bin;
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 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
177 for (i = 0; i < 11; i++) {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 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
179 p += 4;
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 }
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 void
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 write_rx_agcparams_table(bin, outf)
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 u_char *bin;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 FILE *outf;
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 {
3803f838e1f3 RF table writing code implemented, linked into fc-tmsh
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 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
189 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
190 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
191 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
192 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
193 }
141
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
194
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
195 void
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
196 write_tx_ramp(bin, outf)
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
197 u_char *bin;
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
198 FILE *outf;
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
199 {
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
200 int i;
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
201
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
202 fputs("ramp-up ", outf);
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
203 for (i = 0; i < 16; i++)
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
204 fprintf(outf, " %3u", bin[i]);
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
205 putc('\n', outf);
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
206 fputs("ramp-down", outf);
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
207 for (i = 0; i < 16; i++)
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
208 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
209 putc('\n', outf);
141
6b01d4ef85c3 fc-tmsh: save-tx-ramp command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 138
diff changeset
210 }
282
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
211
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
212 void
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
213 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
214 u_char *bin;
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
215 FILE *outf;
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
216 {
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
217 int i;
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
218 u_char *p = bin;
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
219
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
220 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
221 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
222 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
223 write_tx_ramp(p, outf);
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
224 p += 32;
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
225 }
90c475877d34 librftab writer: added function to write Tx ramps tables
Mychaela Falconia <falcon@freecalypso.org>
parents: 280
diff changeset
226 }