diff options
author | Sebastian Stumpf <sebastian.stumpf87@googlemail.com> | 2017-03-04 15:42:11 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-07-12 23:26:26 +0200 |
commit | e7600a0d57c5f1c0add894cdba7904a73775ca1f (patch) | |
tree | 5b55937a8daad721e45544357bfb36e291212c10 /src/host/virt_phy/src/virt_prim_data.c | |
parent | a090f635b03780f651d54033c6f8c616fdd8f870 (diff) |
VIRT-PHY: Fixed FACCH processing on TCH.
As TCH is not supported in GSMTAP yet, all incoming frames on the
virt-phy are forwarded as FACCH to the l23 for now.
Cleanup code in virt_prim_data and virt_prim_traffic.
Change-Id: I6b41f21b6984e62ad98edfe4398bd678d5b2dad5
Diffstat (limited to 'src/host/virt_phy/src/virt_prim_data.c')
-rw-r--r-- | src/host/virt_phy/src/virt_prim_data.c | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/src/host/virt_phy/src/virt_prim_data.c b/src/host/virt_phy/src/virt_prim_data.c index 932683c3..5d62afde 100644 --- a/src/host/virt_phy/src/virt_prim_data.c +++ b/src/host/virt_phy/src/virt_prim_data.c @@ -42,15 +42,13 @@ static void virt_l1_sched_handler_cb(uint32_t fn, struct msgb * msg); /** * @brief Handler callback function for DATA request. * + * @param [in] fn frame number * @param [in] msg the msg to sent over virtual um. */ static void virt_l1_sched_handler_cb(uint32_t fn, struct msgb * msg) { gsmtapl1_tx_to_virt_um(fn, msg); - // send confirm to layer23 - msg = l1ctl_create_l2_msg(L1CTL_DATA_CONF, - fn, 0, 0); - l1ctl_sap_tx_to_l23(msg); + l1ctl_tx_data_conf(fn, 0, l1_model_ms->state->serving_cell.arfcn); } /** @@ -70,7 +68,8 @@ void l1ctl_rx_data_req(struct msgb *msg) struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *)l1h->data; struct l1ctl_data_ind *data_ind = (struct l1ctl_data_ind *)ul->payload; uint8_t rsl_chantype, subslot, timeslot; - uint32_t fn_sched = sched_fn_ul(l1_model_ms->state->current_time, ul->chan_nr, ul->link_id); + uint32_t fn_sched = sched_fn_ul(l1_model_ms->state->current_time, + ul->chan_nr, ul->link_id); rsl_dec_chan_nr(ul->chan_nr, &rsl_chantype, &subslot, ×lot); DEBUGP(DL1C, @@ -85,6 +84,53 @@ void l1ctl_rx_data_req(struct msgb *msg) } +void l1ctl_tx_data_ind(struct msgb *msg, uint16_t arfcn, uint8_t link_id, + uint8_t chan_nr, uint32_t fn, uint8_t snr, + uint8_t signal_dbm, uint8_t num_biterr, uint8_t fire_crc) +{ + struct msgb *l1ctl_msg = NULL; + struct l1ctl_data_ind * l1di; + struct l1ctl_info_dl * l1dl; + l1ctl_msg = l1ctl_msgb_alloc(L1CTL_DATA_IND); + l1dl = (struct l1ctl_info_dl *)msgb_put(l1ctl_msg, + sizeof(struct l1ctl_info_dl)); + l1di = (struct l1ctl_data_ind *)msgb_put(l1ctl_msg, + sizeof(struct l1ctl_data_ind)); + + l1dl->band_arfcn = htons(arfcn); + l1dl->link_id = link_id; + l1dl->chan_nr = chan_nr; + l1dl->frame_nr = htonl(fn); + l1dl->snr = snr; + l1dl->rx_level = signal_dbm; + l1dl->num_biterr = 0; // no biterrors + l1dl->fire_crc = 0; + + // TODO: data decoding and decryption + + memcpy(l1di->data, msgb_data(msg), msgb_length(msg)); + + DEBUGP(DL1C, "Sending signaling-data to l23.\n"); + l1ctl_sap_tx_to_l23(l1ctl_msg); + +} + +/** + * @brief Send a L1CTL_DATA_CONF to L23. + * + * @param [in] fn frame number + * @param [in] snr signal noise ratio + * @param [in] arfcn arfcn of the cell the message was send on + * + */ +void l1ctl_tx_data_conf(uint32_t fn, uint16_t snr, uint16_t arfcn) +{ + struct msgb * l1ctl_msg; + l1ctl_msg = l1ctl_create_l2_msg(L1CTL_DATA_CONF, fn, snr, arfcn); + // send confirm to layer23 + l1ctl_sap_tx_to_l23(l1ctl_msg); +} + /** * @brief Initialize virtual prim data. * |