summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/layer1
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2011-12-15 07:10:10 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-28 13:14:45 +0100
commit6ab18bedb1dca6c3a91b23293583ccf33bc5e70f (patch)
treea17ad2f5e932752ad21f93d8d257de58a59f31a2 /src/target/firmware/layer1
parentc4701d420479f45c2fdf1526945edd707ed32a55 (diff)
firmware/layer1: Using queue to process received l23 frames in main loop
Instead of processing the frames out of the interrupt context, they are queued until serial interrupt returns and main loop is processed.
Diffstat (limited to 'src/target/firmware/layer1')
-rw-r--r--src/target/firmware/layer1/l23_api.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/target/firmware/layer1/l23_api.c b/src/target/firmware/layer1/l23_api.c
index f8152c5c..58a093f4 100644
--- a/src/target/firmware/layer1/l23_api.c
+++ b/src/target/firmware/layer1/l23_api.c
@@ -29,6 +29,8 @@
#include <debug.h>
#include <byteorder.h>
+#include <asm/system.h>
+
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/protocol/gsm_04_08.h>
#include <comm/sercomm.h>
@@ -579,10 +581,31 @@ static void l1ctl_sim_req(struct msgb *msg)
sim_apdu(len, data);
}
+static struct llist_head l23_rx_queue = LLIST_HEAD_INIT(l23_rx_queue);
+
/* callback from SERCOMM when L2 sends a message to L1 */
void l1a_l23_rx(uint8_t dlci, struct msgb *msg)
{
- struct l1ctl_hdr *l1h = (struct l1ctl_hdr *) msg->data;
+ unsigned long flags;
+
+ local_firq_save(flags);
+ msgb_enqueue(&l23_rx_queue, msg);
+ local_irq_restore(flags);
+}
+
+void l1a_l23_handler(void)
+{
+ struct msgb *msg;
+ struct l1ctl_hdr *l1h;
+ unsigned long flags;
+
+ local_firq_save(flags);
+ msg = msgb_dequeue(&l23_rx_queue);
+ local_irq_restore(flags);
+ if (!msg)
+ return;
+
+ l1h = (struct l1ctl_hdr *) msg->data;
#if 0
{