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:
parent
77998b2171
commit
8035ec69fa
4 changed files with 38 additions and 4 deletions
|
@ -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()
|
||||
|
|
25
drivers/fuel_gauge/emul_fuel_gauge_syscall_handlers.c
Normal file
25
drivers/fuel_gauge/emul_fuel_gauge_syscall_handlers.c
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue