drivers: hwinfo: Add device EUI64 ID support
Some devices, mostly with radio support, have an EUI64 ID (unique and attributed by IEEE), in addition to the standard device ID. Add support for reading it through the hwinfo API. As the size is always the same (8 bytes), there is no need to pass the size in the function, nor return the number of bytes copied. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
971491b5a4
commit
ada2c78235
|
@ -15,6 +15,14 @@ ssize_t z_vrfy_hwinfo_get_device_id(uint8_t *buffer, size_t length)
|
|||
}
|
||||
#include <syscalls/hwinfo_get_device_id_mrsh.c>
|
||||
|
||||
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 <syscalls/hwinfo_get_device_eui64_mrsh.c>
|
||||
|
||||
int z_vrfy_hwinfo_get_reset_cause(uint32_t *cause)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue