summaryrefslogtreecommitdiff
path: root/include/motion_sense_fifo.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/motion_sense_fifo.h')
-rw-r--r--include/motion_sense_fifo.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/include/motion_sense_fifo.h b/include/motion_sense_fifo.h
index 90d3f78879..e4012e2372 100644
--- a/include/motion_sense_fifo.h
+++ b/include/motion_sense_fifo.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,8 @@
enum motion_sense_async_event {
ASYNC_EVENT_FLUSH = MOTIONSENSE_SENSOR_FLAG_FLUSH |
MOTIONSENSE_SENSOR_FLAG_TIMESTAMP,
- ASYNC_EVENT_ODR = MOTIONSENSE_SENSOR_FLAG_ODR |
- MOTIONSENSE_SENSOR_FLAG_TIMESTAMP,
+ ASYNC_EVENT_ODR = MOTIONSENSE_SENSOR_FLAG_ODR |
+ MOTIONSENSE_SENSOR_FLAG_TIMESTAMP,
};
/**
@@ -22,6 +22,15 @@ enum motion_sense_async_event {
void motion_sense_fifo_init(void);
/**
+ * Set the expected period between samples. Must be call under
+ * g_mutex_lock each time the sensor ODR changes.
+ *
+ * @param sensor_num Affected sensor
+ * @param data_period expected milliseconds between samples.
+ */
+void motion_sense_set_data_period(int sensor_num, uint32_t data_period);
+
+/**
* Whether or not we need to bypass the FIFO to send an important message.
*
* @return Non zero when a bypass is needed.
@@ -48,9 +57,8 @@ void motion_sense_fifo_reset_needed_flags(void);
* @param sensor The sensor that generated the async event.
* @param event The event to insert.
*/
-void motion_sense_fifo_insert_async_event(
- struct motion_sensor_t *sensor,
- enum motion_sense_async_event event);
+void motion_sense_fifo_insert_async_event(struct motion_sensor_t *sensor,
+ enum motion_sense_async_event event);
/**
* Insert a timestamp into the fifo.
@@ -69,11 +77,9 @@ void motion_sense_fifo_add_timestamp(uint32_t timestamp);
* @param time accurate time (ideally measured in an interrupt) the sample
* was taken at
*/
-void motion_sense_fifo_stage_data(
- struct ec_response_motion_sensor_data *data,
- struct motion_sensor_t *sensor,
- int valid_data,
- uint32_t time);
+void motion_sense_fifo_stage_data(struct ec_response_motion_sensor_data *data,
+ struct motion_sensor_t *sensor,
+ int valid_data, uint32_t time);
/**
* Commit all the currently staged data to the fifo. Doing so makes it readable
@@ -85,12 +91,12 @@ void motion_sense_fifo_commit_data(void);
* Get information about the fifo.
*
* @param fifo_info The struct to modify with the current information about the
- * fifo.
+ * fifo. WARNING: This must point to a buffer big enough for the struct
+ * and also sizeof(uint16_t) * MAX_MOTION_SENSORS of extra space.
* @param reset Whether or not to reset statistics after reading them.
*/
void motion_sense_fifo_get_info(
- struct ec_response_motion_sense_fifo_info *fifo_info,
- int reset);
+ struct ec_response_motion_sense_fifo_info *fifo_info, int reset);
/**
* Check whether or not the fifo has gone over its threshold.