hwinfo: Support NXP LPC family
add hwinfo driver support for NXP's LPC family. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
parent
8b0e79e3b9
commit
6dbffcb2a8
6 changed files with 55 additions and 0 deletions
|
@ -6,6 +6,7 @@ zephyr_sources_ifdef(CONFIG_HWINFO hwinfo_weak_impl.c)
|
|||
zephyr_sources_ifdef(CONFIG_HWINFO_STM32 hwinfo_stm32.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_NRF hwinfo_nrf.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_MCUX_SIM hwinfo_mcux_sim.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_MCUX_SYSCON hwinfo_mcux_syscon.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_ESP32 hwinfo_esp32.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_IMXRT hwinfo_imxrt.c)
|
||||
zephyr_sources_ifdef(CONFIG_HWINFO_SAM hwinfo_sam.c)
|
||||
|
|
|
@ -38,6 +38,13 @@ config HWINFO_MCUX_SIM
|
|||
help
|
||||
Enable NXP kinetis mcux hwinfo driver.
|
||||
|
||||
config HWINFO_MCUX_SYSCON
|
||||
bool "NXP LPC device ID"
|
||||
default y
|
||||
depends on HAS_MCUX_SYSCON
|
||||
help
|
||||
Enable NXP LPC mcux hwinfo driver.
|
||||
|
||||
config HWINFO_IMXRT
|
||||
bool "NXP i.mx RT device ID"
|
||||
default y
|
||||
|
|
28
drivers/hwinfo/hwinfo_mcux_syscon.c
Normal file
28
drivers/hwinfo/hwinfo_mcux_syscon.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2021 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT nxp_lpc_uid
|
||||
|
||||
#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)
|
||||
{
|
||||
uint8_t *uid_addr = (uint8_t *) DT_INST_REG_ADDR(0);
|
||||
|
||||
if (buffer == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (length > DT_INST_REG_SIZE(0)) {
|
||||
length = DT_INST_REG_SIZE(0);
|
||||
}
|
||||
|
||||
memcpy(buffer, uid_addr, length);
|
||||
|
||||
return length;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue