1 /* APC (Automatic Power Control) Implementation */
3 /* (C) 2010 by Harald Welte <laforge@gnumonks.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include <osmocom/core/utils.h>
26 #include <osmocom/gsm/gsm_utils.h>
28 #include <layer1/apc.h>
30 /* calibration table defined in board file */
31 extern const int16_t dbm2apc_gsm900[];
32 extern const int dbm2apc_gsm900_max;
35 /* determine the AUXAPC value by the Tx Power Level */
36 int16_t apc_tx_dbm2auxapc(enum gsm_band band, int8_t dbm)
41 /* FIXME: offsets for different bands! */
42 if (dbm > dbm2apc_gsm900_max)
43 dbm = dbm2apc_gsm900_max;
45 return dbm2apc_gsm900[dbm];
48 /* determine the AUXAPC value by the Tx Power Level */
49 int16_t apc_tx_pwrlvl2auxapc(enum gsm_band band, uint8_t lvl)
51 /* convert tx power level to dBm */
52 int dbm = ms_pwr_dbm(band, lvl);
56 return apc_tx_dbm2auxapc(band, dbm);