diff options
author | Denis Brockus <dbrockus@google.com> | 2020-12-29 09:48:08 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-30 20:01:21 +0000 |
commit | 4772a209e5b760f95232e72a2be775073ce84966 (patch) | |
tree | 2567ac0c69647980f9bb8ac6117c2c2fb4a9dd88 /test | |
parent | bddaef0ac91186e2aab8e123079d57aee7aa4704 (diff) | |
download | chrome-ec-4772a209e5b760f95232e72a2be775073ce84966.tar.gz |
TCPMv2: Compliance Unit Test - TD.PD.LL.E5
BUG=none
BRANCH=none
TEST=make buildall
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I78a77a3ee83d1517c3c1cb4791593f3cc3845151
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606564
Tested-by: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/build.mk | 1 | ||||
-rw-r--r-- | test/usb_tcpmv2_compliance.c | 2 | ||||
-rw-r--r-- | test/usb_tcpmv2_compliance.h | 2 | ||||
-rw-r--r-- | test/usb_tcpmv2_td_pd_ll_e5.c | 57 |
4 files changed, 62 insertions, 0 deletions
diff --git a/test/build.mk b/test/build.mk index f3389a2ccb..fee765a5d0 100644 --- a/test/build.mk +++ b/test/build.mk @@ -219,6 +219,7 @@ usb_pe_drp_noextended-y=usb_pe_drp_noextended.o usb_sm_checks.o usb_tcpmv2_compliance-y=usb_tcpmv2_compliance.o usb_tcpmv2_compliance_common.o \ usb_tcpmv2_td_pd_ll_e3.o \ usb_tcpmv2_td_pd_ll_e4.o \ + usb_tcpmv2_td_pd_ll_e5.o \ usb_tcpmv2_td_pd_src3_e26.o \ usb_tcpmv2_td_pd_snk3_e12.o \ usb_tcpmv2_td_pd_other.o diff --git a/test/usb_tcpmv2_compliance.c b/test/usb_tcpmv2_compliance.c index 6e1bbf75f5..c031860c5a 100644 --- a/test/usb_tcpmv2_compliance.c +++ b/test/usb_tcpmv2_compliance.c @@ -31,6 +31,8 @@ void run_test(int argc, char **argv) RUN_TEST(test_td_pd_ll_e3_ufp); RUN_TEST(test_td_pd_ll_e4_dfp); RUN_TEST(test_td_pd_ll_e4_ufp); + RUN_TEST(test_td_pd_ll_e5_dfp); + RUN_TEST(test_td_pd_ll_e5_ufp); RUN_TEST(test_td_pd_src3_e26); RUN_TEST(test_td_pd_snk3_e12); diff --git a/test/usb_tcpmv2_compliance.h b/test/usb_tcpmv2_compliance.h index 99a614edf2..f477d9f575 100644 --- a/test/usb_tcpmv2_compliance.h +++ b/test/usb_tcpmv2_compliance.h @@ -73,6 +73,8 @@ int test_td_pd_ll_e3_dfp(void); int test_td_pd_ll_e3_ufp(void); int test_td_pd_ll_e4_dfp(void); int test_td_pd_ll_e4_ufp(void); +int test_td_pd_ll_e5_dfp(void); +int test_td_pd_ll_e5_ufp(void); int test_td_pd_src3_e26(void); int test_td_pd_snk3_e12(void); diff --git a/test/usb_tcpmv2_td_pd_ll_e5.c b/test/usb_tcpmv2_td_pd_ll_e5.c new file mode 100644 index 0000000000..c3e0842f63 --- /dev/null +++ b/test/usb_tcpmv2_td_pd_ll_e5.c @@ -0,0 +1,57 @@ +/* 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 "task.h" +#include "tcpci.h" +#include "test_util.h" +#include "timer.h" +#include "usb_tcpmv2_compliance.h" +#include "usb_tc_sm.h" + +/***************************************************************************** + * TD.PD.LL.E5. Soft Reset + * + * Description: + * Check that the UUT will correctly complete the Soft Reset procedure. + */ +static int td_pd_ll_e5(enum pd_data_role data_role) +{ + partner_set_pd_rev(PD_REV20); + + TEST_EQ(tcpci_startup(), EC_SUCCESS, "%d"); + + /* + * a) Run PROC.PD.E1 Bring-up according to the UUT role. + */ + TEST_EQ(proc_pd_e1(data_role, INITIAL_ATTACH), EC_SUCCESS, "%d"); + + /* + * Make sure we are idle. Reject everything that is pending + */ + TEST_EQ(handle_attach_expected_msgs(data_role), EC_SUCCESS, "%d"); + + /* + * b) Initiate a Soft Reset and check that the procedure is completed + * successfully. + */ + partner_send_msg(PD_MSG_SOP, PD_CTRL_SOFT_RESET, 0, 0, NULL); + + TEST_EQ(verify_tcpci_transmit(TCPC_TX_SOP, PD_CTRL_ACCEPT, 0), + EC_SUCCESS, "%d"); + mock_set_alert(TCPC_REG_ALERT_TX_SUCCESS); + + TEST_EQ(proc_pd_e1(data_role, ALREADY_ATTACHED), EC_SUCCESS, "%d"); + + return EC_SUCCESS; +} +int test_td_pd_ll_e5_dfp(void) +{ + return td_pd_ll_e5(PD_ROLE_DFP); +} +int test_td_pd_ll_e5_ufp(void) +{ + return td_pd_ll_e5(PD_ROLE_UFP); +} |