diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f9859b1..fc2ad095 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/mpp/CMakeLists.txt b/mpp/CMakeLists.txt new file mode 100644 index 00000000..b442a01a --- /dev/null +++ b/mpp/CMakeLists.txt @@ -0,0 +1,9 @@ +# vim: syntax=cmake +include_directories(.) + +add_library(mpp STATIC + mpp_info.cpp + ) + +target_link_libraries(mpp osal) + diff --git a/mpp/mpp_info.cpp b/mpp/mpp_info.cpp new file mode 100644 index 00000000..2748192b --- /dev/null +++ b/mpp/mpp_info.cpp @@ -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 +#include + +#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 + + diff --git a/mpp/mpp_info.h b/mpp/mpp_info.h new file mode 100644 index 00000000..ea560077 --- /dev/null +++ b/mpp/mpp_info.h @@ -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