summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-07-12 18:48:18 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-10-23 22:05:49 +0330
commita2be625b4f90b3d85a97abdf1b93a72bf868716b (patch)
treed26d7a3cb9e80fd8363c9f4396ebbb283945dda6
parent99b1fcf066b28b71613331a39c88dab5a74f59c2 (diff)
host/trxcon/scheduler: implement TX queue handling
-rw-r--r--src/host/trxcon/sched_trx.c34
-rw-r--r--src/host/trxcon/sched_trx.h10
2 files changed, 43 insertions, 1 deletions
diff --git a/src/host/trxcon/sched_trx.c b/src/host/trxcon/sched_trx.c
index 32e6a59..3c5e265 100644
--- a/src/host/trxcon/sched_trx.c
+++ b/src/host/trxcon/sched_trx.c
@@ -48,12 +48,44 @@ static void msgb_queue_flush(struct llist_head *list)
static void sched_frame_clck_cb(struct trx_sched *sched)
{
struct trx_instance *trx = (struct trx_instance *) sched->data;
+ const struct trx_frame *frame;
+ trx_lchan_tx_func *handler;
+ struct trx_ts_prim *prim;
+ enum trx_lchan_type chan;
+ uint8_t offset, bid;
+ struct trx_ts *ts;
+ uint32_t fn;
/* If we have no active timeslots, nothing to do */
if (llist_empty(&trx->ts_list))
return;
- /* Do nothing for now */
+ /* For each allocated timeslot */
+ llist_for_each_entry(ts, &trx->ts_list, list) {
+ if (llist_empty(&ts->tx_prims))
+ continue;
+
+ /* Get frame from multiframe */
+ fn = sched->fn_counter_proc;
+ offset = fn % ts->mf_layout->period;
+ frame = ts->mf_layout->frames + offset;
+
+ /* Get required info from frame */
+ bid = frame->ul_bid;
+ chan = frame->ul_chan;
+ handler = trx_lchan_desc[chan].tx_fn;
+
+ /* Omit lchans without handler */
+ if (!handler)
+ continue;
+
+ /* Get a message from TX queue */
+ prim = llist_entry(ts->tx_prims.next, struct trx_ts_prim, list);
+
+ /* Poke lchan handler */
+ if (prim->chan == chan)
+ handler(trx, ts, fn, chan, bid, NULL);
+ }
}
int sched_trx_init(struct trx_instance *trx)
diff --git a/src/host/trxcon/sched_trx.h b/src/host/trxcon/sched_trx.h
index 41662e0..809a324 100644
--- a/src/host/trxcon/sched_trx.h
+++ b/src/host/trxcon/sched_trx.h
@@ -230,6 +230,16 @@ struct trx_ts {
struct llist_head list;
};
+/* Represents one TX primitive in the queue of trx_ts */
+struct trx_ts_prim {
+ /*! \brief Link to queue of TS */
+ struct llist_head list;
+ /*! \brief Logical channel type */
+ enum trx_lchan_type chan;
+ /*! \brief Payload */
+ uint8_t payload[0];
+};
+
extern const struct trx_lchan_desc trx_lchan_desc[_TRX_CHAN_MAX];
const struct trx_multiframe *sched_mframe_layout(
enum gsm_phys_chan_config config, int ts_num);