summaryrefslogtreecommitdiff
path: root/test/usb_prl.c
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2020-09-17 21:05:59 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-22 02:19:29 +0000
commitd03abea4c36062f922182b95e046fc6817e98eec (patch)
treecb90c1fe95ca5660d4055e0663f58b1ead034c40 /test/usb_prl.c
parent17838629321431d8248f3ade35993a9f21242477 (diff)
downloadchrome-ec-d03abea4c36062f922182b95e046fc6817e98eec.tar.gz
test: Add test_send_caps_error to usb_pe_drp
As requested in CL:2321869 review, make a new version of test_send_caps_error that uses the external interface of the PE layer. BUG=b:161835483 BRANCH=none TEST=make run-usb_pe_drp Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I983b145cd1e731e844363955896898a2374a0a30 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2419834 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'test/usb_prl.c')
-rw-r--r--test/usb_prl.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/usb_prl.c b/test/usb_prl.c
index fa5444c85c..d0f3d48322 100644
--- a/test/usb_prl.c
+++ b/test/usb_prl.c
@@ -5,23 +5,24 @@
* Test USB Protocol Layer module.
*/
#include "common.h"
+#include "mock/tcpc_mock.h"
+#include "mock/tcpm_mock.h"
+#include "mock/usb_pd_mock.h"
+#include "mock/usb_pe_sm_mock.h"
+#include "mock/usb_tc_sm_mock.h"
#include "task.h"
#include "tcpci.h"
#include "tcpm.h"
#include "test_util.h"
#include "timer.h"
#include "usb_emsg.h"
-#include "usb_pd_test_util.h"
#include "usb_pd.h"
+#include "usb_pd_test_util.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
#include "usb_sm_checks.h"
#include "usb_tc_sm.h"
#include "util.h"
-#include "mock/tcpc_mock.h"
-#include "mock/tcpm_mock.h"
-#include "mock/usb_tc_sm_mock.h"
-#include "mock/usb_pe_sm_mock.h"
#define PORT0 0
@@ -47,8 +48,8 @@ static int test_receive_control_msg(void)
{
int port = PORT0;
uint16_t header = PD_HEADER(PD_CTRL_DR_SWAP,
- mock_tc_port[port].power_role,
- mock_tc_port[port].data_role,
+ pd_get_power_role(port),
+ pd_get_data_role(port),
mock_tc_port[port].msg_rx_id,
0, mock_tc_port[port].rev, 0);
@@ -99,8 +100,8 @@ static int test_discard_queued_tx_when_rx_happens(void)
{
int port = PORT0;
uint16_t header = PD_HEADER(PD_CTRL_DR_SWAP,
- mock_tc_port[port].power_role,
- mock_tc_port[port].data_role,
+ pd_get_power_role(port),
+ pd_get_data_role(port),
mock_tc_port[port].msg_rx_id,
0, mock_tc_port[port].rev, 0);
uint8_t *buf = tx_emsg[port].buf;
@@ -139,8 +140,8 @@ void before_test(void)
{
mock_tc_port_reset();
mock_tc_port[PORT0].rev = PD_REV30;
- mock_tc_port[PORT0].power_role = PD_ROLE_SOURCE;
- mock_tc_port[PORT0].data_role = PD_ROLE_DFP;
+ mock_pd_port[PORT0].power_role = PD_ROLE_SOURCE;
+ mock_pd_port[PORT0].data_role = PD_ROLE_DFP;
mock_tcpm_reset();
mock_pe_port_reset();