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>
This commit is contained in:
Alec Berg
2014-11-05 14:09:18 -08:00
committed by chrome-internal-fetch
parent 5142cdce2d
commit c33a78a3b1
2 changed files with 13 additions and 3 deletions

View File

@@ -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";

View File

@@ -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