summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/kernel.c5
-rw-r--r--firmware/kernel.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c
index c6ac1fb7aa..639b73def5 100644
--- a/firmware/kernel.c
+++ b/firmware/kernel.c
@@ -94,6 +94,11 @@ void queue_post(struct event_queue *q, int id, void *data)
set_irq_level(oldlevel);
}
+bool queue_empty(struct event_queue* q)
+{
+ return ( q->read == q->write );
+}
+
/****************************************************************************
* Timer tick
diff --git a/firmware/kernel.h b/firmware/kernel.h
index cd5539b791..8f981b3753 100644
--- a/firmware/kernel.h
+++ b/firmware/kernel.h
@@ -19,6 +19,8 @@
#ifndef _KERNEL_H_
#define _KERNEL_H_
+#include <stdbool.h>
+
/* wrap-safe macros for tick comparison */
#define TIME_AFTER(a,b) ((long)(b) - (long)(a) < 0)
#define TIME_BEFORE(a,b) TIME_AFTER(b,a)
@@ -60,6 +62,7 @@ int tick_remove_task(void (*f)(void));
extern void queue_init(struct event_queue *q);
extern void queue_wait(struct event_queue *q, struct event *ev);
extern void queue_post(struct event_queue *q, int id, void *data);
+extern bool queue_empty(struct event_queue* q);
extern void mutex_init(struct mutex *m);
extern void mutex_lock(struct mutex *m);