summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-04-16 12:43:58 -0600
committerchrome-bot <chrome-bot@chromium.org>2019-04-24 15:51:09 -0700
commitbd4012d9abbb7b79f537e7adba9627bcd4a50a72 (patch)
tree137776675c25c27a1925936e6ef9d8af15fc07cb /include/motion_sense.h
parentd6cc4f14205a00b6d17d22fb7e74a0c8b063ec85 (diff)
downloadchrome-ec-bd4012d9abbb7b79f537e7adba9627bcd4a50a72.tar.gz
tasks: convert TASK_EVENT_CUSTOM macro to bit
We should ensure that all custom task definition are non-zero and fit with the globally defined events. Add compile time check and change semantics to specify bit number (instead of making all callers use the BIT macro). This also fixes an error with TASK_EVENT_PHY_TX_DONE for ITE being 0. The bug that made that happen hasn't landed on any firmware branches that use it though. BRANCH=none BUG=none TEST=builds Cq-Depend:chrome-internal:1178968,chrome-internal:1178952 Change-Id: I5e1d1312382d200280c548e9128e53f4eddd3e61 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1570607 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index 9e55a2f255..cebd7907a7 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -51,23 +51,23 @@ enum sensor_config {
((1 << TASK_EVENT_MOTION_INTERRUPT_NUM) - 1)
#define TASK_EVENT_MOTION_SENSOR_INTERRUPT(_sensor_id) \
BUILD_CHECK_INLINE( \
- TASK_EVENT_CUSTOM(1 << (_sensor_id)), \
+ TASK_EVENT_CUSTOM_BIT(_sensor_id), \
_sensor_id < TASK_EVENT_MOTION_INTERRUPT_NUM)
/* Internal events to motion sense task.*/
#define TASK_EVENT_MOTION_FIRST_INTERNAL_EVENT TASK_EVENT_MOTION_INTERRUPT_NUM
#define TASK_EVENT_MOTION_INTERNAL_EVENT_NUM 2
#define TASK_EVENT_MOTION_FLUSH_PENDING \
- TASK_EVENT_CUSTOM(1 << TASK_EVENT_MOTION_FIRST_INTERNAL_EVENT)
+ TASK_EVENT_CUSTOM_BIT(TASK_EVENT_MOTION_FIRST_INTERNAL_EVENT)
#define TASK_EVENT_MOTION_ODR_CHANGE \
- TASK_EVENT_CUSTOM(1 << (TASK_EVENT_MOTION_FIRST_INTERNAL_EVENT + 1))
+ TASK_EVENT_CUSTOM_BIT(TASK_EVENT_MOTION_FIRST_INTERNAL_EVENT + 1)
/* Activity events */
#define TASK_EVENT_MOTION_FIRST_SW_EVENT \
(TASK_EVENT_MOTION_INTERRUPT_NUM + TASK_EVENT_MOTION_INTERNAL_EVENT_NUM)
#define TASK_EVENT_MOTION_ACTIVITY_INTERRUPT(_activity_id) \
- (TASK_EVENT_CUSTOM( \
- 1 << (TASK_EVENT_MOTION_FIRST_SW_EVENT + (_activity_id))))
+ (TASK_EVENT_CUSTOM_BIT( \
+ TASK_EVENT_MOTION_FIRST_SW_EVENT + (_activity_id)))
#define ROUND_UP_FLAG BIT(31)