summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-07-18 08:13:21 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-07-18 14:26:16 -0700
commitdc4c34d13702c2b759646ab481282688e0fb6e16 (patch)
tree717db7a620036611699d0d1c40b4121774bd4d7e
parent94bba42b650f1fac9ec8cdc69df2c82e5bf01f54 (diff)
downloadchrome-ec-dc4c34d13702c2b759646ab481282688e0fb6e16.tar.gz
ec_commands: Add define for maximum number of PD ports
It's helpful for the host to know the maximum number of PD ports that can possibly exist in a cros-ec device. BUG=chromium:741711 BRANCH=None TEST=`make buildall -j` Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ic8a9eb22dc0bf51c8f5e1dfe380ca8f187481070 Reviewed-on: https://chromium-review.googlesource.com/576138 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--common/usb_pd_protocol.c2
-rw-r--r--include/ec_commands.h3
2 files changed, 5 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index bb09a44819..81e1bd2e8a 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -31,6 +31,8 @@
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+BUILD_ASSERT(CONFIG_USB_PD_PORT_COUNT <= EC_USB_PD_MAX_PORTS);
+
/*
* Debug log level - higher number == more log
* Level 0: Log state transitions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 3bc98ae31a..084191c9ca 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -3912,6 +3912,9 @@ struct __ec_align1 ec_response_usb_pd_control_v1 {
#define EC_CMD_USB_PD_PORTS 0x0102
+/* Maximum number of PD ports on a device, num_ports will be <= this */
+#define EC_USB_PD_MAX_PORTS 8
+
struct __ec_align1 ec_response_usb_pd_ports {
uint8_t num_ports;
};