trxcon: move FBSB timeout calculation to the trxcon_fsm

In the upcoming patches I am adding a possibility to enlarge the FBSB
timeout by providing API for that.  This is needed for SDR based PHYs,
because for them it takes longer to tune and so on.  The L1CTL codec
is not the right place for applying PHY specific quirks, so let's
move the TDMA FNs -> ms conversion to the FSM logic.

Change-Id: I685f48cfed000997b0d7c16073c6387bc05d2bbe
Related: OS#5599
This commit is contained in:
Vadim Yanitskiy 2022-12-15 01:41:53 +07:00 committed by fixeria
parent 0883c25ac5
commit f7d5d8d4ff
3 changed files with 9 additions and 6 deletions

View File

@ -54,7 +54,7 @@ struct trxcon_param_full_power_scan_res {
/* param of TRXCON_EV_FBSB_SEARCH_REQ */
struct trxcon_param_fbsb_search_req {
uint16_t band_arfcn;
uint16_t timeout_ms;
uint16_t timeout_fns; /* in TDMA Fn periods */
uint8_t pchan_config;
};

View File

@ -35,8 +35,8 @@
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
#include <osmocom/gsm/gsm0502.h>
#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <osmocom/gsm/protocol/gsm_08_58.h>
#include <osmocom/bb/trxcon/logging.h>
@ -369,15 +369,15 @@ static int l1ctl_rx_fbsb_req(struct trxcon_inst *trxcon, struct msgb *msg)
struct trxcon_param_fbsb_search_req req = {
.pchan_config = l1ctl_ccch_mode2pchan_config(fbsb->ccch_mode),
.timeout_ms = ntohs(fbsb->timeout) * GSM_TDMA_FN_DURATION_uS / 1000,
.timeout_fns = ntohs(fbsb->timeout),
.band_arfcn = ntohs(fbsb->band_arfcn),
};
LOGPFSMSL(fi, g_logc_l1c, LOGL_NOTICE,
"Received FBSB request (%s %d, timeout %u ms)\n",
"Received FBSB request (%s %d, timeout %u TDMA FNs)\n",
arfcn2band_name(req.band_arfcn),
req.band_arfcn & ~ARFCN_FLAG_MASK,
req.timeout_ms);
req.timeout_fns);
osmo_fsm_inst_dispatch(fi, TRXCON_EV_FBSB_SEARCH_REQ, &req);

View File

@ -28,6 +28,7 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/gsm/gsm0502.h>
#include <osmocom/bb/trxcon/trxcon.h>
#include <osmocom/bb/trxcon/trxcon_fsm.h>
@ -163,8 +164,10 @@ static void trxcon_st_reset_action(struct osmo_fsm_inst *fi,
case TRXCON_EV_FBSB_SEARCH_REQ:
{
const struct trxcon_param_fbsb_search_req *req = data;
unsigned long timeout_ms;
osmo_fsm_inst_state_chg_ms(fi, TRXCON_ST_FBSB_SEARCH, req->timeout_ms, 0);
timeout_ms = req->timeout_fns * GSM_TDMA_FN_DURATION_uS / 1000;
osmo_fsm_inst_state_chg_ms(fi, TRXCON_ST_FBSB_SEARCH, timeout_ms, 0);
l1sched_configure_ts(trxcon->sched, 0, req->pchan_config);