-
Notifications
You must be signed in to change notification settings - Fork 0
/
ethos.h
59 lines (49 loc) · 1.19 KB
/
ethos.h
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright(c) 2017 Vishal Verma. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
#ifndef _ETHOS_H_
#define _ETHOS_H_
#include <time.h>
#include <stdint.h>
#include <pthread.h>
#include <linux/types.h>
#define NUM_RX 8
#define NUM_THREADS 4
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define Q_ELEMENTS 64
enum threads {
RSSI_READER = 0,
PASS_DETECTOR,
NET_HANDLER,
CMD_HANDLER,
};
struct rssi_raw {
int rx[NUM_RX];
struct timespec ts[NUM_RX];
};
struct rx_settings {
int freq;
int thresh_hi;
int thresh_low;
int zero_calibration;
};
struct global_settings {
struct rx_settings rx[NUM_RX];
};
struct ethos_ctx {
struct global_settings settings;
pthread_t threads[NUM_THREADS];
struct rssi_raw *rssi;
pthread_mutex_t q_lock;
int q_head;
};
#endif /* _ETHOS_H_ */