summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorHyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com>2021-01-19 21:18:36 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-22 21:43:16 +0000
commit90995b4a525442b448384e8c5e6d77f541283c4d (patch)
tree9e68cdf860d4080a258115edc447c9e488b3688c /include/motion_sense.h
parent90dea61948cfcb668f6d893a7d8f6aef419ef942 (diff)
downloadchrome-ec-90995b4a525442b448384e8c5e6d77f541283c4d.tar.gz
zephyr: add motion sense support
Add support for motion sense in zephyr. This change adds basic functions for motion sense task to do meaningful work. sensor_map.h included by board.h will be used to get board specific sensor configuration. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I906316d2e97428cf46b9a15071666c8e3b039b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638909 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index e19107e290..29ac220395 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -15,6 +15,7 @@
#include "i2c.h"
#include "math_util.h"
#include "queue.h"
+#include "task.h"
#include "timer.h"
#include "util.h"
@@ -72,7 +73,7 @@ enum sensor_config {
TASK_EVENT_MOTION_FIRST_SW_EVENT + (_activity_id)))
-#define ROUND_UP_FLAG BIT(31)
+#define ROUND_UP_FLAG ((uint32_t)BIT(31))
#define BASE_ODR(_odr) ((_odr) & ~ROUND_UP_FLAG)
#define BASE_RANGE(_range) ((_range) & ~ROUND_UP_FLAG)
@@ -160,7 +161,7 @@ struct motion_sensor_t {
enum motionsensor_location location;
const struct accelgyro_drv *drv;
/* One mutex per physical chip. */
- struct mutex *mutex;
+ mutex_t *mutex;
void *drv_data;
/* Only valid if flags & MOTIONSENSE_FLAG_INT_SIGNAL is true. */
enum gpio_signal int_signal;
@@ -256,7 +257,7 @@ struct motion_sensor_t {
* 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;
+extern mutex_t g_sensor_mutex;
/* Defined at board level. */
extern struct motion_sensor_t motion_sensors[];