Skip to content

Commit 211bdd9

Browse files
bjarki-andreasennashif
authored andcommitted
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 <[email protected]>
1 parent 00cefa1 commit 211bdd9

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

drivers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ add_subdirectory_ifdef(CONFIG_CACHE_MANAGEMENT cache)
2424
add_subdirectory_ifdef(CONFIG_CAN can)
2525
add_subdirectory_ifdef(CONFIG_CHARGER charger)
2626
add_subdirectory_ifdef(CONFIG_CLOCK_CONTROL clock_control)
27+
add_subdirectory_ifdef(CONFIG_COMPARATOR comparator)
2728
add_subdirectory_ifdef(CONFIG_CONSOLE console)
2829
add_subdirectory_ifdef(CONFIG_COREDUMP_DEVICE coredump)
2930
add_subdirectory_ifdef(CONFIG_COUNTER counter)

drivers/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ source "drivers/cache/Kconfig"
1515
source "drivers/can/Kconfig"
1616
source "drivers/charger/Kconfig"
1717
source "drivers/clock_control/Kconfig"
18+
source "drivers/comparator/Kconfig"
1819
source "drivers/console/Kconfig"
1920
source "drivers/coredump/Kconfig"
2021
source "drivers/counter/Kconfig"

drivers/comparator/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/comparator.h)
5+
6+
zephyr_library()
7+
8+
zephyr_library_sources_ifdef(CONFIG_USERSPACE comparator_handlers.c)

drivers/comparator/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
menuconfig COMPARATOR
5+
bool "Comparator drivers"
6+
help
7+
Enable comparator driver configuration.
8+
9+
if COMPARATOR
10+
11+
module = COMPARATOR
12+
module-str = comparator
13+
source "subsys/logging/Kconfig.template.log_config"
14+
15+
config COMPARATOR_INIT_PRIORITY
16+
int "COMPARATOR init priority"
17+
default KERNEL_INIT_PRIORITY_DEVICE
18+
help
19+
Comparator device driver initialization priority.
20+
21+
endif # COMPARATOR
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/drivers/comparator.h>
8+
#include <zephyr/internal/syscall_handler.h>
9+
10+
static inline int z_vrfy_comparator_get_output(const struct device *dev)
11+
{
12+
K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, get_output));
13+
return z_impl_comparator_get_output(dev);
14+
}
15+
#include <zephyr/syscalls/comparator_get_output_mrsh.c>
16+
17+
static inline int z_vrfy_comparator_set_trigger(const struct device *dev,
18+
enum comparator_trigger trigger)
19+
{
20+
K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, set_trigger));
21+
return z_impl_comparator_set_trigger(dev, trigger);
22+
}
23+
#include <zephyr/syscalls/comparator_set_trigger_mrsh.c>
24+
25+
static inline int z_vrfy_comparator_trigger_is_pending(const struct device *dev)
26+
{
27+
K_OOPS(K_SYSCALL_DRIVER_COMPARATOR(dev, trigger_is_pending));
28+
return z_impl_comparator_trigger_is_pending(dev);
29+
}
30+
#include <zephyr/syscalls/comparator_trigger_is_pending_mrsh.c>

0 commit comments

Comments
 (0)