diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-11-05 14:09:18 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-11 00:11:02 +0000 |
commit | c33a78a3b1ccf4ff8f083f072636efe25809fce0 (patch) | |
tree | 30f04f30597eea3a13b4cb41dc42f5973654401a | |
parent | 5142cdce2d72069c0970fe33b2b7f18bbd5ee469 (diff) | |
download | chrome-ec-c33a78a3b1ccf4ff8f083f072636efe25809fce0.tar.gz |
pd: add print out when we receive SOP', SOP''
Add print when receive various SOP packets for debugging.
BUG=none
BRANCH=samus
TEST=make buildall
Change-Id: I574d0ed6338e880a9ec238f931fc299c22f3786a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/227721
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 15 | ||||
-rw-r--r-- | include/usb_pd.h | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index d49e7a0041..12ea1f18de 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -121,6 +121,10 @@ static const uint8_t dec4b5b[] = { /* Start of Packet sequence : three Sync-1 K-codes, then one Sync-2 K-code */ #define PD_SOP (PD_SYNC1 | (PD_SYNC1<<5) | (PD_SYNC1<<10) | (PD_SYNC2<<15)) +#define PD_SOP_PRIME (PD_SYNC1 | (PD_SYNC1<<5) | \ + (PD_SYNC3<<10) | (PD_SYNC3<<15)) +#define PD_SOP_PRIME_PRIME (PD_SYNC1 | (PD_SYNC3<<5) | \ + (PD_SYNC1<<10) | (PD_SYNC3<<15)) /* Hard Reset sequence : three RST-1 K-codes, then one RST-2 K-code */ #define PD_HARD_RESET (PD_RST1 | (PD_RST1 << 5) |\ @@ -1050,10 +1054,15 @@ static int analyze_rx(int port, uint32_t *payload) /* Find the Start Of Packet sequence */ while (bit > 0) { bit = pd_dequeue_bits(port, bit, 20, &val); - if (val == PD_SOP) + if (val == PD_SOP) { break; - /* TODO: detect SOP with 1 error code */ - /* TODO: detect Hard reset */ + } else if (val == PD_SOP_PRIME) { + CPRINTF("SOP'\n"); + return -5; + } else if (val == PD_SOP_PRIME_PRIME) { + CPRINTF("SOP''\n"); + return -5; + } } if (bit < 0) { msg = "SOP"; diff --git a/include/usb_pd.h b/include/usb_pd.h index 1f6a4e97cb..0f43e0789f 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -603,6 +603,7 @@ enum pd_data_msg_type { /* K-codes for special symbols */ #define PD_SYNC1 0x18 #define PD_SYNC2 0x11 +#define PD_SYNC3 0x06 #define PD_RST1 0x07 #define PD_RST2 0x19 #define PD_EOP 0x0D |