1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSImplClassic |
---|
7 | * |
---|
8 | * @brief This source file contains the implementation of rtems_version(), |
---|
9 | * rtems_version_control_key(), rtems_version_major(), rtems_version_minor(), |
---|
10 | * and rtems_version_revision(). |
---|
11 | * |
---|
12 | * The version strings are created from the various pieces of version |
---|
13 | * information. The main version number is part of the build system and is |
---|
14 | * stamped into <rtems/score/cpuopts.h>. The version control key string is |
---|
15 | * extracted from the version control tool when the code is being built and is |
---|
16 | * updated if it has changed. It is defined in "version-vc-key.h". The key |
---|
17 | * may indicate there are local modification. |
---|
18 | */ |
---|
19 | |
---|
20 | /* |
---|
21 | * Copyright (C) 2017. |
---|
22 | * Chris Johns <chrisj@rtems.org> |
---|
23 | * |
---|
24 | * Redistribution and use in source and binary forms, with or without |
---|
25 | * modification, are permitted provided that the following conditions |
---|
26 | * are met: |
---|
27 | * 1. Redistributions of source code must retain the above copyright |
---|
28 | * notice, this list of conditions and the following disclaimer. |
---|
29 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
30 | * notice, this list of conditions and the following disclaimer in the |
---|
31 | * documentation and/or other materials provided with the distribution. |
---|
32 | * |
---|
33 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
34 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
35 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
36 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
37 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
38 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
39 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
40 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
41 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
42 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
43 | * POSSIBILITY OF SUCH DAMAGE. |
---|
44 | */ |
---|
45 | |
---|
46 | #ifdef HAVE_CONFIG_H |
---|
47 | #include "config.h" |
---|
48 | #endif |
---|
49 | |
---|
50 | #include <rtems/version.h> |
---|
51 | #include <rtems/score/cpuopts.h> |
---|
52 | |
---|
53 | #include "version-vc-key.h" |
---|
54 | |
---|
55 | const char *rtems_version( void ) |
---|
56 | { |
---|
57 | #ifdef RTEMS_VERSION_CONTROL_KEY |
---|
58 | return RTEMS_VERSION "." RTEMS_VERSION_CONTROL_KEY; |
---|
59 | #else |
---|
60 | return RTEMS_VERSION; |
---|
61 | #endif |
---|
62 | } |
---|
63 | |
---|
64 | int rtems_version_major( void ) |
---|
65 | { |
---|
66 | return __RTEMS_MAJOR__; |
---|
67 | } |
---|
68 | |
---|
69 | int rtems_version_minor( void ) |
---|
70 | { |
---|
71 | return __RTEMS_MINOR__; |
---|
72 | } |
---|
73 | |
---|
74 | int rtems_version_revision( void ) |
---|
75 | { |
---|
76 | return __RTEMS_REVISION__; |
---|
77 | } |
---|
78 | |
---|
79 | const char *rtems_version_control_key( void ) |
---|
80 | { |
---|
81 | #ifdef RTEMS_VERSION_CONTROL_KEY |
---|
82 | return RTEMS_VERSION_CONTROL_KEY; |
---|
83 | #else |
---|
84 | return ""; |
---|
85 | #endif |
---|
86 | } |
---|