This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/6798
host/trxcon/scheduler: clean up the trx_lchan_state
There were some BTS specific variables, which are meaningless.
This change cleans them up, and also groups some measurement,
encryption, and AMR specific variables into sub-structures.
Change-Id: Ie753a7e3e7fa2b433d8319b3a05b85b8583d7be2
---
M src/host/trxcon/sched_lchan_common.c
M src/host/trxcon/sched_lchan_xcch.c
M src/host/trxcon/sched_trx.h
3 files changed, 50 insertions(+), 69 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/98/6798/1
diff --git a/src/host/trxcon/sched_lchan_common.c b/src/host/trxcon/sched_lchan_common.c
index aa0614c..8f06165 100644
--- a/src/host/trxcon/sched_lchan_common.c
+++ b/src/host/trxcon/sched_lchan_common.c
@@ -95,7 +95,7 @@
data->link_id = lchan_desc->link_id;
data->band_arfcn = htons(trx->band_arfcn);
data->frame_nr = htonl(lchan->rx_first_fn);
- data->rx_level = -(lchan->rssi_sum / lchan->rssi_num);
+ data->rx_level = -(lchan->meas.rssi_sum / lchan->meas.rssi_num);
/* FIXME: set proper values */
data->num_biterr = 0;
diff --git a/src/host/trxcon/sched_lchan_xcch.c b/src/host/trxcon/sched_lchan_xcch.c
index f57c8fc..cae3b19 100644
--- a/src/host/trxcon/sched_lchan_xcch.c
+++ b/src/host/trxcon/sched_lchan_xcch.c
@@ -48,8 +48,6 @@
{
const struct trx_lchan_desc *lchan_desc;
int n_errors, n_bits_total, rc;
- uint8_t *rssi_num, *toa_num;
- float *rssi_sum, *toa_sum;
sbit_t *buffer, *offset;
uint8_t l2[23], *mask;
uint32_t *first_fn;
@@ -60,33 +58,28 @@
mask = &lchan->rx_burst_mask;
buffer = lchan->rx_bursts;
- rssi_sum = &lchan->rssi_sum;
- rssi_num = &lchan->rssi_num;
- toa_sum = &lchan->toa_sum;
- toa_num = &lchan->toa_num;
-
LOGP(DSCHD, LOGL_DEBUG, "Data received on %s: fn=%u ts=%u bid=%u\n",
lchan_desc->name, fn, ts->index, bid);
/* Clear buffer & store frame number of first burst */
if (bid == 0) {
+ /* Clean up old measurements */
+ memset(&lchan->meas, 0x00, sizeof(lchan->meas));
+
memset(buffer, 0, 464);
*first_fn = fn;
*mask = 0x0;
-
- *rssi_sum = 0;
- *rssi_num = 0;
- *toa_sum = 0;
- *toa_num = 0;
}
- /* Update mask and RSSI */
+ /* Update mask */
*mask |= (1 << bid);
- *rssi_sum += rssi;
- (*rssi_num)++;
- *toa_sum += toa;
- (*toa_num)++;
+
+ /* Update measurements */
+ lchan->meas.rssi_sum += rssi;
+ lchan->meas.toa_sum += toa;
+ lchan->meas.rssi_num++;
+ lchan->meas.toa_num++;
/* Copy burst to buffer of 4 bursts */
offset = buffer + bid * 116;
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index e1ef924..de7e073 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -154,65 +154,53 @@
/*! \brief Burst buffer for TX */
ubit_t *tx_bursts;
- /*! \brief Number of RSSI values */
- uint8_t rssi_num;
- /*! \brief Sum of RSSI values */
- float rssi_sum;
- /*! \brief Number of TOA values */
- uint8_t toa_num;
- /*! \brief Sum of TOA values */
- float toa_sum;
- /*! \brief (SACCH) loss detection */
- uint8_t lost;
/*! \brief Mode for TCH channels */
uint8_t rsl_cmode, tch_mode;
- /* AMR specific */
- /*! \brief 4 possible codecs for AMR */
- uint8_t codec[4];
- /*! \brief Number of possible codecs */
- int codecs;
- /*! \brief Sum of bit error rates */
- float ber_sum;
- /*! \brief Number of bit error rates */
- int ber_num;
- /*! \brief Current uplink FT index */
- uint8_t ul_ft;
- /*! \brief Current downlink FT index */
- uint8_t dl_ft;
- /*! \brief Current uplink CMR index */
- uint8_t ul_cmr;
- /*! \brief Current downlink CMR index */
- uint8_t dl_cmr;
- /*! \brief If AMR loop is enabled */
- uint8_t amr_loop;
+ /*! \brief FACCH/H on downlink */
+ uint8_t dl_ongoing_facch;
+ /*! \brief FACCH/H on uplink */
+ uint8_t ul_ongoing_facch;
- /* TCH/H */
- uint8_t dl_ongoing_facch; /*! \brief FACCH/H on downlink */
- uint8_t ul_ongoing_facch; /*! \brief FACCH/H on uplink */
-
- /*! \brief A5/x encryption algorithm */
- int encr_algo;
- int encr_key_len;
- uint8_t encr_key[MAX_A5_KEY_LEN];
-
- /*! \brief Measurements */
struct {
- /*! \brief Cyclic clock counter */
- uint8_t clock;
- /*! \brief Last RSSI values */
- int8_t rssi[32];
- /*! \brief Received RSSI values */
- int rssi_count;
- /*! \brief Number of stored value */
- int rssi_valid_count;
- /*! \brief Any burst received so far */
- int rssi_got_burst;
+ /*! \brief Number of RSSI values */
+ uint8_t rssi_num;
+ /*! \brief Sum of RSSI values */
+ float rssi_sum;
+ /*! \brief Number of TOA values */
+ uint8_t toa_num;
/*! \brief Sum of TOA values */
float toa_sum;
- /*! \brief Number of TOA value */
- int toa_num;
} meas;
+
+ /* AMR specific */
+ struct {
+ /*! \brief 4 possible codecs for AMR */
+ uint8_t codec[4];
+ /*! \brief Number of possible codecs */
+ uint8_t codecs;
+ /*! \brief Current uplink FT index */
+ uint8_t ul_ft;
+ /*! \brief Current downlink FT index */
+ uint8_t dl_ft;
+ /*! \brief Current uplink CMR index */
+ uint8_t ul_cmr;
+ /*! \brief Current downlink CMR index */
+ uint8_t dl_cmr;
+ /*! \brief If AMR loop is enabled */
+ uint8_t amr_loop;
+ /*! \brief Number of bit error rates */
+ uint8_t ber_num;
+ /*! \brief Sum of bit error rates */
+ float ber_sum;
+ } amr;
+
+ /*! \brief A5/X encryption state */
+ struct {
+ uint8_t key[MAX_A5_KEY_LEN];
+ uint8_t key_len;
+ uint8_t algo;
+ } a5;
};
struct trx_ts {
--
To view, visit https://gerrit.osmocom.org/6798
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie753a7e3e7fa2b433d8319b3a05b85b8583d7be2
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>