hwinfo: support exx32 family
add hwinfo driver support for the exx32 gecko family. Signed-off-by: Sun Amar <sun681@gmail.com>
This commit is contained in:
parent
305ba26c6e
commit
1be7937f4e
|
@ -13,4 +13,5 @@ zephyr_sources_ifdef(CONFIG_HWINFO_SAM4L hwinfo_sam4l.c)
|
|||
zephyr_sources_ifdef(CONFIG_HWINFO_SAM0 hwinfo_sam0.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_LITEX hwinfo_litex.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_PSOC6 hwinfo_psoc6.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_GECKO hwinfo_gecko.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_SHELL hwinfo_shell.c)
|
||||
|
|
|
@ -100,4 +100,12 @@ config HWINFO_PSOC6
|
|||
help
|
||||
Enable Cypress PSoC-6 hwinfo driver.
|
||||
|
||||
config HWINFO_GECKO
|
||||
bool "GECKO hwinfo"
|
||||
default y
|
||||
depends on SOC_FAMILY_EXX32
|
||||
select HWINFO_HAS_DRIVER
|
||||
help
|
||||
Enable Silabs GECKO hwinfo driver.
|
||||
|
||||
endif
|
||||
|
|
23
drivers/hwinfo/hwinfo_gecko.c
Normal file
23
drivers/hwinfo/hwinfo_gecko.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2021 Sun Amar
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <em_system.h>
|
||||
#include <drivers/hwinfo.h>
|
||||
#include <string.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
|
||||
{
|
||||
uint64_t unique_id = sys_cpu_to_be64(SYSTEM_GetUnique());
|
||||
|
||||
if (length > sizeof(unique_id)) {
|
||||
length = sizeof(unique_id);
|
||||
}
|
||||
|
||||
memcpy(buffer, &unique_id, length);
|
||||
|
||||
return length;
|
||||
}
|
Loading…
Reference in a new issue