1 /* kernel version support */ 2 3 /* 4 * Copyright (c) 2015 Wind River Systems, Inc. 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #ifndef ZEPHYR_INCLUDE_KERNEL_VERSION_H_ 10 #define ZEPHYR_INCLUDE_KERNEL_VERSION_H_ 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * @defgroup version_apis Version APIs 18 * @ingroup kernel_apis 19 * @{ 20 * 21 * The kernel version has been converted from a string to a four-byte 22 * quantity that is divided into two parts. 23 * 24 * Part 1: The three most significant bytes represent the kernel's 25 * numeric version, x.y.z. These fields denote: 26 * x -- major release 27 * y -- minor release 28 * z -- patchlevel release 29 * Each of these elements must therefore be in the range 0 to 255, inclusive. 30 * 31 * Part 2: The least significant byte is reserved for future use. 32 */ 33 #define SYS_KERNEL_VER_MAJOR(ver) (((ver) >> 24) & 0xFF) 34 #define SYS_KERNEL_VER_MINOR(ver) (((ver) >> 16) & 0xFF) 35 #define SYS_KERNEL_VER_PATCHLEVEL(ver) (((ver) >> 8) & 0xFF) 36 37 /* kernel version routines */ 38 39 /** 40 * @brief Return the kernel version of the present build 41 * 42 * The kernel version is a four-byte value, whose format is described in the 43 * file "kernel_version.h". 44 * 45 * @return kernel version 46 */ 47 uint32_t sys_kernel_version_get(void); 48 49 /** 50 * @} 51 */ 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 #endif /* ZEPHYR_INCLUDE_KERNEL_VERSION_H_ */ 58