From 31076646beb85f346d324edd3fa6bf02bdb933e4 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Tue, 2 Aug 2022 00:45:17 +0700 Subject: [PATCH] trxcon: add new trxcon_fsm state - TRXCON_ST_PACKET_DATA Change-Id: I7706d677c8966a6a7c6d452ae97eda84d4282ef5 --- .../trxcon/include/osmocom/bb/trxcon/trxcon.h | 1 + src/host/trxcon/src/trxcon_fsm.c | 43 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h index 910d37f62..9aa5e554c 100644 --- a/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h +++ b/src/host/trxcon/include/osmocom/bb/trxcon/trxcon.h @@ -10,6 +10,7 @@ enum trxcon_fsm_states { TRXCON_ST_FBSB_SEARCH, TRXCON_ST_BCCH_CCCH, TRXCON_ST_DEDICATED, + TRXCON_ST_PACKET_DATA, }; enum trxcon_fsm_events { diff --git a/src/host/trxcon/src/trxcon_fsm.c b/src/host/trxcon/src/trxcon_fsm.c index 59a29d9b3..0d03740ed 100644 --- a/src/host/trxcon/src/trxcon_fsm.c +++ b/src/host/trxcon/src/trxcon_fsm.c @@ -301,7 +301,10 @@ static void trxcon_st_bcch_ccch_action(struct osmo_fsm_inst *fi, return; } - osmo_fsm_inst_state_chg(fi, TRXCON_ST_DEDICATED, 0, 0); + if (config == GSM_PCHAN_PDCH) + osmo_fsm_inst_state_chg(fi, TRXCON_ST_PACKET_DATA, 0, 0); + else + osmo_fsm_inst_state_chg(fi, TRXCON_ST_DEDICATED, 0, 0); break; } case TRXCON_EV_RX_DATA_IND: @@ -448,6 +451,30 @@ static void trxcon_st_dedicated_action(struct osmo_fsm_inst *fi, } } +static void trxcon_st_packet_data_action(struct osmo_fsm_inst *fi, + uint32_t event, void *data) +{ + struct trxcon_inst *trxcon = fi->priv; + + switch (event) { + case TRXCON_EV_TX_ACCESS_BURST_REQ: + handle_tx_access_burst_req(fi, data); + break; + case TRXCON_EV_RX_TRAFFIC_IND: + LOGPFSML(fi, LOGL_NOTICE, "Rx PDTCH/D message\n"); + break; + case TRXCON_EV_RX_DATA_IND: + LOGPFSML(fi, LOGL_NOTICE, "Rx PTCCH/D message\n"); + break; + case TRXCON_EV_DEDICATED_RELEASE_REQ: + l1sched_reset(trxcon->sched, false); + osmo_fsm_inst_state_chg(fi, TRXCON_ST_RESET, 0, 0); + break; + default: + OSMO_ASSERT(0); + } +} + static void trxcon_fsm_pre_term_cb(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) { @@ -501,7 +528,8 @@ static const struct osmo_fsm_state trxcon_fsm_states[] = { .name = "BCCH_CCCH", .out_state_mask = S(TRXCON_ST_RESET) | S(TRXCON_ST_FBSB_SEARCH) - | S(TRXCON_ST_DEDICATED), + | S(TRXCON_ST_DEDICATED) + | S(TRXCON_ST_PACKET_DATA), .in_event_mask = S(TRXCON_EV_RX_DATA_IND) | S(TRXCON_EV_SET_CCCH_MODE_REQ) | S(TRXCON_EV_TX_ACCESS_BURST_REQ) @@ -523,6 +551,17 @@ static const struct osmo_fsm_state trxcon_fsm_states[] = { | S(TRXCON_EV_CRYPTO_REQ), .action = &trxcon_st_dedicated_action, }, + [TRXCON_ST_PACKET_DATA] = { + .name = "PACKET_DATA", + .out_state_mask = S(TRXCON_ST_RESET) + | S(TRXCON_ST_FBSB_SEARCH) + | S(TRXCON_ST_BCCH_CCCH), + .in_event_mask = S(TRXCON_EV_DEDICATED_RELEASE_REQ) + | S(TRXCON_EV_TX_ACCESS_BURST_REQ) + | S(TRXCON_EV_RX_TRAFFIC_IND) + | S(TRXCON_EV_RX_DATA_IND), + .action = &trxcon_st_packet_data_action, + }, }; static const struct value_string trxcon_fsm_event_names[] = {