aboutsummaryrefslogtreecommitdiff
path: root/aufgabe4/queue.h
diff options
context:
space:
mode:
Diffstat (limited to 'aufgabe4/queue.h')
-rw-r--r--aufgabe4/queue.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/aufgabe4/queue.h b/aufgabe4/queue.h
new file mode 100644
index 0000000..3c8a1e3
--- /dev/null
+++ b/aufgabe4/queue.h
@@ -0,0 +1,25 @@
+#ifndef _QUEUE_H
+#define _QUEUE_H
+#include <stdbool.h>
+#include <stdint.h>
+#include <semaphore.h>
+
+struct queueheader {
+ uint8_t msgs;
+ uint8_t cur;
+ sem_t sem;
+} __attribute__((packed));
+
+struct msg {
+ uint8_t dir;
+ uint8_t data;
+} __attribute__((packed));
+
+enum { D_CONV_TO_LOG = 0, D_CONV_TO_STAT, D_STAT_TO_MON, D_INVALID };
+
+void queue_init();
+struct msg *queue_write(uint8_t dir, uint8_t data);
+uint8_t queue_get_data();
+uint8_t queue_get_dir();
+
+#endif