summaryrefslogtreecommitdiff
path: root/common/mock/usb_prl_mock.c
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2021-08-27 15:21:39 -0600
committerCommit Bot <commit-bot@chromium.org>2021-08-31 18:18:20 +0000
commit003ec08f8c67845ae8481d3fb4124555213b04c4 (patch)
tree3502c59532731d0003532657b1a2993e8ca9ad81 /common/mock/usb_prl_mock.c
parent5fa669005c3779b7310bf6bfe43f741a3d8ae871 (diff)
downloadchrome-ec-003ec08f8c67845ae8481d3fb4124555213b04c4.tar.gz
TCPM: Rename enum tcpm_sop_type and its constants
As a followup to CL:3104290, give the TCPCI TRANSMIT and RX_BUF_FRAME_TYPE types more consistent names. Most of them can be used for receiving, not just transmitting. Fix lint errors thus revealed. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I399ec479eacc18622fc4d3f55f8bdabf4560fcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3125995 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/mock/usb_prl_mock.c')
-rw-r--r--common/mock/usb_prl_mock.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/common/mock/usb_prl_mock.c b/common/mock/usb_prl_mock.c
index ae7874d4ac..d5f4781829 100644
--- a/common/mock/usb_prl_mock.c
+++ b/common/mock/usb_prl_mock.c
@@ -26,11 +26,11 @@ struct extended_msg tx_emsg[CONFIG_USB_PD_PORT_MAX_COUNT];
struct mock_prl_port_t {
enum pd_ctrl_msg_type last_ctrl_msg;
enum pd_data_msg_type last_data_msg;
- enum tcpm_sop_type last_tx_type;
+ enum tcpci_msg_type last_tx_type;
bool message_sent;
bool message_received;
enum pe_error error;
- enum tcpm_sop_type error_tx_type;
+ enum tcpci_msg_type error_tx_type;
};
struct mock_prl_port_t mock_prl_port[CONFIG_USB_PD_PORT_MAX_COUNT];
@@ -46,8 +46,8 @@ void mock_prl_reset(void)
memset(mock_prl_port, 0, sizeof(mock_prl_port));
for (port = 0 ; port < CONFIG_USB_PD_PORT_MAX_COUNT ; ++port) {
- mock_prl_port[port].last_tx_type = TCPC_TX_INVALID;
- mock_prl_port[port].error_tx_type = TCPC_TX_INVALID;
+ mock_prl_port[port].last_tx_type = TCPCI_MSG_INVALID;
+ mock_prl_port[port].error_tx_type = TCPCI_MSG_INVALID;
}
}
@@ -58,10 +58,10 @@ void prl_execute_hard_reset(int port)
{
mock_prl_port[port].last_ctrl_msg = 0;
mock_prl_port[port].last_data_msg = 0;
- mock_prl_port[port].last_tx_type = TCPC_TX_HARD_RESET;
+ mock_prl_port[port].last_tx_type = TCPCI_MSG_TX_HARD_RESET;
}
-enum pd_rev_type prl_get_rev(int port, enum tcpm_sop_type partner)
+enum pd_rev_type prl_get_rev(int port, enum tcpci_msg_type partner)
{
return PD_REV30;
}
@@ -82,7 +82,7 @@ __overridable bool prl_is_busy(int port)
void prl_reset_soft(int port)
{}
-void prl_send_ctrl_msg(int port, enum tcpm_sop_type type,
+void prl_send_ctrl_msg(int port, enum tcpci_msg_type type,
enum pd_ctrl_msg_type msg)
{
mock_prl_port[port].last_ctrl_msg = msg;
@@ -90,7 +90,7 @@ void prl_send_ctrl_msg(int port, enum tcpm_sop_type type,
mock_prl_port[port].last_tx_type = type;
}
-void prl_send_data_msg(int port, enum tcpm_sop_type type,
+void prl_send_data_msg(int port, enum tcpci_msg_type type,
enum pd_data_msg_type msg)
{
mock_prl_port[port].last_data_msg = msg;
@@ -98,17 +98,17 @@ void prl_send_data_msg(int port, enum tcpm_sop_type type,
mock_prl_port[port].last_tx_type = type;
}
-void prl_send_ext_data_msg(int port, enum tcpm_sop_type type,
+void prl_send_ext_data_msg(int port, enum tcpci_msg_type type,
enum pd_ext_msg_type msg)
{}
-void prl_set_rev(int port, enum tcpm_sop_type partner,
+void prl_set_rev(int port, enum tcpci_msg_type partner,
enum pd_rev_type rev)
{}
int mock_prl_wait_for_tx_msg(int port,
- enum tcpm_sop_type tx_type,
+ enum tcpci_msg_type tx_type,
enum pd_ctrl_msg_type ctrl_msg,
enum pd_data_msg_type data_msg,
int timeout)
@@ -116,7 +116,7 @@ int mock_prl_wait_for_tx_msg(int port,
uint64_t end_time = get_time().val + timeout;
while (get_time().val < end_time) {
- if (mock_prl_port[port].last_tx_type != TCPC_TX_INVALID) {
+ if (mock_prl_port[port].last_tx_type != TCPCI_MSG_INVALID) {
TEST_EQ(mock_prl_port[port].last_tx_type,
tx_type, "%d");
TEST_EQ(mock_prl_port[port].last_ctrl_msg,
@@ -153,7 +153,7 @@ void mock_prl_clear_last_sent_msg(int port)
{
mock_prl_port[port].last_data_msg = 0;
mock_prl_port[port].last_ctrl_msg = 0;
- mock_prl_port[port].last_tx_type = TCPC_TX_INVALID;
+ mock_prl_port[port].last_tx_type = TCPCI_MSG_INVALID;
}
timestamp_t prl_get_tcpc_tx_success_ts(int port)
@@ -171,7 +171,7 @@ void mock_prl_message_received(int port)
}
void mock_prl_report_error(int port, enum pe_error e,
- enum tcpm_sop_type tx_type)
+ enum tcpci_msg_type tx_type)
{
mock_prl_port[port].error = e;
mock_prl_port[port].error_tx_type = tx_type;
@@ -189,12 +189,12 @@ void prl_run(int port, int evt, int en)
pe_message_received(port);
mock_prl_port[port].message_received = 0;
}
- if (mock_prl_port[port].error_tx_type != TCPC_TX_INVALID) {
+ if (mock_prl_port[port].error_tx_type != TCPCI_MSG_INVALID) {
ccprints("pe_error %d", mock_prl_port[port].error);
pe_report_error(port,
mock_prl_port[port].error,
mock_prl_port[port].error_tx_type);
mock_prl_port[port].error = 0;
- mock_prl_port[port].error_tx_type = TCPC_TX_INVALID;
+ mock_prl_port[port].error_tx_type = TCPCI_MSG_INVALID;
}
}