From 6c980a4dbf2e37b83e868c0eb12774190ea8c94d Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Tue, 28 Oct 2014 14:26:51 -0700 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/226118 Reviewed-by: Vincent Palatin --- test/usb_pd.c | 1 + test/usb_pd_test_util.h | 1 + 2 files changed, 2 insertions(+) (limited to 'test') diff --git a/test/usb_pd.c b/test/usb_pd.c index 2916d4eb94..9da5bfc85c 100644 --- a/test/usb_pd.c +++ b/test/usb_pd.c @@ -95,6 +95,7 @@ static void simulate_rx_msg(int port, uint16_t header, int cnt, pd_test_rx_msg_append_word(port, crc32_result()); pd_test_rx_msg_append_eop(port); + pd_test_rx_msg_append_last_edge(port); pd_simulate_rx(port); } diff --git a/test/usb_pd_test_util.h b/test/usb_pd_test_util.h index 5be8e0984a..d54296ef17 100644 --- a/test/usb_pd_test_util.h +++ b/test/usb_pd_test_util.h @@ -14,6 +14,7 @@ void pd_test_rx_msg_append_bits(int port, uint32_t bits, int nb); void pd_test_rx_msg_append_kcode(int port, uint8_t kcode); void pd_test_rx_msg_append_sop(int port); void pd_test_rx_msg_append_eop(int port); +void pd_test_rx_msg_append_last_edge(int port); void pd_test_rx_msg_append_4b(int port, uint8_t val); void pd_test_rx_msg_append_short(int port, uint16_t val); void pd_test_rx_msg_append_word(int port, uint32_t val); -- cgit v1.2.1