/* * Copyright (c) 2014 Amlogic, Inc. All rights reserved. * * This source code is subject to the terms and conditions defined in the * file 'LICENSE' which is part of this source code package. * * Description: c++ file */ #define LOG_MODULE_TAG "TV" #define LOG_CLASS_TAG "CVrr" #include #include #include #include "CTvLog.h" #include #include #include #include #include #include "CVrr.h" CVrr *CVrr::mInstance; CVrr *CVrr::getInstance() { if (NULL == mInstance) { mInstance = new CVrr(); } return mInstance; } CVrr::CVrr() { mVrrDeviceId = VrrOpenModule(); } CVrr::~CVrr() { VrrCloseModule(); } int CVrr::VrrOpenModule() { int fd = open ( CS_VRR_DEV_PATH, O_RDWR ); if ( fd < 0 ) { LOGE("Open %s error(%s)!\n", CS_VRR_DEV_PATH, strerror ( errno )); return -1; } return fd; } int CVrr::VrrCloseModule() { if ( mVrrDeviceId != -1 ) { close ( mVrrDeviceId ); mVrrDeviceId = -1; } return 0; } int CVrr::VrrDeviceIOCtl(int request, ...) { int ret = -1; va_list ap; void *arg; va_start ( ap, request ); arg = va_arg ( ap, void *); va_end ( ap ); ret = ioctl(mVrrDeviceId, request, arg); return ret; } bool CVrr::GetVrrSupport() { unsigned int isSupport = 0; VrrDeviceIOCtl(VRR_IOC_CMD_GET_SUPPORT, &isSupport); LOGD("%s, support[%s] !\n", __FUNCTION__, isSupport ? "true":"false"); return isSupport ? true:false; }