diff options
author | Yuval Peress <peress@chromium.org> | 2019-07-15 11:40:47 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-23 00:25:33 +0000 |
commit | a2e7b77b3b62d9f663eb1f916fe9ab36bef06dbe (patch) | |
tree | 0508e2e77f23ba861090a53d1b99306fe9ad3046 /include/motion_sense.h | |
parent | 3a2044d812f26a1ac0302a5eeb66eaf9433e78ba (diff) | |
download | chrome-ec-a2e7b77b3b62d9f663eb1f916fe9ab36bef06dbe.tar.gz |
common: Move fifo logic out of motion_sense.c
This change is needed to allow better testing of the fifo
behavior. Additionally, motion_sense_fifo.c will only be compiled
if CONFIG_ACCEL_FIFO is defined. This behaviour requires a few
small changes to several boards and baseboards to make
sure that we only define CONFIG_ACCEL_FIFO when the MOTIONSENSE
task is present (some times that may be only in one section RW or
RO).
BUG=b:137758297
BRANCH=None
TEST=buildall and ran CTS on arcada
Change-Id: I2f7e4e436ba9568a35b7a0b2c8d53a73f198ba73
Signed-off-by: Yuval Peress <peress@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704163
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Commit-Queue: Alexandru M Stan <amstan@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r-- | include/motion_sense.h | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h index 8c3f0cdbde..b0e5244e3b 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -227,6 +227,14 @@ struct motion_sensor_t { uint32_t max_frequency; }; +/* + * Mutex to protect sensor values between host command task and + * motion sense task: + * When we process CMD_DUMP, we want to be sure the motion sense + * task is not updating the sensor values at the same time. + */ +extern struct mutex g_sensor_mutex; + /* Defined at board level. */ extern struct motion_sensor_t motion_sensors[]; @@ -249,32 +257,6 @@ extern unsigned int motion_min_interval; */ #define MOTION_SENSE_HOOK_PRIO (HOOK_PRIO_DEFAULT) -#ifdef CONFIG_ACCEL_FIFO -extern struct queue motion_sense_fifo; - -/** - * Stage data to the fifo, including a timestamp. This data will not be - * available to the AP until motion_sense_fifo_commit_data is called. - * - * @param data data to insert in the FIFO - * @param sensor sensor the data comes from - * @param valid_data data should be copied into the public sensor vector - * @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); - -/** - * Commits all staged data to the fifo. If multiple readings were placed using - * the same timestamps, they will be spread out. - */ -void motion_sense_fifo_commit_data(void); - -#endif - /** * Take actions at end of sensor initialization: * - print init done status to console, |