FreeCalypso > hg > fc-rfcal-tools
annotate autocal/txbasis.c @ 80:b0da2db4e36b
fc-rfcal-txband: basis run implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 15 Jul 2017 21:22:38 +0000 |
parents | |
children | 83b24a1dfd4a |
rev | line source |
---|---|
80
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * The basis steps of Tx power level calibration are implemented here. |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdio.h> |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdlib.h> |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <rvinterf/l1tm.h> |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <rvinterf/exitcodes.h> |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include "txband.h" |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 extern double tx_power_meas(); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 extern vout_t dbm_to_vout(); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 extern struct txcal_band *txcal_band; |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 extern struct tx_basis_point tx_basis[MAX_BASIS_POINTS]; |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern unsigned num_basis_points; |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 txcal_basis_run() |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 { |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 unsigned n; |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 double meas; |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 printf("Performing the calibration basis run\n"); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 do_txpw(TX_PWR_LEVEL, txcal_band->start_plnum); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 printf("Starting RF Tx on the DUT\n"); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 do_rfe(RX_TX_TCH); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 for (n = 0; n < num_basis_points; n++) { |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 do_txpw(TX_APC_DAC, tx_basis[n].apc); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 usleep(20000); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 meas = tx_power_meas(); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 printf("APC DAC=%d: %.2f dBm\n", tx_basis[n].apc, meas); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 tx_basis[n].vout = dbm_to_vout(meas); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 } |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 printf("Stopping RF Tx on the DUT\n"); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 do_rfe(STOP_ALL); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 return(0); |
b0da2db4e36b
fc-rfcal-txband: basis run implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 } |