Line data Source code
1 0 : /* 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 : * @brief Kernel Version APIs
22 : *
23 : * The kernel version has been converted from a string to a four-byte
24 : * quantity that is divided into two parts.
25 : *
26 : * Part 1: The three most significant bytes represent the kernel's
27 : * numeric version, x.y.z. These fields denote:
28 : * x -- major release
29 : * y -- minor release
30 : * z -- patchlevel release
31 : * Each of these elements must therefore be in the range 0 to 255, inclusive.
32 : *
33 : * Part 2: The least significant byte is reserved for future use.
34 : */
35 0 : #define SYS_KERNEL_VER_MAJOR(ver) (((ver) >> 24) & 0xFF)
36 0 : #define SYS_KERNEL_VER_MINOR(ver) (((ver) >> 16) & 0xFF)
37 0 : #define SYS_KERNEL_VER_PATCHLEVEL(ver) (((ver) >> 8) & 0xFF)
38 :
39 : /* kernel version routines */
40 :
41 : /**
42 : * @brief Return the kernel version of the present build
43 : *
44 : * The kernel version is a four-byte value, whose format is described in the
45 : * file "kernel_version.h".
46 : *
47 : * @return kernel version
48 : */
49 1 : uint32_t sys_kernel_version_get(void);
50 :
51 : /**
52 : * @}
53 : */
54 :
55 : #ifdef __cplusplus
56 : }
57 : #endif
58 :
59 : #endif /* ZEPHYR_INCLUDE_KERNEL_VERSION_H_ */
|