summaryrefslogtreecommitdiff
path: root/zephyr/emul/tcpc/emul_tcpci.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/emul/tcpc/emul_tcpci.c')
-rw-r--r--zephyr/emul/tcpc/emul_tcpci.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/zephyr/emul/tcpc/emul_tcpci.c b/zephyr/emul/tcpc/emul_tcpci.c
index 228a26ffab..85def4fd8e 100644
--- a/zephyr/emul/tcpc/emul_tcpci.c
+++ b/zephyr/emul/tcpc/emul_tcpci.c
@@ -13,6 +13,7 @@ LOG_MODULE_REGISTER(tcpci_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <drivers/i2c.h>
#include <drivers/i2c_emul.h>
#include <drivers/gpio/gpio_emul.h>
+#include <ztest.h>
#include "tcpm/tcpci.h"
@@ -1435,3 +1436,16 @@ static int tcpci_emul_init(const struct emul *emul, const struct device *parent)
&tcpci_emul_cfg_##n, &tcpci_emul_data_##n)
DT_INST_FOREACH_STATUS_OKAY(TCPCI_EMUL)
+
+#ifdef CONFIG_ZTEST_NEW_API
+#define TCPCI_EMUL_RESET_RULE_BEFORE(n) \
+ tcpci_emul_reset(&EMUL_REG_NAME(DT_DRV_INST(n)));
+static void tcpci_emul_reset_rule_before(const struct ztest_unit_test *test,
+ void *data)
+{
+ ARG_UNUSED(test);
+ ARG_UNUSED(data);
+ DT_INST_FOREACH_STATUS_OKAY(TCPCI_EMUL_RESET_RULE_BEFORE);
+}
+ZTEST_RULE(tcpci_emul_reset, tcpci_emul_reset_rule_before, NULL);
+#endif /* CONFIG_ZTEST_NEW_API */