summaryrefslogtreecommitdiff
path: root/zephyr/include/emul
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/include/emul')
-rw-r--r--zephyr/include/emul/emul_bb_retimer.h89
-rw-r--r--zephyr/include/emul/emul_bma255.h191
-rw-r--r--zephyr/include/emul/emul_bmi.h431
-rw-r--r--zephyr/include/emul/emul_common_i2c.h369
-rw-r--r--zephyr/include/emul/emul_lis2dw12.h48
-rw-r--r--zephyr/include/emul/emul_ln9310.h73
-rw-r--r--zephyr/include/emul/emul_pi3usb9201.h55
-rw-r--r--zephyr/include/emul/emul_smart_battery.h193
-rw-r--r--zephyr/include/emul/emul_syv682x.h143
-rw-r--r--zephyr/include/emul/emul_tcs3400.h156
-rw-r--r--zephyr/include/emul/i2c_mock.h35
11 files changed, 0 insertions, 1783 deletions
diff --git a/zephyr/include/emul/emul_bb_retimer.h b/zephyr/include/emul/emul_bb_retimer.h
deleted file mode 100644
index c63cc651c0..0000000000
--- a/zephyr/include/emul/emul_bb_retimer.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Backend API for BB retimer emulator
- */
-
-#ifndef __EMUL_BB_RETIMER_H
-#define __EMUL_BB_RETIMER_H
-
-#include <emul.h>
-#include <drivers/i2c.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief BB retimer emulator backend API
- * @defgroup bb_emul BB retimer emulator
- * @{
- *
- * BB retimer emulator supports access to all its registers using I2C messages.
- * It supports not four bytes writes by padding zeros (the same as real
- * device), but show warning in that case.
- * Application may alter emulator state:
- *
- * - define a Device Tree overlay file to set default vendor ID and which
- * inadvisable driver behaviour should be treated as errors
- * - call @ref bb_emul_set_reg and @ref bb_emul_get_reg to set and get value
- * of BB retimers registers
- * - call bb_emul_set_err_* to change emulator behaviour on inadvisable driver
- * behaviour
- * - call functions from emul_common_i2c.h to setup custom handlers for I2C
- * messages
- */
-
-/**
- * @brief Get pointer to BB retimer emulator using device tree order number.
- *
- * @param ord Device tree order number obtained from DT_DEP_ORD macro
- *
- * @return Pointer to BB retimer emulator
- */
-struct i2c_emul *bb_emul_get(int ord);
-
-/**
- * @brief Set value of given register of BB retimer
- *
- * @param emul Pointer to BB retimer emulator
- * @param reg Register address which value will be changed
- * @param val New value of the register
- */
-void bb_emul_set_reg(struct i2c_emul *emul, int reg, uint32_t val);
-
-/**
- * @brief Get value of given register of BB retimer
- *
- * @param emul Pointer to BB retimer emulator
- * @param reg Register address
- *
- * @return Value of the register
- */
-uint32_t bb_emul_get_reg(struct i2c_emul *emul, int reg);
-
-/**
- * @brief Set if error should be generated when read only register is being
- * written
- *
- * @param emul Pointer to BB retimer emulator
- * @param set Check for this error
- */
-void bb_emul_set_err_on_ro_write(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when reserved bits of register are
- * not set to 0 on write I2C message
- *
- * @param emul Pointer to BB retimer emulator
- * @param set Check for this error
- */
-void bb_emul_set_err_on_rsvd_write(struct i2c_emul *emul, bool set);
-
-/**
- * @}
- */
-
-#endif /* __EMUL_BB_RETIMER */
diff --git a/zephyr/include/emul/emul_bma255.h b/zephyr/include/emul/emul_bma255.h
deleted file mode 100644
index b2f71df88b..0000000000
--- a/zephyr/include/emul/emul_bma255.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Backend API for BMA255 emulator
- */
-
-#ifndef __EMUL_BMA255_H
-#define __EMUL_BMA255_H
-
-#include <emul.h>
-#include <drivers/i2c.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief BMA255 emulator backend API
- * @defgroup bma_emul BMA255 emulator
- * @{
- *
- * BMA255 emulator supports responses to all write and read I2C messages.
- * Accelerometer registers are obtained from internal emulator state, range
- * register and offset. Only fast compensation is supported by default handler.
- * Registers backed in NVM are fully supported (GP0, GP1, offset). For proper
- * support for interrupts and FIFO, user needs to use custom handlers.
- * Application may alter emulator state:
- *
- * - define a Device Tree overlay file to set default NVM content, default
- * static accelerometer value and which inadvisable driver behaviour should
- * be treated as errors
- * - call @ref bma_emul_set_reg and @ref bma_emul_get_reg to set and get value
- * of BMA255 registers
- * - call @ref bma_emul_set_off and @ref bma_emul_set_off to set and get
- * internal offset value
- * - call @ref bma_emul_set_acc and @ref bma_emul_set_acc to set and get
- * accelerometer value
- * - call bma_emul_set_err_* to change emulator behaviour on inadvisable driver
- * behaviour
- * - call functions from emul_common_i2c.h to setup custom handlers for I2C
- * messages
- */
-
-/**
- * Axis argument used in @ref bma_emul_set_acc @ref bma_emul_get_acc
- * @ref bma_emul_set_off and @ref bma_emul_get_off
- */
-#define BMA_EMUL_AXIS_X 0
-#define BMA_EMUL_AXIS_Y 1
-#define BMA_EMUL_AXIS_Z 2
-
-/**
- * Acceleration 1g in internal emulator units. It is helpful for using
- * functions @ref bma_emul_set_acc @ref bma_emul_get_acc
- * @ref bma_emul_set_off and @ref bma_emul_get_off
- */
-#define BMA_EMUL_1G BIT(10)
-
-/**
- * @brief Get pointer to BMA255 emulator using device tree order number.
- *
- * @param ord Device tree order number obtained from DT_DEP_ORD macro
- *
- * @return Pointer to BMA255 emulator
- */
-struct i2c_emul *bma_emul_get(int ord);
-
-/**
- * @brief Set value of given register of BMA255
- *
- * @param emul Pointer to BMA255 emulator
- * @param reg Register address which value will be changed
- * @param val New value of the register
- */
-void bma_emul_set_reg(struct i2c_emul *emul, int reg, uint8_t val);
-
-/**
- * @brief Get value of given register of BMA255
- *
- * @param emul Pointer to BMA255 emulator
- * @param reg Register address
- *
- * @return Value of the register
- */
-uint8_t bma_emul_get_reg(struct i2c_emul *emul, int reg);
-
-/**
- * @brief Get internal value of offset for given axis
- *
- * @param emul Pointer to BMA255 emulator
- * @param axis Axis to access: 0 - X, 1 - Y, 2 - Z
- *
- * @return Offset of given axis. LSB is 0.97mg
- */
-int16_t bma_emul_get_off(struct i2c_emul *emul, int axis);
-
-/**
- * @brief Set internal value of offset for given axis
- *
- * @param emul Pointer to BMA255 emulator
- * @param axis Axis to access: 0 - X, 1 - Y, 2 - Z
- * @param val New value of offset. LSB is 0.97mg
- */
-void bma_emul_set_off(struct i2c_emul *emul, int axis, int16_t val);
-
-/**
- * @brief Get internal value of accelerometer for given axis
- *
- * @param emul Pointer to BMA255 emulator
- * @param axis Axis to access: 0 - X, 1 - Y, 2 - Z
- *
- * @return Acceleration of given axis. LSB is 0.97mg
- */
-int16_t bma_emul_get_acc(struct i2c_emul *emul, int axis);
-
-/**
- * @brief Set internal value of accelerometr for given axis
- *
- * @param emul Pointer to BMA255 emulator
- * @param axis Axis to access: 0 - X, 1 - Y, 2 - Z
- * @param val New value of accelerometer axis. LSB is 0.97mg
- */
-void bma_emul_set_acc(struct i2c_emul *emul, int axis, int16_t val);
-
-/**
- * @brief Set if error should be generated when fast compensation is triggered
- * when not ready flag is set
- *
- * @param emul Pointer to BMA255 emulator
- * @param set Check for this error
- */
-void bma_emul_set_err_on_cal_nrdy(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when fast compensation is triggered
- * when range is not 2G
- *
- * @param emul Pointer to BMA255 emulator
- * @param set Check for this error
- */
-void bma_emul_set_err_on_cal_bad_range(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when read only register is being
- * written
- *
- * @param emul Pointer to BMA255 emulator
- * @param set Check for this error
- */
-void bma_emul_set_err_on_ro_write(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when reserved bits of register are
- * not set to 0 on write I2C message
- *
- * @param emul Pointer to BMA255 emulator
- * @param set Check for this error
- */
-void bma_emul_set_err_on_rsvd_write(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when MSB register is accessed before
- * LSB register
- *
- * @param emul Pointer to BMA255 emulator
- * @param set Check for this error
- */
-void bma_emul_set_err_on_msb_first(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Function calculate register that should be accessed when I2C message
- * started from @p reg register and now byte number @p bytes is handled.
- * This function is used in I2C common emulator code and can be used in
- * custom user functions.
- *
- * @param emul Pointer to BMA255 emulator
- * @param reg Starting register
- * @param bytes Number of bytes already processed in the I2C message handler
- * @param read If current I2C message is read
- *
- * @retval Register address that should be accessed
- */
-int bma_emul_access_reg(struct i2c_emul *emul, int reg, int bytes, bool read);
-
-/**
- * @}
- */
-
-#endif /* __EMUL_BMA255_H */
diff --git a/zephyr/include/emul/emul_bmi.h b/zephyr/include/emul/emul_bmi.h
deleted file mode 100644
index 9eac9c3f85..0000000000
--- a/zephyr/include/emul/emul_bmi.h
+++ /dev/null
@@ -1,431 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Backend API for BMI emulator
- */
-
-#ifndef __EMUL_BMI_H
-#define __EMUL_BMI_H
-
-#include <emul.h>
-#include <drivers/i2c.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief BMI emulator backend API
- * @defgroup bmi_emul BMI emulator
- * @{
- *
- * BMI emulator supports responses to all write and read I2C messages.
- * Accelerometer and gyroscope registers are obtained from internal emulator
- * state, range register and offset. FIFO is fully simulated. Emulator can be
- * extended to support more models of BMI.
- * Application may alter emulator state:
- *
- * - define a Device Tree overlay file to set which inadvisable driver behaviour
- * should be treated as errors and which model is emulated
- * - call @ref bmi_emul_set_reg and @ref bmi_emul_get_reg to set and get value
- * of BMI registers
- * - call @ref bmi_emul_set_off and @ref bmi_emul_get_off to set and get
- * internal offset value
- * - call @ref bmi_emul_set_value and @ref bmi_emul_get_value to set and get
- * accelerometer or gyroscope value
- * - call bmi_emul_set_err_* to change emulator behaviour on inadvisable driver
- * behaviour
- * - call @ref bmi_emul_simulate_cmd_exec_time to enable or disable simulation
- * of command execution time
- * - call @ref bmi_emul_append_frame to add frame to FIFO
- * - call @reg bmi_emul_set_skipped_frames to generate skip frame on next access
- * to FIFO
- * - call functions from emul_common_i2c.h to setup custom handlers for I2C
- * messages
- */
-
-/**
- * Axis argument used in @ref bmi_emul_set_value @ref bmi_emul_get_value
- * @ref bmi_emul_set_off and @ref bmi_emul_get_off
- */
-enum bmi_emul_axis {
- BMI_EMUL_ACC_X,
- BMI_EMUL_ACC_Y,
- BMI_EMUL_ACC_Z,
- BMI_EMUL_GYR_X,
- BMI_EMUL_GYR_Y,
- BMI_EMUL_GYR_Z,
-};
-
-/** BMI emulator models */
-#define BMI_EMUL_160 1
-#define BMI_EMUL_260 2
-
-/** Last register supported by emulator */
-#define BMI_EMUL_MAX_REG 0x80
-/** Maximum number of registers that can be backed in NVM */
-#define BMI_EMUL_MAX_NVM_REGS 10
-
-/** Headers used in FIFO frames */
-#define BMI_EMUL_FIFO_HEAD_SKIP 0x40
-#define BMI_EMUL_FIFO_HEAD_TIME 0x44
-#define BMI_EMUL_FIFO_HEAD_CONFIG 0x48
-#define BMI_EMUL_FIFO_HEAD_EMPTY 0x80
-#define BMI_EMUL_FIFO_HEAD_DATA 0x80
-#define BMI_EMUL_FIFO_HEAD_DATA_MAG BIT(4)
-#define BMI_EMUL_FIFO_HEAD_DATA_GYR BIT(3)
-#define BMI_EMUL_FIFO_HEAD_DATA_ACC BIT(2)
-#define BMI_EMUL_FIFO_HEAD_DATA_TAG_MASK 0x03
-
-/**
- * Acceleration 1g in internal emulator units. It is helpful for using
- * functions @ref bmi_emul_set_value @ref bmi_emul_get_value
- * @ref bmi_emul_set_off and @ref bmi_emul_get_off
- */
-#define BMI_EMUL_1G BIT(14)
-/**
- * Gyroscope 125°/s in internal emulator units. It is helpful for using
- * functions @ref bmi_emul_set_value @ref bmi_emul_get_value
- * @ref bmi_emul_set_off and @ref bmi_emul_get_off
- */
-#define BMI_EMUL_125_DEG_S BIT(15)
-
-/** Type of frames that can be added to the emulator frames list */
-#define BMI_EMUL_FRAME_CONFIG BIT(0)
-#define BMI_EMUL_FRAME_ACC BIT(1)
-#define BMI_EMUL_FRAME_MAG BIT(2)
-#define BMI_EMUL_FRAME_GYR BIT(3)
-
-/**
- * Code returned by model specific handle_read and handle_write functions, when
- * RO register is accessed on write or WO register is accessed on read
- */
-#define BMI_EMUL_ACCESS_E 1
-
-/** Structure used to describe single FIFO frame */
-struct bmi_emul_frame {
- /** Type of frame */
- uint8_t type;
- /** Tag added to data frame */
- uint8_t tag;
- /** Value used in config frame */
- uint8_t config;
- /** Accelerometer sensor values in internal emulator units */
- int32_t acc_x;
- int32_t acc_y;
- int32_t acc_z;
- /** Gyroscope sensor values in internal emulator units */
- int32_t gyr_x;
- int32_t gyr_y;
- int32_t gyr_z;
- /** Magnetometer/other sensor values in internal emulator units */
- int32_t mag_x;
- int32_t mag_y;
- int32_t mag_z;
- int32_t rhall;
-
- /** Pointer to next frame or NULL */
- struct bmi_emul_frame *next;
-};
-
-/** Structure describing specific BMI model */
-struct bmi_emul_type_data {
- /** Indicate if time frame should follow config frame */
- bool sensortime_follow_config_frame;
-
- /**
- * @brief Compute register address that acctually will be accessed, when
- * selected register is @p reg and there was @p byte handled in
- * the current I2C message
- *
- * @param emul Pointer to BMI emulator
- * @param reg Selected register
- * @param byte Number of handled bytes in the current I2C message
- * @param read If current I2C message is read
- *
- * @return Register address that will be accessed
- */
- int (*access_reg)(struct i2c_emul *emul, int reg, int byte, bool read);
-
- /**
- * @brief Model specific write function. It should modify state of
- * emulator if required.
- *
- * @param regs Pointer to array of emulator's registers
- * @param emul Pointer to BMI emulator
- * @param reg Selected register
- * @param byte Number of handled bytes in this write command
- * @param val Value that is being written
- *
- * @return 0 on success
- * @return BMI_EMUL_ACCESS_E on RO register access
- * @return other on error
- */
- int (*handle_write)(uint8_t *regs, struct i2c_emul *emul, int reg,
- int byte, uint8_t val);
- /**
- * @brief Model specific read function. It should modify state of
- * emulator if required. @p buf should be set to response value.
- *
- * @param regs Pointer to array of emulator's registers
- * @param emul Pointer to BMI emulator
- * @param reg Selected register
- * @param byte Byte which is accessed during block read
- * @param buf Pointer where read byte should be stored
- *
- * @return 0 on success
- * @return BMI_EMUL_ACCESS_E on WO register access
- * @return other on error
- */
- int (*handle_read)(uint8_t *regs, struct i2c_emul *emul, int reg,
- int byte, char *buf);
- /**
- * @brief Model specific reset function. It should modify state of
- * emulator to imitate after reset conditions.
- *
- * @param regs Pointer to array of emulator's registers
- * @param emul Pointer to BMI emulator
- */
- void (*reset)(uint8_t *regs, struct i2c_emul *emul);
-
- /** Array of reserved bits mask for each register */
- const uint8_t *rsvd_mask;
-
- /** Array of registers that are backed in NVM */
- const int *nvm_reg;
- /** Number of registers backed in NVM */
- int nvm_len;
-
- /** Gyroscope X axis register */
- int gyr_off_reg;
- /** Accelerometer X axis register */
- int acc_off_reg;
- /** Gyroscope 9 and 8 bits register */
- int gyr98_off_reg;
-};
-
-/**
- * @brief Get BMI160 model specific structure.
- *
- * @return Pointer to BMI160 specific structure
- */
-const struct bmi_emul_type_data *get_bmi160_emul_type_data(void);
-/**
- * @brief Get BMI260 model specific structure.
- *
- * @return Pointer to BMI260 specific structure
- */
-const struct bmi_emul_type_data *get_bmi260_emul_type_data(void);
-
-/**
- * @brief Get pointer to BMI emulator using device tree order number.
- *
- * @param ord Device tree order number obtained from DT_DEP_ORD macro
- *
- * @return Pointer to BMI emulator
- */
-struct i2c_emul *bmi_emul_get(int ord);
-
-/**
- * @brief Set value of given register of BMI
- *
- * @param emul Pointer to BMI emulator
- * @param reg Register address which value will be changed
- * @param val New value of the register
- */
-void bmi_emul_set_reg(struct i2c_emul *emul, int reg, uint8_t val);
-
-/**
- * @brief Get value of given register of BMI
- *
- * @param emul Pointer to BMI emulator
- * @param reg Register address
- *
- * @return Value of the register
- */
-uint8_t bmi_emul_get_reg(struct i2c_emul *emul, int reg);
-
-/**
- * @brief Get internal value of offset for given axis and sensor
- *
- * @param emul Pointer to BMI emulator
- * @param axis Axis to access
- *
- * @return Offset of given axis. LSB for accelerometer is 0.061mg and for
- * gyroscope is 0.0037°/s.
- */
-int16_t bmi_emul_get_off(struct i2c_emul *emul, enum bmi_emul_axis axis);
-
-/**
- * @brief Set internal value of offset for given axis and sensor
- *
- * @param emul Pointer to BMI emulator
- * @param axis Axis to access
- * @param val New value of given axis. LSB for accelerometer is 0.061mg and for
- * gyroscope is 0.0037°/s.
- */
-void bmi_emul_set_off(struct i2c_emul *emul, enum bmi_emul_axis axis,
- int16_t val);
-
-/**
- * @brief Get internal value of sensor for given axis
- *
- * @param emul Pointer to BMI emulator
- * @param axis Axis to access
- *
- * @return Sensor value of given axis. LSB for accelerometer is 0.061mg and for
- * gyroscope is 0.0037°/s.
- */
-int32_t bmi_emul_get_value(struct i2c_emul *emul, enum bmi_emul_axis axis);
-
-/**
- * @brief Set internal value of sensor for given axis
- *
- * @param emul Pointer to BMI emulator
- * @param axis Axis to access
- * @param val New value of given axis. LSB for accelerometer is 0.061mg and for
- * gyroscope is 0.0037°/s.
- */
-void bmi_emul_set_value(struct i2c_emul *emul, enum bmi_emul_axis axis,
- int32_t val);
-
-/**
- * @brief Set if error should be generated when read only register is being
- * written
- *
- * @param emul Pointer to BMI emulator
- * @param set Check for this error
- */
-void bmi_emul_set_err_on_ro_write(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when reserved bits of register are
- * not set to 0 on write I2C message
- *
- * @param emul Pointer to BMI emulator
- * @param set Check for this error
- */
-void bmi_emul_set_err_on_rsvd_write(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when write only register is read
- *
- * @param emul Pointer to BMI emulator
- * @param set Check for this error
- */
-void bmi_emul_set_err_on_wo_read(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if effect of simulated command should take place after simulated
- * time pass from issuing command.
- *
- * @param emul Pointer to BMI emulator
- * @param set Simulate command execution time
- */
-void bmi_emul_simulate_cmd_exec_time(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set number of skipped frames. It will generate skip frame on next
- * access to FIFO. After that number of skipped frames is reset to 0.
- *
- * @param emul Pointer to BMI emulator
- * @param skip Number of skipped frames
- */
-void bmi_emul_set_skipped_frames(struct i2c_emul *emul, uint8_t skip);
-
-/**
- * @brief Clear all FIFO frames, set current frame to empty and reset fifo_skip
- * counter
- *
- * @param emul Pointer to BMI emulator
- * @param tag_time Indicate if sensor time should be included in empty frame
- * @param header Indicate if header should be included in frame
- */
-void bmi_emul_flush_fifo(struct i2c_emul *emul, bool tag_time, bool header);
-
-/**
- * @brief Restore registers backed by NVM, reset sensor time and flush FIFO
- *
- * @param emul Pointer to BMI emulator
- */
-void bmi_emul_reset_common(struct i2c_emul *emul, bool tag_time, bool header);
-
-/**
- * @brief Set command end time to @p time ms from now
- *
- * @param emul Pointer to BMI emulator
- * @param time After this amount of ms command should end
- */
-void bmi_emul_set_cmd_end_time(struct i2c_emul *emul, int time);
-
-/**
- * @brief Check if command should end
- *
- * @param emul Pointer to BMI emulator
- */
-bool bmi_emul_is_cmd_end(struct i2c_emul *emul);
-
-/**
- * @brief Append FIFO @p frame to the emulator list of frames. It can be read
- * using I2C interface.
- *
- * @param emul Pointer to BMI emulator
- * @param frame Pointer to new FIFO frame. Pointed data has to be valid while
- * emulator may use this frame (until flush of FIFO or reading
- * it out through I2C)
- */
-void bmi_emul_append_frame(struct i2c_emul *emul, struct bmi_emul_frame *frame);
-
-/**
- * @brief Get length of all frames that are on the emulator list of frames.
- *
- * @param emul Pointer to BMI emulator
- * @param tag_time Indicate if sensor time should be included in empty frame
- * @param header Indicate if header should be included in frame
- */
-uint16_t bmi_emul_fifo_len(struct i2c_emul *emul, bool tag_time, bool header);
-
-/**
- * @brief Get next byte that should be returned on FIFO data access.
- *
- * @param emul Pointer to BMI emulator
- * @param byte Which byte of block read command is currently handled
- * @param tag_time Indicate if sensor time should be included in empty frame
- * @param header Indicate if header should be included in frame
- * @param acc_shift How many bits should be right shifted from accelerometer
- * data
- * @param gyr_shift How many bits should be right shifted from gyroscope data
- *
- * @return FIFO data byte
- */
-uint8_t bmi_emul_get_fifo_data(struct i2c_emul *emul, int byte,
- bool tag_time, bool header, int acc_shift,
- int gyr_shift);
-
-/**
- * @brief Saves current internal state of sensors to emulator's registers.
- *
- * @param emul Pointer to BMI emulator
- * @param acc_shift How many bits should be right shifted from accelerometer
- * data
- * @param gyr_shift How many bits should be right shifted from gyroscope data
- * @param acc_reg Register which holds LSB of accelerometer sensor
- * @param gyr_reg Register which holds LSB of gyroscope sensor
- * @param sensortime_reg Register which holds LSB of sensor time
- * @param acc_off_en Indicate if accelerometer offset should be included to
- * sensor data value
- * @param gyr_off_en Indicate if gyroscope offset should be included to
- * sensor data value
- */
-void bmi_emul_state_to_reg(struct i2c_emul *emul, int acc_shift,
- int gyr_shift, int acc_reg, int gyr_reg,
- int sensortime_reg, bool acc_off_en,
- bool gyr_off_en);
-
-/**
- * @}
- */
-
-#endif /* __EMUL_BMI_H */
diff --git a/zephyr/include/emul/emul_common_i2c.h b/zephyr/include/emul/emul_common_i2c.h
deleted file mode 100644
index 0457842a71..0000000000
--- a/zephyr/include/emul/emul_common_i2c.h
+++ /dev/null
@@ -1,369 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Common code used by devices emulated on I2C bus
- */
-
-#ifndef __EMUL_COMMON_I2C_H
-#define __EMUL_COMMON_I2C_H
-
-#include <emul.h>
-#include <drivers/i2c.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief Common I2C API useb by emulators
- * @defgroup i2c_common_emul common I2C emulator's code
- * @{
- *
- * I2C common emulator functionality is dispatching I2C messages. It supports
- * setting custom user handler and selecting register on which access emulator
- * should fail. To use common I2C handling, emulator should call or setup
- * @ref i2c_common_emul_transfer as transfer callback of i2c_emul_api and
- * register emulator with @ref i2c_common_emul_data structure as data. In data
- * structure, emualtor should set callback called before read/write I2C message
- * (start_read, start_write), for each byte of I2C message (read_byte,
- * write_byte) and after I2C message (finish_read, finish_byte). If specific
- * function is not needed by emulator, than it can be set to NULL.
- *
- * @ref i2c_common_emul_lock_data and @ref i2c_common_emul_unlock_data functions
- * may be used to guard emulator data when accessed from multiple threads.
- *
- * User of emulator with common I2C code can use following API to define custom
- * behaviour of emulator:
- *
- * - call @ref i2c_common_emul_set_read_func and
- * @ref i2c_common_emul_set_write_func to setup custom handlers for I2C
- * messages
- * - call @ref i2c_common_emul_set_read_fail_reg and
- * @ref i2c_common_emul_set_write_fail_reg to configure emulator to fail on
- * given register read or write
- */
-
-/**
- * Special register values used in @ref i2c_common_emul_set_read_fail_reg and
- * @ref i2c_common_emul_set_write_fail_reg
- */
-#define I2C_COMMON_EMUL_FAIL_ALL_REG (-1)
-#define I2C_COMMON_EMUL_NO_FAIL_REG (-2)
-
-/**
- * Describe if there is no ongoing I2C message or if there is message handled
- * at the moment (last message doesn't ended with stop or write is not followed
- * by read).
- */
-enum i2c_common_emul_msg_state {
- I2C_COMMON_EMUL_NONE_MSG,
- I2C_COMMON_EMUL_IN_WRITE,
- I2C_COMMON_EMUL_IN_READ
-};
-
-/**
- * @brief Function type that is used by I2C device emulator for first byte of
- * I2C write message.
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by write command (first byte of I2C
- * write message)
- *
- * @return 0 on success
- * @return -EIO on error
- */
-typedef int (*i2c_common_emul_start_write_func)(struct i2c_emul *emul, int reg);
-
-/**
- * @brief Function type that is used by I2C device emulator at the end of
- * I2C write message.
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by write command (first byte of I2C
- * write message)
- * @param bytes Number of bytes received from the I2C write message
- *
- * @return 0 on success
- * @return -EIO on error
- */
-typedef int (*i2c_common_emul_finish_write_func)(struct i2c_emul *emul, int reg,
- int bytes);
-
-/**
- * @brief Function type that is used by I2C device emulator on each byte of
- * I2C write message (except first byte).
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by write command (first byte of I2C
- * write message)
- * @param val Value of current byte
- * @param bytes Number of bytes already received from the I2C write message
- * (excluding current byte)
- *
- * @return 0 on success
- * @return -EIO on error
- */
-typedef int (*i2c_common_emul_write_byte_func)(struct i2c_emul *emul, int reg,
- uint8_t val, int bytes);
-
-/**
- * @brief Function type that is used by I2C device emulator before first byte of
- * I2C read message.
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by read command (first byte of last
- * I2C write message)
- *
- * @return 0 on success
- * @return -EIO on error
- */
-typedef int (*i2c_common_emul_start_read_func)(struct i2c_emul *emul, int reg);
-
-/**
- * @brief Function type that is used by I2C device emulator at the end of
- * I2C read message.
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by read command (first byte of last
- * I2C write message)
- * @param bytes Number of bytes responeded to the I2C read message
- *
- * @return 0 on success
- * @return -EIO on error
- */
-typedef int (*i2c_common_emul_finish_read_func)(struct i2c_emul *emul, int reg,
- int bytes);
-
-/**
- * @brief Function type that is used by I2C device emulator on each byte of
- * I2C read message.
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by read command (first byte of last
- * I2C write message)
- * @param val Pointer to buffer where current response byte should be stored
- * @param bytes Number of bytes already responded to the I2C read message
- * (excluding current byte)
- *
- * @return 0 on success
- * @return -EIO on error
- */
-typedef int (*i2c_common_emul_read_byte_func)(struct i2c_emul *emul, int reg,
- uint8_t *val, int bytes);
-
-/**
- * @brief Function type that is used by I2C device emulator to select register
- * address that should be compared with fail register set by user using
- * @ref i2c_common_emul_set_read_fail_reg and
- * @ref i2c_common_emul_set_write_fail_reg
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by read/write command (first byte
- * of last I2C write message)
- * @param bytes Number of bytes already processed in the I2C message handler
- * (excluding current byte)
- * @param read If current I2C message is read
- *
- * @return Register address that should be compared with user-defined fail
- * register
- */
-typedef int (*i2c_common_emul_access_reg_func)(struct i2c_emul *emul, int reg,
- int bytes, bool read);
-
-/**
- * @brief Custom function type that is used as user-defined callback in read
- * I2C messages handling.
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by read command (first byte of last
- * I2C write message)
- * @param val Pointer to buffer where current response byte should be stored
- * @param bytes Number of bytes already responded to the I2C read message
- * (excluding current byte)
- * @param data Pointer to custom user data
- *
- * @return 0 on success
- * @return 1 continue with normal emulator handler
- * @return negative on error
- */
-typedef int (*i2c_common_emul_read_func)(struct i2c_emul *emul, int reg,
- uint8_t *val, int bytes, void *data);
-
-/**
- * @brief Custom function type that is used as user-defined callback in write
- * I2C messages handling.
- *
- * @param emul Pointer to emulator
- * @param reg Address which is now accessed by write command (first byte of I2C
- * write message)
- * @param val Value of current byte
- * @param bytes Number of bytes already received from the I2C write message
- * (excluding current byte)
- * @param data Pointer to custom user data
- *
- * @return 0 on success
- * @return 1 continue with normal emulator handler
- * @return negative on error
- */
-typedef int (*i2c_common_emul_write_func)(struct i2c_emul *emul, int reg,
- uint8_t val, int bytes, void *data);
-
-/** Static configuration, common for all i2c emulators */
-struct i2c_common_emul_cfg {
- /** Label of the I2C bus this emulator connects to */
- const char *i2c_label;
- /** Label of the I2C device being emulated */
- const char *dev_label;
- /** Pointer to run-time data */
- struct i2c_common_emul_data *data;
- /** Address of emulator on i2c bus */
- uint16_t addr;
-};
-
-/** Run-time data used by the emulator, common for all i2c emulators */
-struct i2c_common_emul_data {
- /** I2C emulator detail */
- struct i2c_emul emul;
- /** Emulator device */
- const struct device *i2c;
- /** Configuration information */
- const struct i2c_common_emul_cfg *cfg;
-
- /** Current state of I2C bus (if emulator is handling message) */
- enum i2c_common_emul_msg_state msg_state;
- /** Number of already handled bytes in ongoing message */
- int msg_byte;
- /** Register selected in last write command */
- uint8_t cur_reg;
-
- /** Custom write function called on I2C write opperation */
- i2c_common_emul_write_func write_func;
- /** Data passed to custom write function */
- void *write_func_data;
- /** Custom read function called on I2C read opperation */
- i2c_common_emul_read_func read_func;
- /** Data passed to custom read function */
- void *read_func_data;
-
- /** Control if read should fail on given register */
- int read_fail_reg;
- /** Control if write should fail on given register */
- int write_fail_reg;
-
- /** Emulator function, called for first byte of write message */
- i2c_common_emul_start_write_func start_write;
- /** Emulator function, called for each byte of write message */
- i2c_common_emul_write_byte_func write_byte;
- /** Emulator function, called at the end of write message */
- i2c_common_emul_finish_write_func finish_write;
-
- /** Emulator function, called before first byte of read message */
- i2c_common_emul_start_read_func start_read;
- /** Emulator function, called for each byte of read message */
- i2c_common_emul_read_byte_func read_byte;
- /** Emulator function, called at the end of read message */
- i2c_common_emul_finish_read_func finish_read;
-
- /**
- * Emulator function, called to get register that should be checked
- * if was selected by user in set_read/write_fail_reg.
- */
- i2c_common_emul_access_reg_func access_reg;
-
- /** Mutex used to control access to emulator data */
- struct k_mutex data_mtx;
-};
-
-/**
- * @brief Lock access to emulator properties. After acquiring lock, user
- * may change emulator behaviour in multi-thread setup.
- *
- * @param emul Pointer to emulator
- * @param timeout Timeout in getting lock
- *
- * @return k_mutex_lock return code
- */
-int i2c_common_emul_lock_data(struct i2c_emul *emul, k_timeout_t timeout);
-
-/**
- * @brief Unlock access to emulator properties.
- *
- * @param emul Pointer to emulator
- *
- * @return k_mutex_unlock return code
- */
-int i2c_common_emul_unlock_data(struct i2c_emul *emul);
-
-/**
- * @brief Set write handler for I2C messages. This function is called before
- * generic handler.
- *
- * @param emul Pointer to emulator
- * @param func Pointer to custom function
- * @param data User data passed on call of custom function
- */
-void i2c_common_emul_set_write_func(struct i2c_emul *emul,
- i2c_common_emul_write_func func,
- void *data);
-
-/**
- * @brief Set read handler for I2C messages. This function is called before
- * generic handler.
- *
- * @param emul Pointer to emulator
- * @param func Pointer to custom function
- * @param data User data passed on call of custom function
- */
-void i2c_common_emul_set_read_func(struct i2c_emul *emul,
- i2c_common_emul_read_func func, void *data);
-
-/**
- * @brief Setup fail on read of given register of emulator
- *
- * @param emul Pointer to emulator
- * @param reg Register address or one of special values
- * (I2C_COMMON_EMUL_FAIL_ALL_REG, I2C_COMMON_EMUL_NO_FAIL_REG)
- */
-void i2c_common_emul_set_read_fail_reg(struct i2c_emul *emul, int reg);
-
-/**
- * @brief Setup fail on write of given register of emulator
- *
- * @param emul Pointer to emulator
- * @param reg Register address or one of special values
- * (I2C_COMMON_EMUL_FAIL_ALL_REG, I2C_COMMON_EMUL_NO_FAIL_REG)
- */
-void i2c_common_emul_set_write_fail_reg(struct i2c_emul *emul, int reg);
-
-/**
- * @biref Emulate an I2C transfer to an emulator
- *
- * This is common function used by I2C device emulators. It handles dispatching
- * I2C message, calling user custom functions, failing on reading/writing
- * registers selected by user and calling device specific functions.
- *
- * @param emul I2C emulation information
- * @param msgs List of messages to process
- * @param num_msgs Number of messages to process
- * @param addr Address of the I2C target device
- *
- * @retval 0 If successful
- * @retval -EIO General input / output error
- */
-int i2c_common_emul_transfer(struct i2c_emul *emul, struct i2c_msg *msgs,
- int num_msgs, int addr);
-
-/**
- * @brief Initialize common emulator data structure
- *
- * @param data Pointer to emulator data
- */
-void i2c_common_emul_init(struct i2c_common_emul_data *data);
-
-/**
- * @}
- */
-
-#endif /* __EMUL_COMMON_I2C_H */
diff --git a/zephyr/include/emul/emul_lis2dw12.h b/zephyr/include/emul/emul_lis2dw12.h
deleted file mode 100644
index b136e24f0a..0000000000
--- a/zephyr/include/emul/emul_lis2dw12.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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.
- */
-
-#ifndef ZEPHYR_INCLUDE_EMUL_EMUL_LIS2DW12_H_
-#define ZEPHYR_INCLUDE_EMUL_EMUL_LIS2DW12_H_
-
-#include <emul.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief The the i2c emulator pointer from the top level emul.
- *
- * @param emul The emulator to query
- * @return Pointer to the i2c emulator struct
- */
-struct i2c_emul *lis2dw12_emul_to_i2c_emul(const struct emul *emul);
-
-/**
- * @brief Reset the state of the lis2dw12 emulator.
- *
- * @param emul The emulator to reset.
- */
-void lis2dw12_emul_reset(const struct emul *emul);
-
-/**
- * @brief Set the who-am-i register value.
- *
- * By default the who-am-i register holds LIS2DW12_WHO_AM_I, this function
- * enables overriding that value in order to drive testing.
- *
- * @param emul The emulator to modify.
- * @param who_am_i The new who-am-i register value.
- */
-void lis2dw12_emul_set_who_am_i(const struct emul *emul, uint8_t who_am_i);
-
-/**
- * @brief Check the number of times the chip was soft reset.
- *
- * This value is reset by a call to lis2dw12_emul_reset().
- *
- * @param emul The emulator to query
- * @return The number of times that the chip was reset.
- */
-uint32_t lis2dw12_emul_get_soft_reset_count(const struct emul *emul);
-
-#endif /* ZEPHYR_INCLUDE_EMUL_EMUL_LIS2DW12_H_ */
diff --git a/zephyr/include/emul/emul_ln9310.h b/zephyr/include/emul/emul_ln9310.h
deleted file mode 100644
index dfa03eaa28..0000000000
--- a/zephyr/include/emul/emul_ln9310.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Backend API for LN9310 emulator
- */
-
-#ifndef ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_
-#define ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_
-
-#include <emul.h>
-#include "driver/ln9310.h"
-#include <stdbool.h>
-
-/**
- * @brief Select the current emulator to use.
- *
- * Currently, only a single ln9310 can be instantiated at any given instance due
- * to how the driver was written. Once this restriction is removed, there's
- * still an issue with the board_get_battery_cell_type() function as it doesn't
- * take a device pointer. This function selects the current LN9310 context which
- * will serve the data for that board function.
- *
- * @param emulator The LN9310 emulator to select.
- */
-void ln9310_emul_set_context(const struct emul *emulator);
-
-/**
- * @brief Clear all the emulator data.
- *
- * @param emulator The LN9310 emulator to clear.
- */
-void ln9310_emul_reset(const struct emul *emulator);
-
-/**
- * @brief Update the emulator's battery cell type.
- *
- * @param emulator The LN9310 emulator to update.
- * @param type The battery type to use.
- */
-void ln9310_emul_set_battery_cell_type(const struct emul *emulator,
- enum battery_cell_type type);
-
-/**
- * @brief Update the emulator's version number.
- *
- * @param emulator The LN9310 emulator to update.
- * @param version The LN9310 chip version number.
- */
-void ln9310_emul_set_version(const struct emul *emulator, int version);
-
-/**
- * @brief Update whether or not the LN9310 is currently getting more than 10V.
- *
- * @param emulator The LN9310 emulator to update.
- * @param is_gt_10v Whether or not the chip is currently getting more than 10V.
- */
-void ln9310_emul_set_vin_gt_10v(const struct emul *emulator, bool is_gt_10v);
-
-/**
- * @brief Get whether or not the LN9310 is initialized.
- *
- * @param emulator The LN9310 emulator to read.
- *
- * @return true if the LN9310 was correctly initialized.
- */
-bool ln9310_emul_is_init(const struct emul *emulator);
-
-#endif /* ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_ */
diff --git a/zephyr/include/emul/emul_pi3usb9201.h b/zephyr/include/emul/emul_pi3usb9201.h
deleted file mode 100644
index b171cfefc9..0000000000
--- a/zephyr/include/emul/emul_pi3usb9201.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Backend API for pi3usb9201 emulator
- */
-
-#ifndef __EMUL_PI3USB9201_H
-#define __EMUL_PI3USB9201_H
-
-#include <emul.h>
-#include <drivers/i2c.h>
-#include <drivers/i2c_emul.h>
-
-#define PI3USB9201_REG_CTRL_1 0x0
-#define PI3USB9201_REG_CTRL_2 0x1
-#define PI3USB9201_REG_CLIENT_STS 0x2
-#define PI3USB9201_REG_HOST_STS 0x3
-
-/**
- * @brief Get pointer to pi3usb9201 emulator using device tree order number.
- *
- * @param ord Device tree order number obtained from DT_DEP_ORD macro
- *
- * @return Pointer to pi3usb9201 emulator
- */
-struct i2c_emul *pi3usb9201_emul_get(int ord);
-
-/**
- * @brief Set value of given register of pi3usb9201
- *
- * @param emul Pointer to pi3usb9201 emulator
- * @param reg Register address
- * @param val New value of the register
- *
- * @return 0 on success or error
- */
-int pi3usb9201_emul_set_reg(struct i2c_emul *emul, int reg, uint8_t val);
-
-/**
- * @brief Get value of given register of pi3usb9201
- *
- * @param emul Pointer to pi3usb9201 emulator
- * @param reg Register address
- * @param val Pointer to write current value of register
- *
- * @return 0 on success or error
- */
-int pi3usb9201_emul_get_reg(struct i2c_emul *emul, int reg, uint8_t *val);
-
-#endif /* __EMUL_PI3USB9201_H */
diff --git a/zephyr/include/emul/emul_smart_battery.h b/zephyr/include/emul/emul_smart_battery.h
deleted file mode 100644
index b48f836d66..0000000000
--- a/zephyr/include/emul/emul_smart_battery.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Backend API for Smart Battery emulator
- */
-
-#ifndef __EMUL_SMART_BATTERY_H
-#define __EMUL_SMART_BATTERY_H
-
-#include <emul.h>
-#include <drivers/i2c.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief Smart Battery emulator backend API
- * @defgroup sbat_emul Smart Battery emulator
- * @{
- *
- * Smart Battery emulator handle static state of device. E.g. setting charging
- * current will not charge battery over time. Sending periodic status messages
- * and alarms to SMBus Host or charging voltage/current to Smart Battery Charger
- * is not supported. Behaviour of Smart Battery emulator is application-defined.
- * As-such, each application may
- *
- * - define a Device Tree overlay file to set the most of battery properties
- * - get battery properties calling @ref sbat_emul_get_bat_data Battery
- * properties can be changed through obtained pointer. In multithread
- * environment access to battery can be guarded by calling
- * @ref sbat_emul_lock_bat_data and @ref sbat_emul_unlock_bat_data
- * - call functions from emul_common_i2c.h to setup custom handlers for SMBus
- * messages
- */
-
-/* Value used to indicate that no command is selected */
-#define SBAT_EMUL_NO_CMD -1
-/* Maximum size of data that can be returned in SMBus block transaction */
-#define MAX_BLOCK_SIZE 32
-/* Maximum length of command to send is maximum size of data + len byte + PEC */
-#define MSG_BUF_LEN (MAX_BLOCK_SIZE + 2)
-
-/** @brief Emulated smart battery properties */
-struct sbat_emul_bat_data {
- /** Battery mode - bit field configuring some battery behaviours */
- uint16_t mode;
- /** Word returned on manufacturer access command */
- uint16_t mf_access;
- /** Capacity alarm value */
- uint16_t cap_alarm;
- /** Remaing time alarm value */
- uint16_t time_alarm;
- /** Rate of charge used in some commands */
- int16_t at_rate;
- /**
- * Flag indicating if AT_RATE_TIME_TO_FULL command supports mW
- * capacity mode
- */
- int at_rate_full_mw_support;
- /** Error code returned by last command */
- uint16_t error_code;
- /** Design battery voltage in mV */
- uint16_t design_mv;
- /** Battery temperature at the moment in Kelvins */
- uint16_t temp;
- /** Battery voltage at the moment in mV */
- uint16_t volt;
- /** Current charging (> 0) or discharging (< 0) battery in mA */
- int16_t cur;
- /** Average current from 1 minute */
- int16_t avg_cur;
- /** Maximum error of returned values in percent */
- uint16_t max_error;
- /** Capacity of the battery at the moment in mAh */
- uint16_t cap;
- /** Full capacity of the battery in mAh */
- uint16_t full_cap;
- /** Design battery capacity in mAh */
- uint16_t design_cap;
- /** Charging current requested by battery */
- uint16_t desired_charg_cur;
- /** Charging voltage requested by battery */
- uint16_t desired_charg_volt;
- /** Number of cycles */
- uint16_t cycle_count;
- /** Specification of battery */
- uint16_t spec_info;
- /** Status of battery */
- uint16_t status;
- /** Date of manufacturing */
- uint16_t mf_date;
- /** Serial number */
- uint16_t sn;
- /** Manufacturer name */
- uint8_t mf_name[MAX_BLOCK_SIZE];
- /** Manufacturer name length */
- int mf_name_len;
- /** Device name */
- uint8_t dev_name[MAX_BLOCK_SIZE];
- /** Device name length */
- int dev_name_len;
- /** Device chemistry */
- uint8_t dev_chem[MAX_BLOCK_SIZE];
- /** Device chemistry length */
- int dev_chem_len;
- /** Manufacturer data */
- uint8_t mf_data[MAX_BLOCK_SIZE];
- /** Manufacturer data length */
- int mf_data_len;
-};
-
-/**
- * @brief Get pointer to smart battery emulator using device tree order number.
- *
- * @param ord Device tree order number obtained from DT_DEP_ORD macro
- *
- * @return Pointer to smart battery emulator
- */
-struct i2c_emul *sbat_emul_get_ptr(int ord);
-
-/**
- * @brief Function which allows to get properties of emulated smart battery
- *
- * @param emul Pointer to smart battery emulator
- *
- * @return Pointer to smart battery properties
- */
-struct sbat_emul_bat_data *sbat_emul_get_bat_data(struct i2c_emul *emul);
-
-/**
- * @brief Convert date to format used by smart battery
- *
- * @param day Day
- * @param month Month
- * @param year Year
- *
- * @return Converted date
- */
-uint16_t sbat_emul_date_to_word(unsigned int day, unsigned int month,
- unsigned int year);
-
-/**
- * @brief Function which gets return value for read commands that returns word.
- * This function may be used to obtain battery properties that are
- * calculated e.g. time to empty/full.
- *
- * @param emul Pointer to smart battery emulator
- * @param cmd Read command
- * @param val Pointer to where word should be stored
- *
- * @return 0 on success
- * @return 1 if command is unknown or return type different then word
- * @return negative on error while reading value
- */
-int sbat_emul_get_word_val(struct i2c_emul *emul, int cmd, uint16_t *val);
-
-/**
- * @brief Function which gets return value for read commands that returns block
- * data
- *
- * @param emul Pointer to smart battery emulator
- * @param cmd Read command
- * @param blk Pointer to where data pointer should be stored
- * @param len Pointer to where data length should be stored
- *
- * @return 0 on success
- * @return 1 if command is unknown or return type different then word
- * @return negative on error while reading value
- */
-int sbat_emul_get_block_data(struct i2c_emul *emul, int cmd, uint8_t **blk,
- int *len);
-
-/**
- * @brief Set next response of emulator. This function may be used in user
- * custom read callback to setup response with calculated PEC.
- *
- * @param emul Pointer to smart battery emulator
- * @param cmd Read command
- * @param buf Buffer with the response
- * @param len Length of the response
- * @param fail If emulator should fail to send response
- */
-void sbat_emul_set_response(struct i2c_emul *emul, int cmd, uint8_t *buf,
- int len, bool fail);
-
-/**
- * @}
- */
-
-#endif /* __EMUL_SMART_BATTERY_H */
diff --git a/zephyr/include/emul/emul_syv682x.h b/zephyr/include/emul/emul_syv682x.h
deleted file mode 100644
index aa0d8840f7..0000000000
--- a/zephyr/include/emul/emul_syv682x.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* 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.
- */
-
-/** @file
- *
- * @brief Backend API for SYV682X emulator
- */
-
-#ifndef __EMUL_SYV682X_H
-#define __EMUL_SYV682X_H
-
-#include <drivers/i2c_emul.h>
-#include <stdint.h>
-
-/* Register info copied from syv682.h */
-
-/* SYV682x register addresses */
-#define SYV682X_STATUS_REG 0x00
-#define SYV682X_CONTROL_1_REG 0x01
-#define SYV682X_CONTROL_2_REG 0x02
-#define SYV682X_CONTROL_3_REG 0x03
-#define SYV682X_CONTROL_4_REG 0x04
-
-/* Status Register */
-#define SYV682X_STATUS_OC_HV BIT(7)
-#define SYV682X_STATUS_RVS BIT(6)
-#define SYV682X_STATUS_OC_5V BIT(5)
-#define SYV682X_STATUS_OVP BIT(4)
-#define SYV682X_STATUS_FRS BIT(3)
-#define SYV682X_STATUS_TSD BIT(2)
-#define SYV682X_STATUS_VSAFE_5V BIT(1)
-#define SYV682X_STATUS_VSAFE_0V BIT(0)
-#define SYV682X_STATUS_INT_MASK 0xfc
-
-/* Control Register 1 */
-#define SYV682X_CONTROL_1_CH_SEL BIT(1)
-#define SYV682X_CONTROL_1_HV_DR BIT(2)
-#define SYV682X_CONTROL_1_PWR_ENB BIT(7)
-
-#define SYV682X_5V_ILIM_MASK 0x18
-#define SYV682X_5V_ILIM_BIT_SHIFT 3
-#define SYV682X_5V_ILIM_1_25 0
-#define SYV682X_5V_ILIM_1_75 1
-#define SYV682X_5V_ILIM_2_25 2
-#define SYV682X_5V_ILIM_3_30 3
-
-#define SYV682X_HV_ILIM_MASK 0x60
-#define SYV682X_HV_ILIM_BIT_SHIFT 5
-#define SYV682X_HV_ILIM_1_25 0
-#define SYV682X_HV_ILIM_1_75 1
-#define SYV682X_HV_ILIM_3_30 2
-#define SYV682X_HV_ILIM_5_50 3
-
-/* Control Register 2 */
-#define SYV682X_OC_DELAY_MASK GENMASK(7, 6)
-#define SYV682X_OC_DELAY_SHIFT 6
-#define SYV682X_OC_DELAY_1MS 0
-#define SYV682X_OC_DELAY_10MS 1
-#define SYV682X_OC_DELAY_50MS 2
-#define SYV682X_OC_DELAY_100MS 3
-#define SYV682X_DSG_TIME_MASK GENMASK(5, 4)
-#define SYV682X_DSG_TIME_SHIFT 4
-#define SYV682X_DSG_TIME_50MS 0
-#define SYV682X_DSG_TIME_100MS 1
-#define SYV682X_DSG_TIME_200MS 2
-#define SYV682X_DSG_TIME_400MS 3
-#define SYV682X_DSG_RON_MASK GENMASK(3, 2)
-#define SYV682X_DSG_RON_SHIFT 2
-#define SYV682X_DSG_RON_200_OHM 0
-#define SYV682X_DSG_RON_400_OHM 1
-#define SYV682X_DSG_RON_800_OHM 2
-#define SYV682X_DSG_RON_1600_OHM 3
-#define SYV682X_CONTROL_2_SDSG BIT(1)
-#define SYV682X_CONTROL_2_FDSG BIT(0)
-
-/* Control Register 3 */
-#define SYV682X_BUSY BIT(7)
-#define SYV682X_RVS_MASK BIT(3)
-#define SYV682X_RST_REG BIT(0)
-#define SYV682X_OVP_MASK 0x70
-#define SYV682X_OVP_BIT_SHIFT 4
-#define SYV682X_OVP_06_0 0
-#define SYV682X_OVP_08_0 1
-#define SYV682X_OVP_11_1 2
-#define SYV682X_OVP_12_1 3
-#define SYV682X_OVP_14_2 4
-#define SYV682X_OVP_17_9 5
-#define SYV682X_OVP_21_6 6
-#define SYV682X_OVP_23_7 7
-
-/* Control Register 4 */
-#define SYV682X_CONTROL_4_CC1_BPS BIT(7)
-#define SYV682X_CONTROL_4_CC2_BPS BIT(6)
-#define SYV682X_CONTROL_4_VCONN1 BIT(5)
-#define SYV682X_CONTROL_4_VCONN2 BIT(4)
-#define SYV682X_CONTROL_4_VBAT_OVP BIT(3)
-#define SYV682X_CONTROL_4_VCONN_OCP BIT(2)
-#define SYV682X_CONTROL_4_CC_FRS BIT(1)
-#define SYV682X_CONTROL_4_INT_MASK 0x0c
-
-/**
- * @brief Get pointer to SYV682x emulator using device tree order number.
- *
- * @param ord Device tree order number obtained from DT_DEP_ORD macro
- *
- * @return Pointer to smart battery emulator
- */
-struct i2c_emul *syv682x_emul_get(int ord);
-
-/**
- * @brief Set the underlying interrupt conditions affecting the status register
- *
- * @param emul SYV682x emulator
- * @param val A status register value corresponding to the underlying
- * conditions
- */
-void syv682x_emul_set_status(struct i2c_emul *emul, uint8_t val);
-
-/**
- * @brief Set value of a register of SYV682x
- *
- * @param emul SYV682x emulator
- * @param reg Register address
- * @param val Value to write to the register
- *
- * @return 0 on success, error code on error
- */
-int syv682x_emul_set_reg(struct i2c_emul *emul, int reg, uint8_t val);
-
-/**
- * @brief Get value of a register of SYV682x
- *
- * @param emul SYV682x emulator
- * @param reg Register address
- * @param val Pointer at which to store current value of register
- *
- * @return 0 on success, error code on error
- */
-int syv682x_emul_get_reg(struct i2c_emul *emul, int reg, uint8_t *val);
-
-#endif /* __EMUL_SYV682X_H */
diff --git a/zephyr/include/emul/emul_tcs3400.h b/zephyr/include/emul/emul_tcs3400.h
deleted file mode 100644
index 49ec382a66..0000000000
--- a/zephyr/include/emul/emul_tcs3400.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/* 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.
- */
-
-/**
- * @file
- *
- * @brief Backend API for TCS3400 emulator
- */
-
-#ifndef __EMUL_TCS3400_H
-#define __EMUL_TCS3400_H
-
-#include <emul.h>
-#include <drivers/i2c.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief TCS3400 emulator backend API
- * @defgroup tcs_emul TCS3400 emulator
- * @{
- *
- * TCS3400 emulator supports responses to all write and read I2C messages.
- * Light sensor data registers are obtained from internal emulator state, gain
- * and acquisition time. Application may alter emulator state:
- *
- * - define a devicetree overlay file to set which inadvisable driver behaviour
- * should be treated as error and emulated device ID and revision
- * - call @ref tcs_emul_set_reg and @ref tcs_emul_get_reg to set and get value
- * of TCS3400 registers
- * - call @ref tcs_emul_set_val and @ref tcs_emul_set_val to set and get
- * light sensor value
- * - call tcs_emul_set_err_* to change emulator behaviour on inadvisable driver
- * behaviour
- * - call functions from emul_common_i2c.h to setup custom handlers for I2C
- * messages
- */
-
-/**
- * Maximum number of integration cycles (when ATIME is zero). Value read from
- * sensor is proportional to number of integration cycles, e.g. with constant
- * light, value obtainded with 128 cycles will be two times smaller than value
- * obtained with 256 cycles.
- */
-#define TCS_EMUL_MAX_CYCLES 256
-/**
- * Maximum gain supported by TCS3400. Value read from sensor is multiplied by
- * gain selected in CONTROL register.
- */
-#define TCS_EMUL_MAX_GAIN 64
-
-/**
- * Emulator units are value returned with gain x64 and 256 integration cycles.
- * Max value is 1024 returned when gain is x1 and 1 integration cycle. Max value
- * represented in emulator units is 1024 * 64 * 256
- */
-#define TCS_EMUL_MAX_VALUE (1024 * TCS_EMUL_MAX_GAIN * TCS_EMUL_MAX_CYCLES)
-
-/** Axis argument used in @ref tcs_emul_set_val @ref tcs_emul_get_val */
-enum tcs_emul_axis {
- TCS_EMUL_R,
- TCS_EMUL_G,
- TCS_EMUL_B,
- TCS_EMUL_C,
- TCS_EMUL_IR,
-};
-
-/**
- * Emulator saves only those registers in memory. IR select is stored sparately
- * and other registers are write only.
- */
-#define TCS_EMUL_FIRST_REG TCS_I2C_ENABLE
-#define TCS_EMUL_LAST_REG TCS_I2C_BDATAH
-#define TCS_EMUL_REG_COUNT (TCS_EMUL_LAST_REG - TCS_EMUL_FIRST_REG + 1)
-
-/**
- * @brief Get pointer to TCS3400 emulator using device tree order number.
- *
- * @param ord Device tree order number obtained from DT_DEP_ORD macro
- *
- * @return Pointer to TCS3400 emulator
- */
-struct i2c_emul *tcs_emul_get(int ord);
-
-/**
- * @brief Set value of given register of TCS3400
- *
- * @param emul Pointer to TCS3400 emulator
- * @param reg Register address which value will be changed
- * @param val New value of the register
- */
-void tcs_emul_set_reg(struct i2c_emul *emul, int reg, uint8_t val);
-
-/**
- * @brief Get value of given register of TCS3400
- *
- * @param emul Pointer to TCS3400 emulator
- * @param reg Register address
- *
- * @return Value of the register
- */
-uint8_t tcs_emul_get_reg(struct i2c_emul *emul, int reg);
-
-/**
- * @brief Get internal value of light sensor for given axis
- *
- * @param emul Pointer to TCS3400 emulator
- * @param axis Axis to access
- *
- * @return Value of given axis with gain x64 and 256 integration cycles
- */
-int tcs_emul_get_val(struct i2c_emul *emul, enum tcs_emul_axis axis);
-
-/**
- * @brief Set internal value of light sensor for given axis
- *
- * @param emul Pointer to TCS3400 emulator
- * @param axis Axis to access
- * @param val New value of light sensor for given axis with gain x64 and
- * 256 integration cycles
- */
-void tcs_emul_set_val(struct i2c_emul *emul, enum tcs_emul_axis axis, int val);
-
-/**
- * @brief Set if error should be generated when read only register is being
- * written
- *
- * @param emul Pointer to TCS3400 emulator
- * @param set Check for this error
- */
-void tcs_emul_set_err_on_ro_write(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when reserved bits of register are
- * not set to 0 on write I2C message
- *
- * @param emul Pointer to TCS3400 emulator
- * @param set Check for this error
- */
-void tcs_emul_set_err_on_rsvd_write(struct i2c_emul *emul, bool set);
-
-/**
- * @brief Set if error should be generated when MSB register is accessed before
- * LSB register
- *
- * @param emul Pointer to TCS3400 emulator
- * @param set Check for this error
- */
-void tcs_emul_set_err_on_msb_first(struct i2c_emul *emul, bool set);
-
-/**
- * @}
- */
-
-#endif /* __EMUL_TCS3400_H */
diff --git a/zephyr/include/emul/i2c_mock.h b/zephyr/include/emul/i2c_mock.h
deleted file mode 100644
index e9e8d97252..0000000000
--- a/zephyr/include/emul/i2c_mock.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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.
- */
-
-#ifndef ZEPHYR_INCLUDE_EMUL_I2C_MOCK_H_
-#define ZEPHYR_INCLUDE_EMUL_I2C_MOCK_H_
-
-#include <emul.h>
-#include <drivers/i2c_emul.h>
-
-/**
- * @brief reset the I2C mock.
- *
- * @param emul The mock device to reset.
- */
-void i2c_mock_reset(const struct emul *emul);
-
-/**
- * @brief Get the i2c emulator pointer from the top level mock.
- *
- * @param emul The mock device to query
- * @return Pointer to the i2c emulator struct
- */
-struct i2c_emul *i2c_mock_to_i2c_emul(const struct emul *emul);
-
-/**
- * @brief Get the I2C address of the mock
- *
- * @param emul The mock device to query
- * @return The address on the I2C bus
- */
-uint16_t i2c_mock_get_addr(const struct emul *emul);
-
-#endif /* ZEPHYR_INCLUDE_EMUL_I2C_MOCK_H_ */