OSDN Git Service

Limit max frequency to 400Hz
[android-x86/hardware-intel-libsensors.git] / common.h
index 17fd183..9df00ea 100644 (file)
--- a/common.h
+++ b/common.h
 
 #define PROP_BASE      "ro.iio.%s.%s" /* Note: PROPERTY_KEY_MAX is small */
 
-#define MAX_EVENTS 800         /* 800 hz */
+#define MAX_EVENTS 400         /* 400 Hz */
 #define MAX_TYPE_SPEC_LEN 32   /* Channel type spec len; ex: "le:u10/16>>0" */
 #define MAX_SENSOR_REPORT_SIZE 32      /* Sensor report buffer size */
 
 #define MAX_NAME_SIZE          32
 
 #define ARRAY_SIZE(x) sizeof(x)/sizeof(x[0])
+#define REPORTING_MODE(x)      ((x) & 0x06)
 
 #ifdef __LP64__
        typedef uint64_t flag_t;
@@ -150,6 +151,11 @@ struct sensor_info_t
        int report_pending;
 
        /*
+        * This flag is set if we have a meta data event pending
+        */
+       volatile int meta_data_pending;
+
+       /*
         * Timestamp closely matching the date of sampling, preferably retrieved
         * from a iio channel alongside sample data. Value zero indicates that
         * we couldn't get such a closely correlated timestamp, and that one
@@ -202,6 +208,7 @@ struct sensor_info_t
 
        /* A few variables used for data filtering */
        float *history;         /* Working buffer containing recorded samples */
+       float *history_sum;     /* The current sum of the history elements    */
        int history_size;       /* Number of recorded samples                 */
        int history_entries;    /* How many of these are initialized          */
        int history_index;      /* Index of sample to evict next time         */