From 7aee47916536032e6b7fde778b303743af55fa9f Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Wed, 11 Dec 2013 11:31:39 +0100 Subject: [WIP] HO: Add new parameters to L1CTL_DM_EST_REQ * Flag to enter dedicated mode with TX disabled * Flag to use sync info of neighbor cell * Flag to use sync info of previous serving cell * Index of neighbor cell All these parameters are required to handover to a new channel. Change-Id: Iadbc47f006d1f8a019822aedee180814de13cb2d --- include/l1ctl_proto.h | 6 +++++ src/host/layer23/include/osmocom/bb/common/l1ctl.h | 5 ++-- src/host/layer23/src/common/l1ctl.c | 20 ++++++++++++-- src/host/layer23/src/misc/app_cbch_sniff.c | 4 +-- src/host/layer23/src/mobile/gsm48_rr.c | 31 ++++++++++++++-------- 5 files changed, 49 insertions(+), 17 deletions(-) diff --git a/include/l1ctl_proto.h b/include/l1ctl_proto.h index f2ed9242..e69a7f7c 100644 --- a/include/l1ctl_proto.h +++ b/include/l1ctl_proto.h @@ -278,8 +278,14 @@ struct l1ctl_dm_est_req { }; uint8_t tch_mode; uint8_t audio_mode; + uint8_t flags; + uint8_t neighbor; } __attribute__((packed)); +#define L1CTL_EST_F_RXONLY (1<<0) /* TX disabled */ +#define L1CTL_EST_F_NBSYNC (1<<1) /* use neighbor cell's sync info */ +#define L1CTL_EST_F_LASTSYNC (1<<2) /* use sync of last cell */ + struct l1ctl_dm_freq_req { uint16_t fn; uint8_t tsc; diff --git a/src/host/layer23/include/osmocom/bb/common/l1ctl.h b/src/host/layer23/include/osmocom/bb/common/l1ctl.h index e4dbdedc..eb0e2c10 100644 --- a/src/host/layer23/include/osmocom/bb/common/l1ctl.h +++ b/src/host/layer23/include/osmocom/bb/common/l1ctl.h @@ -25,10 +25,11 @@ int l1ctl_tx_rach_req(struct osmocom_ms *ms, uint8_t ra, uint16_t offset, /* Transmit L1CTL_DM_EST_REQ */ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn, - uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode, uint8_t audio_mode); + uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode, uint8_t audio_mode, + int tx, int sync, int index); int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn, uint16_t *ma, uint8_t ma_len, uint8_t chan_nr, uint8_t tsc, - uint8_t tch_mode, uint8_t audio_mode); + uint8_t tch_mode, uint8_t audio_mode, int tx, int sync, int index); /* Transmit L1CTL_DM_FREQ_REQ */ int l1ctl_tx_dm_freq_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn, diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c index cb75957d..3bb4c14d 100644 --- a/src/host/layer23/src/common/l1ctl.c +++ b/src/host/layer23/src/common/l1ctl.c @@ -455,7 +455,7 @@ int l1ctl_tx_rach_req(struct osmocom_ms *ms, uint8_t ra, uint16_t offset, /* Transmit L1CTL_DM_EST_REQ */ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn, uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode, - uint8_t audio_mode) + uint8_t audio_mode, int tx, int sync, int index) { struct msgb *msg; struct l1ctl_info_ul *ul; @@ -478,6 +478,14 @@ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn, req->h0.band_arfcn = htons(band_arfcn); req->tch_mode = tch_mode; req->audio_mode = audio_mode; + req->flags = (tx) ? 0 : L1CTL_EST_F_RXONLY; + if (sync) { + if (index >= 0) { + req->flags |= L1CTL_EST_F_NBSYNC; + req->neighbor = index; + } else + req->flags |= L1CTL_EST_F_LASTSYNC; + } return osmo_send_l1(ms, msg); } @@ -485,7 +493,7 @@ int l1ctl_tx_dm_est_req_h0(struct osmocom_ms *ms, uint16_t band_arfcn, int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn, uint16_t *ma, uint8_t ma_len, uint8_t chan_nr, uint8_t tsc, uint8_t tch_mode, - uint8_t audio_mode) + uint8_t audio_mode, int tx, int sync, int index) { struct msgb *msg; struct l1ctl_info_ul *ul; @@ -513,6 +521,14 @@ int l1ctl_tx_dm_est_req_h1(struct osmocom_ms *ms, uint8_t maio, uint8_t hsn, req->h1.ma[i] = htons(ma[i]); req->tch_mode = tch_mode; req->audio_mode = audio_mode; + req->flags = (tx) ? 0 : L1CTL_EST_F_RXONLY; + if (sync) { + if (index >= 0) { + req->flags |= L1CTL_EST_F_NBSYNC; + req->neighbor = index; + } else + req->flags |= L1CTL_EST_F_LASTSYNC; + } return osmo_send_l1(ms, msg); } diff --git a/src/host/layer23/src/misc/app_cbch_sniff.c b/src/host/layer23/src/misc/app_cbch_sniff.c index 8256eaf6..20e730f5 100644 --- a/src/host/layer23/src/misc/app_cbch_sniff.c +++ b/src/host/layer23/src/misc/app_cbch_sniff.c @@ -57,12 +57,12 @@ static int try_cbch(struct osmocom_ms *ms, struct gsm48_sysinfo *s) return l1ctl_tx_dm_est_req_h1(ms, s->maio, s->hsn, s->hopping, s->hopp_len, s->chan_nr, s->tsc, - GSM48_CMODE_SIGN, 0); + GSM48_CMODE_SIGN, 0, 1, 0, 0); } else { LOGP(DRR, LOGL_INFO, "chan_nr = 0x%02x TSC = %d ARFCN = %d\n", s->chan_nr, s->tsc, s->arfcn); return l1ctl_tx_dm_est_req_h0(ms, s->arfcn, - s->chan_nr, s->tsc, GSM48_CMODE_SIGN, 0); + s->chan_nr, s->tsc, GSM48_CMODE_SIGN, 0, 1, 0, 0); } } diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index a94fc99c..a1f1b609 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -2935,7 +2935,8 @@ int gsm48_rr_los(struct osmocom_ms *ms) /* activation of channel in dedicated mode */ static int gsm48_rr_activate_channel(struct osmocom_ms *ms, - struct gsm48_rr_cd *cd, uint16_t *ma, uint8_t ma_len) + struct gsm48_rr_cd *cd, uint16_t *ma, uint8_t ma_len, int tx, + int sync, int index) { struct gsm_subscriber *subscr = &ms->subscr; struct gsm48_rrlayer *rr = &ms->rrlayer; @@ -2944,11 +2945,17 @@ static int gsm48_rr_activate_channel(struct osmocom_ms *ms, struct rx_meas_stat *meas = &ms->meas; uint8_t ch_type, ch_subch, ch_ts; uint8_t timeout = 64; + int ta = cd->ind_ta; /* setting (new) timing advance */ - LOGP(DRR, LOGL_INFO, "setting indicated TA %d (actual TA %d)\n", - cd->ind_ta, cd->ind_ta - set->alter_delay); - l1ctl_tx_param_req(ms, cd->ind_ta - set->alter_delay, + if (!tx) { + ta = 0; + LOGP(DRR, LOGL_INFO, "setting TA 0 for access bursts " + "(actual TA %d)\n", ta - set->alter_delay); + } else + LOGP(DRR, LOGL_INFO, "setting indicated TA %d " + "(actual TA %d)\n", cd->ind_ta, ta - set->alter_delay); + l1ctl_tx_param_req(ms, ta - set->alter_delay, (set->alter_tx_power) ? set->alter_tx_power_value : cd->ind_tx_power); @@ -2983,15 +2990,17 @@ static int gsm48_rr_activate_channel(struct osmocom_ms *ms, LOGP(DRR, LOGL_INFO, "establishing channel in dedicated mode\n"); rsl_dec_chan_nr(cd->chan_nr, &ch_type, &ch_subch, &ch_ts); LOGP(DRR, LOGL_INFO, " Channel type %d, subch %d, ts %d, mode %d, " - "audio-mode %d, cipher %d\n", ch_type, ch_subch, ch_ts, - cd->mode, rr->audio_mode, rr->cipher_type + 1); + "audio-mode %d, cipher %d, tsc %d, ARFCN %s, hopping=%s\n", + ch_type, ch_subch, ch_ts, cd->mode, rr->audio_mode, + rr->cipher_type + 1, cd->tsc, gsm_print_arfcn(cd->arfcn), + (cd->h) ? "yes":"no"); if (cd->h) l1ctl_tx_dm_est_req_h1(ms, cd->maio, cd->hsn, ma, ma_len, cd->chan_nr, cd->tsc, cd->mode, - rr->audio_mode); + rr->audio_mode, tx, sync, index); else l1ctl_tx_dm_est_req_h0(ms, cd->arfcn, cd->chan_nr, cd->tsc, - cd->mode, rr->audio_mode); + cd->mode, rr->audio_mode, tx, sync, index); rr->dm_est = 1; /* old SI 5/6 are not valid on a new dedicated channel */ @@ -3261,7 +3270,7 @@ static int gsm48_rr_dl_est(struct osmocom_ms *ms) rr->cd_before.h = 0; rr->cd_before.arfcn = 0; /* activate channel */ - gsm48_rr_activate_channel(ms, &rr->cd_before, ma, ma_len); + gsm48_rr_activate_channel(ms, &rr->cd_before, ma, ma_len, 1, 0, 0); /* render channel "after time" */ gsm48_rr_render_ma(ms, &rr->cd_now, ma, &ma_len); /* schedule change of channel */ @@ -3269,7 +3278,7 @@ static int gsm48_rr_dl_est(struct osmocom_ms *ms) rr->cd_now.start_tm.fn); #else /* activate channel */ - gsm48_rr_activate_channel(ms, &rr->cd_now, ma, ma_len); + gsm48_rr_activate_channel(ms, &rr->cd_now, ma, ma_len, 1, 0, 0); #endif /* set T200 of SAPI 0 */ @@ -4432,7 +4441,7 @@ static int gsm48_rr_susp_cnf_dedicated(struct osmocom_ms *ms, struct msgb *msg) /* activate channel */ gsm48_rr_activate_channel(ms, &rr->cd_before, ma, - ma_len); + ma_len, enable_tx, sync, rr->hando_meas_index); /* render channel "after time" */ gsm48_rr_render_ma(ms, &rr->cd_now, ma, &ma_len); -- cgit v1.2.3