drivers: comparator: Add initial files
Add top level CMakeLists.txt entry and Kconfig options along with userspace handlers for comparator API. Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
This commit is contained in:
parent
00cefa15ff
commit
211bdd935c
5 changed files with 61 additions and 0 deletions
|
@ -24,6 +24,7 @@ add_subdirectory_ifdef(CONFIG_CACHE_MANAGEMENT cache)
|
|||
add_subdirectory_ifdef(CONFIG_CAN can)
|
||||
add_subdirectory_ifdef(CONFIG_CHARGER charger)
|
||||
add_subdirectory_ifdef(CONFIG_CLOCK_CONTROL clock_control)
|
||||
add_subdirectory_ifdef(CONFIG_COMPARATOR comparator)
|
||||
add_subdirectory_ifdef(CONFIG_CONSOLE console)
|
||||
add_subdirectory_ifdef(CONFIG_COREDUMP_DEVICE coredump)
|
||||
add_subdirectory_ifdef(CONFIG_COUNTER counter)
|
||||
|
|
|
@ -15,6 +15,7 @@ source "drivers/cache/Kconfig"
|
|||
source "drivers/can/Kconfig"
|
||||
source "drivers/charger/Kconfig"
|
||||
source "drivers/clock_control/Kconfig"
|
||||
source "drivers/comparator/Kconfig"
|
||||
source "drivers/console/Kconfig"
|
||||
source "drivers/coredump/Kconfig"
|
||||
source "drivers/counter/Kconfig"
|
||||
|
|
8
drivers/comparator/CMakeLists.txt
Normal file
8
drivers/comparator/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/comparator.h)
|
||||
|
||||
zephyr_library()
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c)
|
21
drivers/comparator/Kconfig
Normal file
21
drivers/comparator/Kconfig
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Copyright (c) 2024 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menuconfig COMPARATOR
|
||||
bool "Comparator drivers"
|
||||
help
|
||||
Enable comparator driver configuration.
|
||||
|
||||
if COMPARATOR
|
||||
|
||||
module = COMPARATOR
|
||||
module-str = comparator
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
||||
config COMPARATOR_INIT_PRIORITY
|
||||
int "COMPARATOR init priority"
|
||||
default KERNEL_INIT_PRIORITY_DEVICE
|
||||
help
|
||||
Comparator device driver initialization priority.
|
||||
|
||||
endif # COMPARATOR
|
30
drivers/comparator/comparator_handlers.c
Normal file
30
drivers/comparator/comparator_handlers.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2024 Nordic Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/drivers/comparator.h>
|
||||
#include <zephyr/internal/syscall_handler.h>
|
||||
|
||||
static inline int z_vrfy_comparator_get_output(const struct device *dev)
|
||||
{
|
||||
K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, get_output));
|
||||
return z_impl_comparator_get_output(dev);
|
||||
}
|
||||
#include <zephyr/syscalls/comparator_get_output_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_comparator_set_trigger(const struct device *dev,
|
||||
enum comparator_trigger trigger)
|
||||
{
|
||||
K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, set_trigger));
|
||||
return z_impl_comparator_set_trigger(dev, trigger);
|
||||
}
|
||||
#include <zephyr/syscalls/comparator_set_trigger_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_comparator_trigger_is_pending(const struct device *dev)
|
||||
{
|
||||
K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, trigger_is_pending));
|
||||
return z_impl_comparator_trigger_is_pending(dev);
|
||||
}
|
||||
#include <zephyr/syscalls/comparator_trigger_is_pending_mrsh.c>
|
Loading…
Add table
Add a link
Reference in a new issue