mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-22 08:39:23 +08:00
[mpp_info]: add mpp_info with svn information
git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@50 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
@@ -320,5 +320,10 @@ include_directories(osal/inc)
|
||||
# OSAL is needed on all platform, do not need option
|
||||
add_subdirectory(osal)
|
||||
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# osal library
|
||||
# ----------------------------------------------------------------------------
|
||||
# Operation System Abstract Layer (OSAL) include
|
||||
include_directories(mpp/inc)
|
||||
# OSAL is needed on all platform, do not need option
|
||||
add_subdirectory(mpp)
|
||||
|
9
mpp/CMakeLists.txt
Normal file
9
mpp/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
# vim: syntax=cmake
|
||||
include_directories(.)
|
||||
|
||||
add_library(mpp STATIC
|
||||
mpp_info.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(mpp osal)
|
||||
|
107
mpp/mpp_info.cpp
Normal file
107
mpp/mpp_info.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright 2010 Rockchip Electronics S.LSI Co. LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define MODULE_TAG "mpp_info"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "rk_log.h"
|
||||
#include "rk_env.h"
|
||||
#include "mpp_info.h"
|
||||
|
||||
#include "svn_info.h"
|
||||
|
||||
mpp_info *mpp_info::singleton = NULL;
|
||||
|
||||
static char mpp_version_revision[] = SVN_VERSION;
|
||||
static char mpp_version_author[] = SVN_AUTHOR;
|
||||
static char mpp_version_date[] = SVN_DATE;
|
||||
static char mpp_version_one_line[] = SVN_ONE_LINE;
|
||||
|
||||
mpp_info *mpp_info::getInstance()
|
||||
{
|
||||
if (singleton == NULL) {
|
||||
singleton = new mpp_info();
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
static RK_CHIP_TYPE chip_version(void)
|
||||
{
|
||||
RK_CHIP_TYPE type = NONE;
|
||||
char *value = NULL;
|
||||
RK_S32 ret = rk_get_env_str("ro.product.board", &value, NULL);
|
||||
|
||||
if (0 == ret) {
|
||||
if (strstr(value, "rk29")) {
|
||||
rk_log("rk29 board found in board property");
|
||||
type = RK29;
|
||||
} else if (strstr(value, "rk30")) {
|
||||
rk_log("rk30 board found in board property");
|
||||
type = RK30;
|
||||
}
|
||||
}
|
||||
if (NONE == type) {
|
||||
ret = rk_get_env_str("ro.board.platform", &value, NULL);
|
||||
if (0 == ret) {
|
||||
if (strstr(value, "rk29")) {
|
||||
rk_log("rk29 board found in platform property");
|
||||
type = RK29;
|
||||
} else if (strstr(value, "rk30")) {
|
||||
rk_log("rk30 board found in platform property");
|
||||
type = RK30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NONE == type) {
|
||||
rk_log("can not found matched chip type");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
mpp_info::mpp_info()
|
||||
{
|
||||
chip_type = chip_version();
|
||||
|
||||
mpp_info_revision = mpp_version_revision;
|
||||
mpp_info_author = mpp_version_author;
|
||||
mpp_info_date = mpp_version_date;
|
||||
mpp_revision = atoi(SVN_VERSION);
|
||||
|
||||
rk_log("%s\n", mpp_version_one_line);
|
||||
}
|
||||
|
||||
void mpp_info::show_mpp_info()
|
||||
{
|
||||
rk_log("mpp revision : %s", mpp_info_revision);
|
||||
rk_log("mpp author : %s", mpp_info_author);
|
||||
rk_log("mpp date : %s", mpp_info_date);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
RK_CHIP_TYPE get_chip_type()
|
||||
{
|
||||
return chip_version();
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
40
mpp/mpp_info.h
Normal file
40
mpp/mpp_info.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef _mpp_VPU_VERSION_
|
||||
#define _mpp_VPU_VERSION_
|
||||
|
||||
typedef enum RK_CHIP_TYPE {
|
||||
NONE,
|
||||
RK29,
|
||||
RK30,
|
||||
RK31,
|
||||
|
||||
RK_CHIP_NUM = 0x100,
|
||||
} RK_CHIP_TYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
class mpp_info
|
||||
{
|
||||
public:
|
||||
RK_CHIP_TYPE get_chip_type() {return chip_type;}
|
||||
int get_mpp_revision() {return mpp_revision;}
|
||||
void show_mpp_info();
|
||||
|
||||
static mpp_info *getInstance();
|
||||
virtual ~mpp_info() {};
|
||||
private:
|
||||
static mpp_info *singleton;
|
||||
mpp_info();
|
||||
int mpp_revision;
|
||||
char *mpp_info_revision;
|
||||
char *mpp_info_author;
|
||||
char *mpp_info_date;
|
||||
RK_CHIP_TYPE chip_type;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
RK_CHIP_TYPE get_chip_type();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user