From 6d8bb5bebea72249b1744d12104277a71b6882dd Mon Sep 17 00:00:00 2001 From: Scott Chao Date: Wed, 28 Sep 2022 09:52:57 +0800 Subject: TCPMv2: Add bist share mode console command This CL enable bist share mode control by ec console. BUG=b:242957100 BRANCH=none TEST=pd bistsharemode [disable|enable] TEST=./twister -v -T zephyr/test TEST=make run-usb_pd_console TEST=make buildall TEST=make test-coverage Change-Id: I3aaaf91eaa1321d57fd773bba18d126ead29f944 Signed-off-by: Scott Chao Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3924556 Reviewed-by: Diana Z Code-Coverage: Zoss --- test/usb_pd_console.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'test') diff --git a/test/usb_pd_console.c b/test/usb_pd_console.c index 711664aeb0..cb2539fea4 100644 --- a/test/usb_pd_console.c +++ b/test/usb_pd_console.c @@ -43,6 +43,7 @@ static enum pd_dpm_request request; static int max_volt; static int comm_enable; static int pd_suspended; +static int pd_bistsharemode; static int dev_info; static int vdm_cmd; static int vdm_count; @@ -186,6 +187,12 @@ void pd_set_suspend(int port, int enable) pd_suspended = enable; } +enum ec_status pd_set_bist_share_mode(uint8_t enable) +{ + pd_bistsharemode = enable; + return EC_RES_SUCCESS; +} + void tc_print_dev_info(int port) { test_port = port; @@ -310,6 +317,30 @@ static int test_command_pd_version(void) return EC_SUCCESS; } +static int test_command_pd_bistsharemode_enable(void) +{ + int argc = 3; + static const char *argv[10] = { "pd", "bistsharemode", "enable" }; + + pd_bistsharemode = -1; + TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); + TEST_ASSERT(pd_bistsharemode == 1); + + return EC_SUCCESS; +} + +static int test_command_pd_bistsharemode_disable(void) +{ + int argc = 3; + static const char *argv[10] = { "pd", "bistsharemode", "disable" }; + + pd_bistsharemode = -1; + TEST_ASSERT(command_pd(argc, argv) == EC_SUCCESS); + TEST_ASSERT(pd_bistsharemode == 0); + + return EC_SUCCESS; +} + static int test_command_pd_arg_count(void) { int argc; @@ -679,6 +710,8 @@ void run_test(int argc, const char **argv) RUN_TEST(test_command_pd_soft); RUN_TEST(test_command_pd_suspend); RUN_TEST(test_command_pd_resume); + RUN_TEST(test_command_pd_bistsharemode_enable); + RUN_TEST(test_command_pd_bistsharemode_disable); RUN_TEST(test_command_pd_swap1); RUN_TEST(test_command_pd_swap2); RUN_TEST(test_command_pd_swap3); -- cgit v1.2.1