drivers: Add hwinfo API
This commit adds a new hardware info API. With this API it is possible to read out the device ID. Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
parent
73aaad3f36
commit
5b59c10fc4
7 changed files with 105 additions and 0 deletions
2
drivers/hwinfo/CMakeLists.txt
Normal file
2
drivers/hwinfo/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
zephyr_sources_ifdef(CONFIG_USERSPACE hwinfo_handlers.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO hwinfo_weak_impl.c)
|
16
drivers/hwinfo/Kconfig
Normal file
16
drivers/hwinfo/Kconfig
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Kconfig -HW Info driver configuration options
|
||||
|
||||
#
|
||||
# Copyright (c) 2019 Alexander Wachter
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
menuconfig HWINFO
|
||||
bool "Hardware Information driver"
|
||||
help
|
||||
Enable hwinfo driver.
|
||||
|
||||
if HWINFO
|
||||
|
||||
endif
|
15
drivers/hwinfo/hwinfo_handlers.c
Normal file
15
drivers/hwinfo/hwinfo_handlers.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Alexander Wachter
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <syscall_handler.h>
|
||||
#include <hwinfo.h>
|
||||
|
||||
Z_SYSCALL_HANDLER(hwinfo_get_device_id, buffer, length) {
|
||||
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(buffer, length));
|
||||
|
||||
return _impl_hwinfo_get_device_id((u8_t *)buffer, (size_t)length);
|
||||
}
|
12
drivers/hwinfo/hwinfo_weak_impl.c
Normal file
12
drivers/hwinfo/hwinfo_weak_impl.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Alexander Wachter
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <hwinfo.h>
|
||||
|
||||
ssize_t __weak _impl_hwinfo_get_device_id(u8_t *buffer, size_t length)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue