summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-11-22 16:00:33 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2012-11-22 16:00:33 +0100
commitd72cb4401e9229da9306fd49dc0d541eb002de9a (patch)
treea84aabc097cc806ac6d480d700b07098732453a1
parent85f4e1b3b8b386fd7e25b33d83768fe8a100e051 (diff)
Rename various "rxlev" variable to "rxlev_dbm" and correct their signess
All levels in range of 0..63 are now uint8_t and use "rxlev" as variable name. All levels in range of -110..-47 are now int8_t and use "rxlev_dbm" as variable name.
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/gsm322.h8
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h2
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/settings.h2
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/support.h2
-rw-r--r--src/host/layer23/src/misc/cell_log.c36
-rw-r--r--src/host/layer23/src/mobile/gsm322.c22
-rw-r--r--src/host/layer23/src/mobile/gsm48_rr.c10
-rw-r--r--src/host/layer23/src/mobile/settings.c2
-rw-r--r--src/host/layer23/src/mobile/support.c4
-rw-r--r--src/host/layer23/src/mobile/vty_interface.c6
10 files changed, 47 insertions, 47 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm322.h b/src/host/layer23/include/osmocom/bb/mobile/gsm322.h
index f39e566..66bc852 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm322.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm322.h
@@ -70,7 +70,7 @@ enum {
struct gsm322_plmn_list {
struct llist_head entry;
uint16_t mcc, mnc;
- int8_t rxlev; /* rx level in range format */
+ uint8_t rxlev; /* rx level in range format */
uint8_t cause; /* cause value, if PLMN is not allowed */
};
@@ -103,7 +103,7 @@ struct gsm322_ba_list {
/* Cell selection list */
struct gsm322_cs_list {
uint8_t flags; /* see GSM322_CS_FLAG_* */
- int8_t rxlev; /* rx level range format */
+ uint8_t rxlev; /* rx level range format */
struct gsm48_sysinfo *sysinfo;
};
@@ -137,7 +137,7 @@ struct gsm322_neighbour {
uint8_t state; /* GSM322_NB_* */
time_t created; /* when was this neighbour created */
time_t when; /* when did we sync / read */
- int16_t rxlev_dbm; /* sum of received levels */
+ int16_t rxlev_sum_dbm; /* sum of received levels */
uint8_t rxlev_count; /* number of received levels */
int8_t rla_c_dbm; /* average of the reveive level */
uint8_t c12_valid; /* both C1 and C2 are calculated */
@@ -192,7 +192,7 @@ struct gsm322_cellsel {
struct gsm322_neighbour *neighbour; /* when selecting neighbour cell */
time_t resel_when; /* timestamp of last re-selection */
int8_t nb_meas_set;
- int16_t rxlev_dbm; /* sum of received levels */
+ int16_t rxlev_sum_dbm; /* sum of received levels */
uint8_t rxlev_count; /* number of received levels */
int8_t rla_c_dbm; /* average of received level */
uint8_t c12_valid; /* both C1 and C2 values are
diff --git a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
index 2012169..6235bfd 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/gsm48_rr.h
@@ -112,7 +112,7 @@ struct gsm48_cr_hist {
struct gsm48_rr_meas {
/* note: must be sorted by arfcn 1..1023,0 according to SI5* */
uint8_t nc_num; /* number of measured cells (32 max) */
- int8_t nc_rxlev[32]; /* -128 = no value */
+ int8_t nc_rxlev_dbm[32]; /* -128 = no value */
uint8_t nc_bsic[32];
uint16_t nc_arfcn[32];
};
diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h
index 6d44696..fae1220 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/settings.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h
@@ -83,7 +83,7 @@ struct gsm_settings {
uint8_t half_v1;
uint8_t half_v3;
uint8_t ch_cap; /* channel capability */
- int8_t min_rxlev_db; /* min DB to access */
+ int8_t min_rxlev_dbm; /* min dBm to access */
/* radio */
uint16_t dsc_max;
diff --git a/src/host/layer23/include/osmocom/bb/mobile/support.h b/src/host/layer23/include/osmocom/bb/mobile/support.h
index 035e10a..b0a1007 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/support.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/support.h
@@ -79,7 +79,7 @@ struct gsm_support {
/* radio */
uint8_t ch_cap; /* channel capability */
- int8_t min_rxlev_db;
+ int8_t min_rxlev_dbm;
uint8_t scan_to;
uint8_t sync_to;
uint16_t dsc_max; /* maximum dl signal failure counter */
diff --git a/src/host/layer23/src/misc/cell_log.c b/src/host/layer23/src/misc/cell_log.c
index 8fe3e1b..a6059b4 100644
--- a/src/host/layer23/src/misc/cell_log.c
+++ b/src/host/layer23/src/misc/cell_log.c
@@ -47,7 +47,7 @@
#define READ_WAIT 2, 0
#define RACH_WAIT 0, 900000
-#define MIN_RXLEV -106
+#define MIN_RXLEV_DBM -106
#define MAX_DIST 2000
enum {
@@ -74,12 +74,12 @@ static struct osmo_timer_list timer;
static struct pm_info {
uint16_t flags;
- int8_t rxlev;
+ int8_t rxlev_dbm;
} pm[1024];
static int started = 0;
static int state;
-static int8_t min_rxlev = MIN_RXLEV;
+static int8_t min_rxlev_dbm = MIN_RXLEV_DBM;
static int sync_count;
static int pm_index, pm_gps_valid;
static double pm_gps_x, pm_gps_y, pm_gps_z;
@@ -95,7 +95,7 @@ static struct gsm48_sysinfo sysinfo;
static struct log_si {
uint16_t flags;
uint8_t bsic;
- int8_t rxlev;
+ int8_t rxlev_dbm;
uint16_t mcc, mnc, lac, cellid;
uint8_t ta;
double latitude, longitude;
@@ -155,7 +155,7 @@ static void log_pm(void)
if ((pm[i].flags & INFO_FLG_PM)) {
if (!count)
LOGFILE("arfcn %d", i);
- LOGFILE(" %d", pm[i].rxlev);
+ LOGFILE(" %d", pm[i].rxlev_dbm);
count++;
if (count == 12) {
LOGFILE("\n");
@@ -179,7 +179,7 @@ static void log_sysinfo(void)
{
struct rx_meas_stat *meas = &ms->meas;
struct gsm48_sysinfo *s = &sysinfo;
- int8_t rxlev;
+ int8_t rxlev_dbm;
char ta_str[32] = "";
if (log_si.ta != 0xff)
@@ -194,8 +194,8 @@ static void log_sysinfo(void)
log_time();
log_gps();
LOGFILE("bsic %d,%d\n", s->bsic >> 3, s->bsic & 7);
- rxlev = meas->rxlev / meas->frames - 110;
- LOGFILE("rxlev %d\n", rxlev);
+ rxlev_dbm = meas->rxlev / meas->frames - 110;
+ LOGFILE("rxlev %d\n", rxlev_dbm);
if (s->si1)
log_frame("si1", s->si1_msg);
if (s->si2)
@@ -301,7 +301,7 @@ static void start_rach(void)
static void start_sync(void)
{
- int rxlev = -128;
+ int rxlev_dbm = -128;
int i, dist = 0;
char dist_str[32] = "";
@@ -309,8 +309,8 @@ static void start_sync(void)
for (i = 0; i <= 1023; i++) {
if ((pm[i].flags & INFO_FLG_PM)
&& !(pm[i].flags & INFO_FLG_SYNC)) {
- if (pm[i].rxlev > rxlev) {
- rxlev = pm[i].rxlev;
+ if (pm[i].rxlev_dbm > rxlev_dbm) {
+ rxlev_dbm = pm[i].rxlev_dbm;
arfcn = i;
}
}
@@ -328,7 +328,7 @@ static void start_sync(void)
dist = distinspace(pm_gps_x, pm_gps_y, pm_gps_z, x, y, z);
sprintf(dist_str, " dist %d", (int)dist);
}
- if (dist > MAX_DIST || arfcn == 0xffff || rxlev < min_rxlev) {
+ if (dist > MAX_DIST || arfcn == 0xffff || rxlev_dbm < min_rxlev_dbm) {
memset(pm, 0, sizeof(pm));
pm_index = 0;
sync_count = 0;
@@ -336,14 +336,14 @@ static void start_sync(void)
return;
}
pm[arfcn].flags |= INFO_FLG_SYNC;
- LOGP(DSUM, LOGL_INFO, "Sync ARFCN %d (rxlev %d, %d syncs "
- "left)%s\n", arfcn, pm[arfcn].rxlev, sync_count--, dist_str);
+ LOGP(DSUM, LOGL_INFO, "Sync ARFCN %d (rxlev %d, %d syncs left)%s\n",
+ arfcn, pm[arfcn].rxlev_dbm, sync_count--, dist_str);
memset(&sysinfo, 0, sizeof(sysinfo));
sysinfo.arfcn = arfcn;
state = SCAN_STATE_SYNC;
l1ctl_tx_reset_req(ms, L1CTL_RES_T_FULL);
l1ctl_tx_fbsb_req(ms, arfcn, L1CTL_FBSB_F_FB01SB, 100, 0,
- CCCH_MODE_NONE, dbm2rxlev(pm[arfcn].rxlev));
+ CCCH_MODE_NONE, dbm2rxlev(pm[arfcn].rxlev_dbm));
}
static void start_pm(void)
@@ -384,10 +384,10 @@ static int signal_cb(unsigned int subsys, unsigned int signal,
mr = signal_data;
index = mr->band_arfcn & 0x3ff;
pm[index].flags |= INFO_FLG_PM;
- pm[index].rxlev = mr->rx_lev - 110;
- if (pm[index].rxlev >= min_rxlev)
+ pm[index].rxlev_dbm = mr->rx_lev - 110;
+ if (pm[index].rxlev_dbm >= min_rxlev_dbm)
sync_count++;
-// printf("rxlev %d = %d (sync_count %d)\n", index, pm[index].rxlev, sync_count);
+// printf("rxlev %d = %d (sync_count %d)\n", index, pm[index].rxlev_dbm, sync_count);
break;
case S_L1CTL_PM_DONE:
pm_index++;
diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c
index f56fbda..9166089 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -476,7 +476,7 @@ static int gsm322_sync_to_cell(struct gsm322_cellsel *cs,
}
meas->frames = meas->snr = meas->berr = meas->rxlev = 0;
- cs->rxlev_dbm = cs->rxlev_count = 0;
+ cs->rxlev_sum_dbm = cs->rxlev_count = 0;
cs->neighbour = neighbour;
@@ -492,7 +492,7 @@ static int gsm322_sync_to_cell(struct gsm322_cellsel *cs,
return l1ctl_tx_fbsb_req(ms, cs->arfcn,
L1CTL_FBSB_F_FB01SB, 100, 0,
cs->ccch_mode,
- dbm2rxlev(cs->list[cs->arfci].rxlev));
+ cs->list[cs->arfci].rxlev);
}
/* this is called whenever the serving cell is unselectied */
@@ -876,7 +876,7 @@ static int gsm322_sort_list(struct osmocom_ms *ms)
struct gsm322_plmn_list *temp, *found;
struct llist_head *lh, *lh2;
int i, entries, move;
- int8_t search = 0;
+ uint8_t search = 0;
/* flush list */
llist_for_each_safe(lh, lh2, &plmn->sorted_plmn) {
@@ -2901,7 +2901,7 @@ int gsm322_l1_signal(unsigned int subsys, unsigned int signal,
cs->list[i].flags |= GSM322_CS_FLAG_POWER;
cs->list[i].flags &= ~GSM322_CS_FLAG_SIGNAL;
/* if minimum level is reached or if we stick to a cell */
- if (rxlev2dbm(rxlev) >= ms->settings.min_rxlev_db
+ if (rxlev2dbm(rxlev) >= ms->settings.min_rxlev_dbm
|| ms->settings.stick) {
cs->list[i].flags |= GSM322_CS_FLAG_SIGNAL;
LOGP(DCS, LOGL_INFO, "Found signal (ARFCN %s "
@@ -4546,7 +4546,7 @@ static int gsm322_nb_trigger_event(struct gsm322_cellsel *cs)
/* check the list for reading neighbour cell's BCCH */
llist_for_each_entry(nb, &cs->nb_list, entry) {
- if (nb->rla_c_dbm >= cs->ms->settings.min_rxlev_db) {
+ if (nb->rla_c_dbm >= cs->ms->settings.min_rxlev_dbm) {
/* select the strongest unsynced cell */
if (nb->state == GSM322_NB_RLA_C) {
nb_sync = nb;
@@ -4696,9 +4696,9 @@ static int gsm322_nb_new_rxlev(struct gsm322_cellsel *cs)
/* calculate the RAL_C of serving cell */
if (cs->rxlev_count) {
- cs->rla_c_dbm = (cs->rxlev_dbm + (cs->rxlev_count / 2))
+ cs->rla_c_dbm = (cs->rxlev_sum_dbm + (cs->rxlev_count / 2))
/ cs->rxlev_count;
- cs->rxlev_dbm = 0;
+ cs->rxlev_sum_dbm = 0;
cs->rxlev_count = 0;
}
@@ -4730,10 +4730,10 @@ static int gsm322_nb_new_rxlev(struct gsm322_cellsel *cs)
}
}
nb->rla_c_dbm =
- (nb->rxlev_dbm + (nb->rxlev_count / 2))
+ (nb->rxlev_sum_dbm + (nb->rxlev_count / 2))
/ nb->rxlev_count;
nb->rxlev_count = 0;
- nb->rxlev_dbm = 0;
+ nb->rxlev_sum_dbm = 0;
if (nb->state == GSM322_NB_NEW)
nb->state = GSM322_NB_RLA_C;
}
@@ -4791,7 +4791,7 @@ static int gsm322_nb_meas_ind(struct osmocom_ms *ms, uint16_t arfcn,
enough_results = 0;
continue;
}
- nb->rxlev_dbm += rx_lev - 110;
+ nb->rxlev_sum_dbm += rx_lev - 110;
nb->rxlev_count++;
LOGP(DNB, LOGL_INFO, "Measurement result for ARFCN %s: %d\n",
gsm_print_arfcn(arfcn), rx_lev - 110);
@@ -4819,7 +4819,7 @@ int gsm322_meas(struct osmocom_ms *ms, uint8_t rx_lev)
if (cs->neighbour)
return -EINVAL;
- cs->rxlev_dbm += rx_lev - 110;
+ cs->rxlev_sum_dbm += rx_lev - 110;
cs->rxlev_count++;
return 0;
diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c
index 3648860..3d15494 100644
--- a/src/host/layer23/src/mobile/gsm48_rr.c
+++ b/src/host/layer23/src/mobile/gsm48_rr.c
@@ -1736,7 +1736,7 @@ static int gsm48_new_sysinfo(struct osmocom_ms *ms, uint8_t type)
rrmeas->nc_arfcn[n] = i | ARFCN_PCS;
else
rrmeas->nc_arfcn[n] = i & 1023;
- rrmeas->nc_rxlev[n] = -128;
+ rrmeas->nc_rxlev_dbm[n] = -128;
LOGP(DRR, LOGL_NOTICE, "SI5* report arfcn %s\n",
gsm_print_arfcn(rrmeas->nc_arfcn[n]));
n++;
@@ -2782,15 +2782,15 @@ static int gsm48_rr_tx_meas_rep(struct osmocom_ms *ms)
/* only check if NCC is permitted */
ncc = rrmeas->nc_bsic[i] >> 3;
if ((s->nb_ncc_permitted_si6 & (1 << ncc))
- && rrmeas->nc_rxlev[i] > current
- && rrmeas->nc_rxlev[i] < strongest) {
- current = rrmeas->nc_rxlev[i];
+ && rrmeas->nc_rxlev_dbm[i] > current
+ && rrmeas->nc_rxlev_dbm[i] < strongest) {
+ current = rrmeas->nc_rxlev_dbm[i];
index = i;
}
}
if (current == -128) /* no more found */
break;
- rxlev_nc[n] = rrmeas->nc_rxlev[index] + 110;
+ rxlev_nc[n] = rrmeas->nc_rxlev_dbm[index] + 110;
bsic_nc[n] = rrmeas->nc_bsic[index];
bcch_f_nc[n] = index;
}
diff --git a/src/host/layer23/src/mobile/settings.c b/src/host/layer23/src/mobile/settings.c
index e34db7e..2b51837 100644
--- a/src/host/layer23/src/mobile/settings.c
+++ b/src/host/layer23/src/mobile/settings.c
@@ -79,7 +79,7 @@ int gsm_settings_init(struct osmocom_ms *ms)
set->half_v1 = sup->half_v1;
set->half_v3 = sup->half_v3;
set->ch_cap = sup->ch_cap;
- set->min_rxlev_db = sup->min_rxlev_db;
+ set->min_rxlev_dbm = sup->min_rxlev_dbm;
set->dsc_max = sup->dsc_max;
if (sup->half_v1 || sup->half_v3)
diff --git a/src/host/layer23/src/mobile/support.c b/src/host/layer23/src/mobile/support.c
index bfc6180..99a0122 100644
--- a/src/host/layer23/src/mobile/support.c
+++ b/src/host/layer23/src/mobile/support.c
@@ -89,7 +89,7 @@ void gsm_support_init(struct osmocom_ms *ms)
/* radio */
sup->ch_cap = GSM_CAP_SDCCH_TCHF_TCHH;
- sup->min_rxlev_db = -106; // TODO
+ sup->min_rxlev_dbm = -106; // TODO
sup->sync_to = 6; /* how long to wait sync (0.9 s) */
sup->scan_to = 4; /* how long to wait for all sysinfos (>=4 s) */
sup->dsc_max = 90; /* the specs defines 90 */
@@ -177,6 +177,6 @@ void gsm_support_dump(struct osmocom_ms *ms,
print(priv, " Full-Rate V3 : %s\n", SUP_SET(full_v3));
print(priv, " Half-Rate V1 : %s\n", SUP_SET(half_v1));
print(priv, " Half-Rate V3 : %s\n", SUP_SET(half_v3));
- print(priv, " Min RXLEV : %d\n", set->min_rxlev_db);
+ print(priv, " Min RXLEV : %d\n", set->min_rxlev_dbm);
}
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index dc9e09d..4d7f6a2 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -1418,8 +1418,8 @@ static void config_write_ms(struct vty *vty, struct osmocom_ms *ms)
SUP_WRITE(full_v3, "full-speech-v3");
SUP_WRITE(half_v1, "half-speech-v1");
SUP_WRITE(half_v3, "half-speech-v3");
- if (!hide_default || sup->min_rxlev_db != set->min_rxlev_db)
- vty_out(vty, " min-rxlev %d%s", set->min_rxlev_db,
+ if (!hide_default || sup->min_rxlev_dbm != set->min_rxlev_dbm)
+ vty_out(vty, " min-rxlev %d%s", set->min_rxlev_dbm,
VTY_NEWLINE);
if (!hide_default || sup->dsc_max != set->dsc_max)
vty_out(vty, " dsc-max %d%s", set->dsc_max, VTY_NEWLINE);
@@ -2378,7 +2378,7 @@ DEFUN(cfg_ms_sup_min_rxlev, cfg_ms_sup_min_rxlev_cmd, "min-rxlev <-110--47>",
struct osmocom_ms *ms = vty->index;
struct gsm_settings *set = &ms->settings;
- set->min_rxlev_db = atoi(argv[0]);
+ set->min_rxlev_dbm = atoi(argv[0]);
return CMD_SUCCESS;
}