emul: Cleanup emul directory

Avoid implementations in the subsys emul directory to keep the directory
focused on emulator subsystem instead of consumers. Consumers should be
implemented side-by-side to their drivers

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2023-01-24 10:12:18 -07:00 committed by Carles Cufí
parent a6326f1f7f
commit 8ac822e69c
13 changed files with 39 additions and 30 deletions

View file

@ -13,3 +13,5 @@ zephyr_library_sources_ifdef(CONFIG_EEPROM_EMULATOR eeprom_emulator.c)
zephyr_library_sources_ifdef(CONFIG_EEPROM_TMP116 eeprom_tmp116.c)
zephyr_library_sources_ifdef(CONFIG_EEPROM_XEC eeprom_mchp_xec.c)
zephyr_library_sources_ifdef(CONFIG_EEPROM_FAKE eeprom_fake.c)
zephyr_library_sources_ifdef(CONFIG_EEPROM_AT2X_EMUL eeprom_at2x_emul.c)

View file

@ -41,6 +41,27 @@ config EEPROM_AT2X
Enable support for Atmel AT2x (and compatible) I2C/SPI
EEPROMs.
config EEPROM_AT2X_EMUL
bool "Emulate an Atmel AT24 I2C chip"
depends on EMUL
help
This is an emulator for the Atmel AT24 series of I2C-attached EEPROMs.
At present it only supports 8-bit addressing. The size of the EEPROM
is given by the 'size' property. See the binding for further details.
config EMUL_EEPROM_AT2X
bool "[DEPRECATED] Emulate an Atmel AT24 I2C chip"
select EEPROM_AT2X_EMUL
select DEPRECATED
help
This is an emulator for the Atmel AT24 series of I2C-attached EEPROMs.
At present it only supports 8-bit addressing. The size of the EEPROM
is given by the 'size' property. See the binding for further details.
[DEPRECATED] Select EEPROM_AT2X_EMUL instead.
config EEPROM_AT24
bool "Atmel AT24 (and compatible) I2C EEPROM support"
default y

View file

@ -1,3 +1,6 @@
zephyr_library()
zephyr_library_sources(sbs_gauge.c)
zephyr_include_directories_ifdef(CONFIG_EMUL_SBS_GAUGE .)
zephyr_library_sources_ifdef(CONFIG_EMUL_SBS_GAUGE ../../sensor/sbs_gauge/emul_sbs_gauge.c)

View file

@ -1,3 +1,6 @@
zephyr_library()
zephyr_library_sources(sbs_gauge.c)
zephyr_include_directories_ifdef(CONFIG_EMUL_SBS_GAUGE .)
zephyr_library_sources_ifdef(CONFIG_EMUL_SBS_GAUGE emul_sbs_gauge.c)

View file

@ -8,3 +8,10 @@ config SBS_GAUGE
select I2C
help
Enable I2C-based/SMBus-based driver for a Smart Battery Fuel Gauge.
config EMUL_SBS_GAUGE
bool "Emulate an SBS 1.1 compliant smart battery fuel gauge"
depends on EMUL
help
It provides readings which follow a simple sequence, thus allowing
test code to check that things are working as expected.

View file

@ -21,7 +21,7 @@ LOG_MODULE_REGISTER(sbs_sbs_gauge);
#include <zephyr/drivers/i2c_emul.h>
#include <zephyr/sys/byteorder.h>
#include <sbs_gauge.h>
#include "sbs_gauge.h"
/** Run-time data used by the emulator */
struct sbs_gauge_emul_data {

View file

@ -4,5 +4,4 @@ zephyr_library()
zephyr_library_sources_ifdef(CONFIG_EMUL emul.c)
add_subdirectory(i2c)
add_subdirectory(espi)

View file

@ -34,13 +34,6 @@ module = EMUL
module-str = emul
source "subsys/logging/Kconfig.template.log_config"
config EMUL_SBS_GAUGE
bool "Emulate an SBS 1.1 compliant smart battery fuel gauge"
help
It provides readings which follow a simple sequence, thus allowing
test code to check that things are working as expected.
source "subsys/emul/i2c/Kconfig"
source "subsys/emul/espi/Kconfig"
endif

View file

@ -1,8 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
# Once we have more than 10 devices we should consider splitting them into
# subdirectories to match the drivers/ structure.
zephyr_library_sources_ifdef(CONFIG_EMUL_EEPROM_AT2X emul_atmel_at24.c)
zephyr_include_directories_ifdef(CONFIG_EMUL_SBS_GAUGE ${ZEPHYR_BASE}/drivers/sensor/sbs_gauge)
zephyr_library_sources_ifdef(CONFIG_EMUL_SBS_GAUGE emul_sbs_gauge.c)

View file

@ -1,12 +0,0 @@
# Configuration options for I2C emulators
# Copyright 2020 Google LLC
# SPDX-License-Identifier: Apache-2.0
config EMUL_EEPROM_AT2X
bool "Emulate an Atmel AT24 I2C chip"
help
This is an emulator for the Atmel AT24 series of I2C-attached EEPROMs.
At present it only supports 8-bit addressing. The size of the EEPROM
is given by the 'size' property. See the binding for further details.

View file

@ -3,4 +3,4 @@
CONFIG_EMUL=y
CONFIG_EEPROM_INIT_PRIORITY=75
CONFIG_EMUL_EEPROM_AT2X=y
CONFIG_EEPROM_AT2X_EMUL=y

View file

@ -3,5 +3,6 @@ CONFIG_ZTEST_NEW_API=y
CONFIG_I2C=y
CONFIG_TEST_USERSPACE=y
CONFIG_LOG=y
CONFIG_SENSOR=y
CONFIG_FUEL_GAUGE=y