fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmocom-bb/+/30053 )
Change subject: trxcon: add handle_full_power_scan_req(), reduce code duplication
......................................................................
trxcon: add handle_full_power_scan_req(), reduce code duplication
Allow TRXCON_ST_{FULL_POWER_SCAN->FULL_POWER_SCAN} state transition
so that we can call osmo_fsm_inst_state_chg() unconditionally.
Change-Id: I1ea69561a2d3cf73009c6244b1d0f090d744d7b2
Related: OS#5599
---
M src/host/trxcon/src/trxcon_fsm.c
1 file changed, 20 insertions(+), 26 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/53/30053/1
diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c
index 5268bc6..38b95ec 100644
--- a/src/host/trxcon/src/trxcon_fsm.c
+++ b/src/host/trxcon/src/trxcon_fsm.c
@@ -121,6 +121,22 @@
}
}
+static void handle_full_power_scan_req(struct osmo_fsm_inst *fi,
+ const struct trxcon_param_full_power_scan_req *req)
+{
+ struct trxcon_inst *trxcon = fi->priv;
+ const struct phyif_cmd phycmd = {
+ .type = PHYIF_CMDT_MEASURE,
+ .param.measure = {
+ .band_arfcn_start = req->band_arfcn_start,
+ .band_arfcn_stop = req->band_arfcn_stop,
+ },
+ };
+
+ osmo_fsm_inst_state_chg(fi, TRXCON_ST_FULL_POWER_SCAN, 0, 0); /* TODO: timeout */
+ phyif_handle_cmd(trxcon->phyif, &phycmd);
+}
+
static void trxcon_st_reset_action(struct osmo_fsm_inst *fi,
uint32_t event, void *data)
{
@@ -156,20 +172,8 @@
break;
}
case TRXCON_EV_FULL_POWER_SCAN_REQ:
- {
- const struct trxcon_param_full_power_scan_req *req = data;
- const struct phyif_cmd phycmd = {
- .type = PHYIF_CMDT_MEASURE,
- .param.measure = {
- .band_arfcn_start = req->band_arfcn_start,
- .band_arfcn_stop = req->band_arfcn_stop,
- },
- };
-
- osmo_fsm_inst_state_chg(fi, TRXCON_ST_FULL_POWER_SCAN, 0, 0); /* TODO: timeout */
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ handle_full_power_scan_req(fi, (const struct trxcon_param_full_power_scan_req *)data);
break;
- }
default:
OSMO_ASSERT(0);
}
@@ -189,19 +193,8 @@
break;
}
case TRXCON_EV_FULL_POWER_SCAN_REQ:
- {
- const struct trxcon_param_full_power_scan_req *req = data;
- const struct phyif_cmd phycmd = {
- .type = PHYIF_CMDT_MEASURE,
- .param.measure = {
- .band_arfcn_start = req->band_arfcn_start,
- .band_arfcn_stop = req->band_arfcn_stop,
- },
- };
-
- phyif_handle_cmd(trxcon->phyif, &phycmd);
+ handle_full_power_scan_req(fi, (const struct trxcon_param_full_power_scan_req *)data);
break;
- }
default:
OSMO_ASSERT(0);
}
@@ -528,7 +521,8 @@
},
[TRXCON_ST_FULL_POWER_SCAN] = {
.name = "FULL_POWER_SCAN",
- .out_state_mask = S(TRXCON_ST_RESET),
+ .out_state_mask = S(TRXCON_ST_RESET)
+ | S(TRXCON_ST_FULL_POWER_SCAN),
.in_event_mask = S(TRXCON_EV_FULL_POWER_SCAN_RES)
| S(TRXCON_EV_FULL_POWER_SCAN_REQ),
.action = &trxcon_st_full_power_scan_action,
--
To view, visit
https://gerrit.osmocom.org/c/osmocom-bb/+/30053
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I1ea69561a2d3cf73009c6244b1d0f090d744d7b2
Gerrit-Change-Number: 30053
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange