summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2fffc09)
The RTC can be moved backward or forward at any time... err on
the side of safety, even if there are still potential issues with
this implementation (delay between kernel calls, possibility that
we get scheduled out, or that the clock is adjusted after the iio
buffer was stored...).
Change-Id: If1a517e8e2273ef479bd6095975df26d4aa4d2cd
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
static int active_poll_sensors; /* Number of enabled poll-mode sensors */
static int active_poll_sensors; /* Number of enabled poll-mode sensors */
-static int64_t sys_to_rt_delta; /* delta between system and realtime clocks */
-
/* We use pthread condition variables to get worker threads out of sleep */
static pthread_condattr_t thread_cond_attr [MAX_SENSORS];
static pthread_cond_t thread_release_cond [MAX_SENSORS];
/* We use pthread condition variables to get worker threads out of sleep */
static pthread_condattr_t thread_cond_attr [MAX_SENSORS];
static pthread_cond_t thread_release_cond [MAX_SENSORS];
/* Prepare the report timestamp field for the first event, see set_report_ts method */
sensor_info[s].report_ts = 0;
/* Prepare the report timestamp field for the first event, see set_report_ts method */
sensor_info[s].report_ts = 0;
- sys_to_rt_delta = get_timestamp_realtime() - get_timestamp_boot();
-
-
/* If we want to activate gyro calibrated and gyro uncalibrated is activated
* Deactivate gyro uncalibrated - Uncalibrated releases handler
* Activate gyro calibrated - Calibrated has handler
/* If we want to activate gyro calibrated and gyro uncalibrated is activated
* Deactivate gyro uncalibrated - Uncalibrated releases handler
* Activate gyro calibrated - Calibrated has handler
int size;
int64_t ts = 0;
int ts_offset = 0; /* Offset of iio timestamp, if provided */
int size;
int64_t ts = 0;
int ts_offset = 0; /* Offset of iio timestamp, if provided */
+ int64_t sys_to_rt_delta;
/* There's an incoming report on the specified iio device char dev fd */
/* There's an incoming report on the specified iio device char dev fd */
ALOGV("Driver timestamp on iio device %d: ts=%lld\n", dev_num, ts);
ALOGV("Driver timestamp on iio device %d: ts=%lld\n", dev_num, ts);
+ sys_to_rt_delta = get_timestamp_realtime() - get_timestamp_boot();
+
for (s=0; s<MAX_SENSORS; s++)
if (sensor_info[s].dev_num == dev_num && sensor_info[s].enabled)
set_report_ts(s, ts - sys_to_rt_delta);
for (s=0; s<MAX_SENSORS; s++)
if (sensor_info[s].dev_num == dev_num && sensor_info[s].enabled)
set_report_ts(s, ts - sys_to_rt_delta);