summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/host/board.c8
-rw-r--r--board/host/board.h7
-rw-r--r--board/host/gpio.inc5
-rw-r--r--common/fpsensor/build.mk3
-rw-r--r--fuzz/host_command_fuzz.mocklist5
-rw-r--r--fuzz/host_command_fuzz.tasklist2
-rw-r--r--include/fpsensor_state.h5
-rw-r--r--test/fpsensor.mocklist3
8 files changed, 31 insertions, 7 deletions
diff --git a/board/host/board.c b/board/host/board.c
index 086a6f1359..80ac631d19 100644
--- a/board/host/board.c
+++ b/board/host/board.c
@@ -44,7 +44,11 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
test_mockable void button_interrupt(enum gpio_signal signal)
{
-};
+}
+
+test_mockable void fps_event(enum gpio_signal signal)
+{
+}
#ifdef CONFIG_I2C
/* I2C ports */
@@ -62,6 +66,8 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
#ifdef CONFIG_SPI_MASTER
/* SPI devices */
const struct spi_device_t spi_devices[] = {
+ /* Fingerprint sensor (SCLK at 4Mhz) */
+ { CONFIG_SPI_FP_PORT, 3, GPIO_SPI1_NSS },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
diff --git a/board/host/board.h b/board/host/board.h
index d202e23f7a..ac44f31907 100644
--- a/board/host/board.h
+++ b/board/host/board.h
@@ -73,4 +73,11 @@ enum {
#define PD_MIN_CURRENT_MA 500
#define PD_MIN_POWER_MW 7500
+/* Configuration for fake Fingerprint Sensor */
+#define CONFIG_SPI_MASTER
+#define CONFIG_SPI_FP_PORT 1 /* SPI1: third master config */
+
+#define CONFIG_RNG
+void fps_event(enum gpio_signal signal);
+
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/host/gpio.inc b/board/host/gpio.inc
index d80e172448..324721068b 100644
--- a/board/host/gpio.inc
+++ b/board/host/gpio.inc
@@ -14,6 +14,8 @@ GPIO_INT(AC_PRESENT, PIN(0, 2), GPIO_INT_BOTH, extpower_interrupt)
GPIO_INT(VOLUME_DOWN_L, PIN(0, 3), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(VOLUME_UP_L, PIN(0, 4), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(CHARGE_DONE, PIN(0, 5), GPIO_INT_BOTH, inductive_charging_interrupt)
+/* Fingerprint */
+GPIO_INT(FPS_INT, PIN(0, 14), GPIO_INT_RISING, fps_event)
GPIO(EC_INT_L, PIN(0, 6), 0)
GPIO(WP, PIN(0, 7), 0)
@@ -24,3 +26,6 @@ GPIO(ENABLE_BACKLIGHT, PIN(0, 10), 0)
/* Inductive charging */
GPIO(CHARGE_EN, PIN(0, 11), 0)
GPIO(BASE_CHG_VDD_EN, PIN(0, 12), 0)
+
+/* Fingerprint */
+GPIO(SPI1_NSS, PIN(0, 13), GPIO_OUT_HIGH)
diff --git a/common/fpsensor/build.mk b/common/fpsensor/build.mk
index 687496bf2a..03bc80f2ef 100644
--- a/common/fpsensor/build.mk
+++ b/common/fpsensor/build.mk
@@ -9,9 +9,8 @@ _fpsensor_dir:=$(dir $(lastword $(MAKEFILE_LIST)))
all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_state.o
all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_crypto.o
-ifneq ($(CONFIG_SPI_FP_PORT),)
all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor.o
-endif
+
ifeq ($(HAS_MOCK_FP_SENSOR),)
all-obj-$(HAS_TASK_FPSENSOR)+=$(_fpsensor_dir)fpsensor_stubs.o
endif
diff --git a/fuzz/host_command_fuzz.mocklist b/fuzz/host_command_fuzz.mocklist
index efcf062742..be1527bff0 100644
--- a/fuzz/host_command_fuzz.mocklist
+++ b/fuzz/host_command_fuzz.mocklist
@@ -4,5 +4,6 @@
*/
#define CONFIG_TEST_MOCK_LIST \
- MOCK(FP_SENSOR) \
- MOCK(ROLLBACK)
+ MOCK(FP_SENSOR) \
+ MOCK(MKBP_EVENTS) \
+ MOCK(ROLLBACK)
diff --git a/fuzz/host_command_fuzz.tasklist b/fuzz/host_command_fuzz.tasklist
index c95bf17c64..2ff8a94d98 100644
--- a/fuzz/host_command_fuzz.tasklist
+++ b/fuzz/host_command_fuzz.tasklist
@@ -7,4 +7,4 @@
* See CONFIG_TASK_LIST in config.h for details.
*/
#define CONFIG_TEST_TASK_LIST \
- TASK_TEST(FPSENSOR, fp_task_simulate, NULL, TASK_STACK_SIZE)
+ TASK_TEST(FPSENSOR, fp_task, NULL, TASK_STACK_SIZE)
diff --git a/include/fpsensor_state.h b/include/fpsensor_state.h
index 4047fca74d..f7bb3a3f1e 100644
--- a/include/fpsensor_state.h
+++ b/include/fpsensor_state.h
@@ -25,6 +25,7 @@
#if defined(HAVE_PRIVATE) && !defined(TEST_BUILD)
#define HAVE_FP_PRIVATE_DRIVER
+/* Include the device specific header file */
#define PRIV_HEADER(header) STRINGIFY(header)
#include PRIV_HEADER(FP_SENSOR_PRIVATE)
#else
@@ -35,6 +36,10 @@
#define FP_ALGORITHM_TEMPLATE_SIZE 0
#define FP_MAX_FINGER_COUNT 5
#endif
+#ifdef TEST_BUILD
+/* This represents the mock of the private */
+#define HAVE_FP_PRIVATE_DRIVER
+#endif
#define SBP_ENC_KEY_LEN 16
#define FP_ALGORITHM_ENCRYPTED_TEMPLATE_SIZE \
(FP_ALGORITHM_TEMPLATE_SIZE + \
diff --git a/test/fpsensor.mocklist b/test/fpsensor.mocklist
index 3aeffc8dd3..3a90debc1f 100644
--- a/test/fpsensor.mocklist
+++ b/test/fpsensor.mocklist
@@ -4,5 +4,6 @@
*/
#define CONFIG_TEST_MOCK_LIST \
- MOCK(FP_SENSOR) \
+ MOCK(FP_SENSOR) \
+ MOCK(MKBP_EVENTS) \
MOCK(TIMER)