summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-01-15 21:52:35 +0100
committerHarald Welte <laforge@gnumonks.org>2017-01-15 22:20:11 +0100
commit36b5c8c3004644d75797deb8a438df38545455b6 (patch)
tree5576b9ec74635ce6f648f8529594e35cd40fa730
parent1d5267e26429b413d26aa2fd5055f95ae64b7dad (diff)
fw/layer1: Replace multiframe scheduler for sniffing if CONFIG_BURST_IND is set
If the code is compiled with CONFIG_BURST_IND, we simply replace all dedicated multiframe scheduler sets with the dsp sniffer task. This way, a dedicated mode assign via L1CTL makes the firmware dump all the raw burst data.
-rw-r--r--src/target/firmware/include/layer1/sync.h3
-rw-r--r--src/target/firmware/layer1/mframe_sched.c30
2 files changed, 31 insertions, 2 deletions
diff --git a/src/target/firmware/include/layer1/sync.h b/src/target/firmware/include/layer1/sync.h
index dae85a1..2637120 100644
--- a/src/target/firmware/include/layer1/sync.h
+++ b/src/target/firmware/include/layer1/sync.h
@@ -92,6 +92,9 @@ struct l1s_state {
/* callbacks for each of the completions */
l1_compl_cb *completion[L1S_NUM_COMPL];
+ /* are we in sniffer mode (1) or not (0) */
+ int sniffer_mode;
+
/* Structures below are for L1-task specific parameters, used
* to communicate between l1-sync and l1-async (l23_api) */
struct {
diff --git a/src/target/firmware/layer1/mframe_sched.c b/src/target/firmware/layer1/mframe_sched.c
index f3a6b43..18847af 100644
--- a/src/target/firmware/layer1/mframe_sched.c
+++ b/src/target/firmware/layer1/mframe_sched.c
@@ -1,6 +1,6 @@
/* GSM Multiframe Scheduler Implementation (on top of TDMA sched) */
-/* (C) 2010 by Harald Welte <laforge@gnumonks.org>
+/* (C) 2010,2017 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
*
@@ -415,6 +415,22 @@ uint8_t mframe_task2chan_nr(enum mframe_task mft, uint8_t ts)
/* how long do we need to tell the DSP in advance what we want to do? */
#define SCHEDULE_LATENCY 1
+#ifdef CONFIG_BURST_IND
+static struct tdma_sched_item *translate_to_sniffer(struct tdma_sched_item *tsi)
+{
+ /* map all dedicated mode tasks to the sniffer sched_sets */
+ if (tsi == NB_QUAD_DL)
+ tsi = sniff_xcch_dl_sched_set;
+ else if (tsi == NB_QUAD_UL)
+ tsi = sniff_xcch_ul_sched_set;
+ else if (tsi == TCH || tsi == TCH_A)
+ tsi = sniff_tch_sched_set;
+ else if (tsi == TCH_D)
+ tsi = NULL;
+ return tsi;
+}
+#endif
+
/* (test and) schedule one particular sched_item_set by means of the TDMA scheduler */
static void mframe_schedule_set(enum mframe_task task_id)
{
@@ -425,13 +441,23 @@ static void mframe_schedule_set(enum mframe_task task_id)
unsigned int trigger = si->frame_nr % si->modulo;
unsigned int current = (l1s.current_time.fn + SCHEDULE_AHEAD) % si->modulo;
if (current == trigger) {
+ struct tdma_sched_item *tsi;
uint32_t fn;
int rv;
+#ifdef CONFIG_BURST_IND
+ if (l1s.sniffer_mode) {
+ tsi = translate_to_sniffer(si->sched_set);
+ if (!tsi)
+ return;
+ } else
+#endif
+ tsi = si->sched_set;
+
/* Schedule the set */
/* FIXME: what to do with SACCH Flag etc? */
rv = tdma_schedule_set(SCHEDULE_AHEAD-SCHEDULE_LATENCY,
- si->sched_set, task_id | (si->flags<<8));
+ tsi, task_id | (si->flags<<8));
/* Compute the next safe time to queue a DSP command */
fn = l1s.current_time.fn;