summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1
diff options
context:
space:
mode:
authorHarald Welte2010-05-07 16:46:47 +0200
committerHarald Welte2010-05-17 09:23:35 +0200
commitea3b3826f2c8650d36d033e99a7af08c05ef562a (patch)
tree1e490b0828cd373be6e412b2d6589c0e1e0d9e9d /src/target/firmware/layer1
parentcosmetic/whitespace change (diff)
downloadosmocom-ea3b3826f2c8650d36d033e99a7af08c05ef562a.tar.gz
osmocom-ea3b3826f2c8650d36d033e99a7af08c05ef562a.tar.xz
osmocom-ea3b3826f2c8650d36d033e99a7af08c05ef562a.zip
layer1: introduce concept of a 'l1 completion'
The idea is that the L1S part can schedule a completion handler which will then execute in the asynchronous L1A part. This should keep the FIQ priority L1S extremely short, deferring most of the work into the L1A part that runs in regular process context.
Diffstat (limited to 'src/target/firmware/layer1')
-rw-r--r--src/target/firmware/layer1/async.c23
-rw-r--r--src/target/firmware/layer1/sync.c10
2 files changed, 33 insertions, 0 deletions
diff --git a/src/target/firmware/layer1/async.c b/src/target/firmware/layer1/async.c
index 3db07e1..dda4bf1 100644
--- a/src/target/firmware/layer1/async.c
+++ b/src/target/firmware/layer1/async.c
@@ -69,3 +69,26 @@ void l1a_init(void)
{
l1a_l23api_init();
}
+
+/* Execute pending L1A completions */
+void l1a_compl_execute(void)
+{
+ unsigned long flags;
+ unsigned int scheduled;
+ unsigned int i;
+
+ /* get and reset the currently scheduled tasks */
+ local_irq_save(flags);
+ scheduled = l1s.scheduled_compl;
+ l1s.scheduled_compl = 0;
+ local_irq_restore(flags);
+
+ /* Iterate over list of scheduled completions, call their
+ * respective completion handler */
+ for (i = 0; i < 32; i++) {
+ if (!(scheduled & (1 << i)))
+ continue;
+ /* call completion function */
+ l1s.completion[i](i);
+ }
+}
diff --git a/src/target/firmware/layer1/sync.c b/src/target/firmware/layer1/sync.c
index f5629cf..9ca37ef 100644
--- a/src/target/firmware/layer1/sync.c
+++ b/src/target/firmware/layer1/sync.c
@@ -200,6 +200,16 @@ static inline void check_lost_frame(void)
last_timestamp = timestamp;
}
+/* schedule a completion */
+void l1s_compl_sched(enum l1_compl c)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ l1s.scheduled_compl |= (1 << c);
+ local_irq_restore(flags);
+}
+
/* main routine for synchronous part of layer 1, called by frame interrupt
* generated by TPU once every TDMA frame */
static void l1_sync(void)