Commit Graph

4 Commits

Author SHA1 Message Date
Simon Glass fa90b5c243 emul: spi: bmi160: Move to top-level directory
This emulator currently only supports SPI. Before making it also
support I2C, move it up a directory to avoid I2C uses missing it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-27 16:41:30 +01:00
Simon Glass 442f38d610 emul: Add an emulator for the Bosch BMI160 accelerometer
This emulator supports enable functionality to start up the device and
read a few samples. It connects itself to any BMI160 device it finds in
the device tree. The SPI emulation controller driver is used to direct
SPI messages from the BMI160 driver to the BMI160 emulator.

Add a few more definitions to the header file, as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-05 15:33:00 -04:00
Simon Glass d1adbc2133 emul: Add an emulator for the Atmel AT24 series
This emulator supports basic reads and writes with 8-bit addressing.
It connects itself to any AT24 devices it finds in the device tree. The
I2C emulation controller driver is used to direct I2C messages from the
AT24 driver to the AT24 emulator.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-01 14:30:46 -04:00
Simon Glass 302d671ea2 emul: Create an emulation implementation
Create a header file and implementation for emulators. Set up a linker
list so that emulators can be found and initialised at start-up.

Emulators are used to emulate hardware devices, to support testing of
various subsystems. For example, it is possible to write an emulator
for an I2C compass such that it appears on the I2C bus and can be used
just like a real hardware device.

Emulators often implement special features for testing. For example a
compass may support returning bogus data if the I2C bus speed is too
high, or may return invalid measurements if calibration has not yet
been completed. This allows for testing that high-level code can
handle these situations correctly. Test coverage can therefore
approach 100% if all failure conditions are emulated.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-01 14:30:46 -04:00