FreeCalypso > hg > fc-rfcal-tools
annotate autocal/rxupload.c @ 63:131abadbd74d
doc/Rx-cal-theory written
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 28 May 2017 03:21:34 +0000 |
parents | 0bf853d1b68e |
children |
rev | line source |
---|---|
60
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the RF table upload code for fc-rfcal-rxband. |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdio.h> |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdlib.h> |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdint.h> |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <endian.h> |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <rvinterf/l1tm.h> |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <rvinterf/exitcodes.h> |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "rxband.h" |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "rxtables.h" |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 extern struct rxcal_band *rxcal_band; |
61
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
15 extern int Gmagic, rx_calchan_values[]; |
60
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
61
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
17 upload_gmagic() |
60
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 { |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 struct rx_agc_params agcparams; |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 do_rftr(RX_AGC_PARAMS, &agcparams, sizeof agcparams); |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 agcparams.g_magic = htole16(Gmagic); |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 do_rftw(RX_AGC_PARAMS, &agcparams, sizeof agcparams); |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 return(0); |
81e8f7e99d89
fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |
61
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
26 |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
27 upload_rx_calchan() |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
28 { |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
29 unsigned n; |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
30 struct rx_calchan_entry calchan_table[RX_CALCHAN_ENTRIES]; |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
31 |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
32 for (n = 0; n < rxcal_band->num_calchan_ranges; n++) { |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
33 calchan_table[n].upper_bound = |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
34 htole16(rxcal_band->calchan_ranges[n].upper_bound); |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
35 calchan_table[n].agc_calib = htole16(rx_calchan_values[n]); |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
36 } |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
37 for (; n < RX_CALCHAN_ENTRIES; n++) { |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
38 calchan_table[n].upper_bound = 0; |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
39 calchan_table[n].agc_calib = 0; |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
40 } |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
41 do_rftw(RX_CAL_CHAN, calchan_table, sizeof calchan_table); |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
42 return(0); |
0bf853d1b68e
fc-rfcal-rxband: almost finished
Mychaela Falconia <falcon@freecalypso.org>
parents:
60
diff
changeset
|
43 } |