Skip to content
Permalink
Browse files

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>
  • Loading branch information...
nashif committed Jun 25, 2019
1 parent 6aa9c3a commit f901e26de970e6bf7f4130c8263085a7040b259c
@@ -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)
@@ -5,7 +5,7 @@
*/

#include <syscall_handler.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>

Z_SYSCALL_HANDLER(hwinfo_get_device_id, buffer, length) {

@@ -5,7 +5,7 @@
*/

#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>

struct imxrt_uid {
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>
#include <fsl_sim.h>

@@ -5,7 +5,7 @@
*/

#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>

struct nrf_uid {
@@ -5,7 +5,7 @@
*/

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

#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>

struct sam0_uid {
@@ -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>

@@ -5,7 +5,7 @@
*/

#include <soc.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>
#include <string.h>

struct stm32_uid {
@@ -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)
{
@@ -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_ */
@@ -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" {
#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
}
#ifndef CONFIG_COMPAT_INCLUDES
#warning "This header file has moved, include <drivers/hwinfo.h> instead."
#endif

#include <syscalls/hwinfo.h>
#include <drivers/hwinfo.h>

#endif /* ZEPHYR_INCLUDE_HWINFO_H_ */
@@ -8,7 +8,7 @@
#define __UPDATEHUB_DEVICE_H__

#include <zephyr.h>
#include <hwinfo.h>
#include <drivers/hwinfo.h>

#define DEVICE_ID_MAX_SIZE 65

@@ -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>

0 comments on commit f901e26

Please sign in to comment.
You can’t perform that action at this time.