diff options
author | Aaron Massey <aaronmassey@google.com> | 2022-09-26 17:46:04 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-28 22:36:18 +0000 |
commit | 2cf5984aed7cd4000c44c8f287276cf0fa64efb7 (patch) | |
tree | ad520f975cd57a2a63bd38f2ae7b2780cd3cf5f5 | |
parent | ed1de52a845c37664bc7ee6a8310eb693ada424e (diff) | |
download | chrome-ec-2cf5984aed7cd4000c44c8f287276cf0fa64efb7.tar.gz |
test: Add keyboard_host_event64 to mkbp_fifo.
Add a test that validates the adding a 64 bit host event can be
successfully retrieved from the mkbp_fifo.
BRANCH=none
BUG=b:244476858
TEST=./twister -t mkbp
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: I7ded166d2f9e8ae219c4c1e58140d09b081632af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3922457
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rwxr-xr-x | util/twister_tags.py | 1 | ||||
-rw-r--r-- | zephyr/test/drivers/mkbp/src/mkbp_fifo.c | 24 | ||||
-rw-r--r-- | zephyr/test/drivers/testcase.yaml | 3 |
3 files changed, 28 insertions, 0 deletions
diff --git a/util/twister_tags.py b/util/twister_tags.py index 465ebab191..05238610f5 100755 --- a/util/twister_tags.py +++ b/util/twister_tags.py @@ -25,6 +25,7 @@ import yaml # pylint: disable=import-error TAG_TO_DESCRIPTION = { "common": "Directly test shared code in the ec/common dir", + "mkbp": "Testing the MKBP (Matrix Keyboard Protocol) stack", "system": "Directly test functions in common/system.c or shim/src/system.c", } diff --git a/zephyr/test/drivers/mkbp/src/mkbp_fifo.c b/zephyr/test/drivers/mkbp/src/mkbp_fifo.c index e6a6ba5f04..1e1da4c6e4 100644 --- a/zephyr/test/drivers/mkbp/src/mkbp_fifo.c +++ b/zephyr/test/drivers/mkbp/src/mkbp_fifo.c @@ -18,6 +18,8 @@ /* Largest event size that we support */ #define KEY_MATRIX_EVENT_DATA_SIZE KEYBOARD_COLS_MAX +#define KEY_HOST_EVENT64_DATA_SIZE sizeof(uint64_t) + #define MAX_EVENT_DATA_SIZE KEY_MATRIX_EVENT_DATA_SIZE struct mkbp_fifo_fixture { @@ -76,6 +78,28 @@ ZTEST_F(mkbp_fifo, test_fifo_add_keyboard_key_matrix_event) zassert_equal(out[KEY_MATRIX_EVENT_DATA_SIZE], 0, NULL); } +ZTEST_F(mkbp_fifo, test_fifo_add_keyboard_host_event64) +{ + uint8_t out[KEY_MATRIX_EVENT_DATA_SIZE + 1]; + + memset(out, 0, sizeof(out)); + + fill_array_with_incrementing_numbers(fixture->input_event_data, + KEY_HOST_EVENT64_DATA_SIZE); + + zassert_ok(mkbp_fifo_add(EC_MKBP_EVENT_HOST_EVENT64, + fixture->input_event_data), + NULL); + + int dequeued_data_size = + mkbp_fifo_get_next_event(out, EC_MKBP_EVENT_HOST_EVENT64); + + zassert_equal(dequeued_data_size, KEY_HOST_EVENT64_DATA_SIZE, NULL); + zassert_mem_equal(fixture->input_event_data, out, + KEY_HOST_EVENT64_DATA_SIZE, NULL); + zassert_equal(out[KEY_HOST_EVENT64_DATA_SIZE], 0, NULL); +} + ZTEST_F(mkbp_fifo, test_fifo_depth_update) { uint8_t out[KEY_MATRIX_EVENT_DATA_SIZE + 1]; diff --git a/zephyr/test/drivers/testcase.yaml b/zephyr/test/drivers/testcase.yaml index 352025f89b..5dc38bd3fc 100644 --- a/zephyr/test/drivers/testcase.yaml +++ b/zephyr/test/drivers/testcase.yaml @@ -65,6 +65,9 @@ tests: - CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y - CONFIG_PLATFORM_EC_MKBP_EVENT=y - CONFIG_PLATFORM_EC_MKBP_USE_GPIO=y + tags: + common + mkbp drivers.rt9490: extra_args: CONF_FILE="prj.conf;rt9490/prj.conf" DTC_OVERLAY_FILE="./boards/native_posix.overlay;./rt9490/charger.dts" extra_configs: |