diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-04-27 18:08:21 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-04-29 20:44:41 +0000 |
commit | 5d28e776c99ed3d4ceda0bfefe0920ca658b8241 (patch) | |
tree | 2b1dbe49fefdc87e58a816805f22d48d8599f180 | |
parent | 0086f8a7802fa9faddc2fda9c348fa88a47c291e (diff) | |
download | chrome-ec-5d28e776c99ed3d4ceda0bfefe0920ca658b8241.tar.gz |
pd: cleanup PD receive error enum
Cleanup PD receive error enum by including RX in name since
we will have a different enum for TX errors.
BUG=none
BRANCH=none
TEST=make -j buildall
Change-Id: I355092e0e73a022acb4a92736374cd2289d324bf
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/267670
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/twinkie/simpletrace.c | 8 | ||||
-rw-r--r-- | chip/stm32/usb_pd_phy.c | 4 | ||||
-rw-r--r-- | common/usb_pd_protocol.c | 10 | ||||
-rw-r--r-- | include/usb_pd.h | 14 |
4 files changed, 18 insertions, 18 deletions
diff --git a/board/twinkie/simpletrace.c b/board/twinkie/simpletrace.c index f3ff5d3487..5e61dabf70 100644 --- a/board/twinkie/simpletrace.c +++ b/board/twinkie/simpletrace.c @@ -147,13 +147,13 @@ static void print_packet(int head, uint32_t *payload) ccputs("\n"); } -static void print_error(enum pd_errors err) +static void print_error(enum pd_rx_errors err) { - if (err == PD_ERR_INVAL) + if (err == PD_RX_ERR_INVAL) ccprintf("%T TMOUT\n"); - else if (err == PD_ERR_HARD_RESET) + else if (err == PD_RX_ERR_HARD_RESET) ccprintf("%T HARD-RST\n"); - else if (err == -5) + else if (err == PD_RX_ERR_UNSUPPORTED_SOP) ccprintf("%T SOP*\n"); else ccprintf("ERR %d\n", err); diff --git a/chip/stm32/usb_pd_phy.c b/chip/stm32/usb_pd_phy.c index 6c53281346..4fd495d769 100644 --- a/chip/stm32/usb_pd_phy.c +++ b/chip/stm32/usb_pd_phy.c @@ -180,9 +180,9 @@ int pd_find_preamble(int port) if (all == 0x36db6db6) return bit - 1; /* should be SYNC-1 */ if (all == 0xF33F3F3F) - return PD_ERR_HARD_RESET; /* got HARD-RESET */ + return PD_RX_ERR_HARD_RESET; /* got HARD-RESET */ if (all == 0x3c7fe0ff) - return PD_ERR_CABLE_RESET; /* got CABLE-RESET */ + return PD_RX_ERR_CABLE_RESET; /* got CABLE-RESET */ } return -1; } diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index dc4986d2cc..9cf7340d54 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -1449,7 +1449,7 @@ int pd_analyze_rx(int port, uint32_t *payload) /* Detect preamble */ bit = pd_find_preamble(port); - if (bit == PD_ERR_HARD_RESET || bit == PD_ERR_CABLE_RESET) { + if (bit == PD_RX_ERR_HARD_RESET || bit == PD_RX_ERR_CABLE_RESET) { /* Hard reset or cable reset */ return bit; } else if (bit < 0) { @@ -1464,10 +1464,10 @@ int pd_analyze_rx(int port, uint32_t *payload) break; } else if (val == PD_SOP_PRIME) { CPRINTF("SOP'\n"); - return PD_ERR_UNSUPPORTED_SOP; + return PD_RX_ERR_UNSUPPORTED_SOP; } else if (val == PD_SOP_PRIME_PRIME) { CPRINTF("SOP''\n"); - return PD_ERR_UNSUPPORTED_SOP; + return PD_RX_ERR_UNSUPPORTED_SOP; } } if (bit < 0) { @@ -1507,7 +1507,7 @@ int pd_analyze_rx(int port, uint32_t *payload) if (bit < 0 || pcrc != ccrc) { msg = "CRC"; if (pcrc != ccrc) - bit = PD_ERR_CRC; + bit = PD_RX_ERR_CRC; if (debug_level >= 1) CPRINTF("CRC%d %08x <> %08x\n", port, pcrc, ccrc); goto packet_err; @@ -1914,7 +1914,7 @@ void pd_task(void) pd_rx_complete(port); if (head > 0) handle_request(port, head, payload); - else if (head == PD_ERR_HARD_RESET) + else if (head == PD_RX_ERR_HARD_RESET) execute_hard_reset(port); } else { incoming_packet = 0; diff --git a/include/usb_pd.h b/include/usb_pd.h index 478f840193..6eaef7882f 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -13,13 +13,13 @@ /* PD Host command timeout */ #define PD_HOST_COMMAND_TIMEOUT_US SECOND -enum pd_errors { - PD_ERR_INVAL = -1, /* Invalid packet */ - PD_ERR_HARD_RESET = -2, /* Got a Hard-Reset packet */ - PD_ERR_CRC = -3, /* CRC mismatch */ - PD_ERR_ID = -4, /* Invalid ID number */ - PD_ERR_UNSUPPORTED_SOP = -5, /* Unsupported SOP */ - PD_ERR_CABLE_RESET = -6 /* Got a Cable-Reset packet */ +enum pd_rx_errors { + PD_RX_ERR_INVAL = -1, /* Invalid packet */ + PD_RX_ERR_HARD_RESET = -2, /* Got a Hard-Reset packet */ + PD_RX_ERR_CRC = -3, /* CRC mismatch */ + PD_RX_ERR_ID = -4, /* Invalid ID number */ + PD_RX_ERR_UNSUPPORTED_SOP = -5, /* Unsupported SOP */ + PD_RX_ERR_CABLE_RESET = -6 /* Got a Cable-Reset packet */ }; /* incoming packet event (for the USB PD task) */ |