emul: Add syscall support for fuel gauge emulators

In order to ease user thread testing with fuel gauges, enable syscalls for
the fuel gauge emulator backend API.

Signed-off-by: Aaron Massey <aaronmassey@google.com>
This commit is contained in:
Aaron Massey 2023-08-13 14:04:33 -06:00 committed by Fabio Baltieri
commit 8035ec69fa
4 changed files with 38 additions and 4 deletions

View file

@ -6,3 +6,8 @@ add_subdirectory_ifdef(CONFIG_SBS_GAUGE_NEW_API sbs_gauge)
add_subdirectory_ifdef(CONFIG_MAX17048 max17048)
zephyr_library_sources_ifdef(CONFIG_USERSPACE fuel_gauge_syscall_handlers.c)
if (CONFIG_EMUL AND CONFIG_USERSPACE)
zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/emul_fuel_gauge.h)
zephyr_library_sources(emul_fuel_gauge_syscall_handlers.c)
endif()

View file

@ -0,0 +1,25 @@
/*
* Copyright 2023 Google LLC
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/syscall_handler.h>
#include <zephyr/drivers/emul_fuel_gauge.h>
/* Emulator syscalls just need to exist as stubs as these are only called by tests. */
static inline int z_vrfy_emul_fuel_gauge_is_battery_cutoff(const struct emul *target, bool *cutoff)
{
return z_impl_emul_fuel_gauge_is_battery_cutoff(target, cutoff);
}
#include <syscalls/emul_fuel_gauge_is_battery_cutoff_mrsh.c>
static inline int z_vrfy_emul_fuel_gauge_set_battery_charging(const struct emul *target,
uint32_t uV, int uA)
{
return z_impl_emul_fuel_gauge_set_battery_charging(target, uV, uA);
}
#include <syscalls/emul_fuel_gauge_set_battery_charging_mrsh.c>