summaryrefslogtreecommitdiffstats
path: root/src/host
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-08 18:50:14 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commitcb1b60a7c1fbdbdf7fb204ecde57dd95e04b26a5 (patch)
treed90e2cbdf69da002392d3c5b54ae5ce6be2c3777 /src/host
parent059d165cd69491a9c03d6ac3f9109f4bf4f10cdc (diff)
host/trxcon: handle L1CTL_RESET_REQ inside l1ctl.c
Diffstat (limited to 'src/host')
-rw-r--r--src/host/trxcon/l1ctl.c20
-rw-r--r--src/host/trxcon/trxcon.c12
-rw-r--r--src/host/trxcon/trxcon.h1
3 files changed, 20 insertions, 13 deletions
diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c
index 4abec77..c01d372 100644
--- a/src/host/trxcon/l1ctl.c
+++ b/src/host/trxcon/l1ctl.c
@@ -245,8 +245,24 @@ static int l1ctl_rx_reset_req(struct l1ctl_link *l1l, struct msgb *msg)
LOGP(DL1C, LOGL_DEBUG, "Recv Reset Req (%u)\n", res->type);
- osmo_fsm_inst_dispatch(trxcon_fsm,
- L1CTL_EVENT_RESET_REQ, res);
+ switch (res->type) {
+ case L1CTL_RES_T_FULL:
+ /* TODO: implement trx_if_reset() */
+ trx_if_flush_ctrl(l1l->trx);
+ trx_if_cmd_poweroff(l1l->trx);
+ trx_if_cmd_echo(l1l->trx);
+
+ /* Fall through */
+ case L1CTL_RES_T_SCHED:
+ sched_trx_reset(l1l->trx);
+ break;
+ default:
+ LOGP(DL1C, LOGL_ERROR, "Unknown L1CTL_RESET_REQ type\n");
+ goto exit;
+ }
+
+ /* Confirm */
+ rc = l1ctl_tx_reset_conf(l1l, res->type);
exit:
msgb_free(msg);
diff --git a/src/host/trxcon/trxcon.c b/src/host/trxcon/trxcon.c
index 9bc98e5..a87626f 100644
--- a/src/host/trxcon/trxcon.c
+++ b/src/host/trxcon/trxcon.c
@@ -89,25 +89,18 @@ static void trxcon_fsm_managed_action(struct osmo_fsm_inst *fi,
osmo_fsm_inst_state_chg(trxcon_fsm, TRXCON_STATE_IDLE, 0, 0);
if (app_data.trx->fsm->state != TRX_STATE_OFFLINE) {
+ /* TODO: implement trx_if_reset() */
trx_if_flush_ctrl(app_data.trx);
trx_if_cmd_poweroff(app_data.trx);
}
break;
- case L1CTL_EVENT_RESET_REQ:
- trx_if_cmd_poweroff(app_data.trx);
- trx_if_cmd_echo(app_data.trx);
- sched_trx_reset(app_data.trx);
- break;
- case TRX_EVENT_RESET_IND:
- /* TODO: send proper reset type */
- l1ctl_tx_reset_conf(app_data.l1l, L1CTL_RES_T_BOOT);
- break;
case SCH_EVENT_DATA:
l1ctl_tx_data_ind(app_data.l1l, (struct l1ctl_info_dl *) data);
case TRX_EVENT_RSP_ERROR:
case TRX_EVENT_OFFLINE:
case SCH_EVENT_CLCK_IND:
case SCH_EVENT_CLCK_LOSS:
+ case TRX_EVENT_RESET_IND:
/* TODO: notify L2 & L3 about that */
break;
default:
@@ -125,7 +118,6 @@ static struct osmo_fsm_state trxcon_fsm_states[] = {
[TRXCON_STATE_MANAGED] = {
.in_event_mask = (
GEN_MASK(L1CTL_EVENT_DISCONNECT) |
- GEN_MASK(L1CTL_EVENT_RESET_REQ) |
GEN_MASK(TRX_EVENT_RESET_IND) |
GEN_MASK(TRX_EVENT_RSP_ERROR) |
GEN_MASK(TRX_EVENT_OFFLINE) |
diff --git a/src/host/trxcon/trxcon.h b/src/host/trxcon/trxcon.h
index 7b3a232..6452f80 100644
--- a/src/host/trxcon/trxcon.h
+++ b/src/host/trxcon/trxcon.h
@@ -11,7 +11,6 @@ enum trxcon_fsm_events {
/* L1CTL specific events */
L1CTL_EVENT_CONNECT,
L1CTL_EVENT_DISCONNECT,
- L1CTL_EVENT_RESET_REQ,
/* TRX specific events */
TRX_EVENT_RESET_IND,