FreeCalypso > hg > fc-rfcal-tools
annotate autocal/rxcommon.c @ 46:751f8d9efed0
Rx cal: started the single measurement code
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 27 May 2017 06:25:59 +0000 |
parents | 98abe6bd2042 |
children | 1a0dbc746d57 |
rev | line source |
---|---|
44
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the common code for |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * fc-rfcal-gmagic and fc-rfcal-rxband. |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <rvinterf/l1tm.h> |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <rvinterf/exitcodes.h> |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "rxcaldefs.h" |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 l1tm_setup_for_rxcal() |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 { |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 do_rxpw(RX_AGC_ENA_FLAG, 0); |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 do_rxpw(RX_AGC_GAIN, RXCAL_AGC_DB); |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 do_rfpw(AFC_ENA_FLAG, 0); |
45
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
17 do_scw(LOOPS, RXCAL_LOOP_COUNT); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
18 do_scw(AUTO_RESULT_LOOPS, RXCAL_LOOP_COUNT); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
19 do_scw(AUTO_RESET_LOOPS, RXCAL_LOOP_COUNT); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
20 do_scw(STAT_TYPE, ACCUMULATED_RX_STATS); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
21 do_scw(STAT_BITMASK, DSP_PM); |
44
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 return(0); |
5018fd8eecce
autocal: started Rx cal core code
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 } |
46
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
24 |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
25 halfdb_to_string(halfdb, strbuf) |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
26 int halfdb; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
27 char *strbuf; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
28 { |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
29 int sign; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
30 |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
31 if (halfdb < 0) { |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
32 sign = 1; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
33 halfdb = -halfdb; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
34 } else |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
35 sign = 0; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
36 sprintf(strbuf, "%s%d.%c", sign ? "-" : "", halfdb >> 1, |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
37 halfdb & 1 ? '5' : '0'); |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
38 return(0); |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
39 } |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
40 |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
41 rx_single_offset_meas(arfcn, offset) |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
42 unsigned arfcn; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
43 char *offset; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
44 { |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
45 char dbm[64], tsid_cmd[128]; |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
46 |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
47 halfdb_to_string(RXCAL_SIGGEN_LEVEL, dbm); |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
48 printf("Rx meas at ARFCN %u offset %s kHz, TL=%s dBm, AGC=%d dB\n", |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
49 arfcn, offset, dbm, RXCAL_AGC_DB); |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
50 sprintf(tsid_cmd, "signal-gen-sine %u %s %s\n", arfcn, offset, dbm); |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
51 tsid_command(tsid_cmd); |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
52 |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
53 |
751f8d9efed0
Rx cal: started the single measurement code
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
54 } |