1.User space
\tests\drivers\hwinfo\api\src\main.c
hwinfo: add driver support for NXP i.mx RT device ID
Add driver support for NXP i.mx RT ID device.
This device has an ID of 8 bytes.
#include <hwinfo.h> //函数接口定义
#include <ztest.h>
#include <strings.h>
#include <errno.h>
/*
* @addtogroup t_hwinfo_get_device_id_api
* @{
* @defgroup t_hwinfo_get_device_id test_hwinfo_get_device_id
* @brief TestPurpose: verify device id get works
* @details
* - Test Steps
* -# Read the ID
* -# Check if to many bytes are written to the buffer
* -# Check if UID is plausible
* - Expected Results
* -# Device uid with correct length should be written to the buffer.
* @}
*/
#define BUFFER_LENGTH 17
#define BUFFER_CANARY 0xFF
/*
* Function invokes the get_entropy callback in driver
* to get the random data and fill to passed buffer
*/
static void