|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Fake EEPROM driver. More...
Files | |
| file | eeprom_fake.h |
| Fake EEPROM driver API functions. | |
Functions | |
| int | fake_eeprom_read (const struct device *, off_t, void *, size_t) |
| Fake implementation of the eeprom_driver_api::read driver operation. | |
| int | fake_eeprom_write (const struct device *, off_t, const void *, size_t) |
| Fake implementation of the eeprom_driver_api::write driver operation. | |
| size_t | fake_eeprom_size (const struct device *) |
| Fake implementation of the eeprom_driver_api::size driver operation. | |
Fake EEPROM driver.
This is a Fake Function Framework (FFF) implementation of the EEPROM API, provided for use in tests. It is enabled by CONFIG_EEPROM_FAKE and instantiated from zephyr,fake-eeprom devicetree nodes.
Each fake below is paired with an FFF control structure named after it with an additional _fake suffix, which tests use to set return values, install custom fakes, or inspect call counts and captured arguments. The control structures are not listed here; see Mocking via FFF.
Use return_val for fakes that only report status; a fake with output parameters must be driven with a custom_fake, as return_val leaves those parameters untouched.
When CONFIG_ZTEST is enabled, a ztest rule resets every fake before each test case.
fake_eeprom_read() and fake_eeprom_size() are given a default custom_fake honouring the size from devicetree and zero-filling reads, re-installed on every reset. Install your own custom_fake in the test case to change what they report.
#include <zephyr/drivers/eeprom/eeprom_fake.h>
Fake implementation of the eeprom_driver_api::read driver operation.
| size_t fake_eeprom_size | ( | const struct device * | ) |
#include <zephyr/drivers/eeprom/eeprom_fake.h>
Fake implementation of the eeprom_driver_api::size driver operation.
#include <zephyr/drivers/eeprom/eeprom_fake.h>
Fake implementation of the eeprom_driver_api::write driver operation.