summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2019-04-18 12:47:52 -0700
committerCommit Bot <commit-bot@chromium.org>2019-07-30 21:25:24 +0000
commit2e3109ec6b964776e7c5bd12f1fc058ca96d33f7 (patch)
tree23ea5eaf67e50094ae683f5d16f09a332a1303c4 /test
parentb99b1b10c3f2070e3fbd8d5cb2d0927f04f642ea (diff)
downloadchrome-ec-2e3109ec6b964776e7c5bd12f1fc058ca96d33f7.tar.gz
type-c: USB Type-C State Machine based on Release 1.4 of the spec.
Implements DRP with Accessory, and Try.SRC as detailed in Release 1.4 of the USB Type-C specification. BUG=b:130895206 BRANCH=none TEST=manual Used Atlas device to verify that it could be charged from PD and none PD charges at 5V/3A. Attached USB dock and verifed access to USB Thumb drive. Performed same tests on Hatch Port 0 on Hatch was used to run this CL, merged with PD functionality, on the PD2.0 Compliance tester. All tests pass except for a few physical layer tests. The test report has been added to the bug. Change-Id: Ic4869e20e5b4c2ba6c827d92e40c70f3140f2518 Signed-off-by: Sam Hurst <shurst@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1574667 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Sam Hurst <shurst@google.com> Commit-Queue: Sam Hurst <shurst@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/usb_prl.c2
-rw-r--r--test/usb_sm_framework_h3.c394
-rw-r--r--test/usb_typec_ctvpd.c120
3 files changed, 180 insertions, 336 deletions
diff --git a/test/usb_prl.c b/test/usb_prl.c
index ee15143986..36f007b057 100644
--- a/test/usb_prl.c
+++ b/test/usb_prl.c
@@ -1255,7 +1255,7 @@ int pd_task(void *u)
evt = task_wait_event(-1);
tcpc_run(port, evt);
- protocol_layer(port, evt, pd_port[port].pd_enable);
+ usbc_protocol_layer(port, evt, pd_port[port].pd_enable);
}
return EC_SUCCESS;
diff --git a/test/usb_sm_framework_h3.c b/test/usb_sm_framework_h3.c
index 37266517ce..dc3a1238cd 100644
--- a/test/usb_sm_framework_h3.c
+++ b/test/usb_sm_framework_h3.c
@@ -124,186 +124,30 @@ struct sm_ {
} sm[1];
#if defined(TEST_USB_SM_FRAMEWORK_H3)
-static unsigned int sm_test_super_A1(int port, enum signal sig);
-static unsigned int sm_test_super_A1_entry(int port);
-static unsigned int sm_test_super_A1_run(int port);
-static unsigned int sm_test_super_A1_exit(int port);
-
-static unsigned int sm_test_super_B1(int port, enum signal sig);
-static unsigned int sm_test_super_B1_entry(int port);
-static unsigned int sm_test_super_B1_run(int port);
-static unsigned int sm_test_super_B1_exit(int port);
+DECLARE_STATE(sm, test_super_A1, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_super_B1, WITH_RUN, WITH_EXIT);
#endif
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
-static unsigned int sm_test_super_A2(int port, enum signal sig);
-static unsigned int sm_test_super_A2_entry(int port);
-static unsigned int sm_test_super_A2_run(int port);
-static unsigned int sm_test_super_A2_exit(int port);
-
-static unsigned int sm_test_super_B2(int port, enum signal sig);
-static unsigned int sm_test_super_B2_entry(int port);
-static unsigned int sm_test_super_B2_run(int port);
-static unsigned int sm_test_super_B2_exit(int port);
+DECLARE_STATE(sm, test_super_A2, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_super_B2, WITH_RUN, WITH_EXIT);
#endif
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2) || \
defined(TEST_USB_SM_FRAMEWORK_H1)
-static unsigned int sm_test_super_A3(int port, enum signal sig);
-static unsigned int sm_test_super_A3_entry(int port);
-static unsigned int sm_test_super_A3_run(int port);
-static unsigned int sm_test_super_A3_exit(int port);
-
-static unsigned int sm_test_super_B3(int port, enum signal sig);
-static unsigned int sm_test_super_B3_entry(int port);
-static unsigned int sm_test_super_B3_run(int port);
-static unsigned int sm_test_super_B3_exit(int port);
+DECLARE_STATE(sm, test_super_A3, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_super_B3, WITH_RUN, WITH_EXIT);
#endif
-static unsigned int sm_test_A4(int port, enum signal sig);
-static unsigned int sm_test_A4_entry(int port);
-static unsigned int sm_test_A4_run(int port);
-static unsigned int sm_test_A4_exit(int port);
-
-static unsigned int sm_test_A5(int port, enum signal sig);
-static unsigned int sm_test_A5_entry(int port);
-static unsigned int sm_test_A5_run(int port);
-static unsigned int sm_test_A5_exit(int port);
-
-static unsigned int sm_test_A6(int port, enum signal sig);
-static unsigned int sm_test_A6_entry(int port);
-static unsigned int sm_test_A6_run(int port);
-static unsigned int sm_test_A6_exit(int port);
-
-static unsigned int sm_test_A7(int port, enum signal sig);
-static unsigned int sm_test_A7_entry(int port);
-static unsigned int sm_test_A7_run(int port);
-static unsigned int sm_test_A7_exit(int port);
-
-static unsigned int sm_test_B4(int port, enum signal sig);
-static unsigned int sm_test_B4_entry(int port);
-static unsigned int sm_test_B4_run(int port);
-static unsigned int sm_test_B4_exit(int port);
-
-static unsigned int sm_test_B5(int port, enum signal sig);
-static unsigned int sm_test_B5_entry(int port);
-static unsigned int sm_test_B5_run(int port);
-static unsigned int sm_test_B5_exit(int port);
-
-static unsigned int sm_test_B6(int port, enum signal sig);
-static unsigned int sm_test_B6_entry(int port);
-static unsigned int sm_test_B6_run(int port);
-static unsigned int sm_test_B6_exit(int port);
-
-static unsigned int sm_test_C(int port, enum signal sig);
-static unsigned int sm_test_C_entry(int port);
-static unsigned int sm_test_C_run(int port);
-static unsigned int sm_test_C_exit(int port);
+DECLARE_STATE(sm, test_A4, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_A5, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_A6, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_A7, WITH_RUN, WITH_EXIT);
-#if defined(TEST_USB_SM_FRAMEWORK_H3)
-static const state_sig sm_test_super_A1_sig[] = {
- sm_test_super_A1_entry,
- sm_test_super_A1_run,
- sm_test_super_A1_exit,
- get_super_state
-};
-
-static const state_sig sm_test_super_B1_sig[] = {
- sm_test_super_B1_entry,
- sm_test_super_B1_run,
- sm_test_super_B1_exit,
- get_super_state
-};
-#endif
-
-#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
-static const state_sig sm_test_super_A2_sig[] = {
- sm_test_super_A2_entry,
- sm_test_super_A2_run,
- sm_test_super_A2_exit,
- get_super_state
-};
-
-static const state_sig sm_test_super_B2_sig[] = {
- sm_test_super_B2_entry,
- sm_test_super_B2_run,
- sm_test_super_B2_exit,
- get_super_state
-};
-#endif
-
-#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2) || \
- defined(TEST_USB_SM_FRAMEWORK_H1)
-static const state_sig sm_test_super_A3_sig[] = {
- sm_test_super_A3_entry,
- sm_test_super_A3_run,
- sm_test_super_A3_exit,
- get_super_state
-};
-
-static const state_sig sm_test_super_B3_sig[] = {
- sm_test_super_B3_entry,
- sm_test_super_B3_run,
- sm_test_super_B3_exit,
- get_super_state
-};
-#endif
-
-static const state_sig sm_test_A4_sig[] = {
- sm_test_A4_entry,
- sm_test_A4_run,
- sm_test_A4_exit,
- get_super_state
-};
-
-static const state_sig sm_test_A5_sig[] = {
- sm_test_A5_entry,
- sm_test_A5_run,
- sm_test_A5_exit,
- get_super_state
-};
-
-static const state_sig sm_test_A6_sig[] = {
- sm_test_A6_entry,
- sm_test_A6_run,
- sm_test_A6_exit,
- get_super_state
-};
-
-static const state_sig sm_test_A7_sig[] = {
- sm_test_A7_entry,
- sm_test_A7_run,
- sm_test_A7_exit,
- get_super_state
-};
-
-static const state_sig sm_test_B4_sig[] = {
- sm_test_B4_entry,
- sm_test_B4_run,
- sm_test_B4_exit,
- get_super_state
-};
-
-static const state_sig sm_test_B5_sig[] = {
- sm_test_B5_entry,
- sm_test_B5_run,
- sm_test_B5_exit,
- get_super_state
-};
-
-static const state_sig sm_test_B6_sig[] = {
- sm_test_B6_entry,
- sm_test_B6_run,
- sm_test_B6_exit,
- get_super_state
-};
-
-static const state_sig sm_test_C_sig[] = {
- sm_test_C_entry,
- sm_test_C_run,
- sm_test_C_exit,
- get_super_state
-};
+DECLARE_STATE(sm, test_B4, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_B5, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_B6, WITH_RUN, WITH_EXIT);
+DECLARE_STATE(sm, test_C, WITH_RUN, WITH_EXIT);
static void clear_seq(int port)
{
@@ -316,53 +160,53 @@ static void clear_seq(int port)
}
#if defined(TEST_USB_SM_FRAMEWORK_H3)
-static unsigned int sm_test_super_A1(int port, enum signal sig)
+static int sm_test_super_A1(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_super_A1_sig[sig])(port);
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
}
-static unsigned int sm_test_super_A1_entry(int port)
+static int sm_test_super_A1_entry(int port)
{
sm[port].seq[sm[port].idx++] = ENTER_A1;
return 0;
}
-static unsigned int sm_test_super_A1_run(int port)
+static int sm_test_super_A1_run(int port)
{
sm[port].seq[sm[port].idx++] = RUN_A1;
return 0;
}
-static unsigned int sm_test_super_A1_exit(int port)
+static int sm_test_super_A1_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_A1;
return 0;
}
-static unsigned int sm_test_super_B1(int port, enum signal sig)
+static int sm_test_super_B1(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_super_B1_sig[sig])(port);
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
}
-static unsigned int sm_test_super_B1_entry(int port)
+static int sm_test_super_B1_entry(int port)
{
sm[port].seq[sm[port].idx++] = ENTER_B1;
return 0;
}
-static unsigned int sm_test_super_B1_run(int port)
+static int sm_test_super_B1_run(int port)
{
sm[port].seq[sm[port].idx++] = RUN_B1;
return 0;
}
-static unsigned int sm_test_super_B1_exit(int port)
+static int sm_test_super_B1_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_B1;
return 0;
@@ -370,61 +214,61 @@ static unsigned int sm_test_super_B1_exit(int port)
#endif
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
-static unsigned int sm_test_super_A2(int port, enum signal sig)
+static int sm_test_super_A2(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_super_A2_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3)
- return SUPER(ret, sig, sm_test_super_A1);
+ return SM_SUPER(ret, sig, sm_test_super_A1);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_super_A2_entry(int port)
+static int sm_test_super_A2_entry(int port)
{
sm[port].seq[sm[port].idx++] = ENTER_A2;
return 0;
}
-static unsigned int sm_test_super_A2_run(int port)
+static int sm_test_super_A2_run(int port)
{
sm[port].seq[sm[port].idx++] = RUN_A2;
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_super_A2_exit(int port)
+static int sm_test_super_A2_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_A2;
return 0;
}
-static unsigned int sm_test_super_B2(int port, enum signal sig)
+static int sm_test_super_B2(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_super_B2_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3)
- return SUPER(ret, sig, sm_test_super_B1);
+ return SM_SUPER(ret, sig, sm_test_super_B1);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_super_B2_entry(int port)
+static int sm_test_super_B2_entry(int port)
{
sm[port].seq[sm[port].idx++] = ENTER_B2;
return 0;
}
-static unsigned int sm_test_super_B2_run(int port)
+static int sm_test_super_B2_run(int port)
{
sm[port].seq[sm[port].idx++] = RUN_B2;
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_super_B2_exit(int port)
+static int sm_test_super_B2_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_B2;
return 0;
@@ -433,69 +277,69 @@ static unsigned int sm_test_super_B2_exit(int port)
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2) || \
defined(TEST_USB_SM_FRAMEWORK_H1)
-static unsigned int sm_test_super_A3(int port, enum signal sig)
+static int sm_test_super_A3(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_super_A3_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
- return SUPER(ret, sig, sm_test_super_A2);
+ return SM_SUPER(ret, sig, sm_test_super_A2);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_super_A3_entry(int port)
+static int sm_test_super_A3_entry(int port)
{
sm[port].seq[sm[port].idx++] = ENTER_A3;
return 0;
}
-static unsigned int sm_test_super_A3_run(int port)
+static int sm_test_super_A3_run(int port)
{
sm[port].seq[sm[port].idx++] = RUN_A3;
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
- return RUN_SUPER;
+ return SM_RUN_SUPER;
#else
return 0;
#endif
}
-static unsigned int sm_test_super_A3_exit(int port)
+static int sm_test_super_A3_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_A3;
return 0;
}
-static unsigned int sm_test_super_B3(int port, enum signal sig)
+static int sm_test_super_B3(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_super_B3_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
- return SUPER(ret, sig, sm_test_super_B2);
+ return SM_SUPER(ret, sig, sm_test_super_B2);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_super_B3_entry(int port)
+static int sm_test_super_B3_entry(int port)
{
sm[port].seq[sm[port].idx++] = ENTER_B3;
return 0;
}
-static unsigned int sm_test_super_B3_run(int port)
+static int sm_test_super_B3_run(int port)
{
sm[port].seq[sm[port].idx++] = RUN_B3;
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
- return RUN_SUPER;
+ return SM_RUN_SUPER;
#else
return 0;
#endif
}
-static unsigned int sm_test_super_B3_exit(int port)
+static int sm_test_super_B3_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_B3;
return 0;
@@ -503,303 +347,303 @@ static unsigned int sm_test_super_B3_exit(int port)
#endif
-static unsigned int sm_test_A4(int port, enum signal sig)
+static int sm_test_A4(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_A4_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2) || \
defined(TEST_USB_SM_FRAMEWORK_H1)
- return SUPER(ret, sig, sm_test_super_A3);
+ return SM_SUPER(ret, sig, sm_test_super_A3);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_A4_entry(int port)
+static int sm_test_A4_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_A4;
return 0;
}
-static unsigned int sm_test_A4_run(int port)
+static int sm_test_A4_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].sv_tmp = 1;
sm[port].seq[sm[port].idx++] = RUN_A4;
} else {
- set_state(port, TSM_OBJ(port), sm_test_B4);
+ sm_set_state(port, TSM_OBJ(port), sm_test_B4);
return 0;
}
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_A4_exit(int port)
+static int sm_test_A4_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_A4;
return 0;
}
-static unsigned int sm_test_A5(int port, enum signal sig)
+static int sm_test_A5(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_A5_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2) || \
defined(TEST_USB_SM_FRAMEWORK_H1)
- return SUPER(ret, sig, sm_test_super_A3);
+ return SM_SUPER(ret, sig, sm_test_super_A3);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_A5_entry(int port)
+static int sm_test_A5_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_A5;
return 0;
}
-static unsigned int sm_test_A5_run(int port)
+static int sm_test_A5_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].sv_tmp = 1;
sm[port].seq[sm[port].idx++] = RUN_A5;
} else {
- set_state(port, TSM_OBJ(port), sm_test_A4);
+ sm_set_state(port, TSM_OBJ(port), sm_test_A4);
return 0;
}
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_A5_exit(int port)
+static int sm_test_A5_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_A5;
return 0;
}
-static unsigned int sm_test_A6(int port, enum signal sig)
+static int sm_test_A6(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_A6_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
- return SUPER(ret, sig, sm_test_super_A2);
+ return SM_SUPER(ret, sig, sm_test_super_A2);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_A6_entry(int port)
+static int sm_test_A6_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_A6;
return 0;
}
-static unsigned int sm_test_A6_run(int port)
+static int sm_test_A6_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].sv_tmp = 1;
sm[port].seq[sm[port].idx++] = RUN_A6;
} else {
- set_state(port, TSM_OBJ(port), sm_test_A5);
+ sm_set_state(port, TSM_OBJ(port), sm_test_A5);
return 0;
}
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_A6_exit(int port)
+static int sm_test_A6_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_A6;
return 0;
}
-static unsigned int sm_test_A7(int port, enum signal sig)
+static int sm_test_A7(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_A7_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3)
- return SUPER(ret, sig, sm_test_super_A1);
+ return SM_SUPER(ret, sig, sm_test_super_A1);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_A7_entry(int port)
+static int sm_test_A7_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_A7;
return 0;
}
-static unsigned int sm_test_A7_run(int port)
+static int sm_test_A7_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].sv_tmp = 1;
sm[port].seq[sm[port].idx++] = RUN_A7;
} else {
- set_state(port, TSM_OBJ(port), sm_test_A6);
+ sm_set_state(port, TSM_OBJ(port), sm_test_A6);
return 0;
}
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_A7_exit(int port)
+static int sm_test_A7_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_A7;
return 0;
}
-static unsigned int sm_test_B4(int port, enum signal sig)
+static int sm_test_B4(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_B4_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2) || \
defined(TEST_USB_SM_FRAMEWORK_H1)
- return SUPER(ret, sig, sm_test_super_B3);
+ return SM_SUPER(ret, sig, sm_test_super_B3);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_B4_entry(int port)
+static int sm_test_B4_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_B4;
return 0;
}
-static unsigned int sm_test_B4_run(int port)
+static int sm_test_B4_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].seq[sm[port].idx++] = RUN_B4;
sm[port].sv_tmp = 1;
} else {
- set_state(port, TSM_OBJ(port), sm_test_B5);
+ sm_set_state(port, TSM_OBJ(port), sm_test_B5);
return 0;
}
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_B4_exit(int port)
+static int sm_test_B4_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_B4;
return 0;
}
-static unsigned int sm_test_B5(int port, enum signal sig)
+static int sm_test_B5(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_B5_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3) || defined(TEST_USB_SM_FRAMEWORK_H2)
- return SUPER(ret, sig, sm_test_super_B2);
+ return SM_SUPER(ret, sig, sm_test_super_B2);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_B5_entry(int port)
+static int sm_test_B5_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_B5;
return 0;
}
-static unsigned int sm_test_B5_run(int port)
+static int sm_test_B5_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].sv_tmp = 1;
sm[port].seq[sm[port].idx++] = RUN_B5;
} else {
- set_state(port, TSM_OBJ(port), sm_test_B6);
+ sm_set_state(port, TSM_OBJ(port), sm_test_B6);
return 0;
}
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_B5_exit(int port)
+static int sm_test_B5_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_B5;
return 0;
}
-static unsigned int sm_test_B6(int port, enum signal sig)
+static int sm_test_B6(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_B6_sig[sig])(port);
#if defined(TEST_USB_SM_FRAMEWORK_H3)
- return SUPER(ret, sig, sm_test_super_B1);
+ return SM_SUPER(ret, sig, sm_test_super_B1);
#else
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
#endif
}
-static unsigned int sm_test_B6_entry(int port)
+static int sm_test_B6_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_B6;
return 0;
}
-static unsigned int sm_test_B6_run(int port)
+static int sm_test_B6_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].sv_tmp = 1;
sm[port].seq[sm[port].idx++] = RUN_B6;
} else {
- set_state(port, TSM_OBJ(port), sm_test_C);
+ sm_set_state(port, TSM_OBJ(port), sm_test_C);
return 0;
}
- return RUN_SUPER;
+ return SM_RUN_SUPER;
}
-static unsigned int sm_test_B6_exit(int port)
+static int sm_test_B6_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_B6;
return 0;
}
-static unsigned int sm_test_C(int port, enum signal sig)
+static int sm_test_C(int port, enum sm_signal sig)
{
int ret;
ret = (*sm_test_C_sig[sig])(port);
- return SUPER(ret, sig, 0);
+ return SM_SUPER(ret, sig, 0);
}
-static unsigned int sm_test_C_entry(int port)
+static int sm_test_C_entry(int port)
{
sm[port].sv_tmp = 0;
sm[port].seq[sm[port].idx++] = ENTER_C;
return 0;
}
-static unsigned int sm_test_C_run(int port)
+static int sm_test_C_run(int port)
{
if (sm[port].sv_tmp == 0) {
sm[port].seq[sm[port].idx++] = RUN_C;
sm[port].sv_tmp = 1;
} else {
- set_state(port, TSM_OBJ(port), sm_test_A7);
+ sm_set_state(port, TSM_OBJ(port), sm_test_A7);
}
return 0;
}
-static unsigned int sm_test_C_exit(int port)
+static int sm_test_C_exit(int port)
{
sm[port].seq[sm[port].idx++] = EXIT_C;
return 0;
@@ -812,7 +656,7 @@ static int test_hierarchy_0(void)
int i;
clear_seq(port);
- init_state(port, TSM_OBJ(port), sm_test_A4);
+ sm_init_state(port, TSM_OBJ(port), sm_test_A4);
for (i = 0; i < 17; i++) {
task_wake(TASK_ID_TEST);
@@ -893,7 +737,7 @@ static int test_hierarchy_1(void)
int i;
clear_seq(port);
- init_state(port, TSM_OBJ(port), sm_test_A4);
+ sm_init_state(port, TSM_OBJ(port), sm_test_A4);
for (i = 0; i < 17; i++) {
task_wake(TASK_ID_TEST);
@@ -983,7 +827,7 @@ static int test_hierarchy_2(void)
int i;
clear_seq(port);
- init_state(port, TSM_OBJ(port), sm_test_A4);
+ sm_init_state(port, TSM_OBJ(port), sm_test_A4);
for (i = 0; i < 17; i++) {
task_wake(TASK_ID_TEST);
@@ -1082,7 +926,7 @@ static int test_hierarchy_3(void)
int i;
clear_seq(port);
- init_state(port, TSM_OBJ(port), sm_test_A4);
+ sm_init_state(port, TSM_OBJ(port), sm_test_A4);
for (i = 0; i < 17; i++) {
task_wake(TASK_ID_TEST);
@@ -1190,7 +1034,7 @@ int test_task(void *u)
/* wait for next event/packet or timeout expiration */
task_wait_event(-1);
/* run state machine */
- exe_state(port, TSM_OBJ(port), RUN_SIG);
+ sm_run_state_machine(port, TSM_OBJ(port), SM_RUN_SIG);
}
return EC_SUCCESS;
diff --git a/test/usb_typec_ctvpd.c b/test/usb_typec_ctvpd.c
index 19fbfa1b8a..b2a100ad25 100644
--- a/test/usb_typec_ctvpd.c
+++ b/test/usb_typec_ctvpd.c
@@ -330,7 +330,7 @@ static int test_vpd_host_src_detection(void)
* Host is configured properly and start state is UNATTACHED_SNK
*/
TEST_ASSERT(check_host_ra_rd());
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
/*
* TEST:
@@ -342,7 +342,7 @@ static int test_vpd_host_src_detection(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
/*
* TEST:
@@ -373,7 +373,7 @@ static int test_vpd_host_src_detection(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
return EC_SUCCESS;
}
@@ -394,7 +394,7 @@ static int test_vpd_host_src_detection_vbus(void)
*/
TEST_ASSERT(check_host_ra_rd());
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
/*
* TEST:
@@ -406,7 +406,7 @@ static int test_vpd_host_src_detection_vbus(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
/*
* TEST:
@@ -418,7 +418,7 @@ static int test_vpd_host_src_detection_vbus(void)
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SNK);
/*
* TEST:
@@ -429,7 +429,7 @@ static int test_vpd_host_src_detection_vbus(void)
wait_for_state_change(port, 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
return EC_SUCCESS;
}
@@ -450,7 +450,7 @@ static int test_vpd_host_src_detection_vconn(void)
*/
TEST_ASSERT(check_host_ra_rd());
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
/*
* TEST:
@@ -462,7 +462,7 @@ static int test_vpd_host_src_detection_vconn(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
/*
* TEST:
@@ -474,7 +474,7 @@ static int test_vpd_host_src_detection_vconn(void)
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SNK);
/* VCONN was detected. Make sure RA is removed */
task_wake(PD_PORT_TO_TASK_ID(port));
@@ -490,7 +490,7 @@ static int test_vpd_host_src_detection_vconn(void)
wait_for_state_change(port, 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
host_disconnect_source();
@@ -540,7 +540,7 @@ static int test_vpd_host_src_detection_message_reception(void)
*/
TEST_ASSERT(check_host_ra_rd());
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
/*
* Transition to ATTACHED_SNK
@@ -550,11 +550,11 @@ static int test_vpd_host_src_detection_message_reception(void)
wait_for_state_change(port, 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 20 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SNK);
/* Run state machines to enable rx monitoring */
task_wake(PD_PORT_TO_TASK_ID(port));
@@ -606,7 +606,7 @@ static int test_vpd_host_src_detection_message_reception(void)
wait_for_state_change(port, 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
host_disconnect_source();
@@ -634,7 +634,7 @@ static int test_ctvpd_behavior_case1(void)
*/
/* 1. DRP and CTVPD are both in the unattached state */
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
/*
* a. DRP alternates between Unattached.SRC and Unattached.SNK
@@ -670,10 +670,10 @@ static int test_ctvpd_behavior_case1(void)
* Charge-Through port’s CC1 and CC2 pins
*/
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SNK);
TEST_ASSERT(check_ct_ccs_hz());
/*
@@ -702,7 +702,7 @@ static int test_ctvpd_behavior_case1(void)
* d. CTVPD apply Rd on its Charge-Through port’s CC1 and CC2 pins
*/
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
/*
* 6. While the CTVPD in CTUnattached.VPD state and the DRP in
@@ -723,32 +723,32 @@ static int test_ctvpd_behavior_case1(void)
TEST_ASSERT(ct_connect_source(CC2, VBUS_0));
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTATTACH_WAIT_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTATTACH_WAIT_VPD);
/* Remove Power Source */
TEST_ASSERT(ct_disconnect_source());
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
/* Attach Sink */
TEST_ASSERT(ct_connect_sink(CC1, SRC_CON_DEF));
wait_for_state_change(port, PD_T_DRP_SNK);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_UNSUPPORTED);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_UNSUPPORTED);
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTATTACH_WAIT_UNSUPPORTED);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTATTACH_WAIT_UNSUPPORTED);
/* Remove VCONN (Host detach) */
mock_set_vconn(VCONN_0);
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
return EC_SUCCESS;
}
@@ -780,25 +780,25 @@ static int test_ctvpd_behavior_case2(void)
* pins and Rp termination advertising 3.0 A on the Host-side
* port’s CC pin
*/
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
host_connect_source(VBUS_5);
mock_set_vconn(VCONN_3);
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SNK);
/* Remove Host CC */
mock_set_host_cc_source_voltage(0);
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
TEST_ASSERT(check_ct_ccs_rd());
TEST_ASSERT(check_host_rp3a0());
@@ -836,11 +836,11 @@ static int test_ctvpd_behavior_case2(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTATTACH_WAIT_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTATTACH_WAIT_VPD);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTATTACHED_VPD);
TEST_ASSERT(moch_get_ct_cl_sel() == CT_CC2);
TEST_ASSERT(check_host_cc_open());
TEST_ASSERT(check_ct_ccs_hz());
@@ -870,7 +870,7 @@ static int test_ctvpd_behavior_case2(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTDISABLED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTDISABLED_VPD);
return EC_SUCCESS;
}
@@ -899,7 +899,7 @@ static int test_ctvpd_behavior_case3(void)
* a. CTVPD has applied Rd on the Charge-Through port’s CC1 and CC2
* pins and Rd on the Host-side port’s CC pin
*/
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
TEST_ASSERT(check_ct_ccs_rd());
TEST_ASSERT(check_host_ra_rd());
@@ -923,7 +923,7 @@ static int test_ctvpd_behavior_case3(void)
* between Unattached.SRC and Unattached.SNK
*/
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SRC);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SRC);
/*
* 4. While the CTVPD alternates between Unattached.SRC and
@@ -942,14 +942,14 @@ static int test_ctvpd_behavior_case3(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SRC);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SRC);
/* Remove VBUS */
TEST_ASSERT(ct_disconnect_source());
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
return EC_SUCCESS;
}
@@ -1004,7 +1004,7 @@ static int test_ctvpd_behavior_case4(void)
* b. CTVPD has applied Rd on its Charge-Through port’s CC1 and CC2
* pins and Rd on the Host-side port’s CC pin
*/
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
TEST_ASSERT(check_ct_ccs_rd());
TEST_ASSERT(check_host_ra_rd());
@@ -1038,11 +1038,11 @@ static int test_ctvpd_behavior_case4(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SNK);
TEST_ASSERT(check_ct_ccs_hz());
/*
@@ -1109,7 +1109,7 @@ static int test_ctvpd_behavior_case4(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
TEST_ASSERT(check_ct_ccs_rd());
TEST_ASSERT(check_host_rp3a0());
@@ -1119,16 +1119,16 @@ static int test_ctvpd_behavior_case4(void)
*/
wait_for_state_change(port, PD_T_DRP_SRC + 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_UNSUPPORTED);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_UNSUPPORTED);
wait_for_state_change(port, PD_T_DRP_SRC + 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
TEST_ASSERT(ct_connect_source(CC2, VBUS_5));
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTATTACH_WAIT_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTATTACH_WAIT_VPD);
return EC_SUCCESS;
}
@@ -1159,7 +1159,7 @@ static int test_ctvpd_behavior_case5(void)
* b. CTVPD apply Rd on the Charge-Through port’s CC1 and CC2 pins
* and Rd on the Host-side port’s CC pin
*/
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
TEST_ASSERT(check_ct_ccs_rd());
TEST_ASSERT(check_host_ra_rd());
@@ -1184,7 +1184,7 @@ static int test_ctvpd_behavior_case5(void)
*/
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SRC);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SRC);
/* Connect Host With Dead Battery */
host_connect_sink(SRC_CON_DEF);
@@ -1204,11 +1204,11 @@ static int test_ctvpd_behavior_case5(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SRC);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SRC);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 10 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == TRY_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_TRY_SNK);
TEST_ASSERT(check_host_ra_rd());
/* 5. DRP in dead battery condition remains in Unattached.SNK */
@@ -1230,12 +1230,12 @@ static int test_ctvpd_behavior_case5(void)
wait_for_state_change(port, PD_T_TRY_CC_DEBOUNCE +
PD_T_DRP_TRY + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == TRY_WAIT_SRC);
+ TEST_ASSERT(get_typec_state_id(port) == TC_TRY_WAIT_SRC);
TEST_ASSERT(check_host_rpusb());
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SRC);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SRC);
TEST_ASSERT(mock_get_vbus_pass_en());
/*
@@ -1268,7 +1268,7 @@ static int test_ctvpd_behavior_case5(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
return EC_SUCCESS;
}
@@ -1299,7 +1299,7 @@ static int test_ctvpd_behavior_case6(void)
* b. CTVPD has applied Rd on its Charge-Through port’s CC1 and CC2
* pins and Rd on the Host-side port’s CC pin
*/
- TEST_ASSERT(get_typec_state_id(port) == UNATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_UNATTACHED_SNK);
TEST_ASSERT(check_ct_ccs_rd());
TEST_ASSERT(check_host_ra_rd());
@@ -1330,11 +1330,11 @@ static int test_ctvpd_behavior_case6(void)
*/
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACH_WAIT_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACH_WAIT_SNK);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == ATTACHED_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_ATTACHED_SNK);
TEST_ASSERT(check_ct_ccs_hz());
/*
@@ -1367,7 +1367,7 @@ static int test_ctvpd_behavior_case6(void)
*/
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
TEST_ASSERT(check_host_rp3a0());
TEST_ASSERT(mock_get_vbus_pass_en() == 0);
TEST_ASSERT(check_ct_ccs_rd());
@@ -1382,15 +1382,15 @@ static int test_ctvpd_behavior_case6(void)
*/
wait_for_state_change(port, PD_T_DRP_SNK + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_UNSUPPORTED);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_UNSUPPORTED);
wait_for_state_change(port, PD_T_DRP_SNK + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
wait_for_state_change(port, PD_T_DRP_SNK + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_UNSUPPORTED);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_UNSUPPORTED);
/*
* 7. CTVPD transitions from CTUnattached.Unsupported to CTTry.SNK
@@ -1409,11 +1409,11 @@ static int test_ctvpd_behavior_case6(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTATTACH_WAIT_UNSUPPORTED);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTATTACH_WAIT_UNSUPPORTED);
wait_for_state_change(port, PD_T_CC_DEBOUNCE + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTTRY_SNK);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTTRY_SNK);
TEST_ASSERT(check_ct_ccs_rd());
/*
@@ -1426,7 +1426,7 @@ static int test_ctvpd_behavior_case6(void)
wait_for_state_change(port, PD_T_DRP_TRY + PD_T_TRY_WAIT + 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTATTACHED_UNSUPPORTED);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTATTACHED_UNSUPPORTED);
/*
* 9. While the CTVPD in CTAttached.Unsupported state, the DRP in
@@ -1455,7 +1455,7 @@ static int test_ctvpd_behavior_case6(void)
wait_for_state_change(port, 40 * MSEC);
- TEST_ASSERT(get_typec_state_id(port) == CTUNATTACHED_VPD);
+ TEST_ASSERT(get_typec_state_id(port) == TC_CTUNATTACHED_VPD);
return EC_SUCCESS;
}