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>
This commit is contained in:
Anas Nashif 2019-06-25 15:53:53 -04:00
parent 6aa9c3a68f
commit f901e26de9
14 changed files with 74 additions and 59 deletions

View File

@ -6,7 +6,7 @@
#include <soc/efuse_reg.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>
ssize_t _impl_hwinfo_get_device_id(u8_t *buffer, size_t length)

View File

@ -5,7 +5,7 @@
*/
#include <syscall_handler.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
Z_SYSCALL_HANDLER(hwinfo_get_device_id, buffer, length) {

View File

@ -5,7 +5,7 @@
*/
#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>
struct imxrt_uid {

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>
#include <fsl_sim.h>

View File

@ -5,7 +5,7 @@
*/
#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>
struct nrf_uid {

View File

@ -5,7 +5,7 @@
*/
#include <device.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <init.h>
#include <soc.h>
#include <string.h>

View File

@ -5,7 +5,7 @@
*/
#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>
struct sam0_uid {

View File

@ -6,7 +6,7 @@
#include <misc/printk.h>
#include <shell/shell.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <zephyr/types.h>
#include <logging/log.h>

View File

@ -5,7 +5,7 @@
*/
#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>
struct stm32_uid {

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <hwinfo.h>
#include <drivers/hwinfo.h>
ssize_t __weak z_impl_hwinfo_get_device_id(u8_t *buffer, size_t length)
{

58
include/drivers/hwinfo.h Normal file
View File

@ -0,0 +1,58 @@
/**
* @file
*
* @brief Public APIs to get device Information.
*/
/*
* Copyright (c) 2018 Alexander Wachter
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_DRIVERS_HWINFO_H_
#define ZEPHYR_INCLUDE_DRIVERS_HWINFO_H_
#include <zephyr/types.h>
#include <sys/types.h>
#include <stddef.h>
#include <errno.h>
#include <kernel.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Device ID
* @{
*/
/**
* @brief Copy the device id to a buffer
*
* This routine copies "length" number of bytes of the device ID to the buffer.
* If the device ID is smaller then length, the rest of the buffer is left unchanged.
* The ID depends on the hardware and is not guaranteed unique.
*
* @param buffer Buffer to write the ID to.
* @param length Max length of the buffer.
*
* @retval size of the device ID copied or negative on error.
*/
__syscall ssize_t hwinfo_get_device_id(u8_t *buffer, size_t length);
ssize_t z_impl_hwinfo_get_device_id(u8_t *buffer, size_t length);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#include <syscalls/hwinfo.h>
#endif /* ZEPHYR_INCLUDE_DRIVERS_HWINFO_H_ */

View File

@ -1,58 +1,15 @@
/**
* @file
*
* @brief Public APIs to get device Information.
*/
/*
* Copyright (c) 2018 Alexander Wachter
* Copyright (c) 2019 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_HWINFO_H_
#define ZEPHYR_INCLUDE_HWINFO_H_
#include <zephyr/types.h>
#include <sys/types.h>
#include <stddef.h>
#include <errno.h>
#include <kernel.h>
#ifdef __cplusplus
extern "C" {
#ifndef CONFIG_COMPAT_INCLUDES
#warning "This header file has moved, include <drivers/hwinfo.h> instead."
#endif
/**
* @brief Device ID
* @{
*/
/**
* @brief Copy the device id to a buffer
*
* This routine copies "length" number of bytes of the device ID to the buffer.
* If the device ID is smaller then length, the rest of the buffer is left unchanged.
* The ID depends on the hardware and is not guaranteed unique.
*
* @param buffer Buffer to write the ID to.
* @param length Max length of the buffer.
*
* @retval size of the device ID copied or negative on error.
*/
__syscall ssize_t hwinfo_get_device_id(u8_t *buffer, size_t length);
ssize_t z_impl_hwinfo_get_device_id(u8_t *buffer, size_t length);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#include <syscalls/hwinfo.h>
#include <drivers/hwinfo.h>
#endif /* ZEPHYR_INCLUDE_HWINFO_H_ */

View File

@ -8,7 +8,7 @@
#define __UPDATEHUB_DEVICE_H__
#include <zephyr.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#define DEVICE_ID_MAX_SIZE 65

View File

@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <ztest.h>
#include <strings.h>
#include <errno.h>