zephyr/drivers/hwinfo/hwinfo_esp32.c
Anas Nashif f901e26de9 cleanup: include/: move hwinfo.h to drivers/hwinfo.h
move hwinfo.h to drivers/hwinfo.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00

27 lines
470 B
C

/*
* Copyright (c) 2019 Leandro A. F. Pereira
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <soc/efuse_reg.h>
#include <drivers/hwinfo.h>
#include <string.h>
ssize_t _impl_hwinfo_get_device_id(u8_t *buffer, size_t length)
{
uint32_t fuse_rdata[] = {
sys_read32(EFUSE_BLK0_RDATA1_REG),
sys_read32(EFUSE_BLK0_RDATA2_REG),
};
if (length > sizeof(fuse_rdata)) {
length = sizeof(fuse_rdata);
}
memcpy(buffer, fuse_rdata, length);
return length;
}