mirror of
https://github.com/OpenAMP/open-amp.git
synced 2026-02-06 11:13:09 +08:00
lib: add new API to get the library version
Add similar API that the libmetal to allow application to get information about the version of the openamp library. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
This commit is contained in:
committed by
Arnaud Pouliquen
parent
d8541f2f12
commit
2833ca2aaa
@@ -4,6 +4,7 @@ set_property (GLOBAL PROPERTY "PROJECT_LIB_EXTRA_CFLAGS")
|
||||
collector_create (PROJECT_LIB_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
collect (PROJECT_LIB_DIRS "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
collect (PROJECT_INC_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
collect (PROJECT_LIB_SOURCES version.c)
|
||||
|
||||
|
||||
add_subdirectory (virtio)
|
||||
|
||||
77
lib/include/openamp/version.h
Normal file
77
lib/include/openamp/version.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (c) 2021, STMicroelectronics.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file version.h
|
||||
* @brief Library version information for OpenAMP.
|
||||
*/
|
||||
|
||||
#ifndef __OPENAMP_VERSION__H__
|
||||
#define __OPENAMP_VERSION__H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup versions Library Version Interfaces
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Library major version number.
|
||||
*
|
||||
* Return the major version number of the library linked into the application.
|
||||
* This is required to match the value of LIB_VERSION_MAJOR, which is the major
|
||||
* version of the library that the application was compiled against.
|
||||
*
|
||||
* @return Library major version number.
|
||||
* @see PROJECT_VERSION_MAJOR
|
||||
*/
|
||||
extern int openamp_version_major(void);
|
||||
|
||||
/**
|
||||
* @brief Library minor version number.
|
||||
*
|
||||
* Return the minor version number of the library linked into the application.
|
||||
* This could differ from the value of LIB_VERSION_MINOR, which is the minor
|
||||
* version of the library that the application was compiled against.
|
||||
*
|
||||
* @return Library minor version number.
|
||||
* @see PROJECT_VERSION_MINOR
|
||||
*/
|
||||
extern int openamp_version_minor(void);
|
||||
|
||||
/**
|
||||
* @brief Library patch level.
|
||||
*
|
||||
* Return the patch level of the library linked into the application. This
|
||||
* could differ from the value of LIB_VERSION_PATCH, which is the patch level of
|
||||
* the library that the application was compiled against.
|
||||
*
|
||||
* @return Library patch level.
|
||||
* @see PROJECT_VERSION_PATCH
|
||||
*/
|
||||
extern int openamp_version_patch(void);
|
||||
|
||||
/**
|
||||
* @brief Library version string.
|
||||
*
|
||||
* Return the version string of the library linked into the application. This
|
||||
* could differ from the value of LIB_VERSION, which is the version string of
|
||||
* the library that the application was compiled against.
|
||||
*
|
||||
* @return Library version string.
|
||||
* @see PROJECT_VERSION
|
||||
*/
|
||||
extern const char *openamp_version(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENAMP_VERSION__H__ */
|
||||
25
lib/version.c
Normal file
25
lib/version.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021, STMicroelectronics
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
int openamp_version_major(void)
|
||||
{
|
||||
return OPENAMP_VERSION_MAJOR;
|
||||
}
|
||||
|
||||
int openamp_version_minor(void)
|
||||
{
|
||||
return OPENAMP_VERSION_MINOR;
|
||||
}
|
||||
|
||||
int openamp_version_patch(void)
|
||||
{
|
||||
return OPENAMP_VERSION_PATCH;
|
||||
}
|
||||
|
||||
const char *openamp_version(void)
|
||||
{
|
||||
return OPENAMP_VERSION;
|
||||
}
|
||||
Reference in New Issue
Block a user