2 * This code was written by Mychaela Falconia <falcon@freecalypso.org>
3 * who refuses to claim copyright on it and has released it as public domain
4 * instead. NO rights reserved, all rights relinquished.
6 * Tweaked (coding style changes) by Vadim Yanitskiy <axilirator@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
24 #include <rf/readcal.h>
25 #include <rf/vcxocal.h>
29 static int16_t afcdac_shifted
;
31 static void afcdac_postproc(void)
33 afc_initial_dac_value
= afcdac_shifted
>> 3;
36 static const struct calmap
{
40 void (*postproc
)(void);
42 { "/gsm/rf/afcdac", 2, &afcdac_shifted
, afcdac_postproc
},
43 { "/gsm/rf/tx/ramps.850", 512, rf_tx_ramps_850
, NULL
},
44 { "/gsm/rf/tx/levels.850", 128, rf_tx_levels_850
, NULL
},
45 { "/gsm/rf/tx/calchan.850", 128, rf_tx_chan_cal_850
, NULL
},
46 { "/gsm/rf/tx/ramps.900", 512, rf_tx_ramps_900
, NULL
},
47 { "/gsm/rf/tx/levels.900", 128, rf_tx_levels_900
, NULL
},
48 { "/gsm/rf/tx/calchan.900", 128, rf_tx_chan_cal_900
, NULL
},
49 { "/gsm/rf/tx/ramps.1800", 512, rf_tx_ramps_1800
, NULL
},
50 { "/gsm/rf/tx/levels.1800", 128, rf_tx_levels_1800
, NULL
},
51 { "/gsm/rf/tx/calchan.1800", 128, rf_tx_chan_cal_1800
, NULL
},
52 { "/gsm/rf/tx/ramps.1900", 512, rf_tx_ramps_1900
, NULL
},
53 { "/gsm/rf/tx/levels.1900", 128, rf_tx_levels_1900
, NULL
},
54 { "/gsm/rf/tx/calchan.1900", 128, rf_tx_chan_cal_1900
, NULL
},
55 { NULL
, 0, NULL
, NULL
}
58 void read_factory_rf_calibration(void)
60 const struct calmap
*tp
;
64 puts("Checking TIFFS for the RF calibration records\n");
65 for (tp
= rf_cal_list
; tp
->pathname
; tp
++) {
66 rc
= tiffs_read_file_fixedlen(tp
->pathname
, buf
,
70 printf("Found '%s', applying\n", tp
->pathname
);
71 memcpy(tp
->buffer
, buf
, tp
->record_len
);