summaryrefslogtreecommitdiffstats
path: root/src/host/trxcon/trxcon.c
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-06 13:05:27 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-11-19 17:35:07 +0700
commit604ac30825dd3e915daaf6b155c07f0e1d49d500 (patch)
tree1a72d1391c5e3107ccf48405979633077c9f6c96 /src/host/trxcon/trxcon.c
parent62328cb08812ff440a699e92772b0c40bbc37869 (diff)
host/trxcon: handle ccch_mode from L1CTL_FBSB_REQ
Previously, the content of L1CTL_FBSB_REQ message was only used to obtain a new ARFCN and retune transceiver. Now, since we have working TDMA scheduler, some other params (like ccch_mode) may be used too. Change-Id: Iccabba376d67e091b55a604a2ae87f2aa86362e5
Diffstat (limited to 'src/host/trxcon/trxcon.c')
-rw-r--r--src/host/trxcon/trxcon.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c
index d88e990f..6f50d1a2 100644
--- a/src/host/trxcon/trxcon.c
+++ b/src/host/trxcon/trxcon.c
@@ -29,6 +29,8 @@
#include <unistd.h>
#include <signal.h>
+#include <arpa/inet.h>
+
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
@@ -72,6 +74,31 @@ static struct {
void *tall_trx_ctx = NULL;
struct osmo_fsm_inst *trxcon_fsm;
+static void trxcon_handle_fbsb_req(struct l1ctl_fbsb_req *req)
+{
+ uint16_t band_arfcn;
+
+ /* Reset L1 */
+ sched_trx_reset(app_data.trx);
+
+ /* Configure a single timeslot */
+ if (req->ccch_mode == CCCH_MODE_COMBINED)
+ sched_trx_configure_ts(app_data.trx, 0, GSM_PCHAN_CCCH_SDCCH4);
+ else
+ sched_trx_configure_ts(app_data.trx, 0, GSM_PCHAN_CCCH);
+
+ /* Store current ARFCN */
+ band_arfcn = ntohs(req->band_arfcn);
+ app_data.trx->band_arfcn = band_arfcn;
+
+ /* Tune transceiver to required ARFCN */
+ trx_if_cmd_rxtune(app_data.trx, band_arfcn);
+ trx_if_cmd_txtune(app_data.trx, band_arfcn);
+ trx_if_cmd_poweron(app_data.trx);
+
+ talloc_free(req);
+}
+
static void trxcon_fsm_idle_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
@@ -101,10 +128,7 @@ static void trxcon_fsm_managed_action(struct osmo_fsm_inst *fi,
l1ctl_tx_reset_conf(app_data.l1l, L1CTL_RES_T_BOOT);
break;
case L1CTL_EVENT_FBSB_REQ:
- app_data.trx->band_arfcn = *((uint16_t *) data);
- trx_if_cmd_rxtune(app_data.trx, app_data.trx->band_arfcn);
- trx_if_cmd_txtune(app_data.trx, app_data.trx->band_arfcn);
- trx_if_cmd_poweron(app_data.trx);
+ trxcon_handle_fbsb_req((struct l1ctl_fbsb_req *) data);
break;
case TRX_EVENT_RSP_ERROR:
case TRX_EVENT_OFFLINE: