2015-05-25 23:10:30 +08:00
|
|
|
/* kernel version support */
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Wind River Systems, Inc.
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#ifndef ZEPHYR_INCLUDE_KERNEL_VERSION_H_
|
|
|
|
#define ZEPHYR_INCLUDE_KERNEL_VERSION_H_
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-12-07 22:17:59 +08:00
|
|
|
/**
|
|
|
|
* @defgroup version_apis Version APIs
|
|
|
|
* @ingroup kernel_apis
|
|
|
|
* @{
|
|
|
|
*
|
2015-04-11 07:44:37 +08:00
|
|
|
* The kernel version has been converted from a string to a four-byte
|
2015-06-24 06:52:06 +08:00
|
|
|
* quantity that is divided into two parts.
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-06-24 06:52:06 +08:00
|
|
|
* Part 1: The three most significant bytes represent the kernel's
|
|
|
|
* numeric version, x.y.z. These fields denote:
|
2015-04-11 07:44:37 +08:00
|
|
|
* x -- major release
|
|
|
|
* y -- minor release
|
2015-06-24 06:52:06 +08:00
|
|
|
* z -- patchlevel release
|
2016-10-21 19:58:43 +08:00
|
|
|
* Each of these elements must therefore be in the range 0 to 255, inclusive.
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-06-24 06:52:06 +08:00
|
|
|
* Part 2: The least significant byte is reserved for future use.
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
2018-01-04 13:04:12 +08:00
|
|
|
#define SYS_KERNEL_VER_MAJOR(ver) (((ver) >> 24) & 0xFF)
|
|
|
|
#define SYS_KERNEL_VER_MINOR(ver) (((ver) >> 16) & 0xFF)
|
|
|
|
#define SYS_KERNEL_VER_PATCHLEVEL(ver) (((ver) >> 8) & 0xFF)
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2015-05-25 23:10:30 +08:00
|
|
|
/* kernel version routines */
|
|
|
|
|
2018-12-07 22:17:59 +08:00
|
|
|
/**
|
|
|
|
* @brief Return the kernel version of the present build
|
|
|
|
*
|
|
|
|
* The kernel version is a four-byte value, whose format is described in the
|
|
|
|
* file "kernel_version.h".
|
|
|
|
*
|
|
|
|
* @return kernel version
|
|
|
|
*/
|
2017-04-21 23:55:34 +08:00
|
|
|
extern u32_t sys_kernel_version_get(void);
|
2015-05-25 23:10:30 +08:00
|
|
|
|
2018-12-07 22:17:59 +08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2016-01-23 01:38:49 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-09-15 01:43:44 +08:00
|
|
|
#endif /* ZEPHYR_INCLUDE_KERNEL_VERSION_H_ */
|