diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2014-05-16 18:04:58 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-21 04:17:58 +0000 |
commit | 2d4a02759dbc4119a2ecac0f7ea6189bc6165cc0 (patch) | |
tree | f89eec761f2930360345b71f55d0db75a1759751 | |
parent | 46c6d3dd1b99452ba2ca254114c70afc0f1cc030 (diff) | |
download | chrome-ec-2d4a02759dbc4119a2ecac0f7ea6189bc6165cc0.tar.gz |
pd: revert slow traces in PD code
The commit 4ba7a15 has modified the traces resulting in a far larger overhead
(mainly due to %T doing dozen? of 64-bit divisions which is an expensive
operation on a Cortex-M0)
as a result the code is now missing communication deadlines.
for lack of a better solution, revert the modification is this file.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=none
TEST=run PD communication between Zinger and Firefly,
and between Fruitpie and Samus and see communication
error rate is going down from 30% failure to less than a few percents.
Change-Id: I902b951450bc200baad722ae5d65053ceda5357b
Reviewed-on: https://chromium-review.googlesource.com/200326
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 0fc93539c0..8addf680d2 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -312,14 +312,13 @@ static int send_validate_message(void *ctxt, uint16_t header, uint8_t cnt, udelay(10); return bit_len; } else { - /* CPRINTF("[%T PD ERR ACK/%d %04x]\n", - id, head); */ + /* CPRINTF("ERR ACK/%d %04x\n", id, head); */ } } } /* we failed all the re-transmissions */ /* TODO: try HardReset */ - CPRINTF("[%T PD TX NO ACK %04x/%d]\n", header, cnt); + CPRINTF("TX NO ACK %04x/%d\n", header, cnt); return -1; } @@ -330,7 +329,7 @@ static int send_control(void *ctxt, int type) bit_len = send_validate_message(ctxt, header, 0, NULL); - CPRINTF("[%T PD CTRL[%d]>%d]\n", type, bit_len); + CPRINTF("CTRL[%d]>%d\n", type, bit_len); return bit_len; } @@ -352,7 +351,7 @@ static int send_source_cap(void *ctxt) bit_len = send_validate_message(ctxt, header, pd_src_pdo_cnt, pd_src_pdo); - CPRINTF("[%T PD srcCAP>%d]\n", bit_len); + CPRINTF("srcCAP>%d\n", bit_len); return bit_len; } @@ -366,7 +365,7 @@ static void send_sink_cap(void *ctxt) bit_len = send_validate_message(ctxt, header, pd_snk_pdo_cnt, pd_snk_pdo); - CPRINTF("[%T PD snkCAP>%d]\n", bit_len); + CPRINTF("snkCAP>%d\n", bit_len); } static int send_request(void *ctxt, uint32_t rdo) @@ -375,7 +374,7 @@ static int send_request(void *ctxt, uint32_t rdo) uint16_t header = PD_HEADER(PD_DATA_REQUEST, pd_role, pd_message_id, 1); bit_len = send_validate_message(ctxt, header, 1, &rdo); - CPRINTF("[%T PD REQ%d>]\n", bit_len); + CPRINTF("REQ%d>\n", bit_len); return bit_len; } @@ -388,7 +387,7 @@ static int send_bist(void *ctxt) uint16_t header = PD_HEADER(PD_DATA_BIST, pd_role, pd_message_id, 1); bit_len = send_validate_message(ctxt, header, 1, &bdo); - CPRINTF("[%T PD BIST>%d]\n", bit_len); + CPRINTF("BIST>%d\n", bit_len); return bit_len; } @@ -410,7 +409,7 @@ static void handle_vdm_request(void *ctxt, int cnt, uint32_t *payload) return; } #endif - CPRINTF("[%T PD Unhandled VDM VID %04x CMD %04x]\n", + CPRINTF("Unhandled VDM VID %04x CMD %04x\n", vid, payload[0] & 0xFFFF); } @@ -454,7 +453,7 @@ static void handle_data_request(void *ctxt, uint16_t head, uint32_t *payload) send_control(ctxt, PD_CTRL_REJECT); break; case PD_DATA_BIST: - CPRINTF("[%T PD BIST not supported]\n"); + CPRINTF("BIST not supported\n"); break; case PD_DATA_SINK_CAP: break; @@ -462,7 +461,7 @@ static void handle_data_request(void *ctxt, uint16_t head, uint32_t *payload) handle_vdm_request(ctxt, cnt, payload); break; default: - CPRINTF("[%T PD unhandled data message type %d]\n", type); + CPRINTF("Unhandled data message type %d\n", type); } } @@ -500,7 +499,7 @@ static void handle_ctrl_request(void *ctxt, uint16_t head, uint32_t *payload) case PD_CTRL_WAIT: case PD_CTRL_SOFT_RESET: default: - CPRINTF("[%T PD unhandled ctrl message type %d]\n", type); + CPRINTF("Unhandled ctrl message type %d\n", type); } } @@ -513,10 +512,10 @@ static void handle_request(void *ctxt, uint16_t head, uint32_t *payload) send_goodcrc(ctxt, PD_HEADER_ID(head)); /* dump received packet content */ - CPRINTF("[%T PD RECV %04x/%d ", head, cnt); + CPRINTF("RECV %04x/%d ", head, cnt); for (p = 0; p < cnt; p++) CPRINTF("[%d]%08x ", p, payload[p]); - CPRINTF("]\n"); + CPRINTF("\n"); if (cnt) handle_data_request(ctxt, head, payload); @@ -606,8 +605,7 @@ static int analyze_rx(uint32_t *payload) msg = "CRC"; if (pcrc != ccrc) bit = PD_ERR_CRC; - /* DEBUG */ - CPRINTF("[%T PD CRC %08x <> %08x]\n", pcrc, crc32_result()); + /* DEBUG */CPRINTF("CRC %08x <> %08x\n", pcrc, crc32_result()); goto packet_err; } @@ -625,7 +623,7 @@ packet_err: if (debug_dump) pd_dump_packet(ctxt, msg); else - CPRINTF("[%T PD RX ERR (%d)]\n", bit); + CPRINTF("RX ERR (%d)\n", bit); return bit; } @@ -639,7 +637,7 @@ static void execute_hard_reset(void) pd_task_state = PD_STATE_SRC_DISCONNECTED; #endif pd_power_supply_reset(); - CPRINTF("[%T PD HARD RESET!]\n"); + CPRINTF("HARD RESET!\n"); } void pd_task(void) |