diff options
-rw-r--r-- | src/host/layer23/include/osmocom/bb/common/osmocom_data.h | 6 | ||||
-rw-r--r-- | src/host/layer23/src/common/l1ctl.c | 38 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h index 14e594cb..4ec7ad77 100644 --- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h +++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h @@ -114,6 +114,7 @@ enum osmobb_l1ctl_sig { S_L1CTL_TCH_MODE_CONF, S_L1CTL_LOSS_IND, S_L1CTL_NEIGH_PM_IND, + S_L1CTL_BURST_IND, }; enum osmobb_global_sig { @@ -150,4 +151,9 @@ struct osmobb_neigh_pm_ind { uint8_t rx_lev; }; +struct osmobb_msg_ind { + struct osmocom_ms *ms; + struct msgb *msg; +}; + #endif diff --git a/src/host/layer23/src/common/l1ctl.c b/src/host/layer23/src/common/l1ctl.c index 9af61677..b717af03 100644 --- a/src/host/layer23/src/common/l1ctl.c +++ b/src/host/layer23/src/common/l1ctl.c @@ -340,6 +340,41 @@ static int rx_ph_data_ind(struct osmocom_ms *ms, struct msgb *msg) return lapdm_phsap_up(&pp.oph, le); } +/* Receive L1CTL_BURST_IND (Data Indication from L1) */ +static int rx_ph_burst_ind(struct osmocom_ms *ms, struct msgb *msg) +{ + struct l1ctl_burst_ind *bi; + struct osmobb_msg_ind mi; + uint8_t chan_type, chan_ts, chan_ss; + struct gsm_time rx_time; + uint16_t arfcn; + + /* Header handling */ + bi = (struct l1ctl_burst_ind *) msg->l1h; + + rsl_dec_chan_nr(bi->chan_nr, &chan_type, &chan_ss, &chan_ts); + gsm_fn2gsmtime(&rx_time, ntohl(bi->frame_nr)); + arfcn = ntohs(bi->band_arfcn); + + /* Debug print */ + LOGP(DL1C, LOGL_NOTICE, "BURST IND: @(%6d = %.4u/%.2u/%.2u) (%4d dBm, SNR %3d%s%s)\n", + rx_time.fn, rx_time.t1, rx_time.t2, rx_time.t3, + (int)bi->rx_level-110, bi->snr, + arfcn & ARFCN_UPLINK ? ", UL" : "", + bi->flags & BI_FLG_SACCH ? ", SACCH" : "" + ); + + /* Dispatch signal !HACK! */ + mi.ms = ms; + mi.msg = msg; + osmo_signal_dispatch(SS_L1CTL, S_L1CTL_BURST_IND, &mi); + + /* Done with the message */ + msgb_free(msg); + + return 0; +} + /* Receive L1CTL_DATA_CONF (Data Confirm from L1) */ static int rx_ph_data_conf(struct osmocom_ms *ms, struct msgb *msg) { @@ -999,6 +1034,9 @@ int l1ctl_recv(struct osmocom_ms *ms, struct msgb *msg) case L1CTL_DATA_IND: rc = rx_ph_data_ind(ms, msg); break; + case L1CTL_BURST_IND: + rc = rx_ph_burst_ind(ms, msg); + break; case L1CTL_DATA_CONF: rc = rx_ph_data_conf(ms, msg); break; |