summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1/async.c
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/async.c
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/async.c')
-rw-r--r--src/target/firmware/layer1/async.c23
1 files changed, 23 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);
+ }
+}