summaryrefslogtreecommitdiff
path: root/include/mkbp_event.h
diff options
context:
space:
mode:
authorTristan Honscheid <honscheid@google.com>2022-09-12 13:50:00 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-12 21:56:03 +0000
commit953d4674e60b3c4cdabda38e0880fa92894ab5de (patch)
tree89a647c259542a3865d41a30ae4c4c09b158a576 /include/mkbp_event.h
parent801af54b125fced75596f37592b31f76a45f1d29 (diff)
downloadchrome-ec-953d4674e60b3c4cdabda38e0880fa92894ab5de.tar.gz
zephyr: tests: Test host command EC_CMD_GET_NEXT_EVENT in `mkbp_event.c`
Tests the above host command by adding a simulated event to the keyboard FIFO and retrieving it via the host command. BRANCH=None BUG=b:245531291 TEST=./twister Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: I16a1a07e5aa56b95f6e118926b531b09baab992e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891205 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
Diffstat (limited to 'include/mkbp_event.h')
-rw-r--r--include/mkbp_event.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/mkbp_event.h b/include/mkbp_event.h
index 1fc3d54453..d31bd82cb2 100644
--- a/include/mkbp_event.h
+++ b/include/mkbp_event.h
@@ -57,4 +57,16 @@ struct mkbp_event_source {
__attribute__((section(".rodata.evtsrcs"))) = { type, func }
#endif
+#ifdef TEST_BUILD
+/* Allow directly raising events in unit tests */
+void activate_mkbp_with_events(uint32_t events_to_add);
+
+/**
+ * @brief Force the event bits to zero, causing the event handling code to
+ * believe there are no pending events to service. This has no effect on
+ * any event sources' internal queues or logic.
+ */
+__test_only void mkbp_event_clear_all(void);
+#endif /* TEST_BUILD */
+
#endif /* __CROS_EC_MKBP_EVENT_H */