diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-01-14 08:54:31 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-14 23:13:03 +0000 |
commit | 389ef0f90ff9318ced905d7a1ed8c025953aebc3 (patch) | |
tree | 91f4d33033f411f00b65d37878e7f7bee70b44fa /common | |
parent | 03f66537a2bdd039341b03b073c63c6554b8cc10 (diff) | |
download | chrome-ec-389ef0f90ff9318ced905d7a1ed8c025953aebc3.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
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>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_protocol.c | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 0b6f82e1f6..56b9132153 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) { @@ -2655,10 +2660,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; } |