summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2021-08-18 11:43:25 -0600
committerCommit Bot <commit-bot@chromium.org>2021-08-18 23:04:51 +0000
commit59e395027ab03c0ca2b5263193b30dff1c063c44 (patch)
tree7965d55bbc96f1515bdd2ca063fe5d48b69f1bd4
parentfb89306a92228081e4203a33725357dd9754b6c8 (diff)
downloadchrome-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>
-rw-r--r--board/coffeecake/usb_pd_policy.c3
-rw-r--r--board/dingdong/usb_pd_policy.c3
-rw-r--r--board/hoho/usb_pd_policy.c3
-rw-r--r--board/plankton/usb_pd_policy.c3
-rw-r--r--board/servo_v4/usb_pd_policy.c2
-rw-r--r--board/servo_v4p1/usb_pd_policy.c2
-rw-r--r--chip/stm32/ucpd-stm32gx.c12
-rw-r--r--chip/stm32/ucpd-stm32gx.h4
-rw-r--r--common/mock/tcpc_mock.c2
-rw-r--r--common/mock/tcpci_i2c_mock.c11
-rw-r--r--common/mock/usb_pd_dpm_mock.c5
-rw-r--r--common/mock/usb_pe_sm_mock.c5
-rw-r--r--common/mock/usb_prl_mock.c19
-rw-r--r--common/usb_common.c2
-rw-r--r--common/usb_pd_alt_mode_dfp.c52
-rw-r--r--common/usb_pd_console_cmd.c3
-rw-r--r--common/usb_pd_policy.c27
-rw-r--r--common/usb_pd_protocol.c16
-rw-r--r--common/usb_pd_tcpc.c4
-rw-r--r--common/usbc/dp_alt_mode.c6
-rw-r--r--common/usbc/tbt_alt_mode.c9
-rw-r--r--common/usbc/usb_mode.c9
-rw-r--r--common/usbc/usb_pd_dpm.c9
-rw-r--r--common/usbc/usb_pd_host.c3
-rw-r--r--common/usbc/usb_pe_ctvpd_sm.c3
-rw-r--r--common/usbc/usb_pe_drp_sm.c38
-rw-r--r--common/usbc/usb_prl_sm.c16
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c5
-rw-r--r--driver/tcpm/anx74xx.c3
-rw-r--r--driver/tcpm/fusb302.c3
-rw-r--r--driver/tcpm/it83xx.c6
-rw-r--r--driver/tcpm/it8xxx2.c4
-rw-r--r--driver/tcpm/ps8xxx.c2
-rw-r--r--driver/tcpm/stm32gx.c2
-rw-r--r--driver/tcpm/stub.c2
-rw-r--r--driver/tcpm/tcpci.c3
-rw-r--r--fuzz/usb_pd_fuzz.c5
-rw-r--r--include/driver/tcpm/tcpci.h2
-rw-r--r--include/driver/tcpm/tcpm.h4
-rw-r--r--include/mock/tcpci_i2c_mock.h11
-rw-r--r--include/mock/usb_pe_sm_mock.h3
-rw-r--r--include/mock/usb_prl_mock.h5
-rw-r--r--include/mock/usb_tc_sm_mock.h3
-rw-r--r--include/usb_dp_alt_mode.h4
-rw-r--r--include/usb_mode.h7
-rw-r--r--include/usb_pd.h62
-rw-r--r--include/usb_pd_dpm.h4
-rw-r--r--include/usb_pd_tcpc.h2
-rw-r--r--include/usb_pd_tcpm.h11
-rw-r--r--include/usb_pe_sm.h2
-rw-r--r--include/usb_prl_sm.h11
-rw-r--r--include/usb_tbt_alt_mode.h7
-rw-r--r--test/fake_usbc.c7
-rw-r--r--test/usb_prl_old.c11
54 files changed, 249 insertions, 213 deletions
diff --git a/board/coffeecake/usb_pd_policy.c b/board/coffeecake/usb_pd_policy.c
index f24c941832..6d9210895a 100644
--- a/board/coffeecake/usb_pd_policy.c
+++ b/board/coffeecake/usb_pd_policy.c
@@ -18,6 +18,7 @@
#include "usb_api.h"
#include "usb_bb.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#include "util.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
@@ -266,7 +267,7 @@ static int svdm_enter_mode(int port, uint32_t *payload)
return rv;
}
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid)
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid)
{
if (type != TCPC_TX_SOP)
return 0;
diff --git a/board/dingdong/usb_pd_policy.c b/board/dingdong/usb_pd_policy.c
index 09a0f9cc01..d7af654689 100644
--- a/board/dingdong/usb_pd_policy.c
+++ b/board/dingdong/usb_pd_policy.c
@@ -18,6 +18,7 @@
#include "usb_bb.h"
#include "usb_api.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
@@ -219,7 +220,7 @@ static int svdm_enter_mode(int port, uint32_t *payload)
return rv;
}
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid)
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid)
{
if (type != TCPC_TX_SOP)
return 0;
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c
index d2bb172286..994989bdd7 100644
--- a/board/hoho/usb_pd_policy.c
+++ b/board/hoho/usb_pd_policy.c
@@ -17,6 +17,7 @@
#include "usb_api.h"
#include "usb_bb.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#include "util.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
@@ -194,7 +195,7 @@ static int svdm_enter_mode(int port, uint32_t *payload)
return rv;
}
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid)
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid)
{
if (type != TCPC_TX_SOP)
return 0;
diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c
index 5bceceaf6c..769c4b298c 100644
--- a/board/plankton/usb_pd_policy.c
+++ b/board/plankton/usb_pd_policy.c
@@ -15,6 +15,7 @@
#include "timer.h"
#include "util.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
@@ -236,7 +237,7 @@ int svdm_enter_mode(int port, uint32_t *payload)
return 1;
}
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid)
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid)
{
return alt_mode;
}
diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c
index f3df427851..82c0cf7f27 100644
--- a/board/servo_v4/usb_pd_policy.c
+++ b/board/servo_v4/usb_pd_policy.c
@@ -965,7 +965,7 @@ static int svdm_enter_mode(int port, uint32_t *payload)
return 1;
}
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid)
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid)
{
if (type == TCPC_TX_SOP && svid == USB_SID_DISPLAYPORT)
return alt_mode;
diff --git a/board/servo_v4p1/usb_pd_policy.c b/board/servo_v4p1/usb_pd_policy.c
index 93f4a2034c..88e1a51b33 100644
--- a/board/servo_v4p1/usb_pd_policy.c
+++ b/board/servo_v4p1/usb_pd_policy.c
@@ -1010,7 +1010,7 @@ static int svdm_enter_mode(int port, uint32_t *payload)
return 1;
}
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid)
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid)
{
if (type != TCPC_TX_SOP)
return 0;
diff --git a/chip/stm32/ucpd-stm32gx.c b/chip/stm32/ucpd-stm32gx.c
index 94f7ed6eba..84726d55be 100644
--- a/chip/stm32/ucpd-stm32gx.c
+++ b/chip/stm32/ucpd-stm32gx.c
@@ -105,7 +105,7 @@ union buffer {
};
struct ucpd_tx_desc {
- enum tcpm_transmit_type type;
+ enum tcpm_sop_type type;
int msg_len;
int msg_index;
union buffer data;
@@ -719,7 +719,7 @@ int stm32gx_ucpd_get_chip_info(int port, int live,
static int stm32gx_ucpd_start_transmit(int port, enum ucpd_tx_msg msg_type)
{
- enum tcpm_transmit_type type;
+ enum tcpm_sop_type type;
/* Select the correct tx desciptor */
ucpd_tx_active_buffer = &ucpd_tx_buffers[msg_type];
@@ -1130,7 +1130,7 @@ static void ucpd_send_good_crc(int port, uint16_t rx_header)
int msg_id;
int rev_id;
uint16_t tx_header;
- enum tcpm_transmit_type tx_type;
+ enum tcpm_sop_type tx_type;
enum pd_power_role pr = 0;
enum pd_data_role dr = 0;
@@ -1146,7 +1146,7 @@ static void ucpd_send_good_crc(int port, uint16_t rx_header)
/*
* Get the rx ordered set code just detected. SOP -> SOP''_Debug are in
- * the same order as enum tcpm_transmit_type and so can be used
+ * the same order as enum tcpm_sop_type and so can be used
* directly.
*/
tx_type = STM32_UCPD_RX_ORDSETR(port) & STM32_UCPD_RXORDSETR_MASK;
@@ -1180,7 +1180,7 @@ static void ucpd_send_good_crc(int port, uint16_t rx_header)
}
int stm32gx_ucpd_transmit(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
uint16_t header,
const uint32_t *data)
{
@@ -1319,7 +1319,7 @@ void stm32gx_ucpd1_irq(void)
/* Check for errors */
if (!(sr & STM32_UCPD_SR_RXERR)) {
uint16_t *rx_header = (uint16_t *)ucpd_rx_buffer;
- enum tcpm_transmit_type type;
+ enum tcpm_sop_type type;
int good_crc = 0;
type = STM32_UCPD_RX_ORDSETR(port) &
diff --git a/chip/stm32/ucpd-stm32gx.h b/chip/stm32/ucpd-stm32gx.h
index 0ffb8ffcd8..f7021136ad 100644
--- a/chip/stm32/ucpd-stm32gx.h
+++ b/chip/stm32/ucpd-stm32gx.h
@@ -51,7 +51,7 @@
#define UCPD_RST2 0x19u
#define UCPD_EOP 0x0Du
-/* This order of this enum matches tcpm_transmit_type */
+/* This order of this enum matches tcpm_sop_type */
enum ucpd_tx_ordset {
TX_ORDERSET_SOP = (UCPD_SYNC1 |
(UCPD_SYNC1<<5u) |
@@ -173,7 +173,7 @@ int stm32gx_ucpd_set_msg_header(int port, int power_role, int data_role);
* @return EC_SUCCESS
*/
int stm32gx_ucpd_transmit(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
uint16_t header,
const uint32_t *data);
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;
diff --git a/common/usb_common.c b/common/usb_common.c
index 9e17c0d98c..a77771d9e4 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -361,7 +361,7 @@ __overridable bool board_is_dts_port(int port)
return true;
}
-int pd_get_retry_count(int port, enum tcpm_transmit_type type)
+int pd_get_retry_count(int port, enum tcpm_sop_type type)
{
/* PD 3.0 6.7.7: nRetryCount = 2; PD 2.0 6.6.9: nRetryCount = 3 */
return pd_get_rev(port, type) == PD_REV30 ? 2 : 3;
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 3c43b847d6..3c5d133bc4 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -58,7 +58,7 @@ __overridable const struct svdm_response svdm_rsp = {
.modes = NULL,
};
-static int pd_get_mode_idx(int port, enum tcpm_transmit_type type,
+static int pd_get_mode_idx(int port, enum tcpm_sop_type type,
uint16_t svid)
{
int amode_idx;
@@ -73,7 +73,7 @@ static int pd_get_mode_idx(int port, enum tcpm_transmit_type type,
return -1;
}
-static int pd_allocate_mode(int port, enum tcpm_transmit_type type,
+static int pd_allocate_mode(int port, enum tcpm_sop_type type,
uint16_t svid)
{
int i, j;
@@ -226,7 +226,7 @@ int pd_dfp_dp_get_pin_mode(int port, uint32_t status)
}
struct svdm_amode_data *pd_get_amode_data(int port,
- enum tcpm_transmit_type type, uint16_t svid)
+ enum tcpm_sop_type type, uint16_t svid)
{
int idx = pd_get_mode_idx(port, type, svid);
struct partner_active_modes *active =
@@ -240,7 +240,7 @@ struct svdm_amode_data *pd_get_amode_data(int port,
* Enter default mode ( payload[0] == 0 ) or attempt to enter mode via svid &
* opos
*/
-uint32_t pd_dfp_enter_mode(int port, enum tcpm_transmit_type type,
+uint32_t pd_dfp_enter_mode(int port, enum tcpm_sop_type type,
uint16_t svid, int opos)
{
int mode_idx = pd_allocate_mode(port, type, svid);
@@ -280,7 +280,7 @@ uint32_t pd_dfp_enter_mode(int port, enum tcpm_transmit_type type,
}
/* TODO(b/170372521) : Incorporate exit mode specific changes to DPM SM */
-int pd_dfp_exit_mode(int port, enum tcpm_transmit_type type, uint16_t svid,
+int pd_dfp_exit_mode(int port, enum tcpm_sop_type type, uint16_t svid,
int opos)
{
struct svdm_amode_data *modep;
@@ -353,7 +353,7 @@ void dfp_consume_attention(int port, uint32_t *payload)
modep->fx->attention(port, payload);
}
-void dfp_consume_identity(int port, enum tcpm_transmit_type type, int cnt,
+void dfp_consume_identity(int port, enum tcpm_sop_type type, int cnt,
uint32_t *payload)
{
int ptype;
@@ -396,7 +396,7 @@ void dfp_consume_identity(int port, enum tcpm_transmit_type type, int cnt,
pd_set_identity_discovery(port, type, PD_DISC_COMPLETE);
}
-void dfp_consume_svids(int port, enum tcpm_transmit_type type, int cnt,
+void dfp_consume_svids(int port, enum tcpm_sop_type type, int cnt,
uint32_t *payload)
{
int i;
@@ -441,7 +441,7 @@ void dfp_consume_svids(int port, enum tcpm_transmit_type type, int cnt,
pd_set_svids_discovery(port, type, PD_DISC_COMPLETE);
}
-void dfp_consume_modes(int port, enum tcpm_transmit_type type, int cnt,
+void dfp_consume_modes(int port, enum tcpm_sop_type type, int cnt,
uint32_t *payload)
{
int svid_idx;
@@ -488,14 +488,14 @@ void dfp_consume_modes(int port, enum tcpm_transmit_type type, int cnt,
PD_DISC_COMPLETE);
}
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid)
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid)
{
struct svdm_amode_data *modep = pd_get_amode_data(port, type, svid);
return (modep) ? modep->opos : -1;
}
-void pd_set_identity_discovery(int port, enum tcpm_transmit_type type,
+void pd_set_identity_discovery(int port, enum tcpm_sop_type type,
enum pd_discovery_state disc)
{
struct pd_discovery *pd = pd_get_am_discovery(port, type);
@@ -504,7 +504,7 @@ void pd_set_identity_discovery(int port, enum tcpm_transmit_type type,
}
enum pd_discovery_state pd_get_identity_discovery(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
struct pd_discovery *disc = pd_get_am_discovery(port, type);
@@ -512,7 +512,7 @@ enum pd_discovery_state pd_get_identity_discovery(int port,
}
const union disc_ident_ack *pd_get_identity_response(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
if (type >= DISCOVERY_TYPE_COUNT)
return NULL;
@@ -544,7 +544,7 @@ uint8_t pd_get_product_type(int port)
return resp->idh.product_type;
}
-void pd_set_svids_discovery(int port, enum tcpm_transmit_type type,
+void pd_set_svids_discovery(int port, enum tcpm_sop_type type,
enum pd_discovery_state disc)
{
struct pd_discovery *pd = pd_get_am_discovery(port, type);
@@ -553,28 +553,28 @@ void pd_set_svids_discovery(int port, enum tcpm_transmit_type type,
}
enum pd_discovery_state pd_get_svids_discovery(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
struct pd_discovery *disc = pd_get_am_discovery(port, type);
return disc->svids_discovery;
}
-int pd_get_svid_count(int port, enum tcpm_transmit_type type)
+int pd_get_svid_count(int port, enum tcpm_sop_type type)
{
struct pd_discovery *disc = pd_get_am_discovery(port, type);
return disc->svid_cnt;
}
-uint16_t pd_get_svid(int port, uint16_t svid_idx, enum tcpm_transmit_type type)
+uint16_t pd_get_svid(int port, uint16_t svid_idx, enum tcpm_sop_type type)
{
struct pd_discovery *disc = pd_get_am_discovery(port, type);
return disc->svids[svid_idx].svid;
}
-void pd_set_modes_discovery(int port, enum tcpm_transmit_type type,
+void pd_set_modes_discovery(int port, enum tcpm_sop_type type,
uint16_t svid, enum pd_discovery_state disc)
{
struct pd_discovery *pd = pd_get_am_discovery(port, type);
@@ -592,7 +592,7 @@ void pd_set_modes_discovery(int port, enum tcpm_transmit_type type,
}
enum pd_discovery_state pd_get_modes_discovery(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
const struct svid_mode_data *mode_data = pd_get_next_mode(port, type);
@@ -606,7 +606,7 @@ enum pd_discovery_state pd_get_modes_discovery(int port,
return mode_data->discovery;
}
-int pd_get_mode_vdo_for_svid(int port, enum tcpm_transmit_type type,
+int pd_get_mode_vdo_for_svid(int port, enum tcpm_sop_type type,
uint16_t svid, uint32_t *vdo_out)
{
int idx;
@@ -628,7 +628,7 @@ int pd_get_mode_vdo_for_svid(int port, enum tcpm_transmit_type type,
}
struct svid_mode_data *pd_get_next_mode(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
struct pd_discovery *disc = pd_get_am_discovery(port, type);
struct svid_mode_data *failed_mode_data = NULL;
@@ -663,14 +663,14 @@ struct svid_mode_data *pd_get_next_mode(int port,
}
uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
struct pd_discovery *disc = pd_get_am_discovery(port, type);
return disc->svids[svid_idx].mode_vdo;
}
-bool pd_is_mode_discovered_for_svid(int port, enum tcpm_transmit_type type,
+bool pd_is_mode_discovered_for_svid(int port, enum tcpm_sop_type type,
uint16_t svid)
{
const struct pd_discovery *disc = pd_get_am_discovery(port, type);
@@ -696,7 +696,7 @@ void notify_sysjump_ready(void)
task_set_event(sysjump_task_waiting, TASK_EVENT_SYSJUMP_READY);
}
-static inline bool is_pd_rev3(int port, enum tcpm_transmit_type type)
+static inline bool is_pd_rev3(int port, enum tcpm_sop_type type)
{
return pd_get_rev(port, type) == PD_REV30;
}
@@ -848,7 +848,7 @@ bool is_active_cable_element_retimer(int port)
* ############################################################################
*/
-uint32_t pd_get_tbt_mode_vdo(int port, enum tcpm_transmit_type type)
+uint32_t pd_get_tbt_mode_vdo(int port, enum tcpm_sop_type type)
{
uint32_t tbt_mode_vdo[PDO_MODES];
@@ -960,13 +960,13 @@ enum tbt_compat_cable_speed get_tbt_cable_speed(int port)
max_tbt_speed : cable_tbt_speed;
}
-int enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop,
+int enter_tbt_compat_mode(int port, enum tcpm_sop_type sop,
uint32_t *payload)
{
union tbt_dev_mode_enter_cmd enter_dev_mode = { .raw_value = 0 };
union tbt_mode_resp_device dev_mode_resp;
union tbt_mode_resp_cable cable_mode_resp;
- enum tcpm_transmit_type enter_mode_sop =
+ enum tcpm_sop_type enter_mode_sop =
sop == TCPC_TX_SOP_PRIME_PRIME ?
TCPC_TX_SOP_PRIME : sop;
diff --git a/common/usb_pd_console_cmd.c b/common/usb_pd_console_cmd.c
index 1448424213..9746904a1d 100644
--- a/common/usb_pd_console_cmd.c
+++ b/common/usb_pd_console_cmd.c
@@ -8,6 +8,7 @@
#include "console.h"
#include "usb_pd.h"
#include "util.h"
+#include "usb_pd_tcpm.h"
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
#ifdef CONFIG_CMD_USB_PD_PE
@@ -17,7 +18,7 @@ static void dump_pe(int port)
struct svdm_amode_data *modep;
uint32_t mode_caps;
const union disc_ident_ack *resp;
- enum tcpm_transmit_type type;
+ enum tcpm_sop_type type;
/* TODO(b/152417597): Output SOP' discovery results */
const struct pd_discovery *disc =
pd_get_am_discovery(port, TCPC_TX_SOP);
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 3ba2ea0c5c..e91b99393b 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -26,6 +26,7 @@
#include "usb_common.h"
#include "usb_mux.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
#ifdef CONFIG_COMMON_RUNTIME
@@ -246,7 +247,7 @@ static inline bool is_limit_tbt_cable_speed(int port)
return !!(cable[port].flags & CABLE_FLAGS_TBT_COMPAT_LIMIT_SPEED);
}
-static bool is_intel_svid(int port, enum tcpm_transmit_type type)
+static bool is_intel_svid(int port, enum tcpm_sop_type type)
{
int i;
@@ -368,13 +369,13 @@ static int dfp_discover_svids(uint32_t *payload)
return 1;
}
-struct pd_discovery *pd_get_am_discovery(int port, enum tcpm_transmit_type type)
+struct pd_discovery *pd_get_am_discovery(int port, enum tcpm_sop_type type)
{
return &discovery[port][type];
}
struct partner_active_modes *
-pd_get_partner_active_modes(int port, enum tcpm_transmit_type type)
+pd_get_partner_active_modes(int port, enum tcpm_sop_type type)
{
assert(type < AMODE_TYPE_COUNT);
return &partner_amodes[port][type];
@@ -424,7 +425,7 @@ static bool is_usb4_vdo(int port, int cnt, uint32_t *payload)
static int process_am_discover_ident_sop(int port, int cnt, uint32_t head,
uint32_t *payload,
- enum tcpm_transmit_type *rtype)
+ enum tcpm_sop_type *rtype)
{
pd_dfp_discovery_init(port);
dfp_consume_identity(port, TCPC_TX_SOP, cnt, payload);
@@ -490,8 +491,8 @@ static int process_am_discover_ident_sop_prime(int port, int cnt, uint32_t head,
}
static int process_am_discover_svids(int port, int cnt, uint32_t *payload,
- enum tcpm_transmit_type sop,
- enum tcpm_transmit_type *rtype)
+ enum tcpm_sop_type sop,
+ enum tcpm_sop_type *rtype)
{
/*
* The pd_discovery structure stores SOP and SOP' discovery results
@@ -540,9 +541,9 @@ static int process_am_discover_svids(int port, int cnt, uint32_t *payload,
}
static int process_tbt_compat_discover_modes(int port,
- enum tcpm_transmit_type sop,
+ enum tcpm_sop_type sop,
uint32_t *payload,
- enum tcpm_transmit_type *rtype)
+ enum tcpm_sop_type *rtype)
{
int rsize;
@@ -604,9 +605,9 @@ static int process_tbt_compat_discover_modes(int port,
return rsize;
}
-static int obj_cnt_enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop,
+static int obj_cnt_enter_tbt_compat_mode(int port, enum tcpm_sop_type sop,
uint32_t *payload,
- enum tcpm_transmit_type *rtype)
+ enum tcpm_sop_type *rtype)
{
struct pd_discovery *disc = &discovery[port][TCPC_TX_SOP_PRIME];
@@ -630,7 +631,7 @@ static int obj_cnt_enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop,
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
- uint32_t head, enum tcpm_transmit_type *rtype)
+ uint32_t head, enum tcpm_sop_type *rtype)
{
int cmd = PD_VDO_CMD(payload[0]);
int cmd_type = PD_VDO_CMDT(payload[0]);
@@ -639,7 +640,7 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
int rsize = 1; /* VDM header at a minimum */
#ifdef CONFIG_USB_PD_ALT_MODE_DFP
- enum tcpm_transmit_type sop = PD_HEADER_GET_SOP(head);
+ enum tcpm_sop_type sop = PD_HEADER_GET_SOP(head);
#endif
/* Transmit SOP messages by default */
@@ -843,7 +844,7 @@ int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
#else
int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
- uint32_t head, enum tcpm_transmit_type *rtype)
+ uint32_t head, enum tcpm_sop_type *rtype)
{
return 0;
}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 510f0447b4..e20fa11aee 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -268,7 +268,7 @@ static struct pd_protocol {
/* next Vendor Defined Message to send */
uint32_t vdo_data[VDO_MAX_SIZE];
/* type of transmit message (SOP/SOP'/SOP'') */
- enum tcpm_transmit_type xmit_type;
+ enum tcpm_sop_type xmit_type;
uint8_t vdo_count;
/* VDO to retry if UFP responder replied busy. */
uint32_t vdo_retry;
@@ -345,7 +345,7 @@ static inline void set_state_timeout(int port,
pd[port].timeout_state = timeout_state;
}
-int pd_get_rev(int port, enum tcpm_transmit_type type)
+int pd_get_rev(int port, enum tcpm_sop_type type)
{
#ifdef CONFIG_USB_PD_REV30
/* TCPMv1 Only stores PD revision for SOP and SOP' types */
@@ -360,7 +360,7 @@ int pd_get_rev(int port, enum tcpm_transmit_type type)
#endif
}
-int pd_get_vdo_ver(int port, enum tcpm_transmit_type type)
+int pd_get_vdo_ver(int port, enum tcpm_sop_type type)
{
#ifdef CONFIG_USB_PD_REV30
if (type == TCPC_TX_SOP_PRIME)
@@ -681,7 +681,7 @@ static bool consume_sop_repeat_message(int port, uint8_t msg_id)
static bool consume_repeat_message(int port, uint32_t msg_header)
{
uint8_t msg_id = PD_HEADER_ID(msg_header);
- enum tcpm_transmit_type sop = PD_HEADER_GET_SOP(msg_header);
+ enum tcpm_sop_type sop = PD_HEADER_GET_SOP(msg_header);
/* If repeat message ignore, except softreset control request. */
if (PD_HEADER_TYPE(msg_header) == PD_CTRL_SOFT_RESET &&
@@ -908,7 +908,7 @@ void pd_transmit_complete(int port, int status)
task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_TX);
}
-static int pd_transmit(int port, enum tcpm_transmit_type type,
+static int pd_transmit(int port, enum tcpm_sop_type type,
uint16_t header, const uint32_t *data, enum ams_seq ams)
{
int evt;
@@ -1260,7 +1260,7 @@ static int send_bist_cmd(int port)
#endif
static void queue_vdm(int port, uint32_t *header, const uint32_t *data,
- int data_cnt, enum tcpm_transmit_type type)
+ int data_cnt, enum tcpm_sop_type type)
{
pd[port].vdo_count = data_cnt + 1;
pd[port].vdo_data[0] = header[0];
@@ -1276,7 +1276,7 @@ static void handle_vdm_request(int port, int cnt, uint32_t *payload,
{
int rlen = 0;
uint32_t *rdata;
- enum tcpm_transmit_type rtype = TCPC_TX_SOP;
+ enum tcpm_sop_type rtype = TCPC_TX_SOP;
if (pd[port].vdm_state == VDM_STATE_BUSY) {
/* If UFP responded busy retry after timeout */
@@ -2213,7 +2213,7 @@ static void pd_vdm_send_state_machine(int port)
{
int res;
uint16_t header;
- enum tcpm_transmit_type msg_type = pd[port].xmit_type;
+ enum tcpm_sop_type msg_type = pd[port].xmit_type;
switch (pd[port].vdm_state) {
case VDM_STATE_READY:
diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c
index 118c11f1e6..325af57af8 100644
--- a/common/usb_pd_tcpc.c
+++ b/common/usb_pd_tcpc.c
@@ -259,7 +259,7 @@ static struct pd_port_controller {
int rx_buf_head, rx_buf_tail;
/* Next transmit */
- enum tcpm_transmit_type tx_type;
+ enum tcpm_sop_type tx_type;
uint16_t tx_head;
uint32_t tx_payload[7];
const uint32_t *tx_data;
@@ -1128,7 +1128,7 @@ int tcpc_set_rx_enable(int port, int enable)
return EC_SUCCESS;
}
-int tcpc_transmit(int port, enum tcpm_transmit_type type, uint16_t header,
+int tcpc_transmit(int port, enum tcpm_sop_type type, uint16_t header,
const uint32_t *data)
{
/* Store data to transmit and wake task to send it */
diff --git a/common/usbc/dp_alt_mode.c b/common/usbc/dp_alt_mode.c
index eb42dfef0f..1f62d5fb71 100644
--- a/common/usbc/dp_alt_mode.c
+++ b/common/usbc/dp_alt_mode.c
@@ -73,7 +73,7 @@ static void dp_entry_failed(int port)
dp_state[port] = DP_INACTIVE;
}
-static bool dp_response_valid(int port, enum tcpm_transmit_type type,
+static bool dp_response_valid(int port, enum tcpm_sop_type type,
char *cmdt, int vdm_cmd)
{
enum dp_states st = dp_state[port];
@@ -111,7 +111,7 @@ static void dp_exit_to_usb_mode(int port)
? DP_START : DP_INACTIVE;
}
-void dp_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
+void dp_vdm_acked(int port, enum tcpm_sop_type type, int vdo_count,
uint32_t *vdm)
{
const struct svdm_amode_data *modep =
@@ -171,7 +171,7 @@ void dp_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
}
}
-void dp_vdm_naked(int port, enum tcpm_transmit_type type, uint8_t vdm_cmd)
+void dp_vdm_naked(int port, enum tcpm_sop_type type, uint8_t vdm_cmd)
{
if (!dp_response_valid(port, type, "NAK", vdm_cmd))
return;
diff --git a/common/usbc/tbt_alt_mode.c b/common/usbc/tbt_alt_mode.c
index fdee453904..b54848053c 100644
--- a/common/usbc/tbt_alt_mode.c
+++ b/common/usbc/tbt_alt_mode.c
@@ -18,6 +18,7 @@
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tbt.h"
+#include "usb_pd_tcpm.h"
#include "usb_pe_sm.h"
#include "usb_tbt_alt_mode.h"
@@ -184,7 +185,7 @@ void tbt_exit_mode_request(int port)
}
}
-static bool tbt_response_valid(int port, enum tcpm_transmit_type type,
+static bool tbt_response_valid(int port, enum tcpm_sop_type type,
char *cmdt, int vdm_cmd)
{
enum tbt_states st = tbt_state[port];
@@ -258,7 +259,7 @@ bool tbt_cable_entry_required_for_usb4(int port)
return false;
}
-void intel_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
+void intel_vdm_acked(int port, enum tcpm_sop_type type, int vdo_count,
uint32_t *vdm)
{
struct pd_discovery *disc;
@@ -366,7 +367,7 @@ void intel_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
}
}
-void intel_vdm_naked(int port, enum tcpm_transmit_type type, uint8_t vdm_cmd)
+void intel_vdm_naked(int port, enum tcpm_sop_type type, uint8_t vdm_cmd)
{
if (!tbt_response_valid(port, type, "NAK", vdm_cmd))
return;
@@ -458,7 +459,7 @@ static bool tbt_mode_is_supported(int port, int vdo_count)
}
int tbt_setup_next_vdm(int port, int vdo_count, uint32_t *vdm,
- enum tcpm_transmit_type *tx_type)
+ enum tcpm_sop_type *tx_type)
{
struct svdm_amode_data *modep;
int vdo_count_ret = 0;
diff --git a/common/usbc/usb_mode.c b/common/usbc/usb_mode.c
index 54034c8f19..3829d5463f 100644
--- a/common/usbc/usb_mode.c
+++ b/common/usbc/usb_mode.c
@@ -19,6 +19,7 @@
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_dpm.h"
+#include "usb_pd_tcpm.h"
#include "usb_pe_sm.h"
#include "usbc_ppc.h"
@@ -142,7 +143,7 @@ void enter_usb_failed(int port)
usb4_state[port] = USB4_INACTIVE;
}
-static bool enter_usb_response_valid(int port, enum tcpm_transmit_type type)
+static bool enter_usb_response_valid(int port, enum tcpm_sop_type type)
{
/*
* Check for an unexpected response.
@@ -215,7 +216,7 @@ bool enter_usb_cable_is_capable(int port)
return true;
}
-void enter_usb_accepted(int port, enum tcpm_transmit_type type)
+void enter_usb_accepted(int port, enum tcpm_sop_type type)
{
struct pd_discovery *disc;
@@ -253,7 +254,7 @@ void enter_usb_accepted(int port, enum tcpm_transmit_type type)
}
}
-void enter_usb_rejected(int port, enum tcpm_transmit_type type)
+void enter_usb_rejected(int port, enum tcpm_sop_type type)
{
if (!enter_usb_response_valid(port, type) ||
usb4_state[port] == USB4_ACTIVE)
@@ -262,7 +263,7 @@ void enter_usb_rejected(int port, enum tcpm_transmit_type type)
enter_usb_failed(port);
}
-uint32_t enter_usb_setup_next_msg(int port, enum tcpm_transmit_type *type)
+uint32_t enter_usb_setup_next_msg(int port, enum tcpm_sop_type *type)
{
struct pd_discovery *disc_sop_prime;
diff --git a/common/usbc/usb_pd_dpm.c b/common/usbc/usb_pd_dpm.c
index 55dace1aaf..4fbd496ad4 100644
--- a/common/usbc/usb_pd_dpm.c
+++ b/common/usbc/usb_pd_dpm.c
@@ -20,6 +20,7 @@
#include "usb_mode.h"
#include "usb_pd.h"
#include "usb_pd_dpm.h"
+#include "usb_pd_tcpm.h"
#include "usb_tbt_alt_mode.h"
#ifdef CONFIG_COMMON_RUNTIME
@@ -180,7 +181,7 @@ static bool dpm_mode_entry_requested(int port, enum typec_mode mode)
}
}
-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)
{
const uint16_t svid = PD_VDO_VID(vdm[0]);
@@ -202,7 +203,7 @@ void dpm_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
}
}
-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)
{
switch (svid) {
@@ -230,7 +231,7 @@ static void dpm_attempt_mode_entry(int port)
{
int vdo_count = 0;
uint32_t vdm[VDO_MAX_SIZE];
- enum tcpm_transmit_type tx_type = TCPC_TX_SOP;
+ enum tcpm_sop_type tx_type = TCPC_TX_SOP;
bool enter_mode_requested =
IS_ENABLED(CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY) ? false : true;
@@ -355,7 +356,7 @@ static void dpm_attempt_mode_exit(int port)
{
uint32_t vdm = 0;
int vdo_count = 0;
- enum tcpm_transmit_type tx_type = TCPC_TX_SOP;
+ enum tcpm_sop_type tx_type = TCPC_TX_SOP;
if (IS_ENABLED(CONFIG_USB_PD_USB4) &&
enter_usb_entry_is_done(port)) {
diff --git a/common/usbc/usb_pd_host.c b/common/usbc/usb_pd_host.c
index c72e16afe9..e4d044097b 100644
--- a/common/usbc/usb_pd_host.c
+++ b/common/usbc/usb_pd_host.c
@@ -12,6 +12,7 @@
#include "host_command.h"
#include "usb_mux.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#include "util.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
@@ -23,7 +24,7 @@ static enum ec_status hc_typec_discovery(struct host_cmd_handler_args *args)
const struct ec_params_typec_discovery *p = args->params;
struct ec_response_typec_discovery *r = args->response;
const struct pd_discovery *disc;
- enum tcpm_transmit_type type;
+ enum tcpm_sop_type type;
/* Confirm the number of HC VDOs matches our stored VDOs */
BUILD_ASSERT(sizeof(r->discovery_vdo) == sizeof(union disc_ident_ack));
diff --git a/common/usbc/usb_pe_ctvpd_sm.c b/common/usbc/usb_pe_ctvpd_sm.c
index 06a9137a2d..eb7d8a0aa7 100644
--- a/common/usbc/usb_pe_ctvpd_sm.c
+++ b/common/usbc/usb_pe_ctvpd_sm.c
@@ -11,6 +11,7 @@
#include "usb_pd_tcpm.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
+#include "usb_pd_tcpm.h"
#include "usb_tc_sm.h"
#include "usb_emsg.h"
#include "usb_sm.h"
@@ -110,7 +111,7 @@ void pe_got_hard_reset(int port)
/* No implementation needed by this policy engine */
}
-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)
{
/* No implementation needed by this policy engine */
}
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 05d498f0d9..3f770a9fb7 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -575,7 +575,7 @@ static struct policy_engine {
uint32_t events;
/* port address where soft resets are sent */
- enum tcpm_transmit_type soft_reset_sop;
+ enum tcpm_sop_type soft_reset_sop;
/* Current limit / voltage based on the last request message */
uint32_t curr_limit;
@@ -590,7 +590,7 @@ static struct policy_engine {
struct partner_active_modes partner_amodes[AMODE_TYPE_COUNT];
/* Partner type to send */
- enum tcpm_transmit_type tx_type;
+ enum tcpm_sop_type tx_type;
/* VDM - used to send information to shared VDM Request state */
uint32_t vdm_cnt;
@@ -670,12 +670,12 @@ static const uint8_t vdo_ver[] = {
[PD_REV30] = VDM_VER20,
};
-int pd_get_rev(int port, enum tcpm_transmit_type type)
+int pd_get_rev(int port, enum tcpm_sop_type type)
{
return prl_get_rev(port, type);
}
-int pd_get_vdo_ver(int port, enum tcpm_transmit_type type)
+int pd_get_vdo_ver(int port, enum tcpm_sop_type type)
{
enum pd_rev_type rev = prl_get_rev(port, type);
@@ -693,7 +693,7 @@ static void pe_set_ready_state(int port)
set_state_pe(port, PE_SNK_READY);
}
-static inline void send_data_msg(int port, enum tcpm_transmit_type type,
+static inline void send_data_msg(int port, enum tcpm_sop_type type,
enum pd_data_msg_type msg)
{
/* Clear any previous TX status before sending a new message */
@@ -702,14 +702,14 @@ static inline void send_data_msg(int port, enum tcpm_transmit_type type,
}
static __maybe_unused inline void send_ext_data_msg(
- int port, enum tcpm_transmit_type type, enum pd_ext_msg_type msg)
+ int port, enum tcpm_sop_type type, enum pd_ext_msg_type msg)
{
/* Clear any previous TX status before sending a new message */
PE_CLR_FLAG(port, PE_FLAGS_TX_COMPLETE);
prl_send_ext_data_msg(port, type, msg);
}
-static inline void send_ctrl_msg(int port, enum tcpm_transmit_type type,
+static inline void send_ctrl_msg(int port, enum tcpm_sop_type type,
enum pd_ctrl_msg_type msg)
{
/* Clear any previous TX status before sending a new message */
@@ -1082,7 +1082,7 @@ static bool pe_can_send_sop_vdm(int port, int vdm_cmd)
return false;
}
-static void pe_send_soft_reset(const int port, enum tcpm_transmit_type type)
+static void pe_send_soft_reset(const int port, enum tcpm_sop_type type)
{
pe[port].soft_reset_sop = type;
set_state_pe(port, PE_SEND_SOFT_RESET);
@@ -1117,7 +1117,7 @@ static bool pe_check_outgoing_discard(int port)
*/
if (PE_CHK_FLAG(port, PE_FLAGS_MSG_DISCARDED) &&
PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) {
- enum tcpm_transmit_type sop =
+ enum tcpm_sop_type sop =
PD_HEADER_GET_SOP(rx_emsg[port].header);
PE_CLR_FLAG(port, PE_FLAGS_MSG_DISCARDED);
@@ -1130,7 +1130,7 @@ static bool pe_check_outgoing_discard(int port)
return false;
}
-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)
{
/* This should only be called from the PD task */
assert(port == TASK_ID_TO_PD_PORT(task_get_current()));
@@ -1911,7 +1911,7 @@ __maybe_unused static bool pe_attempt_port_discovery(int port)
return false;
}
-bool pd_setup_vdm_request(int port, enum tcpm_transmit_type tx_type,
+bool pd_setup_vdm_request(int port, enum tcpm_sop_type tx_type,
uint32_t *vdm, uint32_t vdo_cnt)
{
if (vdo_cnt < VDO_HDR_SIZE || vdo_cnt > VDO_MAX_SIZE)
@@ -3179,7 +3179,7 @@ static void pe_snk_select_capability_run(int port)
{
uint8_t type;
uint8_t cnt;
- enum tcpm_transmit_type sop;
+ enum tcpm_sop_type sop;
enum pe_msg_check msg_check;
/*
@@ -6319,7 +6319,7 @@ static void pe_vcs_send_swap_run(int port)
{
uint8_t type;
uint8_t cnt;
- enum tcpm_transmit_type sop;
+ enum tcpm_sop_type sop;
enum pe_msg_check msg_check;
/*
@@ -6565,7 +6565,7 @@ static void pe_vcs_send_ps_rdy_swap_entry(int port)
/* Check for any interruptions to this non-interruptible AMS */
if (PE_CHK_FLAG(port, PE_FLAGS_MSG_RECEIVED)) {
- enum tcpm_transmit_type sop =
+ enum tcpm_sop_type sop =
PD_HEADER_GET_SOP(rx_emsg[port].header);
PE_CLR_FLAG(port, PE_FLAGS_MSG_RECEIVED);
@@ -6762,7 +6762,7 @@ static void pe_dr_get_sink_cap_run(int port)
int cnt;
int ext;
enum pe_msg_check msg_check;
- enum tcpm_transmit_type sop;
+ enum tcpm_sop_type sop;
/*
* Check the state of the message sent
@@ -7010,7 +7010,7 @@ void pd_dfp_discovery_init(int port)
}
__maybe_unused void pd_discovery_access_clear(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
if (!IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP))
assert(0);
@@ -7019,7 +7019,7 @@ __maybe_unused void pd_discovery_access_clear(int port,
}
__maybe_unused bool pd_discovery_access_validate(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
if (!IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP))
assert(0);
@@ -7028,7 +7028,7 @@ __maybe_unused bool pd_discovery_access_validate(int port,
}
__maybe_unused struct pd_discovery *pd_get_am_discovery(int port,
- enum tcpm_transmit_type type)
+ enum tcpm_sop_type type)
{
if (!IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP))
assert(0);
@@ -7039,7 +7039,7 @@ __maybe_unused struct pd_discovery *pd_get_am_discovery(int port,
}
__maybe_unused struct partner_active_modes *pd_get_partner_active_modes(
- int port, enum tcpm_transmit_type type)
+ int port, enum tcpm_sop_type type)
{
if (!IS_ENABLED(CONFIG_USB_PD_ALT_MODE_DFP))
assert(0);
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index 1d77de1aa4..c09854bb46 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -312,7 +312,7 @@ static struct tx_chunked {
/* Message Reception State Machine Object */
static struct protocol_layer_rx {
/* received message type */
- enum tcpm_transmit_type sop;
+ enum tcpm_sop_type sop;
/* message ids for all valid port partners */
int msg_id[NUM_SOP_STAR_TYPES];
} prl_rx[CONFIG_USB_PD_PORT_MAX_COUNT];
@@ -324,7 +324,7 @@ static struct protocol_layer_tx {
/* state machine flags */
uint32_t flags;
/* last message type we transmitted */
- enum tcpm_transmit_type last_xmit_type;
+ enum tcpm_sop_type last_xmit_type;
/* message id counters for all 6 port partners */
uint32_t msg_id_counter[NUM_SOP_STAR_TYPES];
/* transmit status */
@@ -344,7 +344,7 @@ static struct pd_message {
/* message status flags */
uint32_t flags;
/* SOP* */
- enum tcpm_transmit_type xmit_type;
+ enum tcpm_sop_type xmit_type;
/* type of message */
uint8_t msg_type;
/* PD revision */
@@ -627,7 +627,7 @@ void prl_hard_reset_complete(int port)
}
void prl_send_ctrl_msg(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
enum pd_ctrl_msg_type msg)
{
pdmsg[port].xmit_type = type;
@@ -647,7 +647,7 @@ void prl_send_ctrl_msg(int port,
}
void prl_send_data_msg(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
enum pd_data_msg_type msg)
{
pdmsg[port].xmit_type = type;
@@ -667,7 +667,7 @@ void prl_send_data_msg(int port,
#ifdef CONFIG_USB_PD_EXTENDED_MESSAGES
void prl_send_ext_data_msg(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
enum pd_ext_msg_type msg)
{
pdmsg[port].xmit_type = type;
@@ -772,7 +772,7 @@ void prl_run(int port, int evt, int en)
}
}
-void prl_set_rev(int port, enum tcpm_transmit_type type,
+void prl_set_rev(int port, enum tcpm_sop_type type,
enum pd_rev_type rev)
{
/* We only store revisions for SOP* types. */
@@ -781,7 +781,7 @@ void prl_set_rev(int port, enum tcpm_transmit_type type,
pdmsg[port].rev[type] = rev;
}
-enum pd_rev_type prl_get_rev(int port, enum tcpm_transmit_type type)
+enum pd_rev_type prl_get_rev(int port, enum tcpm_sop_type type)
{
/* We only store revisions for SOP* types. */
ASSERT(type < NUM_SOP_STAR_TYPES);
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index f3b914dcf5..80ccb3124e 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -15,6 +15,7 @@
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_dpm.h"
+#include "usb_pd_tcpm.h"
#include "usb_pd_timer.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
@@ -530,7 +531,7 @@ void pd_set_src_caps(int port, int cnt, uint32_t *src_caps)
{
}
-int pd_get_rev(int port, enum tcpm_transmit_type type)
+int pd_get_rev(int port, enum tcpm_sop_type type)
{
return PD_REV30;
}
@@ -3938,7 +3939,7 @@ static void pd_chipset_reset(void)
return;
for (i = 0; i < board_get_usb_pd_port_count(); i++) {
- enum tcpm_transmit_type tx;
+ enum tcpm_sop_type tx;
/* Do not notify the AP of irrelevant past Hard Resets. */
pd_clear_events(i, PD_STATUS_EVENT_HARD_RESET);
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index 8916fac17d..3653866673 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -17,6 +17,7 @@
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tcpc.h"
+#include "usb_pd_tcpm.h"
#include "util.h"
#if !defined(CONFIG_USB_PD_TCPM_TCPCI)
@@ -909,7 +910,7 @@ static int anx74xx_tcpm_get_message_raw(int port, uint32_t *payload, int *head)
return anx74xx_read_pd_obj(port, (uint8_t *)payload, len);
}
-static int anx74xx_tcpm_transmit(int port, enum tcpm_transmit_type type,
+static int anx74xx_tcpm_transmit(int port, enum tcpm_sop_type type,
uint16_t header,
const uint32_t *data)
{
diff --git a/driver/tcpm/fusb302.c b/driver/tcpm/fusb302.c
index 93c9435a0d..370e10b713 100644
--- a/driver/tcpm/fusb302.c
+++ b/driver/tcpm/fusb302.c
@@ -17,6 +17,7 @@
#include "usb_charge.h"
#include "usb_pd.h"
#include "usb_pd_tcpc.h"
+#include "usb_pd_tcpm.h"
#include "util.h"
#if defined(CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE) || \
@@ -844,7 +845,7 @@ static int fusb302_tcpm_get_message_raw(int port, uint32_t *payload, int *head)
return rv;
}
-static int fusb302_tcpm_transmit(int port, enum tcpm_transmit_type type,
+static int fusb302_tcpm_transmit(int port, enum tcpm_sop_type type,
uint16_t header, const uint32_t *data)
{
/*
diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c
index 8c45b0e6b3..6c9092613b 100644
--- a/driver/tcpm/it83xx.c
+++ b/driver/tcpm/it83xx.c
@@ -178,7 +178,7 @@ static int it83xx_tcpm_get_message_raw(int port, uint32_t *buf, int *head)
static enum tcpc_transmit_complete it83xx_tx_data(
enum usbpd_port port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
uint16_t header,
const uint32_t *buf)
{
@@ -247,7 +247,7 @@ static enum tcpc_transmit_complete it83xx_tx_data(
}
static enum tcpc_transmit_complete it83xx_send_hw_reset(enum usbpd_port port,
- enum tcpm_transmit_type reset_type)
+ enum tcpm_sop_type reset_type)
{
if (reset_type == TCPC_TX_CABLE_RESET)
IT83XX_USBPD_MTSR0(port) |= USBPD_REG_MASK_CABLE_ENABLE;
@@ -678,7 +678,7 @@ static int it83xx_tcpm_set_rx_enable(int port, int enable)
}
static int it83xx_tcpm_transmit(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
uint16_t header,
const uint32_t *data)
{
diff --git a/driver/tcpm/it8xxx2.c b/driver/tcpm/it8xxx2.c
index 246075207f..9f34442bd9 100644
--- a/driver/tcpm/it8xxx2.c
+++ b/driver/tcpm/it8xxx2.c
@@ -197,7 +197,7 @@ void it8xxx2_get_tx_error_status(enum usbpd_port port)
}
static enum tcpc_transmit_complete it8xxx2_tx_data(enum usbpd_port port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
uint16_t header,
const uint32_t *buf)
{
@@ -595,7 +595,7 @@ static int it8xxx2_tcpm_set_rx_enable(int port, int enable)
}
static int it8xxx2_tcpm_transmit(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
uint16_t header,
const uint32_t *data)
{
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index cab795ef09..51b6c4c412 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -414,7 +414,7 @@ static int ps8xxx_tcpc_bist_mode_2(int port)
return rv;
}
-static int ps8xxx_tcpm_transmit(int port, enum tcpm_transmit_type type,
+static int ps8xxx_tcpm_transmit(int port, enum tcpm_sop_type type,
uint16_t header, const uint32_t *data)
{
if (type == TCPC_TX_BIST_MODE_2)
diff --git a/driver/tcpm/stm32gx.c b/driver/tcpm/stm32gx.c
index 654bf73652..4b33f32209 100644
--- a/driver/tcpm/stm32gx.c
+++ b/driver/tcpm/stm32gx.c
@@ -103,7 +103,7 @@ static int stm32gx_tcpm_set_rx_enable(int port, int enable)
}
static int stm32gx_tcpm_transmit(int port,
- enum tcpm_transmit_type type,
+ enum tcpm_sop_type type,
uint16_t header,
const uint32_t *data)
{
diff --git a/driver/tcpm/stub.c b/driver/tcpm/stub.c
index 352124e5dc..48c0c51da9 100644
--- a/driver/tcpm/stub.c
+++ b/driver/tcpm/stub.c
@@ -113,7 +113,7 @@ void tcpm_clear_pending_messages(int port)
rx_buf_clear(port);
}
-int tcpm_transmit(int port, enum tcpm_transmit_type type, uint16_t header,
+int tcpm_transmit(int port, enum tcpm_sop_type type, uint16_t header,
const uint32_t *data)
{
return tcpc_transmit(port, type, header, data);
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index d113d876ea..6674b67c02 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -22,6 +22,7 @@
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tcpc.h"
+#include "usb_pd_tcpm.h"
#include "util.h"
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
@@ -943,7 +944,7 @@ void tcpm_clear_pending_messages(int port)
q->tail = q->head;
}
-int tcpci_tcpm_transmit(int port, enum tcpm_transmit_type type,
+int tcpci_tcpm_transmit(int port, enum tcpm_sop_type type,
uint16_t header, const uint32_t *data)
{
int reg = TCPC_REG_TX_DATA;
diff --git a/fuzz/usb_pd_fuzz.c b/fuzz/usb_pd_fuzz.c
index 205360015a..12fe4cc9f1 100644
--- a/fuzz/usb_pd_fuzz.c
+++ b/fuzz/usb_pd_fuzz.c
@@ -45,8 +45,9 @@ static int mock_tcpm_set_vconn(int port, int enable) { return EC_SUCCESS; }
static int mock_tcpm_set_msg_header(int port,
int power_role, int data_role) { return EC_SUCCESS; }
static int mock_tcpm_set_rx_enable(int port, int enable) { return EC_SUCCESS; }
-static int mock_tcpm_transmit(int port, enum tcpm_transmit_type type,
- uint16_t header, const uint32_t *data) { return EC_SUCCESS; }
+static int mock_tcpm_transmit(int port, enum tcpm_sop_type type,
+ uint16_t header, const uint32_t *data)
+{ return EC_SUCCESS; }
static void mock_tcpc_alert(int port) {}
static int mock_tcpci_get_chip_info(int port, int live,
struct ec_response_pd_chip_info_v1 *info)
diff --git a/include/driver/tcpm/tcpci.h b/include/driver/tcpm/tcpci.h
index 04002862df..5270da8d4e 100644
--- a/include/driver/tcpm/tcpci.h
+++ b/include/driver/tcpm/tcpci.h
@@ -262,7 +262,7 @@ int tcpci_tcpm_set_vconn(int port, int enable);
int tcpci_tcpm_set_msg_header(int port, int power_role, int data_role);
int tcpci_tcpm_set_rx_enable(int port, int enable);
int tcpci_tcpm_get_message_raw(int port, uint32_t *payload, int *head);
-int tcpci_tcpm_transmit(int port, enum tcpm_transmit_type type,
+int tcpci_tcpm_transmit(int port, enum tcpm_sop_type type,
uint16_t header, const uint32_t *data);
int tcpci_tcpm_release(int port);
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
diff --git a/include/driver/tcpm/tcpm.h b/include/driver/tcpm/tcpm.h
index 848178d958..d8fe5602a3 100644
--- a/include/driver/tcpm/tcpm.h
+++ b/include/driver/tcpm/tcpm.h
@@ -271,7 +271,7 @@ static inline int tcpm_reset_bist_type_2(int port)
*/
int tcpm_enqueue_message(int port);
-static inline int tcpm_transmit(int port, enum tcpm_transmit_type type,
+static inline int tcpm_transmit(int port, enum tcpm_sop_type type,
uint16_t header, const uint32_t *data)
{
return tcpc_config[port].drv->transmit(port, type, header, data);
@@ -532,7 +532,7 @@ void tcpm_enable_auto_discharge_disconnect(int port, int enable);
*
* @return EC_SUCCESS or error
*/
-int tcpm_transmit(int port, enum tcpm_transmit_type type, uint16_t header,
+int tcpm_transmit(int port, enum tcpm_sop_type type, uint16_t header,
const uint32_t *data);
/**
diff --git a/include/mock/tcpci_i2c_mock.h b/include/mock/tcpci_i2c_mock.h
index 46691e5b46..de813e392c 100644
--- a/include/mock/tcpci_i2c_mock.h
+++ b/include/mock/tcpci_i2c_mock.h
@@ -5,6 +5,7 @@
#include "common.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#define MOCK_TCPCI_I2C_ADDR_FLAGS 0x99
@@ -16,21 +17,21 @@ void mock_tcpci_clr_reg_bits(int reg_offset, uint16_t mask);
uint16_t mock_tcpci_get_reg(int reg_offset);
-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);
-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);
-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);
-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,
@@ -38,7 +39,7 @@ int verify_tcpci_tx_with_data(enum tcpm_transmit_type tx_type,
int timeout);
struct possible_tx {
- 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;
};
diff --git a/include/mock/usb_pe_sm_mock.h b/include/mock/usb_pe_sm_mock.h
index 8b1e790d9c..58138f7473 100644
--- a/include/mock/usb_pe_sm_mock.h
+++ b/include/mock/usb_pe_sm_mock.h
@@ -9,9 +9,10 @@
#include "common.h"
#include "usb_pe_sm.h"
+#include "usb_pd_tcpm.h"
struct mock_pe_port_t {
- enum tcpm_transmit_type sop;
+ enum tcpm_sop_type sop;
int mock_pe_message_sent;
int mock_pe_error;
diff --git a/include/mock/usb_prl_mock.h b/include/mock/usb_prl_mock.h
index ca5d3c8fc4..15015a6f0f 100644
--- a/include/mock/usb_prl_mock.h
+++ b/include/mock/usb_prl_mock.h
@@ -9,11 +9,12 @@
#include "common.h"
#include "usb_emsg.h"
+#include "usb_pd_tcpm.h"
void mock_prl_reset(void);
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);
@@ -30,6 +31,6 @@ void mock_prl_message_sent(int port);
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);
#endif /* __MOCK_DP_ALT_MODE_MOCK_H */
diff --git a/include/mock/usb_tc_sm_mock.h b/include/mock/usb_tc_sm_mock.h
index 1120ea850b..ca82eec638 100644
--- a/include/mock/usb_tc_sm_mock.h
+++ b/include/mock/usb_tc_sm_mock.h
@@ -10,13 +10,14 @@
#include "common.h"
#include "usb_tc_sm.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
struct mock_tc_port_t {
int rev;
int pd_enable;
int msg_tx_id;
int msg_rx_id;
- enum tcpm_transmit_type sop;
+ enum tcpm_sop_type sop;
enum tcpc_rp_value lcl_rp;
int attached_snk;
int attached_src;
diff --git a/include/usb_dp_alt_mode.h b/include/usb_dp_alt_mode.h
index df968879be..430926c5bf 100644
--- a/include/usb_dp_alt_mode.h
+++ b/include/usb_dp_alt_mode.h
@@ -50,7 +50,7 @@ bool dp_entry_is_done(int port);
* @param vdo_count The number of VDOs in the ACK VDM
* @param vdm VDM from ACK
*/
-void dp_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
+void dp_vdm_acked(int port, enum tcpm_sop_type type, int vdo_count,
uint32_t *vdm);
/*
@@ -61,7 +61,7 @@ void dp_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
* @param svid The SVID of the request
* @param vdm_cmd The VDM command of the request
*/
-void dp_vdm_naked(int port, enum tcpm_transmit_type type, uint8_t vdm_cmd);
+void dp_vdm_naked(int port, enum tcpm_sop_type type, uint8_t vdm_cmd);
/*
* Construct the next DisplayPort VDM that should be sent.
diff --git a/include/usb_mode.h b/include/usb_mode.h
index 98157626aa..598024d683 100644
--- a/include/usb_mode.h
+++ b/include/usb_mode.h
@@ -15,6 +15,7 @@
#include <stdint.h>
#include "tcpm/tcpm.h"
+#include "usb_pd_tcpm.h"
/*
* Initialize USB4 state for the specified port.
@@ -71,7 +72,7 @@ bool enter_usb_cable_is_capable(int port);
* @param port USB-C port number
* @param type Transmit type (SOP, SOP', SOP'') for request
*/
-void enter_usb_accepted(int port, enum tcpm_transmit_type type);
+void enter_usb_accepted(int port, enum tcpm_sop_type type);
/*
* Handles rejected USB4 response
@@ -79,7 +80,7 @@ void enter_usb_accepted(int port, enum tcpm_transmit_type type);
* @param port USB-C port number
* @param type Transmit type (SOP, SOP', SOP'') for request
*/
-void enter_usb_rejected(int port, enum tcpm_transmit_type type);
+void enter_usb_rejected(int port, enum tcpm_sop_type type);
/*
* Constructs the next USB4 EUDO that should be sent.
@@ -87,6 +88,6 @@ void enter_usb_rejected(int port, enum tcpm_transmit_type type);
* @param port USB-C port number
* @param type Transmit type (SOP, SOP', SOP'') for request
*/
-uint32_t enter_usb_setup_next_msg(int port, enum tcpm_transmit_type *type);
+uint32_t enter_usb_setup_next_msg(int port, enum tcpm_sop_type *type);
#endif
diff --git a/include/usb_pd.h b/include/usb_pd.h
index aed49c8f07..5200ef4e1c 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -1368,7 +1368,7 @@ void schedule_deferred_pd_interrupt(int port);
* PD_REV20 for PD Revision 2.0
* PD_REV30 for PD Revision 3.0
*/
-int pd_get_rev(int port, enum tcpm_transmit_type type);
+int pd_get_rev(int port, enum tcpm_sop_type type);
/**
* Get current PD VDO Version of Structured VDM
@@ -1378,7 +1378,7 @@ int pd_get_rev(int port, enum tcpm_transmit_type type);
* @return VDM_VER10 for VDM Version 1.0
* VDM_VER20 for VDM Version 2.0
*/
-int pd_get_vdo_ver(int port, enum tcpm_transmit_type type);
+int pd_get_vdo_ver(int port, enum tcpm_sop_type type);
/**
* Get transmit retry count for active PD revision.
@@ -1387,7 +1387,7 @@ int pd_get_vdo_ver(int port, enum tcpm_transmit_type type);
* @param type The partner to query (SOP, SOP', or SOP'')
* @return The number of retries to perform when transmitting.
*/
-int pd_get_retry_count(int port, enum tcpm_transmit_type type);
+int pd_get_retry_count(int port, enum tcpm_sop_type type);
/**
* Check if max voltage request is allowed (only used if
@@ -1714,7 +1714,7 @@ __override_proto int pd_custom_vdm(int port, int cnt, uint32_t *payload,
* @return if >0, number of VDOs to send back.
*/
int pd_svdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload,
- uint32_t head, enum tcpm_transmit_type *rtype);
+ uint32_t head, enum tcpm_sop_type *rtype);
/**
* Handle Custom VDMs for flashing.
@@ -1735,7 +1735,7 @@ int pd_custom_flash_vdm(int port, int cnt, uint32_t *payload);
* @param opos object position of mode to exit.
* @return vdm for UFP to be sent to enter mode or zero if not.
*/
-uint32_t pd_dfp_enter_mode(int port, enum tcpm_transmit_type type,
+uint32_t pd_dfp_enter_mode(int port, enum tcpm_sop_type type,
uint16_t svid, int opos);
/**
@@ -1773,7 +1773,7 @@ int pd_dfp_dp_get_pin_mode(int port, uint32_t status);
* @param opos object position of mode to exit.
* @return 1 if UFP should be sent exit mode VDM.
*/
-int pd_dfp_exit_mode(int port, enum tcpm_transmit_type type, uint16_t svid,
+int pd_dfp_exit_mode(int port, enum tcpm_sop_type type, uint16_t svid,
int opos);
/**
@@ -1792,7 +1792,7 @@ void dfp_consume_attention(int port, uint32_t *payload);
* @param cnt number of data objects in payload
* @param payload payload data.
*/
-void dfp_consume_identity(int port, enum tcpm_transmit_type type, int cnt,
+void dfp_consume_identity(int port, enum tcpm_sop_type type, int cnt,
uint32_t *payload);
/**
@@ -1803,7 +1803,7 @@ void dfp_consume_identity(int port, enum tcpm_transmit_type type, int cnt,
* @param cnt number of data objects in payload
* @param payload payload data.
*/
-void dfp_consume_svids(int port, enum tcpm_transmit_type type, int cnt,
+void dfp_consume_svids(int port, enum tcpm_sop_type type, int cnt,
uint32_t *payload);
/**
@@ -1814,7 +1814,7 @@ void dfp_consume_svids(int port, enum tcpm_transmit_type type, int cnt,
* @param cnt number of data objects in payload
* @param payload payload data.
*/
-void dfp_consume_modes(int port, enum tcpm_transmit_type type, int cnt,
+void dfp_consume_modes(int port, enum tcpm_sop_type type, int cnt,
uint32_t *payload);
/**
@@ -1901,7 +1901,7 @@ void pd_dfp_discovery_init(int port);
* @param type SOP* type to set
* @param disc Discovery state to set (failed or complete)
*/
-void pd_set_identity_discovery(int port, enum tcpm_transmit_type type,
+void pd_set_identity_discovery(int port, enum tcpm_sop_type type,
enum pd_discovery_state disc);
/**
@@ -1912,7 +1912,7 @@ void pd_set_identity_discovery(int port, enum tcpm_transmit_type type,
* @return Current discovery state (failed or complete)
*/
enum pd_discovery_state pd_get_identity_discovery(int port,
- enum tcpm_transmit_type type);
+ enum tcpm_sop_type type);
/**
* Set SVID discovery state for this type and port.
@@ -1921,7 +1921,7 @@ enum pd_discovery_state pd_get_identity_discovery(int port,
* @param type SOP* type to set
* @param disc Discovery state to set (failed or complete)
*/
-void pd_set_svids_discovery(int port, enum tcpm_transmit_type type,
+void pd_set_svids_discovery(int port, enum tcpm_sop_type type,
enum pd_discovery_state disc);
/**
@@ -1932,7 +1932,7 @@ void pd_set_svids_discovery(int port, enum tcpm_transmit_type type,
* @return Current discovery state (failed or complete)
*/
enum pd_discovery_state pd_get_svids_discovery(int port,
- enum tcpm_transmit_type type);
+ enum tcpm_sop_type type);
/**
* Set Modes discovery state for this port, SOP* type, and SVID.
@@ -1942,7 +1942,7 @@ enum pd_discovery_state pd_get_svids_discovery(int port,
* @param svid SVID to set mode discovery state for
* @param disc Discovery state to set (failed or complete)
*/
-void pd_set_modes_discovery(int port, enum tcpm_transmit_type type,
+void pd_set_modes_discovery(int port, enum tcpm_sop_type type,
uint16_t svid, enum pd_discovery_state disc);
/**
@@ -1959,7 +1959,7 @@ void pd_set_modes_discovery(int port, enum tcpm_transmit_type type,
* PD_DISC_FAIL)
*/
enum pd_discovery_state pd_get_modes_discovery(int port,
- enum tcpm_transmit_type type);
+ enum tcpm_sop_type type);
/**
* Returns the mode vdo count of the specified SVID and sets
@@ -1973,7 +1973,7 @@ enum pd_discovery_state pd_get_modes_discovery(int port,
* @return Mode VDO cnt of specified SVID if is discovered,
* 0 otherwise
*/
-int pd_get_mode_vdo_for_svid(int port, enum tcpm_transmit_type type,
+int pd_get_mode_vdo_for_svid(int port, enum tcpm_sop_type type,
uint16_t svid, uint32_t *vdo_out);
/**
@@ -1989,7 +1989,7 @@ int pd_get_mode_vdo_for_svid(int port, enum tcpm_transmit_type type,
* mode, if any exist and no modes succeeded in discovery;
* NULL, otherwise
*/
-struct svid_mode_data *pd_get_next_mode(int port, enum tcpm_transmit_type type);
+struct svid_mode_data *pd_get_next_mode(int port, enum tcpm_sop_type type);
/**
* Return a pointer to the discover identity response structure for this SOP*
@@ -2000,7 +2000,7 @@ struct svid_mode_data *pd_get_next_mode(int port, enum tcpm_transmit_type type);
* @return pointer to response structure, which the caller may not alter
*/
const union disc_ident_ack *pd_get_identity_response(int port,
- enum tcpm_transmit_type type);
+ enum tcpm_sop_type type);
/**
* Return the VID of the USB PD accessory connected to a specified port
@@ -2033,7 +2033,7 @@ uint8_t pd_get_product_type(int port);
* @param type SOP* type to retrieve
* @return SVID count
*/
-int pd_get_svid_count(int port, enum tcpm_transmit_type type);
+int pd_get_svid_count(int port, enum tcpm_sop_type type);
/**
* Return the SVID of given SVID index of port partner connected
@@ -2044,7 +2044,7 @@ int pd_get_svid_count(int port, enum tcpm_transmit_type type);
* @param type SOP* type to retrieve
* @return SVID
*/
-uint16_t pd_get_svid(int port, uint16_t svid_idx, enum tcpm_transmit_type type);
+uint16_t pd_get_svid(int port, uint16_t svid_idx, enum tcpm_sop_type type);
/**
* Return the pointer to modes of VDO of port partner connected
@@ -2056,7 +2056,7 @@ uint16_t pd_get_svid(int port, uint16_t svid_idx, enum tcpm_transmit_type type);
* @return Pointer to modes of VDO
*/
uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx,
- enum tcpm_transmit_type type);
+ enum tcpm_sop_type type);
/*
* Looks for a discovered mode VDO for the specified SVID.
@@ -2066,7 +2066,7 @@ uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx,
* @param svid SVID to look up
* @return Whether a mode was discovered for the SVID
*/
-bool pd_is_mode_discovered_for_svid(int port, enum tcpm_transmit_type type,
+bool pd_is_mode_discovered_for_svid(int port, enum tcpm_sop_type type,
uint16_t svid);
/**
@@ -2078,7 +2078,7 @@ bool pd_is_mode_discovered_for_svid(int port, enum tcpm_transmit_type type,
* @return pointer to SVDM mode data
*/
struct svdm_amode_data *pd_get_amode_data(int port,
- enum tcpm_transmit_type type, uint16_t svid);
+ enum tcpm_sop_type type, uint16_t svid);
/*
* Returns cable revision
@@ -2119,7 +2119,7 @@ bool consume_sop_prime_prime_repeat_msg(int port, uint8_t msg_id);
* @param port USB-C port number
* @param type Transmit type (SOP, SOP')
*/
-void pd_discovery_access_clear(int port, enum tcpm_transmit_type type);
+void pd_discovery_access_clear(int port, enum tcpm_sop_type type);
/*
* Validate that this current task is the only one which has retrieved the
@@ -2130,7 +2130,7 @@ void pd_discovery_access_clear(int port, enum tcpm_transmit_type type);
* @param type Transmit type (SOP, SOP')
* @return True - No other tasks have accessed the data
*/
-bool pd_discovery_access_validate(int port, enum tcpm_transmit_type type);
+bool pd_discovery_access_validate(int port, enum tcpm_sop_type type);
/*
* Returns the pointer to PD alternate mode discovery results
@@ -2147,7 +2147,7 @@ bool pd_discovery_access_validate(int port, enum tcpm_transmit_type type);
* @return pointer to PD alternate mode discovery results
*/
struct pd_discovery *pd_get_am_discovery(int port,
- enum tcpm_transmit_type type);
+ enum tcpm_sop_type type);
/*
* Returns the pointer to PD active alternate modes.
@@ -2158,7 +2158,7 @@ struct pd_discovery *pd_get_am_discovery(int port,
* @return Pointer to PD active alternate modes.
*/
struct partner_active_modes *pd_get_partner_active_modes(int port,
- enum tcpm_transmit_type type);
+ enum tcpm_sop_type type);
/*
* Sets the current object position for DP alt-mode
@@ -2306,7 +2306,7 @@ enum tbt_compat_rounded_support get_tbt_rounded_support(int port);
* @return Discover Mode VDO for Intel SVID if the Intel mode VDO is
* discovered, 0 otherwise
*/
-uint32_t pd_get_tbt_mode_vdo(int port, enum tcpm_transmit_type type);
+uint32_t pd_get_tbt_mode_vdo(int port, enum tcpm_sop_type type);
/**
* Sets the Mux state to Thunderbolt-Compatible mode
@@ -2333,7 +2333,7 @@ enum tbt_compat_cable_speed get_tbt_cable_speed(int port);
* @param payload payload data
* @return Number of object filled
*/
-int enter_tbt_compat_mode(int port, enum tcpm_transmit_type sop,
+int enter_tbt_compat_mode(int port, enum tcpm_sop_type sop,
uint32_t *payload);
/**
@@ -2462,7 +2462,7 @@ void pd_dpm_request(int port, enum pd_dpm_request req);
* must be 1 - 7 inclusive.
* @return True if the setup was successful
*/
-bool pd_setup_vdm_request(int port, enum tcpm_transmit_type tx_type,
+bool pd_setup_vdm_request(int port, enum tcpm_sop_type tx_type,
uint32_t *vdm, uint32_t vdo_cnt);
/* Power Data Objects for the source and the sink */
@@ -2496,7 +2496,7 @@ static inline void pd_send_host_event(int mask) { }
* @param svid USB standard or vendor id
* @return object position of mode chosen in alternate mode otherwise zero.
*/
-int pd_alt_mode(int port, enum tcpm_transmit_type type, uint16_t svid);
+int pd_alt_mode(int port, enum tcpm_sop_type type, uint16_t svid);
/**
* Send hpd over USB PD.
diff --git a/include/usb_pd_dpm.h b/include/usb_pd_dpm.h
index 0ecb577a1a..f995363fdf 100644
--- a/include/usb_pd_dpm.h
+++ b/include/usb_pd_dpm.h
@@ -36,7 +36,7 @@ void dpm_set_mode_exit_request(int port);
* @param vdo_count The number of VDOs in vdm; must be at least 1
* @param vdm The VDM payload of the ACK
*/
-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);
/*
@@ -48,7 +48,7 @@ void dpm_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
* @param svid The SVID of the request
* @param vdm_cmd The VDM command of the request
*/
-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/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h
index 384e30bd21..34affc973d 100644
--- a/include/usb_pd_tcpc.h
+++ b/include/usb_pd_tcpc.h
@@ -61,7 +61,7 @@ int tcpc_set_vconn(int port, int enable);
int tcpc_set_msg_header(int port, int power_role, int data_role);
int tcpc_set_rx_enable(int port, int enable);
int tcpc_get_message(int port, uint32_t *payload, int *head);
-int tcpc_transmit(int port, enum tcpm_transmit_type type, uint16_t header,
+int tcpc_transmit(int port, enum tcpm_sop_type type, uint16_t header,
const uint32_t *data);
int rx_buf_is_empty(int port);
void rx_buf_clear(int port);
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 0902d411b5..7dfa2dca1c 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -65,14 +65,21 @@ static inline enum tcpc_cc_polarity polarity_rm_dts(
return (enum tcpc_cc_polarity)(polarity & BIT(0));
}
-enum tcpm_transmit_type {
+/*
+ * Types of PD data that can be sent or received. The values match the TCPCI bit
+ * field values TRANSMIT[Transmit SOP* Message] (TCPCI r2.0 v1.2, table 4-38)
+ * and RX_BUF_FRAME_TYPE[Received SOP* message] (table 4-37).
+ */
+enum tcpm_sop_type {
TCPC_TX_SOP = 0,
TCPC_TX_SOP_PRIME = 1,
TCPC_TX_SOP_PRIME_PRIME = 2,
TCPC_TX_SOP_DEBUG_PRIME = 3,
TCPC_TX_SOP_DEBUG_PRIME_PRIME = 4,
+ /* Only a valid register setting for TRANSMIT */
TCPC_TX_HARD_RESET = 5,
TCPC_TX_CABLE_RESET = 6,
+ /* Only a valid register setting for TRANSMIT */
TCPC_TX_BIST_MODE_2 = 7,
TCPC_TX_INVALID = 0xf,
};
@@ -302,7 +309,7 @@ struct tcpm_drv {
*
* @return EC_SUCCESS or error
*/
- int (*transmit)(int port, enum tcpm_transmit_type type, uint16_t header,
+ int (*transmit)(int port, enum tcpm_sop_type type, uint16_t header,
const uint32_t *data);
/**
diff --git a/include/usb_pe_sm.h b/include/usb_pe_sm.h
index 3da1e9fae6..4c7c375d16 100644
--- a/include/usb_pe_sm.h
+++ b/include/usb_pe_sm.h
@@ -50,7 +50,7 @@ void pe_message_sent(int port);
* @param e error
* @param type port address where error was generated
*/
-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);
/**
* Informs the Policy Engine of a discard.
diff --git a/include/usb_prl_sm.h b/include/usb_prl_sm.h
index 0111f54fc1..011dce2100 100644
--- a/include/usb_prl_sm.h
+++ b/include/usb_prl_sm.h
@@ -12,6 +12,7 @@
#include "usb_pd_tcpm.h"
#include "usb_sm.h"
#include "timer.h"
+#include "usb_pd_tcpm.h"
/**
* Returns TX success time stamp.
@@ -79,7 +80,7 @@ void prl_run(int port, int evt, int en);
* @param type port address
* @param rev revision
*/
-void prl_set_rev(int port, enum tcpm_transmit_type type,
+void prl_set_rev(int port, enum tcpm_sop_type type,
enum pd_rev_type rev);
/**
@@ -89,7 +90,7 @@ void prl_set_rev(int port, enum tcpm_transmit_type type,
* @param type port address
* @return pd rev
*/
-enum pd_rev_type prl_get_rev(int port, enum tcpm_transmit_type type);
+enum pd_rev_type prl_get_rev(int port, enum tcpm_sop_type type);
/**
* Sends a PD control message
@@ -98,7 +99,7 @@ enum pd_rev_type prl_get_rev(int port, enum tcpm_transmit_type type);
* @param type Transmit type
* @param msg Control message type
*/
-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);
/**
@@ -108,7 +109,7 @@ void prl_send_ctrl_msg(int port, enum tcpm_transmit_type type,
* @param type Transmit type
* @param msg Data message 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);
/**
@@ -118,7 +119,7 @@ void prl_send_data_msg(int port, enum tcpm_transmit_type type,
* @param type Transmit type
* @param msg Extended data message 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);
/**
diff --git a/include/usb_tbt_alt_mode.h b/include/usb_tbt_alt_mode.h
index 01604d72ae..5190f00ec1 100644
--- a/include/usb_tbt_alt_mode.h
+++ b/include/usb_tbt_alt_mode.h
@@ -14,6 +14,7 @@
#include <stdint.h>
#include "tcpm/tcpm.h"
+#include "usb_pd_tcpm.h"
/*
* Initialize Thunderbolt state for the specified port.
@@ -75,7 +76,7 @@ bool tbt_is_active(int port);
* @param vdo_count The number of VDOs in the ACK VDM
* @param vdm VDM from ACK
*/
-void intel_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
+void intel_vdm_acked(int port, enum tcpm_sop_type type, int vdo_count,
uint32_t *vdm);
/*
@@ -86,7 +87,7 @@ void intel_vdm_acked(int port, enum tcpm_transmit_type type, int vdo_count,
* @param svid The SVID of the request
* @param vdm_cmd The VDM command of the request
*/
-void intel_vdm_naked(int port, enum tcpm_transmit_type type, uint8_t vdm_cmd);
+void intel_vdm_naked(int port, enum tcpm_sop_type type, uint8_t vdm_cmd);
/*
* Construct the next Thunderbolt VDM that should be sent.
@@ -99,6 +100,6 @@ void intel_vdm_naked(int port, enum tcpm_transmit_type type, uint8_t vdm_cmd);
* @return The number of VDOs written to VDM or -1 to indicate error
*/
int tbt_setup_next_vdm(int port, int vdo_count, uint32_t *vdm,
- enum tcpm_transmit_type *tx_type);
+ enum tcpm_sop_type *tx_type);
#endif
diff --git a/test/fake_usbc.c b/test/fake_usbc.c
index dc27c0e941..e60bd16898 100644
--- a/test/fake_usbc.c
+++ b/test/fake_usbc.c
@@ -7,6 +7,7 @@
#include "common.h"
#include "usb_tc_sm.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
__overridable int pd_is_vbus_present(int port)
{
@@ -56,7 +57,7 @@ __overridable enum pd_cable_plug tc_get_cable_plug(int port)
return PD_PLUG_FROM_DFP_UFP;
}
-__overridable int pd_get_rev(int port, enum tcpm_transmit_type type)
+__overridable int pd_get_rev(int port, enum tcpm_sop_type type)
{
return IS_ENABLED(CONFIG_USB_PD_REV30) ? PD_REV30 : PD_REV20;
}
@@ -258,12 +259,12 @@ void dpm_init(int port)
{
}
-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/test/usb_prl_old.c b/test/usb_prl_old.c
index b3e39b3b30..4cd4b3bbaf 100644
--- a/test/usb_prl_old.c
+++ b/test/usb_prl_old.c
@@ -13,6 +13,7 @@
#include "usb_emsg.h"
#include "usb_pd_test_util.h"
#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
#include "usb_pe_sm.h"
#include "usb_prl_sm.h"
#include "usb_sm_checks.h"
@@ -114,7 +115,7 @@ static struct pd_prl {
enum pd_data_role data_role;
int msg_tx_id;
int msg_rx_id;
- enum tcpm_transmit_type sop;
+ enum tcpm_sop_type sop;
int mock_pe_message_sent;
int mock_pe_error;
@@ -505,7 +506,7 @@ static int verify_ctrl_msg_transmission(int port,
}
static int simulate_send_ctrl_msg_request_from_pe(int port,
- enum tcpm_transmit_type type, enum pd_ctrl_msg_type msg_type)
+ enum tcpm_sop_type type, enum pd_ctrl_msg_type msg_type)
{
pd_port[port].mock_got_soft_reset = 0;
pd_port[port].mock_pe_error = -1;
@@ -564,7 +565,7 @@ static int verify_data_msg_transmission(int port,
}
static int simulate_send_data_msg_request_from_pe(int port,
- enum tcpm_transmit_type type, enum pd_ctrl_msg_type msg_type, int len)
+ enum tcpm_sop_type type, enum pd_ctrl_msg_type msg_type, int len)
{
int i;
uint8_t *buf = tx_emsg[port].buf;
@@ -699,7 +700,7 @@ static int verify_extended_data_msg_transmission(int port,
}
static int simulate_send_extended_data_msg(int port,
- enum tcpm_transmit_type type, enum pd_ctrl_msg_type msg_type,
+ enum tcpm_sop_type type, enum pd_ctrl_msg_type msg_type,
int len)
{
int i;
@@ -757,7 +758,7 @@ enum pd_cable_plug tc_get_cable_plug(int port)
return PD_PLUG_FROM_DFP_UFP;
}
-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)
{
pd_port[port].mock_pe_error = e;
pd_port[port].sop = type;