summaryrefslogtreecommitdiffstats
path: root/src/host/virt_phy/src/virt_prim_traffic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/virt_phy/src/virt_prim_traffic.c')
-rw-r--r--src/host/virt_phy/src/virt_prim_traffic.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/src/host/virt_phy/src/virt_prim_traffic.c b/src/host/virt_phy/src/virt_prim_traffic.c
index acfd493e..9e87db9a 100644
--- a/src/host/virt_phy/src/virt_prim_traffic.c
+++ b/src/host/virt_phy/src/virt_prim_traffic.c
@@ -1,7 +1,7 @@
/* Layer 1 normal data burst tx handling */
/* (C) 2010 by Dieter Spaar <spaar@mirider.augusta.de>
- * (C) 2010 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2010,2017 by Harald Welte <laforge@gnumonks.org>
* (C) 2016 by Sebastian Stumpf <sebastian.stumpf87@googlemail.com>
*
* All Rights Reserved
@@ -38,19 +38,16 @@
#include <l1ctl_proto.h>
-static struct l1_model_ms *l1_model_ms = NULL;
-static void virt_l1_sched_handler_cb(uint32_t fn, struct msgb * msg);
-
/**
* @brief Handler callback function for TRAFFIC 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)
+static void virt_l1_sched_handler_cb(struct l1_model_ms *ms, uint32_t fn, struct msgb * msg)
{
- gsmtapl1_tx_to_virt_um(fn, msg);
- l1ctl_tx_traffic_conf(fn, 0, l1_model_ms->state.serving_cell.arfcn);
+ gsmtapl1_tx_to_virt_um_inst(ms, fn, msg);
+ l1ctl_tx_traffic_conf(ms, fn, 0, ms->state.serving_cell.arfcn);
}
/**
@@ -63,26 +60,25 @@ static void virt_l1_sched_handler_cb(uint32_t fn, struct msgb * msg)
* Enqueue the message (traffic frame) to the L1 state machine's transmit queue. In virtual layer1 just submit it to the virt um.
*
*/
-void l1ctl_rx_traffic_req(struct msgb *msg)
+void l1ctl_rx_traffic_req(struct l1_model_ms *ms, struct msgb *msg)
{
struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
struct l1ctl_info_ul *ul = (struct l1ctl_info_ul *) l1h->data;
struct l1ctl_traffic_req *tr = (struct l1ctl_traffic_req *) 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(ms->state.current_time, ul->chan_nr, ul->link_id);
rsl_dec_chan_nr(ul->chan_nr, &rsl_chantype, &subslot, &timeslot);
DEBUGP(DL1C, "Received and handled from l23 - L1CTL_TRAFFIC_REQ\n");
msg->l2h = tr->data;
- virt_l1_sched_schedule(msg, fn_sched, timeslot, &virt_l1_sched_handler_cb);
+ virt_l1_sched_schedule(ms, msg, fn_sched, timeslot, &virt_l1_sched_handler_cb);
}
-void l1ctl_tx_traffic_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)
+void l1ctl_tx_traffic_ind(struct l1_model_ms *ms, 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_traffic_ind * l1ti;
@@ -107,7 +103,7 @@ void l1ctl_tx_traffic_ind(struct msgb *msg, uint16_t arfcn, uint8_t link_id,
memcpy(l1ti->data, msgb_data(msg), msgb_length(msg));
DEBUGP(DL1C, "Sending to l23 - L1CTL_TRAFFIC_IND\n");
- l1ctl_sap_tx_to_l23(l1ctl_msg);
+ l1ctl_sap_tx_to_l23_inst(ms, l1ctl_msg);
}
/**
@@ -118,20 +114,10 @@ void l1ctl_tx_traffic_ind(struct msgb *msg, uint16_t arfcn, uint8_t link_id,
* @param [in] arfcn arfcn of the cell the message was send on
*
*/
-void l1ctl_tx_traffic_conf(uint32_t fn, uint16_t snr, uint16_t arfcn)
+void l1ctl_tx_traffic_conf(struct l1_model_ms *ms, uint32_t fn, uint16_t snr, uint16_t arfcn)
{
struct msgb * l1ctl_msg;
l1ctl_msg = l1ctl_create_l2_msg(L1CTL_TRAFFIC_CONF, fn, snr, arfcn);
/* send confirm to layer23 */
- l1ctl_sap_tx_to_l23(l1ctl_msg);
-}
-
-/**
- * @brief Initialize virtual prim traffic.
- *
- * @param [in] model the l1 model instance
- */
-void prim_traffic_init(struct l1_model_ms *model)
-{
- l1_model_ms = model;
+ l1ctl_sap_tx_to_l23_inst(ms, l1ctl_msg);
}