summaryrefslogtreecommitdiff
path: root/test/usb_tcpmv2_compliance.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-12-15 16:20:06 -0700
committerCommit Bot <commit-bot@chromium.org>2020-12-17 00:29:18 +0000
commit6ab83beef7e4a6230ce583e2a47b38583bc7dc06 (patch)
tree6b786d3e5ed142b6235272ceb456ddd350e4e34f /test/usb_tcpmv2_compliance.c
parent4152f3c9cbcadb6215590967453294c8aa286c35 (diff)
downloadchrome-ec-6ab83beef7e4a6230ce583e2a47b38583bc7dc06.tar.gz
TCPMv2: Unit Test TD.PD.LL.E3 Soft Reset Usage
BUG=b:175144677 BRANCH=none TEST=make run-usb_tcpmv2_compliance Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I629e2811b2cba5aa9821d8c855e039a6cfaa32ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2595816 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'test/usb_tcpmv2_compliance.c')
-rw-r--r--test/usb_tcpmv2_compliance.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/usb_tcpmv2_compliance.c b/test/usb_tcpmv2_compliance.c
new file mode 100644
index 0000000000..2ca08308ca
--- /dev/null
+++ b/test/usb_tcpmv2_compliance.c
@@ -0,0 +1,34 @@
+/* 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 "mock/tcpci_i2c_mock.h"
+#include "mock/usb_mux_mock.h"
+#include "task.h"
+#include "test_util.h"
+#include "timer.h"
+#include "usb_tcpmv2_compliance.h"
+
+void before_test(void)
+{
+ partner_tx_id = 0;
+ partner_set_pd_rev(PD_REV30);
+
+ mock_usb_mux_reset();
+ mock_tcpci_reset();
+
+ /* Restart the PD task and let it settle */
+ task_set_event(TASK_ID_PD_C0, TASK_EVENT_RESET_DONE);
+ task_wait_event(SECOND);
+}
+
+void run_test(int argc, char **argv)
+{
+ test_reset();
+
+ RUN_TEST(test_td_pd_ll_e3_dfp);
+ RUN_TEST(test_td_pd_ll_e3_ufp);
+
+ test_print_result();
+}