summaryrefslogtreecommitdiffstats
path: root/src/target
diff options
context:
space:
mode:
Diffstat (limited to 'src/target')
-rw-r--r--src/target/firmware/apps/layer1/main.c1
-rw-r--r--src/target/firmware/include/layer1/l23_api.h1
-rw-r--r--src/target/firmware/layer1/l23_api.c25
3 files changed, 26 insertions, 1 deletions
diff --git a/src/target/firmware/apps/layer1/main.c b/src/target/firmware/apps/layer1/main.c
index 61a400cf..0abfc063 100644
--- a/src/target/firmware/apps/layer1/main.c
+++ b/src/target/firmware/apps/layer1/main.c
@@ -95,6 +95,7 @@ int main(void)
l1a_compl_execute();
update_timers();
sim_handler();
+ l1a_l23_handler();
}
/* NOT REACHED */
diff --git a/src/target/firmware/include/layer1/l23_api.h b/src/target/firmware/include/layer1/l23_api.h
index 4ea71018..e4a3fd0a 100644
--- a/src/target/firmware/include/layer1/l23_api.h
+++ b/src/target/firmware/include/layer1/l23_api.h
@@ -6,6 +6,7 @@
#include <l1ctl_proto.h>
void l1a_l23api_init(void);
+void l1a_l23_handler(void);
void l1_queue_for_l2(struct msgb *msg);
struct msgb *l1ctl_msgb_alloc(uint8_t msg_type);
struct msgb *l1_create_l2_msg(int msg_type, uint32_t fn, uint16_t snr, uint16_t arfcn);
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
{