diff options
author | Abe Levkoy <alevkoy@chromium.org> | 2021-08-18 11:43:25 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-18 23:04:51 +0000 |
commit | 59e395027ab03c0ca2b5263193b30dff1c063c44 (patch) | |
tree | 7965d55bbc96f1515bdd2ca063fe5d48b69f1bd4 /common/mock | |
parent | fb89306a92228081e4203a33725357dd9754b6c8 (diff) | |
download | chrome-ec-59e395027ab03c0ca2b5263193b30dff1c063c44.tar.gz |
TCPM: Rename enum tcpm_transmit_type
Rename tcpm_transmit_type to tcpm_sop_type to reflect that it can be
used for Rx as well. Describe it in comments. This prepares to
consolidate enum pd_msg_type into this enum.
BUG=b:155476419
TEST=make buildall
BRANCH=none
Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Change-Id: Ife97d4ad51c48f2e832b94e007954919e236a309
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104290
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/mock')
-rw-r--r-- | common/mock/tcpc_mock.c | 2 | ||||
-rw-r--r-- | common/mock/tcpci_i2c_mock.c | 11 | ||||
-rw-r--r-- | common/mock/usb_pd_dpm_mock.c | 5 | ||||
-rw-r--r-- | common/mock/usb_pe_sm_mock.c | 5 | ||||
-rw-r--r-- | common/mock/usb_prl_mock.c | 19 |
5 files changed, 23 insertions, 19 deletions
diff --git a/common/mock/tcpc_mock.c b/common/mock/tcpc_mock.c index d000133a2a..b12267401f 100644 --- a/common/mock/tcpc_mock.c +++ b/common/mock/tcpc_mock.c @@ -141,7 +141,7 @@ static int mock_get_message_raw(int port, uint32_t *payload, int *head) return EC_SUCCESS; } -static int mock_transmit(int port, enum tcpm_transmit_type type, +static int mock_transmit(int port, enum tcpm_sop_type type, uint16_t header, const uint32_t *data) { return EC_SUCCESS; diff --git a/common/mock/tcpci_i2c_mock.c b/common/mock/tcpci_i2c_mock.c index a9cc09fb54..f11d12c7d6 100644 --- a/common/mock/tcpci_i2c_mock.c +++ b/common/mock/tcpci_i2c_mock.c @@ -8,6 +8,7 @@ #include "tcpm/tcpci.h" #include "test_util.h" #include "timer.h" +#include "usb_pd_tcpm.h" #ifndef TEST_BUILD #error "Mocks should only be in the test build." @@ -180,7 +181,7 @@ static bool debug_accessory_indicator_supported(void) return true; } -static int verify_transmit(enum tcpm_transmit_type want_tx_type, +static int verify_transmit(enum tcpm_sop_type want_tx_type, int want_tx_retry, enum pd_ctrl_msg_type want_ctrl_msg, enum pd_data_msg_type want_data_msg, @@ -229,7 +230,7 @@ static int verify_transmit(enum tcpm_transmit_type want_tx_type, return EC_ERROR_UNKNOWN; } -int verify_tcpci_transmit(enum tcpm_transmit_type tx_type, +int verify_tcpci_transmit(enum tcpm_sop_type tx_type, enum pd_ctrl_msg_type ctrl_msg, enum pd_data_msg_type data_msg) { @@ -238,7 +239,7 @@ int verify_tcpci_transmit(enum tcpm_transmit_type tx_type, VERIFY_TIMEOUT); } -int verify_tcpci_tx_timeout(enum tcpm_transmit_type tx_type, +int verify_tcpci_tx_timeout(enum tcpm_sop_type tx_type, enum pd_ctrl_msg_type ctrl_msg, enum pd_data_msg_type data_msg, int timeout) @@ -248,7 +249,7 @@ int verify_tcpci_tx_timeout(enum tcpm_transmit_type tx_type, timeout); } -int verify_tcpci_tx_retry_count(enum tcpm_transmit_type tx_type, +int verify_tcpci_tx_retry_count(enum tcpm_sop_type tx_type, enum pd_ctrl_msg_type ctrl_msg, enum pd_data_msg_type data_msg, int retry_count) @@ -258,7 +259,7 @@ int verify_tcpci_tx_retry_count(enum tcpm_transmit_type tx_type, VERIFY_TIMEOUT); } -int verify_tcpci_tx_with_data(enum tcpm_transmit_type tx_type, +int verify_tcpci_tx_with_data(enum tcpm_sop_type tx_type, enum pd_data_msg_type data_msg, uint8_t *data, int data_bytes, diff --git a/common/mock/usb_pd_dpm_mock.c b/common/mock/usb_pd_dpm_mock.c index 3da96fea2d..9bec8358dd 100644 --- a/common/mock/usb_pd_dpm_mock.c +++ b/common/mock/usb_pd_dpm_mock.c @@ -11,6 +11,7 @@ #include "usb_pd.h" #include "mock/usb_pd_dpm_mock.h" #include "memory.h" +#include "usb_pd_tcpm.h" #ifndef TEST_BUILD #error "Mocks should only be in the test build." @@ -30,12 +31,12 @@ void dpm_init(int port) dpm[port].mode_exit_request = false; } -void dpm_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count, +void dpm_vdm_acked(int port, enum tcpm_sop_type type, int vdo_count, uint32_t *vdm) { } -void dpm_vdm_naked(int port, enum tcpm_transmit_type type, uint16_t svid, +void dpm_vdm_naked(int port, enum tcpm_sop_type type, uint16_t svid, uint8_t vdm_cmd) { } diff --git a/common/mock/usb_pe_sm_mock.c b/common/mock/usb_pe_sm_mock.c index 150cbb51e6..a237102a74 100644 --- a/common/mock/usb_pe_sm_mock.c +++ b/common/mock/usb_pe_sm_mock.c @@ -11,6 +11,7 @@ #include "usb_pe_sm.h" #include "mock/usb_pe_sm_mock.h" #include "memory.h" +#include "usb_pd_tcpm.h" #ifndef CONFIG_COMMON_RUNTIME #define cprints(format, args...) @@ -45,7 +46,7 @@ void mock_pe_port_reset(void) } } -void pe_report_error(int port, enum pe_error e, enum tcpm_transmit_type type) +void pe_report_error(int port, enum pe_error e, enum tcpm_sop_type type) { mock_pe_port[port].mock_pe_error = e; mock_pe_port[port].sop = type; @@ -109,7 +110,7 @@ void pd_set_src_caps(int port, int cnt, uint32_t *src_caps) void pd_request_power_swap(int port) {} -int pd_get_rev(int port, enum tcpm_transmit_type type) +int pd_get_rev(int port, enum tcpm_sop_type type) { return IS_ENABLED(CONFIG_USB_PD_REV30) ? PD_REV30 : PD_REV20; } diff --git a/common/mock/usb_prl_mock.c b/common/mock/usb_prl_mock.c index 9caf63fbf4..ae7874d4ac 100644 --- a/common/mock/usb_prl_mock.c +++ b/common/mock/usb_prl_mock.c @@ -13,6 +13,7 @@ #include "task.h" #include "test_util.h" #include "timer.h" +#include "usb_pd_tcpm.h" #ifndef TEST_BUILD #error "Mocks should only be in the test build." @@ -25,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_transmit_type last_tx_type; + enum tcpm_sop_type last_tx_type; bool message_sent; bool message_received; enum pe_error error; - enum tcpm_transmit_type error_tx_type; + enum tcpm_sop_type error_tx_type; }; struct mock_prl_port_t mock_prl_port[CONFIG_USB_PD_PORT_MAX_COUNT]; @@ -60,7 +61,7 @@ void prl_execute_hard_reset(int port) mock_prl_port[port].last_tx_type = TCPC_TX_HARD_RESET; } -enum pd_rev_type prl_get_rev(int port, enum tcpm_transmit_type partner) +enum pd_rev_type prl_get_rev(int port, enum tcpm_sop_type partner) { return PD_REV30; } @@ -81,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_transmit_type type, +void prl_send_ctrl_msg(int port, enum tcpm_sop_type type, enum pd_ctrl_msg_type msg) { mock_prl_port[port].last_ctrl_msg = msg; @@ -89,7 +90,7 @@ void prl_send_ctrl_msg(int port, enum tcpm_transmit_type type, mock_prl_port[port].last_tx_type = type; } -void prl_send_data_msg(int port, enum tcpm_transmit_type type, +void prl_send_data_msg(int port, enum tcpm_sop_type type, enum pd_data_msg_type msg) { mock_prl_port[port].last_data_msg = msg; @@ -97,17 +98,17 @@ void prl_send_data_msg(int port, enum tcpm_transmit_type type, mock_prl_port[port].last_tx_type = type; } -void prl_send_ext_data_msg(int port, enum tcpm_transmit_type type, +void prl_send_ext_data_msg(int port, enum tcpm_sop_type type, enum pd_ext_msg_type msg) {} -void prl_set_rev(int port, enum tcpm_transmit_type partner, +void prl_set_rev(int port, enum tcpm_sop_type partner, enum pd_rev_type rev) {} int mock_prl_wait_for_tx_msg(int port, - enum tcpm_transmit_type tx_type, + enum tcpm_sop_type tx_type, enum pd_ctrl_msg_type ctrl_msg, enum pd_data_msg_type data_msg, int timeout) @@ -170,7 +171,7 @@ void mock_prl_message_received(int port) } void mock_prl_report_error(int port, enum pe_error e, - enum tcpm_transmit_type tx_type) + enum tcpm_sop_type tx_type) { mock_prl_port[port].error = e; mock_prl_port[port].error_tx_type = tx_type; |