aboutsummaryrefslogtreecommitdiff
path: root/aufgabe4/queue.h
blob: 940a4bc05c9eebf53fcbffb8f510ec9e9c7ca048 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
};

struct msg {
	uint8_t dir;
	uint8_t data;
};

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