summaryrefslogtreecommitdiff
path: root/chip/host
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-10-28 14:26:51 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-17 03:27:17 +0000
commit6c980a4dbf2e37b83e868c0eb12774190ea8c94d (patch)
treeda414fe9f2f5609525ba950d5a05c54accfee475 /chip/host
parent3b101e56a9e058aee19933f9adfae1c8bb2dbedd (diff)
downloadchrome-ec-6c980a4dbf2e37b83e868c0eb12774190ea8c94d.tar.gz
pd: check for collisions before transmitting
Added check for collision just before transmitting on CC line. To check for collision, RX monitoring is left on all the time (except when in the act of receiving or transmitting, or in between receiving and sending a goodCRC), and a simple check for RX transmission started is used to see if the CC line is idle or not. RX monitoring is also changed to only trigger on 3 edges within 20us, as per the PD spec. When a collision is detected by seeing that CC is not idle, the transmitting packet is dropped. BUG=chrome-os-partner:30135 BRANCH=samus TEST=load onto samus and zinger. make sure we negotiate and make sure custom VDMs succeed. enabled pings and made sure we stay alive with pings for a few min. Also added code to pd_rx_handler to toggle a test point on EVT board to verify the timing of when we get RX interrupts: Change-Id: I22d172163319437d3d901e019eda79d4d592f6b8 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226118 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/host')
-rw-r--r--chip/host/usb_pd_phy.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/chip/host/usb_pd_phy.c b/chip/host/usb_pd_phy.c
index 1cb770bf8d..bd75bd2d6b 100644
--- a/chip/host/usb_pd_phy.c
+++ b/chip/host/usb_pd_phy.c
@@ -76,6 +76,12 @@ void pd_test_rx_msg_append_eop(int port)
pd_test_rx_msg_append_kcode(port, PD_EOP);
}
+void pd_test_rx_msg_append_last_edge(int port)
+{
+ /* end with 1, 1, 0 similar to pd_write_last_edge() */
+ pd_test_rx_msg_append_bits(port, 3, 6);
+}
+
void pd_test_rx_msg_append_4b(int port, uint8_t val)
{
pd_test_rx_msg_append_bits(port, enc4b5b[val & 0xF], 5);
@@ -224,7 +230,7 @@ void pd_tx_set_circular_mode(int port)
/* Not implemented */
}
-void pd_start_tx(int port, int polarity, int bit_len)
+int pd_start_tx(int port, int polarity, int bit_len)
{
ASSERT(pd_phy[port].hw_init_done);
pd_phy[port].has_msg = 0;
@@ -237,6 +243,8 @@ void pd_start_tx(int port, int polarity, int bit_len)
*/
task_wake(TASK_ID_TEST_RUNNER);
task_wait_event(-1);
+
+ return bit_len;
}
void pd_tx_done(int port, int polarity)