summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-01-14 08:54:31 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-30 03:28:08 +0000
commit95e74550f27e93a2133c3b5437dd2bdde8ac8956 (patch)
tree3b811cfc0c52144e19d35c5b205967e5a80ce709
parentff5e62331554a2fcd25df4b8cceba938feb33975 (diff)
downloadchrome-ec-95e74550f27e93a2133c3b5437dd2bdde8ac8956.tar.gz
zinger: remove functions for analyzing bist results
Remove functions for sending bist command and analyzing the resulting stream in order to save flash space. BUG=chrome-os-partner:32785 BRANCH=samus TEST=make -j buildall Original-Change-Id: I8fec2d632bce82b1cc344e674b48c5cf2b3a3647 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/240700 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 389ef0f90ff9318ced905d7a1ed8c025953aebc3) Reviewed-on: https://chromium-review.googlesource.com/240836 (cherry picked from commit 7f0e13f25fb14301364386d8d369ae9c148e4fcd) Signed-off-by: Todd Broch <tbroch@chromium.org> Change-Id: I0ff3621f7c941fa416f6744e6947149e716574f7 Reviewed-on: https://chromium-review.googlesource.com/244221 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
-rw-r--r--common/usb_pd_protocol.c61
-rw-r--r--include/usb_pd.h2
2 files changed, 36 insertions, 27 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 72094f9912..011d033747 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -477,7 +477,6 @@ int prepare_message(int port, uint16_t header, uint8_t cnt,
}
static int analyze_rx(int port, uint32_t *payload);
-static void analyze_rx_bist(int port);
int send_hard_reset(int port)
{
@@ -681,6 +680,9 @@ static int send_request(int port, uint32_t rdo)
}
#endif /* CONFIG_USB_PD_DUAL_ROLE */
+#ifdef CONFIG_COMMON_RUNTIME
+static void analyze_rx_bist(int port);
+
static int send_bist_cmd(int port)
{
/* currently only support sending bist carrier 2 */
@@ -695,6 +697,33 @@ static int send_bist_cmd(int port)
return bit_len;
}
+static void bist_mode_2_rx(int port)
+{
+ /* monitor for incoming packet */
+ pd_rx_enable_monitoring(port);
+
+ /* loop until we start receiving data */
+ while (1) {
+ task_wait_event(500*MSEC);
+ /* incoming packet ? */
+ if (pd_rx_started(port))
+ break;
+ }
+
+ /*
+ * once we start receiving bist data, do not
+ * let state machine run again. stay here, and
+ * analyze a chunk of data every 250ms.
+ */
+ while (1) {
+ analyze_rx_bist(port);
+ pd_rx_complete(port);
+ msleep(250);
+ pd_rx_enable_monitoring(port);
+ }
+}
+#endif
+
static void bist_mode_2_tx(int port)
{
int bit;
@@ -723,32 +752,6 @@ static void bist_mode_2_tx(int port)
task_wait_event(-1);
}
-static void bist_mode_2_rx(int port)
-{
- /* monitor for incoming packet */
- pd_rx_enable_monitoring(port);
-
- /* loop until we start receiving data */
- while (1) {
- task_wait_event(500*MSEC);
- /* incoming packet ? */
- if (pd_rx_started(port))
- break;
- }
-
- /*
- * once we start receiving bist data, do not
- * let state machine run again. stay here, and
- * analyze a chunk of data every 250ms.
- */
- while (1) {
- analyze_rx_bist(port);
- pd_rx_complete(port);
- msleep(250);
- pd_rx_enable_monitoring(port);
- }
-}
-
static void queue_vdm(int port, uint32_t *header, const uint32_t *data,
int data_cnt)
{
@@ -1273,6 +1276,7 @@ static inline int decode_word(int port, int off, uint32_t *val32)
return decode_short(port, off, ((uint16_t *)val32 + 1));
}
+#ifdef CONFIG_COMMON_RUNTIME
static int count_set_bits(int n)
{
int count = 0;
@@ -1318,6 +1322,7 @@ static void analyze_rx_bist(int port)
CPRINTF("- incorrect bits: %d / %d\n", invalid_bits,
total_invalid_bits);
}
+#endif
static int analyze_rx(int port, uint32_t *payload)
{
@@ -2652,10 +2657,12 @@ void pd_task(void)
execute_hard_reset(port);
timeout = 10*MSEC;
break;
+#ifdef CONFIG_COMMON_RUNTIME
case PD_STATE_BIST:
send_bist_cmd(port);
bist_mode_2_rx(port);
break;
+#endif
default:
break;
}
diff --git a/include/usb_pd.h b/include/usb_pd.h
index a84736cdae..081e78c6f3 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -610,7 +610,9 @@ enum pd_states {
PD_STATE_SOFT_RESET,
PD_STATE_HARD_RESET_SEND,
PD_STATE_HARD_RESET_EXECUTE,
+#ifdef CONFIG_COMMON_RUNTIME
PD_STATE_BIST,
+#endif
/* Number of states. Not an actual state. */
PD_STATE_COUNT,