summaryrefslogtreecommitdiff
path: root/include/keyboard_test.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-10-10 09:47:00 -0700
committerGerrit <chrome-bot@google.com>2012-10-31 17:21:00 -0700
commitf3c88fa1ab60101f32f9117dced3afdc3f4c9393 (patch)
treeb751fa8ac6ff6861b33a23a520c34cde1eced1cd /include/keyboard_test.h
parenteee95c9448a8accc8416b32c55a89d5796cdf35b (diff)
downloadchrome-ec-f3c88fa1ab60101f32f9117dced3afdc3f4c9393.tar.gz
stm32: Implement keyscan test infrastructure
Support the keyscan test functionality on stm32. Note: This is enabled by default so that it continues to build. But it is unlikely that we will want this in a shipping image. I suggest we add the facility for a dev build. Secondly, the stack has to be larger due to a printf (which admittedly I could just remove). Should we make the stack size conditional on the CONFIG? Seems a bit ugly, on the other hand we don't want to waste IRAM. BUG=chrome-os-partner:12179 BRANCH=none TEST=manual for now: On snow: ./ectool keyscan 20000 key_sequence.txt See that the test passes. Change-Id: Ic441ca0bde1be9589a924374605e2f146d16f423 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35118
Diffstat (limited to 'include/keyboard_test.h')
-rw-r--r--include/keyboard_test.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/keyboard_test.h b/include/keyboard_test.h
new file mode 100644
index 0000000000..df95d9c081
--- /dev/null
+++ b/include/keyboard_test.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Keyboard scanner test module for Chrome EC */
+
+#ifndef __CROS_EC_KEYBOARD_TEST_H
+#define __CROS_EC_KEYBOARD_TEST_H
+
+#include <timer.h>
+
+/*
+ * Keyboard scan test item - contains a single scan to 'present' to key scan
+ * logic.
+ */
+struct keyscan_item {
+ timestamp_t abs_time; /* absolute timestamp to present this item */
+ uint32_t time_us; /* time for this item relative to test start */
+ uint8_t done; /* 1 if we managed to present this */
+ uint8_t scan[KB_OUTPUTS];
+};
+
+/**
+ * Get the next key scan from the test sequence, if any
+ *
+ * @param column Column to read (-1 to OR all columns together
+ * @param scan Raw scan data read from GPIOs
+ * @return test scan, or just 'scan' if no test is active
+ */
+uint8_t keyscan_seq_get_scan(int column, uint8_t scan);
+
+/**
+ * Calculate the delay until the next key scan event needs to be presented
+ *
+ * @return number of microseconds from now until the next key scan event, or
+ * -1 if there is no future key scan event (e.g. testing is complete)
+ */
+int keyscan_seq_next_event_delay(void);
+
+#endif