summaryrefslogtreecommitdiff
path: root/include
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 /include
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>
Diffstat (limited to 'include')
-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
15 files changed, 76 insertions, 62 deletions
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