summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
authorTomasz Michalec <tm@semihalf.com>2021-12-10 12:47:20 +0100
committerCommit Bot <commit-bot@chromium.org>2021-12-16 09:58:35 +0000
commit28ceff1f7b9294d49dea37396229fca0644e5216 (patch)
treea841ed928a6488c09dcffb768ef8468d7e097f96 /zephyr
parent36b85b1fb4f5f472c56b321f2e84ea2c7c3a2054 (diff)
downloadchrome-ec-28ceff1f7b9294d49dea37396229fca0644e5216.tar.gz
zephyr: emul: Move TCPC emulators to sub directory
There are few emulators related to TCPC and each other and new are expected to be created. Because of that, zephyr/emul/tcpc/ subdirectory is created to keep these emulators in one place. BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ida4903dd4ab9307f6783af8e14ae99d25ec76edb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3330197 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/emul/CMakeLists.txt6
-rw-r--r--zephyr/emul/Kconfig3
-rw-r--r--zephyr/emul/tcpc/CMakeLists.txt8
-rw-r--r--zephyr/emul/tcpc/Kconfig (renamed from zephyr/emul/Kconfig.tcpci)9
-rw-r--r--zephyr/emul/tcpc/emul_ps8xxx.c (renamed from zephyr/emul/emul_ps8xxx.c)4
-rw-r--r--zephyr/emul/tcpc/emul_tcpci.c (renamed from zephyr/emul/emul_tcpci.c)2
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_common.c (renamed from zephyr/emul/emul_tcpci_partner_common.c)4
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_src.c (renamed from zephyr/emul/emul_tcpci_partner_src.c)6
-rw-r--r--zephyr/include/emul/tcpc/emul_ps8xxx.h (renamed from zephyr/include/emul/emul_ps8xxx.h)0
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci.h (renamed from zephyr/include/emul/emul_tcpci.h)0
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_common.h (renamed from zephyr/include/emul/emul_tcpci_partner_common.h)2
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_src.h (renamed from zephyr/include/emul/emul_tcpci_partner_src.h)4
-rw-r--r--zephyr/test/drivers/src/integration_usb.c10
-rw-r--r--zephyr/test/drivers/src/ps8xxx.c4
-rw-r--r--zephyr/test/drivers/src/tcpci.c2
-rw-r--r--zephyr/test/drivers/src/tcpci_test_common.c2
16 files changed, 37 insertions, 29 deletions
diff --git a/zephyr/emul/CMakeLists.txt b/zephyr/emul/CMakeLists.txt
index beee664bd6..8d96d46029 100644
--- a/zephyr/emul/CMakeLists.txt
+++ b/zephyr/emul/CMakeLists.txt
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+add_subdirectory("tcpc")
+
zephyr_library_sources_ifdef(CONFIG_EMUL_COMMON_I2C emul_common_i2c.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_SMART_BATTERY emul_smart_battery.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_BMA255 emul_bma255.c)
@@ -17,8 +19,4 @@ zephyr_library_sources_ifdef(CONFIG_EMUL_LIS2DW12 emul_lis2dw12.c)
zephyr_library_sources_ifdef(CONFIG_I2C_MOCK i2c_mock.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_ISL923X emul_isl923x.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_CLOCK_CONTROL emul_clock_control.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI emul_tcpci.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_SN5S330 emul_sn5s330.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_PS8XXX emul_ps8xxx.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_SRC emul_tcpci_partner_src.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_COMMON emul_tcpci_partner_common.c)
diff --git a/zephyr/emul/Kconfig b/zephyr/emul/Kconfig
index a6b39405c6..7e1e869b39 100644
--- a/zephyr/emul/Kconfig
+++ b/zephyr/emul/Kconfig
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+rsource "tcpc/Kconfig"
+
config EMUL_COMMON_I2C
bool "Common handler for I2C emulator messages"
help
@@ -72,5 +74,4 @@ rsource "Kconfig.lis2dw12"
rsource "Kconfig.i2c_mock"
rsource "Kconfig.isl923x"
rsource "Kconfig.clock_control"
-rsource "Kconfig.tcpci"
rsource "Kconfig.sn5s330"
diff --git a/zephyr/emul/tcpc/CMakeLists.txt b/zephyr/emul/tcpc/CMakeLists.txt
new file mode 100644
index 0000000000..9dcf8f6024
--- /dev/null
+++ b/zephyr/emul/tcpc/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI emul_tcpci.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_PS8XXX emul_ps8xxx.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_SRC emul_tcpci_partner_src.c)
+zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_COMMON emul_tcpci_partner_common.c)
diff --git a/zephyr/emul/Kconfig.tcpci b/zephyr/emul/tcpc/Kconfig
index 982e067e8a..f4ebbaad9e 100644
--- a/zephyr/emul/Kconfig.tcpci
+++ b/zephyr/emul/tcpc/Kconfig
@@ -13,7 +13,8 @@ menuconfig EMUL_TCPCI
It is used to test tcpci code. It supports reads and writes to all
emulator registers. Generic TCPCI emulator can be used as the base
for specific TCPC device emulator that follow TCPCI specification.
- TCPCI emulator API is available in zephyr/include/emul/emul_tcpci.h
+ TCPCI emulator API is available in
+ zephyr/include/emul/tcpc/emul_tcpci.h
if EMUL_TCPCI
@@ -27,14 +28,14 @@ config EMUL_TCPCI_PARTNER_COMMON
This option is selected automatically by specific TCPCI partner
emulators. Enable common code that can be used by TCPCI partner device
emulators. It covers sending delayed messages. API of common functions
- is available in zephyr/include/emul/emul_common_tcpci_partner.h
+ is available in zephyr/include/emul/tcpc/emul_common_tcpci_partner.h
config EMUL_PS8XXX
bool "Parade PS8XXX emulator"
help
Enable emulator for PS8XXX family of TCPC. This emulator is extenstion
for TCPCI emulator. PS8XXX specific API is available in
- zephyr/include/emul/emul_tcpci.h
+ zephyr/include/emul/tcpc/emul_ps8xxx.h
config EMUL_TCPCI_PARTNER_SRC
bool "USB-C source device emulator"
@@ -42,6 +43,6 @@ config EMUL_TCPCI_PARTNER_SRC
help
Enable USB-C source device emulator which may be attached to TCPCI
emulator. API of source device emulator is available in
- zephyr/include/emul/emul_tcpci_partner_src.h
+ zephyr/include/emul/tcpc/emul_tcpci_partner_src.h
endif # EMUL_TCPCI
diff --git a/zephyr/emul/emul_ps8xxx.c b/zephyr/emul/tcpc/emul_ps8xxx.c
index 0a8cc61fba..5a36f39cd1 100644
--- a/zephyr/emul/emul_ps8xxx.c
+++ b/zephyr/emul/tcpc/emul_ps8xxx.c
@@ -16,8 +16,8 @@ LOG_MODULE_REGISTER(ps8xxx_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "tcpm/tcpci.h"
#include "emul/emul_common_i2c.h"
-#include "emul/emul_ps8xxx.h"
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_ps8xxx.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "driver/tcpm/ps8xxx.h"
diff --git a/zephyr/emul/emul_tcpci.c b/zephyr/emul/tcpc/emul_tcpci.c
index c37ef560a5..4f05744c6b 100644
--- a/zephyr/emul/emul_tcpci.c
+++ b/zephyr/emul/tcpc/emul_tcpci.c
@@ -17,7 +17,7 @@ LOG_MODULE_REGISTER(tcpci_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "tcpm/tcpci.h"
#include "emul/emul_common_i2c.h"
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci.h"
#define TCPCI_DATA_FROM_I2C_EMUL(_emul) \
CONTAINER_OF(CONTAINER_OF(_emul, struct i2c_common_emul_data, emul), \
diff --git a/zephyr/emul/emul_tcpci_partner_common.c b/zephyr/emul/tcpc/emul_tcpci_partner_common.c
index 2fbfcf544f..5164ed2120 100644
--- a/zephyr/emul/emul_tcpci_partner_common.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_common.c
@@ -9,8 +9,8 @@ LOG_MODULE_REGISTER(tcpci_partner, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr.h>
#include "common.h"
-#include "emul/emul_tcpci_partner_common.h"
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci_partner_common.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "usb_pd.h"
/** Check description in emul_common_tcpci_partner.h */
diff --git a/zephyr/emul/emul_tcpci_partner_src.c b/zephyr/emul/tcpc/emul_tcpci_partner_src.c
index ca4be3db0c..f81f3faecc 100644
--- a/zephyr/emul/emul_tcpci_partner_src.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_src.c
@@ -9,9 +9,9 @@ LOG_MODULE_REGISTER(tcpci_src_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr.h>
#include "common.h"
-#include "emul/emul_tcpci_partner_common.h"
-#include "emul/emul_tcpci_partner_src.h"
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci_partner_common.h"
+#include "emul/tcpc/emul_tcpci_partner_src.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "usb_pd.h"
/**
diff --git a/zephyr/include/emul/emul_ps8xxx.h b/zephyr/include/emul/tcpc/emul_ps8xxx.h
index 110def22ec..110def22ec 100644
--- a/zephyr/include/emul/emul_ps8xxx.h
+++ b/zephyr/include/emul/tcpc/emul_ps8xxx.h
diff --git a/zephyr/include/emul/emul_tcpci.h b/zephyr/include/emul/tcpc/emul_tcpci.h
index 3a5a3047d7..3a5a3047d7 100644
--- a/zephyr/include/emul/emul_tcpci.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci.h
diff --git a/zephyr/include/emul/emul_tcpci_partner_common.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h
index 52c6d534fc..b6aef9e3b9 100644
--- a/zephyr/include/emul/emul_tcpci_partner_common.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h
@@ -13,7 +13,7 @@
#define __EMUL_TCPCI_PARTNER_COMMON_H
#include <emul.h>
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "ec_commands.h"
#include "usb_pd.h"
diff --git a/zephyr/include/emul/emul_tcpci_partner_src.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h
index 9ac7744d8d..549afb5cc0 100644
--- a/zephyr/include/emul/emul_tcpci_partner_src.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h
@@ -13,8 +13,8 @@
#define __EMUL_TCPCI_PARTNER_SRC_H
#include <emul.h>
-#include "emul/emul_tcpci_partner_common.h"
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci_partner_common.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "usb_pd.h"
/**
diff --git a/zephyr/test/drivers/src/integration_usb.c b/zephyr/test/drivers/src/integration_usb.c
index 4cd040a1be..854f286c77 100644
--- a/zephyr/test/drivers/src/integration_usb.c
+++ b/zephyr/test/drivers/src/integration_usb.c
@@ -5,14 +5,14 @@
#include <zephyr.h>
#include <ztest.h>
-
-#include "emul/emul_tcpci.h"
-#include "emul/emul_smart_battery.h"
-#include "emul/emul_tcpci_partner_src.h"
#include <drivers/gpio/gpio_emul.h>
+
#include "battery_smart.h"
-#include "tcpm/tcpci.h"
#include "ec_tasks.h"
+#include "emul/emul_smart_battery.h"
+#include "emul/tcpc/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci_partner_src.h"
+#include "tcpm/tcpci.h"
#define TCPCI_EMUL_LABEL DT_NODELABEL(tcpci_emul)
#define BATTERY_ORD DT_DEP_ORD(DT_NODELABEL(battery))
diff --git a/zephyr/test/drivers/src/ps8xxx.c b/zephyr/test/drivers/src/ps8xxx.c
index 6f76ab2be0..a2052b43fc 100644
--- a/zephyr/test/drivers/src/ps8xxx.c
+++ b/zephyr/test/drivers/src/ps8xxx.c
@@ -8,8 +8,8 @@
#include "common.h"
#include "emul/emul_common_i2c.h"
-#include "emul/emul_tcpci.h"
-#include "emul/emul_ps8xxx.h"
+#include "emul/tcpc/emul_tcpci.h"
+#include "emul/tcpc/emul_ps8xxx.h"
#include "timer.h"
#include "i2c.h"
#include "stubs.h"
diff --git a/zephyr/test/drivers/src/tcpci.c b/zephyr/test/drivers/src/tcpci.c
index d67680bacc..be38711307 100644
--- a/zephyr/test/drivers/src/tcpci.c
+++ b/zephyr/test/drivers/src/tcpci.c
@@ -11,7 +11,7 @@
#include "common.h"
#include "ec_tasks.h"
#include "emul/emul_common_i2c.h"
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "hooks.h"
#include "i2c.h"
#include "stubs.h"
diff --git a/zephyr/test/drivers/src/tcpci_test_common.c b/zephyr/test/drivers/src/tcpci_test_common.c
index 57cc35b89c..525c64085e 100644
--- a/zephyr/test/drivers/src/tcpci_test_common.c
+++ b/zephyr/test/drivers/src/tcpci_test_common.c
@@ -8,7 +8,7 @@
#include "common.h"
#include "emul/emul_common_i2c.h"
-#include "emul/emul_tcpci.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "tcpci_test_common.h"
#include "tcpm/tcpci.h"