summaryrefslogtreecommitdiff
path: root/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c
diff options
context:
space:
mode:
authorTang Qijun <qijun.tang@ecs.corp-partner.google.com>2023-04-29 10:26:48 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-05-03 21:30:29 +0000
commit037c04236fdccb37b02075f46b47c7ee92ac9ab8 (patch)
tree2ed7e188da44cc189796737071f64b0b7ea2b068 /zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c
parentb647360e5d8b79c87644dd06ef54ecd3e0746b1c (diff)
downloadchrome-ec-037c04236fdccb37b02075f46b47c7ee92ac9ab8.tar.gz
crystaldrift: modify port0 ppc config
design port0 ppc change from aoz1380 to sm5360 BRANCH=skyrim BUG=b:260771028 TEST=1. zmake build crystaldrift test port0 typeC function is ok 2. twister -T zephyr/test/skyrim Change-Id: I4c33c1004d18a07e84cb9390ccf1b686e71c9da7 Signed-off-by: Tang Qijun <qijun.tang@ecs.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4493843 Commit-Queue: Chao Gui <chaogui@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> (cherry picked from commit dcb771689a6fd8c78a3ea110ac492e957c4e1850) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4493445 Reviewed-by: Chao Gui <chaogui@google.com>
Diffstat (limited to 'zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c')
-rw-r--r--zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c b/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c
new file mode 100644
index 0000000000..0f319d8ea4
--- /dev/null
+++ b/zephyr/test/skyrim/tests/crystaldrift/src/ppc_config.c
@@ -0,0 +1,37 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include <zephyr/fff.h>
+#include <zephyr/ztest.h>
+
+#include <gpio.h>
+#include <usbc_ppc.h>
+
+FAKE_VOID_FUNC(nx20p348x_interrupt, int);
+
+static void ppc_config_before(void *fixture)
+{
+ ARG_UNUSED(fixture);
+ RESET_FAKE(nx20p348x_interrupt);
+}
+
+void ppc_interrupt(enum gpio_signal signal);
+
+ZTEST_SUITE(ppc_config, NULL, NULL, ppc_config_before, NULL, NULL);
+
+ZTEST(ppc_config, test_ppc_interrupt_c0)
+{
+ ppc_interrupt(GPIO_USB_C0_PPC_INT_ODL);
+ zassert_equal(nx20p348x_interrupt_fake.call_count, 1);
+ /* port */
+ zassert_equal(nx20p348x_interrupt_fake.arg0_val, 0);
+}
+
+ZTEST(ppc_config, test_ppc_interrupt_c1)
+{
+ ppc_interrupt(GPIO_USB_C1_PPC_INT_ODL);
+ zassert_equal(nx20p348x_interrupt_fake.call_count, 1);
+ /* port */
+ zassert_equal(nx20p348x_interrupt_fake.arg0_val, 1);
+}