comparison 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
comparison
equal deleted inserted replaced
79:394daa4ad6e8 80:b0da2db4e36b
1 /*
2 * The basis steps of Tx power level calibration are implemented here.
3 */
4
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <rvinterf/l1tm.h>
8 #include <rvinterf/exitcodes.h>
9 #include "txband.h"
10
11 extern double tx_power_meas();
12 extern vout_t dbm_to_vout();
13
14 extern struct txcal_band *txcal_band;
15 extern struct tx_basis_point tx_basis[MAX_BASIS_POINTS];
16 extern unsigned num_basis_points;
17
18 txcal_basis_run()
19 {
20 unsigned n;
21 double meas;
22
23 printf("Performing the calibration basis run\n");
24 do_txpw(TX_PWR_LEVEL, txcal_band->start_plnum);
25 printf("Starting RF Tx on the DUT\n");
26 do_rfe(RX_TX_TCH);
27
28 for (n = 0; n < num_basis_points; n++) {
29 do_txpw(TX_APC_DAC, tx_basis[n].apc);
30 usleep(20000);
31 meas = tx_power_meas();
32 printf("APC DAC=%d: %.2f dBm\n", tx_basis[n].apc, meas);
33 tx_basis[n].vout = dbm_to_vout(meas);
34 }
35
36 printf("Stopping RF Tx on the DUT\n");
37 do_rfe(STOP_ALL);
38 return(0);
39 }