Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Fake regulator driver. More...

Files

file  fake.h
 Fake regulator driver API functions.

Functions

int regulator_fake_enable (const struct device *)
 Fake implementation of the regulator_driver_api::enable driver operation.
int regulator_fake_disable (const struct device *)
 Fake implementation of the regulator_driver_api::disable driver operation.
unsigned int regulator_fake_count_voltages (const struct device *)
 Fake implementation of the regulator_driver_api::count_voltages driver operation.
int regulator_fake_list_voltage (const struct device *, unsigned int, int32_t *)
 Fake implementation of the regulator_driver_api::list_voltage driver operation.
int regulator_fake_set_voltage (const struct device *, int32_t, int32_t)
 Fake implementation of the regulator_driver_api::set_voltage driver operation.
int regulator_fake_get_voltage (const struct device *, int32_t *)
 Fake implementation of the regulator_driver_api::get_voltage driver operation.
unsigned int regulator_fake_count_current_limits (const struct device *)
 Fake implementation of the regulator_driver_api::count_current_limits driver operation.
int regulator_fake_list_current_limit (const struct device *, unsigned int, int32_t *)
 Fake implementation of the regulator_driver_api::list_current_limit driver operation.
int regulator_fake_set_current_limit (const struct device *, int32_t, int32_t)
 Fake implementation of the regulator_driver_api::set_current_limit driver operation.
int regulator_fake_get_current_limit (const struct device *, int32_t *)
 Fake implementation of the regulator_driver_api::get_current_limit driver operation.
int regulator_fake_set_mode (const struct device *, regulator_mode_t)
 Fake implementation of the regulator_driver_api::set_mode driver operation.
int regulator_fake_get_mode (const struct device *, regulator_mode_t *)
 Fake implementation of the regulator_driver_api::get_mode driver operation.
int regulator_fake_set_active_discharge (const struct device *, bool)
 Fake implementation of the regulator_driver_api::set_active_discharge driver operation.
int regulator_fake_get_active_discharge (const struct device *, bool *)
 Fake implementation of the regulator_driver_api::get_active_discharge driver operation.
int regulator_fake_get_error_flags (const struct device *, regulator_error_flags_t *)
 Fake implementation of the regulator_driver_api::get_error_flags driver operation.
int regulator_parent_fake_dvs_state_set (const struct device *, regulator_dvs_state_t)
 Fake implementation of the regulator_parent_driver_api::dvs_state_set driver operation.
int regulator_parent_fake_ship_mode (const struct device *)
 Fake implementation of the regulator_parent_driver_api::ship_mode driver operation.

Detailed Description

Fake regulator driver.

This is a Fake Function Framework (FFF) implementation of the Regulator API, provided for use in tests. It is enabled by CONFIG_REGULATOR_FAKE and instantiated from zephyr,fake-regulator 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.

A zephyr,fake-regulator node is instantiated as the regulator parent device and each of its child nodes as a regulator device.

regulator_fake_get_voltage() is given a default custom_fake returning 1 V, re-installed on every reset. Install your own custom_fake in the test case to change what it reports.

Function Documentation

◆ regulator_fake_count_current_limits()

unsigned int regulator_fake_count_current_limits ( const struct device * )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::count_current_limits driver operation.

◆ regulator_fake_count_voltages()

unsigned int regulator_fake_count_voltages ( const struct device * )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::count_voltages driver operation.

◆ regulator_fake_disable()

int regulator_fake_disable ( const struct device * )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::disable driver operation.

◆ regulator_fake_enable()

int regulator_fake_enable ( const struct device * )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::enable driver operation.

◆ regulator_fake_get_active_discharge()

int regulator_fake_get_active_discharge ( const struct device * ,
bool *  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::get_active_discharge driver operation.

◆ regulator_fake_get_current_limit()

int regulator_fake_get_current_limit ( const struct device * ,
int32_t *  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::get_current_limit driver operation.

◆ regulator_fake_get_error_flags()

int regulator_fake_get_error_flags ( const struct device * ,
regulator_error_flags_t *  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::get_error_flags driver operation.

◆ regulator_fake_get_mode()

int regulator_fake_get_mode ( const struct device * ,
regulator_mode_t *  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::get_mode driver operation.

◆ regulator_fake_get_voltage()

int regulator_fake_get_voltage ( const struct device * ,
int32_t *  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::get_voltage driver operation.

◆ regulator_fake_list_current_limit()

int regulator_fake_list_current_limit ( const struct device * ,
unsigned int ,
int32_t *  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::list_current_limit driver operation.

◆ regulator_fake_list_voltage()

int regulator_fake_list_voltage ( const struct device * ,
unsigned int ,
int32_t *  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::list_voltage driver operation.

◆ regulator_fake_set_active_discharge()

int regulator_fake_set_active_discharge ( const struct device * ,
bool  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::set_active_discharge driver operation.

◆ regulator_fake_set_current_limit()

int regulator_fake_set_current_limit ( const struct device * ,
int32_t ,
int32_t  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::set_current_limit driver operation.

◆ regulator_fake_set_mode()

int regulator_fake_set_mode ( const struct device * ,
regulator_mode_t  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::set_mode driver operation.

◆ regulator_fake_set_voltage()

int regulator_fake_set_voltage ( const struct device * ,
int32_t ,
int32_t  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_driver_api::set_voltage driver operation.

◆ regulator_parent_fake_dvs_state_set()

int regulator_parent_fake_dvs_state_set ( const struct device * ,
regulator_dvs_state_t  )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_parent_driver_api::dvs_state_set driver operation.

◆ regulator_parent_fake_ship_mode()

int regulator_parent_fake_ship_mode ( const struct device * )

#include <zephyr/drivers/regulator/fake.h>

Fake implementation of the regulator_parent_driver_api::ship_mode driver operation.