diff --git a/drivers/hwinfo/hwinfo_handlers.c b/drivers/hwinfo/hwinfo_handlers.c index 02058f9b95..a1eb9e2c83 100644 --- a/drivers/hwinfo/hwinfo_handlers.c +++ b/drivers/hwinfo/hwinfo_handlers.c @@ -15,6 +15,14 @@ ssize_t z_vrfy_hwinfo_get_device_id(uint8_t *buffer, size_t length) } #include +ssize_t z_vrfy_hwinfo_get_device_eui64(uint8_t *buffer) +{ + K_OOPS(K_SYSCALL_MEMORY_WRITE(buffer, 8)); + + return z_impl_hwinfo_get_device_eui64((uint8_t *)buffer); +} +#include + int z_vrfy_hwinfo_get_reset_cause(uint32_t *cause) { int ret; diff --git a/drivers/hwinfo/hwinfo_weak_impl.c b/drivers/hwinfo/hwinfo_weak_impl.c index c951d639ae..a21745d892 100644 --- a/drivers/hwinfo/hwinfo_weak_impl.c +++ b/drivers/hwinfo/hwinfo_weak_impl.c @@ -11,6 +11,11 @@ ssize_t __weak z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length) return -ENOSYS; } +int __weak z_impl_hwinfo_get_device_eui64(uint8_t *buffer) +{ + return -ENOSYS; +} + int __weak z_impl_hwinfo_get_reset_cause(uint32_t *cause) { return -ENOSYS; diff --git a/include/zephyr/drivers/hwinfo.h b/include/zephyr/drivers/hwinfo.h index df412cdf29..468356284b 100644 --- a/include/zephyr/drivers/hwinfo.h +++ b/include/zephyr/drivers/hwinfo.h @@ -95,6 +95,22 @@ __syscall ssize_t hwinfo_get_device_id(uint8_t *buffer, size_t length); ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length); +/** + * @brief Copy the device EUI64 to a buffer + * + * This routine copies the device EUI64 (8 bytes) to the buffer. + * The EUI64 depends on the hardware and is guaranteed unique. + * + * @param buffer Buffer of 8 bytes to write the ID to. + * + * @retval zero if successful. + * @retval -ENOSYS if there is no implementation for the particular device. + * @retval any negative value on driver specific errors. + */ +__syscall int hwinfo_get_device_eui64(uint8_t *buffer); + +int z_impl_hwinfo_get_device_eui64(uint8_t *buffer); + /** * @brief Retrieve cause of device reset. *