aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-trx
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-01-09 18:25:22 +0100
committerHarald Welte <laforge@gnumonks.org>2016-01-16 17:49:04 +0100
commitdd562d84bab5974f7b3505500bc9eced52252904 (patch)
tree4b223cfa13d8c93640058b090b0f5356128a7c15 /src/osmo-bts-trx
parent773ab8b2c52d0145561e113e8af7bb839bbe4749 (diff)
TRX: Don't use magic numbers when we have #defines
Diffstat (limited to 'src/osmo-bts-trx')
-rw-r--r--src/osmo-bts-trx/l1_if.c10
-rw-r--r--src/osmo-bts-trx/l1_if.h24
-rw-r--r--src/osmo-bts-trx/scheduler.c8
-rw-r--r--src/osmo-bts-trx/trx_vty.c4
4 files changed, 23 insertions, 23 deletions
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index e9d7a02b..a45ba05b 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -111,7 +111,7 @@ static void check_transceiver_availability_trx(struct trx_l1h *l1h, int avail)
oml_mo_state_chg(&trx->bb_transc.mo, -1, NM_AVSTATE_OK);
oml_mo_tx_sw_act_rep(&trx->bb_transc.mo);
- for (tn = 0; tn < 8; tn++)
+ for (tn = 0; tn < TRX_NR_TS; tn++)
oml_mo_state_chg(&trx->ts[tn].mo, NM_OPSTATE_DISABLED,
(l1h->config.slotmask & (1 << tn)) ?
NM_AVSTATE_DEPENDENCY :
@@ -122,7 +122,7 @@ static void check_transceiver_availability_trx(struct trx_l1h *l1h, int avail)
oml_mo_state_chg(&trx->bb_transc.mo, NM_OPSTATE_DISABLED,
NM_AVSTATE_OFF_LINE);
- for (tn = 0; tn < 8; tn++)
+ for (tn = 0; tn < TRX_NR_TS; tn++)
oml_mo_state_chg(&trx->ts[tn].mo, NM_OPSTATE_DISABLED,
NM_AVSTATE_OFF_LINE);
}
@@ -188,7 +188,7 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h)
trx_if_cmd_setmaxdly(l1h, l1h->config.maxdly);
l1h->config.maxdly_sent = 1;
}
- for (tn = 0; tn < 8; tn++) {
+ for (tn = 0; tn < TRX_NR_TS; tn++) {
if (l1h->config.slottype_valid[tn]
&& !l1h->config.slottype_sent[tn]) {
trx_if_cmd_setslot(l1h, tn,
@@ -205,7 +205,7 @@ int l1if_provision_transceiver_trx(struct trx_l1h *l1h)
l1h->config.rxgain_sent = 0;
l1h->config.power_sent = 0;
l1h->config.maxdly_sent = 0;
- for (tn = 0; tn < 8; tn++)
+ for (tn = 0; tn < TRX_NR_TS; tn++)
l1h->config.slottype_sent[tn] = 0;
}
@@ -227,7 +227,7 @@ int l1if_provision_transceiver(struct gsm_bts *bts)
l1h->config.rxgain_sent = 0;
l1h->config.power_sent = 0;
l1h->config.maxdly_sent = 0;
- for (tn = 0; tn < 8; tn++)
+ for (tn = 0; tn < TRX_NR_TS; tn++)
l1h->config.slottype_sent[tn] = 0;
l1if_provision_transceiver_trx(l1h);
}
diff --git a/src/osmo-bts-trx/l1_if.h b/src/osmo-bts-trx/l1_if.h
index b8e8da61..2c672cb9 100644
--- a/src/osmo-bts-trx/l1_if.h
+++ b/src/osmo-bts-trx/l1_if.h
@@ -87,8 +87,8 @@ struct trx_chan_state {
int dl_encr_algo; /* A5/x encry algo uplink */
int ul_encr_key_len;
int dl_encr_key_len;
- uint8_t ul_encr_key[8];
- uint8_t dl_encr_key[8];
+ uint8_t ul_encr_key[MAX_A5_KEY_LEN];
+ uint8_t dl_encr_key[MAX_A5_KEY_LEN];
/* measurements */
struct {
@@ -136,9 +136,9 @@ struct trx_config {
uint8_t slotmask;
- int slottype_valid[8];
- uint8_t slottype[8];
- int slottype_sent[8];
+ int slottype_valid[TRX_NR_TS];
+ uint8_t slottype[TRX_NR_TS];
+ int slottype_sent[TRX_NR_TS];
};
struct trx_l1h {
@@ -153,15 +153,15 @@ struct trx_l1h {
/* transceiver config */
struct trx_config config;
- uint8_t mf_index[8]; /* selected multiframe index */
- uint32_t mf_last_fn[8]; /* last received frame */
- uint8_t mf_period[8]; /* period of multiframe */
- const struct trx_sched_frame *mf_frames[8]; /* pointer to frame layout */
+ uint8_t mf_index[TRX_NR_TS]; /* selected multiframe index */
+ uint32_t mf_last_fn[TRX_NR_TS]; /* last received frame */
+ uint8_t mf_period[TRX_NR_TS]; /* period of multiframe */
+ const struct trx_sched_frame *mf_frames[TRX_NR_TS]; /* pointer to frame layout */
/* Channel states for all channels on all timeslots */
- struct trx_chan_state chan_states[8][_TRX_CHAN_MAX];
- struct llist_head dl_prims[8]; /* Queue primitves for TX */
- uint8_t ho_rach_detect[8][8];
+ struct trx_chan_state chan_states[TRX_NR_TS][_TRX_CHAN_MAX];
+ struct llist_head dl_prims[TRX_NR_TS]; /* Queue primitves for TX */
+ uint8_t ho_rach_detect[TRX_NR_TS][TS_MAX_LCHAN];
};
struct trx_l1h *l1if_open(struct gsm_bts_trx *trx);
diff --git a/src/osmo-bts-trx/scheduler.c b/src/osmo-bts-trx/scheduler.c
index 44ed5659..bccc1830 100644
--- a/src/osmo-bts-trx/scheduler.c
+++ b/src/osmo-bts-trx/scheduler.c
@@ -230,7 +230,7 @@ int trx_sched_init(struct trx_l1h *l1h)
/* hack to get bts */
bts = l1h->trx->bts;
- for (tn = 0; tn < 8; tn++) {
+ for (tn = 0; tn < TRX_NR_TS; tn++) {
l1h->mf_index[tn] = 0;
l1h->mf_last_fn[tn] = 0;
INIT_LLIST_HEAD(&l1h->dl_prims[tn]);
@@ -251,7 +251,7 @@ void trx_sched_exit(struct trx_l1h *l1h)
LOGP(DL1C, LOGL_NOTICE, "Exit scheduler for trx=%u\n", l1h->trx->nr);
- for (tn = 0; tn < 8; tn++) {
+ for (tn = 0; tn < TRX_NR_TS; tn++) {
msgb_queue_flush(&l1h->dl_prims[tn]);
for (i = 0; i < _TRX_CHAN_MAX; i++) {
chan_state = &l1h->chan_states[tn][i];
@@ -265,7 +265,7 @@ void trx_sched_exit(struct trx_l1h *l1h)
}
}
/* clear lchan channel states */
- for (i = 0; i < 8; i++)
+ for (i = 0; i < TRX_NR_TS; i++)
l1h->trx->ts[tn].lchan[i].state = LCHAN_S_NONE;
}
}
@@ -2876,7 +2876,7 @@ static int trx_sched_fn(uint32_t fn)
continue;
/* process every TS of TRX */
- for (tn = 0; tn < 8; tn++) {
+ for (tn = 0; tn < TRX_NR_TS; tn++) {
/* ignore disabled slots */
if (!(l1h->config.slotmask & (1 << tn)))
continue;
diff --git a/src/osmo-bts-trx/trx_vty.c b/src/osmo-bts-trx/trx_vty.c
index e3e9c364..43c00f88 100644
--- a/src/osmo-bts-trx/trx_vty.c
+++ b/src/osmo-bts-trx/trx_vty.c
@@ -100,7 +100,7 @@ DEFUN(show_transceiver, show_transceiver_cmd, "show transceiver",
VTY_NEWLINE);
else
vty_out(vty, " maxdly : undefined%s", VTY_NEWLINE);
- for (tn = 0; tn < 8; tn++) {
+ for (tn = 0; tn < TRX_NR_TS; tn++) {
if (!((1 << tn) & l1h->config.slotmask))
vty_out(vty, " slot #%d: unsupported%s", tn,
VTY_NEWLINE);
@@ -299,7 +299,7 @@ DEFUN(cfg_trx_slotmask, cfg_trx_slotmask_cmd,
uint8_t tn;
l1h->config.slotmask = 0;
- for (tn = 0; tn < 8; tn++)
+ for (tn = 0; tn < TRX_NR_TS; tn++)
if (argv[tn][0] == '1')
l1h->config.slotmask |= (1 << tn);