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

Fake RTC driver. More...

Files

file  rtc_fake.h
 Fake RTC driver API functions.

Functions

 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_set_time, const struct device *, const struct rtc_time *)
 @fake_of{rtc_driver_api::set_time}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_get_time, const struct device *, struct rtc_time *)
 @fake_of{rtc_driver_api::get_time}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_alarm_get_supported_fields, const struct device *, uint16_t, uint16_t *)
 @fake_of{rtc_driver_api::alarm_get_supported_fields}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_alarm_set_time, const struct device *, uint16_t, uint16_t, const struct rtc_time *)
 @fake_of{rtc_driver_api::alarm_set_time}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_alarm_get_time, const struct device *, uint16_t, uint16_t *, struct rtc_time *)
 @fake_of{rtc_driver_api::alarm_get_time}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_alarm_is_pending, const struct device *, uint16_t)
 @fake_of{rtc_driver_api::alarm_is_pending}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_alarm_set_callback, const struct device *, uint16_t, rtc_alarm_callback, void *)
 @fake_of{rtc_driver_api::alarm_set_callback}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_update_set_callback, const struct device *, rtc_update_callback, void *)
 @fake_of{rtc_driver_api::update_set_callback}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_set_calibration, const struct device *, int32_t)
 @fake_of{rtc_driver_api::set_calibration}
 DECLARE_FAKE_VALUE_FUNC (int, rtc_fake_get_calibration, const struct device *, int32_t *)
 @fake_of{rtc_driver_api::get_calibration}

Detailed Description

Fake RTC driver.

@driver_fake{rtc_interface,CONFIG_RTC_FAKE,zephyr\,fake-rtc}

const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(fake_rtc));
struct rtc_time tm = {0};
rtc_fake_set_time_fake.return_val = -EINVAL;
zassert_equal(1, rtc_fake_set_time_fake.call_count);
zassert_equal(dev, rtc_fake_set_time_fake.arg0_val);
#define DEVICE_DT_GET(node_id)
Get a device reference from a devicetree node identifier.
Definition device.h:317
#define DT_NODELABEL(label)
Get a node identifier for a node label.
Definition devicetree.h:197
int rtc_set_time(const struct device *dev, const struct rtc_time *timeptr)
API for setting RTC time.
#define EINVAL
Invalid argument.
Definition errno.h:61
#define zassert_equal(a, b,...)
Assert that a equals b.
Definition ztest_assert.h:321
Runtime device structure (in ROM) per driver instance.
Definition device.h:525
Structure for storing date and time values with sub-second precision.
Definition rtc.h:62
Definition time.h:24

Function Documentation

◆ DECLARE_FAKE_VALUE_FUNC() [1/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_alarm_get_supported_fields ,
const struct device * ,
uint16_t ,
uint16_t *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::alarm_get_supported_fields}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_ALARM 
.

◆ DECLARE_FAKE_VALUE_FUNC() [2/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_alarm_get_time ,
const struct device * ,
uint16_t ,
uint16_t * ,
struct rtc_time *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::alarm_get_time}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_ALARM 
.

◆ DECLARE_FAKE_VALUE_FUNC() [3/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_alarm_is_pending ,
const struct device * ,
uint16_t  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::alarm_is_pending}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_ALARM 
.

◆ DECLARE_FAKE_VALUE_FUNC() [4/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_alarm_set_callback ,
const struct device * ,
uint16_t ,
rtc_alarm_callback ,
void *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::alarm_set_callback}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_ALARM 
.

◆ DECLARE_FAKE_VALUE_FUNC() [5/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_alarm_set_time ,
const struct device * ,
uint16_t ,
uint16_t ,
const struct rtc_time *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::alarm_set_time}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_ALARM 
.

◆ DECLARE_FAKE_VALUE_FUNC() [6/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_get_calibration ,
const struct device * ,
int32_t *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::get_calibration}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_CALIBRATION 
.

◆ DECLARE_FAKE_VALUE_FUNC() [7/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_get_time ,
const struct device * ,
struct rtc_time *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::get_time}

◆ DECLARE_FAKE_VALUE_FUNC() [8/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_set_calibration ,
const struct device * ,
int32_t  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::set_calibration}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_CALIBRATION 
.

◆ DECLARE_FAKE_VALUE_FUNC() [9/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_set_time ,
const struct device * ,
const struct rtc_time *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::set_time}

◆ DECLARE_FAKE_VALUE_FUNC() [10/10]

DECLARE_FAKE_VALUE_FUNC ( int ,
rtc_fake_update_set_callback ,
const struct device * ,
rtc_update_callback ,
void *  )

#include <rtc_fake.h>

@fake_of{rtc_driver_api::update_set_callback}

Attention
Available only when the following Kconfig option is enabled:
CONFIG_RTC_UPDATE 
.