summaryrefslogtreecommitdiff
path: root/test/usb_pd_test_util.h
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-10-01 13:46:18 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-04 21:08:48 +0000
commitf0dc012cf75a02110f3ac98a4dbd1a395a70e794 (patch)
tree7b3e93ec612d16d8acd54b674c02a5c1507fdd66 /test/usb_pd_test_util.h
parent15eced037401c1749b634786754df17d8c58285f (diff)
downloadchrome-ec-f0dc012cf75a02110f3ac98a4dbd1a395a70e794.tar.gz
Add back unit test for usb_pd"
This is mostly the same as previous commits, but with increased delay. Previously, we have short delays (e.g. 3ms) which is too short and may cause instability. Now that we have slowed down the time when running unit tests and increased the delay, this shouldn't cause problems anymore. BUG=chrome-os-partner:31200 TEST=Repeatedly run multiple unit tests in parallel. BRANCH=Samus Change-Id: Ib55e3adc5fd27a8e233996b4799dab3cefd62318 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220734 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'test/usb_pd_test_util.h')
-rw-r--r--test/usb_pd_test_util.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/usb_pd_test_util.h b/test/usb_pd_test_util.h
new file mode 100644
index 0000000000..5be8e0984a
--- /dev/null
+++ b/test/usb_pd_test_util.h
@@ -0,0 +1,31 @@
+/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Test utilities for USB PD unit test.
+ */
+
+#ifndef __USB_PD_TEST_UTIL_H
+#define __USB_PD_TEST_UTIL_H
+
+/* Simulate Rx message */
+void pd_test_rx_set_preamble(int port, int has_preamble);
+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_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);
+void pd_simulate_rx(int port);
+
+/* Verify Tx message */
+int pd_test_tx_msg_verify_kcode(int port, uint8_t kcode);
+int pd_test_tx_msg_verify_sop(int port);
+int pd_test_tx_msg_verify_eop(int port);
+int pd_test_tx_msg_verify_4b5b(int port, uint8_t b4);
+int pd_test_tx_msg_verify_short(int port, uint16_t val);
+int pd_test_tx_msg_verify_word(int port, uint32_t val);
+int pd_test_tx_msg_verify_crc(int port);
+
+#endif /* __USB_PD_TEST_UTIL_H */