annotate autocal/txcalchan.c @ 102:80281b67511f

fc-rfcal-txband: fixed bug in the corner case when the target power level is above the highest basis point
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 12 Aug 2017 08:47:09 +0000
parents 3f63e71b6422
children 4ce87a30383f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
77
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module contains the code for handling Tx calchan tables.
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <stdio.h>
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdlib.h>
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdint.h>
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <endian.h>
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <rvinterf/l1tm.h>
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <rvinterf/exitcodes.h>
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "txband.h"
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "txcalchan.h"
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 extern struct txcal_band *txcal_band;
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 unsigned tx_calchan_values[TX_CALCHAN_TABLES][TX_CALCHAN_ENTRIES];
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 init_tx_calchan()
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 unsigned i, j;
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 for (i = 0; i < TX_CALCHAN_TABLES; i++)
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 for (j = 0; j < TX_CALCHAN_ENTRIES; j++)
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 tx_calchan_values[i][j] = 128;
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 return(0);
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 }
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 upload_tx_calchan()
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 {
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 unsigned i, j;
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 struct tx_calchan_entry l1_table[TX_CALCHAN_TABLES][TX_CALCHAN_ENTRIES];
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 for (i = 0; i < TX_CALCHAN_TABLES; i++) {
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 for (j = 0; j < TX_CALCHAN_ENTRIES; j++) {
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 l1_table[i][j].arfcn_limit =
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 htole16(txcal_band->calchan_ranges[j].upper_bound);
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 l1_table[i][j].chan_cal =
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 htole16(tx_calchan_values[i][j]);
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 }
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 }
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 do_rftw(TX_CAL_CHAN, l1_table, sizeof l1_table);
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 return(0);
3f63e71b6422 fc-rfcal-txband: implemented initial calchan clearing
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }