summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/common/include/test/drivers/tcpci_test_common.h
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/test/drivers/common/include/test/drivers/tcpci_test_common.h')
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/tcpci_test_common.h253
1 files changed, 253 insertions, 0 deletions
diff --git a/zephyr/test/drivers/common/include/test/drivers/tcpci_test_common.h b/zephyr/test/drivers/common/include/test/drivers/tcpci_test_common.h
new file mode 100644
index 0000000000..08d75cccf7
--- /dev/null
+++ b/zephyr/test/drivers/common/include/test/drivers/tcpci_test_common.h
@@ -0,0 +1,253 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __TCPCI_TEST_COMMON_H
+#define __TCPCI_TEST_COMMON_H
+
+#include "stubs.h"
+
+/**
+ * @brief Check TCPC register value using zassert API
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param reg TCPC register address to check
+ * @param exp_val Expected value of register
+ * @param line Line number to print in case of failure
+ */
+void check_tcpci_reg_f(const struct emul *emul, int reg, uint16_t exp_val,
+ int line);
+#define check_tcpci_reg(emul, reg, exp_val) \
+ check_tcpci_reg_f((emul), (reg), (exp_val), __LINE__)
+
+/**
+ * @brief Check TCPC register value with mask using zassert API
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param reg TCPC register address to check
+ * @param exp_val Expected value of register
+ * @param mask Bits that are checked
+ * @param line Line number to print in case of failure
+ */
+void check_tcpci_reg_with_mask_f(const struct emul *emul, int reg,
+ uint16_t exp_val, uint16_t mask, int line);
+#define check_tcpci_reg_with_mask(emul, reg, exp_val, mask) \
+ check_tcpci_reg_with_mask_f((emul), (reg), (exp_val), (mask), __LINE__)
+
+/**
+ * @brief Test TCPCI init and vbus level callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_init(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI release callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_release(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI get cc callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_get_cc(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI set cc callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_set_cc(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI set polarity callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_set_polarity(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI set vconn callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_set_vconn(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI set msg header callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_set_msg_header(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI rx and sop prime enable callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_set_rx_detect(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI get raw message from TCPC callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_get_rx_message_raw(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI transmitting message from TCPC callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_transmit(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI alert callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_alert(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI alert RX message callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_alert_rx_message(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI auto discharge on disconnect callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_auto_discharge(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI drp toggle callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_drp_toggle(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI get chip info callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_get_chip_info(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI enter low power mode callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_low_power_mode(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI set bist test mode callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to argument emul's i2c_common_emul_data
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_set_bist_mode(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+/**
+ * @brief Test TCPCI hard reset re-init callback
+ *
+ * @param emul Pointer to TCPCI emulator
+ * @param common_data Pointer to emulated I2C bus
+ * @param port Select USBC port that will be used to obtain tcpm_drv from
+ * tcpc_config
+ */
+void test_tcpci_hard_reset_reinit(const struct emul *emul,
+ struct i2c_common_emul_data *common_data,
+ enum usbc_port port);
+
+#endif /* __TCPCI_TEST_COMMON_H */