summaryrefslogtreecommitdiffstats
path: root/Src/osmoconbb/src/target/firmware/include/layer1/avg.h
diff options
context:
space:
mode:
authorTom2011-08-16 15:41:46 +0200
committerTom2011-08-16 15:41:46 +0200
commitf910171deda0933e506cf3ffc216ee8daa418c24 (patch)
treedddee7cdad41fc4f3d8c1de95148d0a2daac1193 /Src/osmoconbb/src/target/firmware/include/layer1/avg.h
parentanother system info 2 description (diff)
downloadimsi-catcher-detection-f910171deda0933e506cf3ffc216ee8daa418c24.tar.gz
imsi-catcher-detection-f910171deda0933e506cf3ffc216ee8daa418c24.tar.xz
imsi-catcher-detection-f910171deda0933e506cf3ffc216ee8daa418c24.zip
corrected spelling mistake and added 2 new papers for gsm specs
Diffstat (limited to 'Src/osmoconbb/src/target/firmware/include/layer1/avg.h')
-rw-r--r--Src/osmoconbb/src/target/firmware/include/layer1/avg.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/Src/osmoconbb/src/target/firmware/include/layer1/avg.h b/Src/osmoconbb/src/target/firmware/include/layer1/avg.h
new file mode 100644
index 0000000..6c5de17
--- /dev/null
+++ b/Src/osmoconbb/src/target/firmware/include/layer1/avg.h
@@ -0,0 +1,23 @@
+#ifndef _L1_AVG_H
+#define _L1_AVG_H
+
+struct running_avg {
+ /* configuration */
+ uint16_t period; /* over how many samples to average */
+ uint16_t min_valid;
+
+ int32_t acc_val;
+ uint16_t num_samples; /* how often did we try to sample? */
+ uint16_t num_samples_valid; /* how often did we receive valid samples? */
+
+ void (*outfn)(struct running_avg *, int32_t avg);
+ void *priv;
+};
+
+/* input a new sample into the averaging process */
+void runavg_input(struct running_avg *ravg, int32_t val, int valid);
+
+/* check if sufficient samples have been obtained, and call outfn() */
+int runavg_check_output(struct running_avg *ravg);
+
+#endif /* _AVG_H */