summaryrefslogtreecommitdiff
path: root/test
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 /test
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 'test')
-rw-r--r--test/usb_pd.c1
-rw-r--r--test/usb_pd_test_util.h1
2 files changed, 2 insertions, 0 deletions
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);