summaryrefslogtreecommitdiff
path: root/include/mock
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /include/mock
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-14528.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'include/mock')
-rw-r--r--include/mock/charge_manager_mock.h27
-rw-r--r--include/mock/dp_alt_mode_mock.h14
-rw-r--r--include/mock/fp_sensor_mock.h48
-rw-r--r--include/mock/fpsensor_detect_mock.h27
-rw-r--r--include/mock/fpsensor_state_mock.h18
-rw-r--r--include/mock/mkbp_events_mock.h25
-rw-r--r--include/mock/rollback_mock.h27
-rw-r--r--include/mock/tcpc_mock.h37
-rw-r--r--include/mock/tcpci_i2c_mock.h58
-rw-r--r--include/mock/tcpm_mock.h23
-rw-r--r--include/mock/timer_mock.h15
-rw-r--r--include/mock/usb_mux_mock.h19
-rw-r--r--include/mock/usb_pd_dpm_mock.h23
-rw-r--r--include/mock/usb_pe_sm_mock.h30
-rw-r--r--include/mock/usb_prl_mock.h36
-rw-r--r--include/mock/usb_tc_sm_mock.h33
16 files changed, 0 insertions, 460 deletions
diff --git a/include/mock/charge_manager_mock.h b/include/mock/charge_manager_mock.h
deleted file mode 100644
index 8a791f6121..0000000000
--- a/include/mock/charge_manager_mock.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright 2021 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.
- */
-
-/**
- * @file
- * @brief Controls for the mock charge_manager
- */
-
-#ifndef __MOCK_CHARGE_MANAGER_MOCK_H
-#define __MOCK_CHARGE_MANAGER_MOCK_H
-
-struct mock_ctrl_charge_manager {
- int vbus_voltage_mv;
-};
-
-#define MOCK_CTRL_DEFAULT_CHARGE_MANAGER \
- ((struct mock_ctrl_charge_manager) { \
- .vbus_voltage_mv = 0, \
- })
-
-extern struct mock_ctrl_charge_manager mock_ctrl_charge_manager;
-
-void mock_charge_manager_set_vbus_voltage(int voltage_mv);
-
-#endif /* __MOCK_CHARGE_MANAGER_MOCK_H */
diff --git a/include/mock/dp_alt_mode_mock.h b/include/mock/dp_alt_mode_mock.h
deleted file mode 100644
index 27811140c7..0000000000
--- a/include/mock/dp_alt_mode_mock.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Copyright 2020 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.
- */
-/* Mock for DisplayPort alternate mode support */
-
-#ifndef __MOCK_DP_ALT_MODE_MOCK_H
-#define __MOCK_DP_ALT_MODE_MOCK_H
-
-#include "common.h"
-
-void mock_dp_alt_mode_reset(void);
-
-#endif /* __MOCK_DP_ALT_MODE_MOCK_H */
diff --git a/include/mock/fp_sensor_mock.h b/include/mock/fp_sensor_mock.h
deleted file mode 100644
index 432802348c..0000000000
--- a/include/mock/fp_sensor_mock.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/**
- * @file
- * @brief Controls for the mock fpsensor private driver
- */
-
-#ifndef __MOCK_FP_SENSOR_MOCK_H
-#define __MOCK_FP_SENSOR_MOCK_H
-
-#include "common.h"
-#include "fpsensor.h"
-
-struct mock_ctrl_fp_sensor {
- int fp_sensor_init_return;
- int fp_sensor_deinit_return;
- int fp_sensor_get_info_return;
- enum finger_state fp_sensor_finger_status_return;
- int fp_sensor_acquire_image_return;
- int fp_sensor_acquire_image_with_mode_return;
- int fp_finger_match_return;
- int fp_enrollment_begin_return;
- int fp_enrollment_finish_return;
- int fp_finger_enroll_return;
- int fp_maintenance_return;
-};
-
-#define MOCK_CTRL_DEFAULT_FP_SENSOR \
-(struct mock_ctrl_fp_sensor) { \
- .fp_sensor_init_return = EC_SUCCESS, \
- .fp_sensor_deinit_return = EC_SUCCESS, \
- .fp_sensor_get_info_return = EC_SUCCESS, \
- .fp_sensor_finger_status_return = FINGER_NONE, \
- .fp_sensor_acquire_image_return = 0, \
- .fp_sensor_acquire_image_with_mode_return = 0, \
- .fp_finger_match_return = EC_MKBP_FP_ERR_MATCH_YES_UPDATED, \
- .fp_enrollment_begin_return = 0, \
- .fp_enrollment_finish_return = 0, \
- .fp_finger_enroll_return = EC_MKBP_FP_ERR_ENROLL_OK, \
- .fp_maintenance_return = EC_SUCCESS \
-}
-
-extern struct mock_ctrl_fp_sensor mock_ctrl_fp_sensor;
-
-#endif /* __MOCK_FP_SENSOR_MOCK_H */
diff --git a/include/mock/fpsensor_detect_mock.h b/include/mock/fpsensor_detect_mock.h
deleted file mode 100644
index da23dded96..0000000000
--- a/include/mock/fpsensor_detect_mock.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright 2020 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.
- */
-
-#ifndef __MOCK_FPSENSOR_DETECT_MOCK_H
-#define __MOCK_FPSENSOR_DETECT_MOCK_H
-
-#include "fpsensor_detect.h"
-
-struct mock_ctrl_fpsensor_detect {
- enum fp_sensor_type get_fp_sensor_type_return;
- enum fp_transport_type get_fp_transport_type_return;
- enum fp_sensor_spi_select get_fp_sensor_spi_select_return;
-};
-
-#define MOCK_CTRL_DEFAULT_FPSENSOR_DETECT \
- { \
- .get_fp_sensor_type_return = FP_SENSOR_TYPE_UNKNOWN, \
- .get_fp_transport_type_return = FP_TRANSPORT_TYPE_UNKNOWN, \
- .get_fp_sensor_spi_select_return = \
- FP_SENSOR_SPI_SELECT_UNKNOWN \
- }
-
-extern struct mock_ctrl_fpsensor_detect mock_ctrl_fpsensor_detect;
-
-#endif /* __MOCK_FPSENSOR_DETECT_MOCK_H */
diff --git a/include/mock/fpsensor_state_mock.h b/include/mock/fpsensor_state_mock.h
deleted file mode 100644
index eafe01851c..0000000000
--- a/include/mock/fpsensor_state_mock.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright 2020 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.
- */
-
-#ifndef __MOCK_FPSENSOR_STATE_MOCK_H
-#define __MOCK_FPSENSOR_STATE_MOCK_H
-
-#include <stdbool.h>
-#include <stdint.h>
-#include "ec_commands.h"
-
-extern const uint8_t default_fake_tpm_seed[FP_CONTEXT_TPM_BYTES];
-
-int fpsensor_state_mock_set_tpm_seed(
- const uint8_t tpm_seed[FP_CONTEXT_TPM_BYTES]);
-
-#endif /* __MOCK_FPSENSOR_STATE_MOCK_H */
diff --git a/include/mock/mkbp_events_mock.h b/include/mock/mkbp_events_mock.h
deleted file mode 100644
index 3d686e3618..0000000000
--- a/include/mock/mkbp_events_mock.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/**
- * @file
- * @brief Controls for the mock MKBP keyboard protocol
- */
-
-#ifndef __MOCK_MKBP_EVENTS_MOCK_H
-#define __MOCK_MKBP_EVENTS_MOCK_H
-
-struct mock_ctrl_mkbp_events {
- int mkbp_send_event_return;
-};
-
-#define MOCK_CTRL_DEFAULT_MKBP_EVENTS \
-(struct mock_ctrl_mkbp_events) { \
- .mkbp_send_event_return = 1, \
-}
-
-extern struct mock_ctrl_mkbp_events mock_ctrl_mkbp_events;
-
-#endif /* __MOCK_MKBP_EVENTS_MOCK_H */
diff --git a/include/mock/rollback_mock.h b/include/mock/rollback_mock.h
deleted file mode 100644
index 576f87e6b9..0000000000
--- a/include/mock/rollback_mock.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright 2019 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.
- */
-
-/**
- * @file
- * @brief Controls for the mock rollback block library
- */
-
-#ifndef __MOCK_ROLLBACK_MOCK_H
-#define __MOCK_ROLLBACK_MOCK_H
-
-#include <stdbool.h>
-
-struct mock_ctrl_rollback {
- bool get_secret_fail;
-};
-
-#define MOCK_CTRL_DEFAULT_ROLLBACK \
-(struct mock_ctrl_rollback) { \
- .get_secret_fail = false, \
-}
-
-extern struct mock_ctrl_rollback mock_ctrl_rollback;
-
-#endif /* __MOCK_ROLLBACK_MOCK_H */
diff --git a/include/mock/tcpc_mock.h b/include/mock/tcpc_mock.h
deleted file mode 100644
index 9098fe1ba3..0000000000
--- a/include/mock/tcpc_mock.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright 2019 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.
- */
- /* Mock for the TCPC interface */
-
-#include "usb_pd_tcpm.h"
-#include "usb_pd.h"
-
-/* Controller for TCPC state */
-struct mock_tcpc_ctrl {
- enum tcpc_cc_voltage_status cc1;
- enum tcpc_cc_voltage_status cc2;
- int vbus_level;
- int num_calls_to_set_header;
- bool should_print_call;
- uint64_t first_call_to_enable_auto_toggle;
-
- /* Set to function pointer if callback is needed for test code */
- struct tcpm_drv callbacks;
-
- /* Store the latest values that were set on TCPC API */
- struct {
- enum pd_power_role power_role;
- enum pd_data_role data_role;
- enum tcpc_cc_pull cc;
- enum tcpc_rp_value rp;
- enum tcpc_cc_polarity polarity;
- } last;
-
-};
-
-/* Reset this TCPC mock */
-void mock_tcpc_reset(void);
-
-extern const struct tcpm_drv mock_tcpc_driver;
-extern struct mock_tcpc_ctrl mock_tcpc;
diff --git a/include/mock/tcpci_i2c_mock.h b/include/mock/tcpci_i2c_mock.h
deleted file mode 100644
index 1d4a986ebe..0000000000
--- a/include/mock/tcpci_i2c_mock.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright 2020 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.
- */
-
-#include "common.h"
-#include "usb_pd.h"
-#include "usb_pd_tcpm.h"
-
-#define MOCK_TCPCI_I2C_ADDR_FLAGS 0x99
-
-void mock_tcpci_reset(void);
-
-void mock_tcpci_set_reg(int reg, uint16_t value);
-void mock_tcpci_set_reg_bits(int reg_offset, uint16_t mask);
-void mock_tcpci_clr_reg_bits(int reg_offset, uint16_t mask);
-
-uint16_t mock_tcpci_get_reg(int reg_offset);
-
-int verify_tcpci_transmit(enum tcpci_msg_type tx_type,
- enum pd_ctrl_msg_type ctrl_msg,
- enum pd_data_msg_type data_msg);
-
-int verify_tcpci_tx_retry_count(enum tcpci_msg_type tx_type,
- enum pd_ctrl_msg_type ctrl_msg,
- enum pd_data_msg_type data_msg,
- int retry_count);
-
-int verify_tcpci_tx_timeout(enum tcpci_msg_type tx_type,
- enum pd_ctrl_msg_type ctrl_msg,
- enum pd_data_msg_type data_msg,
- int timeout);
-
-int verify_tcpci_tx_with_data(enum tcpci_msg_type tx_type,
- enum pd_data_msg_type data_msg,
- uint8_t *data,
- int data_bytes,
- int *msg_len,
- int timeout);
-
-struct possible_tx {
- enum tcpci_msg_type tx_type;
- enum pd_ctrl_msg_type ctrl_msg;
- enum pd_data_msg_type data_msg;
-};
-
-int verify_tcpci_possible_tx(struct possible_tx possible[],
- int possible_cnt,
- int *found_index,
- uint8_t *data,
- int data_bytes,
- int *msg_len,
- int timeout);
-
-void mock_tcpci_receive(enum tcpci_msg_type sop, uint16_t header,
- uint32_t *payload);
-
-void tcpci_register_dump(void);
diff --git a/include/mock/tcpm_mock.h b/include/mock/tcpm_mock.h
deleted file mode 100644
index 7fd89919f5..0000000000
--- a/include/mock/tcpm_mock.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2020 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.
- */
- /* Mock for the TCPM interface */
-
-#include "common.h"
-#include "tcpm/tcpm.h"
-
-/* Copied from usb_prl_sm.c, line 99. */
-#define MOCK_CHK_BUF_SIZE 7
-
-/* Define a struct to hold the data we need to control the mocks. */
-struct mock_tcpm_t {
- uint32_t mock_rx_chk_buf[MOCK_CHK_BUF_SIZE];
- uint32_t mock_header;
- int mock_has_pending_message;
-};
-
-extern struct mock_tcpm_t mock_tcpm[CONFIG_USB_PD_PORT_MAX_COUNT];
-
-void mock_tcpm_reset(void);
-void mock_tcpm_rx_msg(int port, uint16_t header, int cnt, const uint32_t *data);
diff --git a/include/mock/timer_mock.h b/include/mock/timer_mock.h
deleted file mode 100644
index 04dc01e9ab..0000000000
--- a/include/mock/timer_mock.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright 2019 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.
- */
-
-#ifndef __MOCK_TIMER_MOCK_H
-#define __MOCK_TIMER_MOCK_H
-
-#include "timer.h"
-
-void set_time(timestamp_t now_);
-
-timestamp_t get_time(void);
-
-#endif /* __MOCK_TIMER_MOCK_H */
diff --git a/include/mock/usb_mux_mock.h b/include/mock/usb_mux_mock.h
deleted file mode 100644
index 128286796b..0000000000
--- a/include/mock/usb_mux_mock.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2019 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.
- */
-/* Mock USB Type-C mux */
-
-#include "usb_mux.h"
-
-/* Controller for mux state */
-struct mock_usb_mux_ctrl {
- mux_state_t state;
- int num_set_calls;
-};
-
-/* Resets the state of the mock */
-void mock_usb_mux_reset(void);
-
-extern const struct usb_mux_driver mock_usb_mux_driver;
-extern struct mock_usb_mux_ctrl mock_usb_mux;
diff --git a/include/mock/usb_pd_dpm_mock.h b/include/mock/usb_pd_dpm_mock.h
deleted file mode 100644
index c61594fd2b..0000000000
--- a/include/mock/usb_pd_dpm_mock.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2020 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.
- */
-/* Mock of Device Policy Manager implementation */
-
-#ifndef __MOCK_USB_PD_DPM_MOCK_H
-#define __MOCK_USB_PD_DPM_MOCK_H
-
-#include "common.h"
-#include "usb_pd_dpm.h"
-
-/* Defaults should all be 0 values. */
-struct mock_dpm_port_t {
- bool mode_entry_done;
- bool mode_exit_request;
-};
-
-extern struct mock_dpm_port_t dpm[CONFIG_USB_PD_PORT_MAX_COUNT];
-
-void mock_dpm_reset(void);
-
-#endif /* __MOCK_USB_PD_DPM_MOCK_H */
diff --git a/include/mock/usb_pe_sm_mock.h b/include/mock/usb_pe_sm_mock.h
deleted file mode 100644
index fcd6e268a0..0000000000
--- a/include/mock/usb_pe_sm_mock.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2020 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.
- */
-/* Mock USB PE state machine */
-
-#ifndef __MOCK_USB_PE_SM_MOCK_H
-#define __MOCK_USB_PE_SM_MOCK_H
-
-#include "common.h"
-#include "usb_pe_sm.h"
-#include "usb_pd_tcpm.h"
-
-struct mock_pe_port_t {
- enum tcpci_msg_type sop;
-
- int mock_pe_message_sent;
- int mock_pe_error;
- int mock_pe_hard_reset_sent;
- int mock_pe_got_hard_reset;
- int mock_pe_message_received;
- int mock_got_soft_reset;
- int mock_pe_message_discarded;
-};
-
-extern struct mock_pe_port_t mock_pe_port[CONFIG_USB_PD_PORT_MAX_COUNT];
-
-void mock_pe_port_reset(void);
-
-#endif /* __MOCK_USB_PE_SM_MOCK_H */
diff --git a/include/mock/usb_prl_mock.h b/include/mock/usb_prl_mock.h
deleted file mode 100644
index ee37d6e6e2..0000000000
--- a/include/mock/usb_prl_mock.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright 2020 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.
- */
-/* Mock for USB protocol layer */
-
-#ifndef __MOCK_USB_PRL_MOCK_H
-#define __MOCK_USB_PRL_MOCK_H
-
-#include "common.h"
-#include "usb_emsg.h"
-#include "usb_pd_tcpm.h"
-
-void mock_prl_reset(void);
-
-int mock_prl_wait_for_tx_msg(int port,
- enum tcpci_msg_type tx_type,
- enum pd_ctrl_msg_type ctrl_msg,
- enum pd_data_msg_type data_msg,
- int timeout);
-
-enum pd_ctrl_msg_type mock_prl_get_last_sent_ctrl_msg(int port);
-
-enum pd_data_msg_type mock_prl_get_last_sent_data_msg(int port);
-
-
-void mock_prl_clear_last_sent_msg(int port);
-
-void mock_prl_message_sent(int port);
-
-void mock_prl_message_received(int port);
-
-void mock_prl_report_error(int port, enum pe_error e,
- enum tcpci_msg_type tx_type);
-
-#endif /* __MOCK_DP_ALT_MODE_MOCK_H */
diff --git a/include/mock/usb_tc_sm_mock.h b/include/mock/usb_tc_sm_mock.h
deleted file mode 100644
index ca16fb4d98..0000000000
--- a/include/mock/usb_tc_sm_mock.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2020 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.
- */
-/* Mock USB TC state machine*/
-
-#ifndef __MOCK_USB_TC_SM_MOCK_H
-#define __MOCK_USB_TC_SM_MOCK_H
-
-#include "common.h"
-#include "usb_tc_sm.h"
-#include "usb_pd.h"
-#include "usb_pd_tcpm.h"
-
-struct mock_tc_port_t {
- int rev;
- int pd_enable;
- int msg_tx_id;
- int msg_rx_id;
- enum tcpci_msg_type sop;
- enum tcpc_rp_value lcl_rp;
- int attached_snk;
- int attached_src;
- bool vconn_src;
- enum pd_data_role data_role;
- enum pd_power_role power_role;
-};
-
-extern struct mock_tc_port_t mock_tc_port[CONFIG_USB_PD_PORT_MAX_COUNT];
-
-void mock_tc_port_reset(void);
-
-#endif /* __MOCK_USB_TC_SM_MOCK_H */