예제 #1
0
MINT32 halAUTORAMA::mHalAutoramaCalcStitch(void* SrcImg,MINT32 gEv,MTKPIPEAUTORAMA_DIRECTION_ENUM DIRECTION
                                          )
{
    MINT32 Retcode = S_AUTORAMA_OK;

    MHAL_LOG("[mHalAutoramaCalcStitch] \n");

    MTKAutoramaProcInfo AutoramaProcInfo;

    AutoramaProcInfo.AutoramaCtrlEnum = MTKAUTORAMA_CTRL_ADD_IMAGE;
    AutoramaProcInfo.SrcImgAddr = (MUINT32)SrcImg;
    AutoramaProcInfo.EV = gEv;
    AutoramaProcInfo.StitchDirection=(MTKAUTORAMA_DIRECTION_ENUM)DIRECTION;
    Retcode = m_pMTKAutoramaObj->AutoramaFeatureCtrl(MTKAUTORAMA_FEATURE_SET_PROC_INFO, &AutoramaProcInfo, 0);
    if(Retcode!=S_AUTORAMA_OK)
    {
        MHAL_LOG("[mHalAutoramaCalcStitch] MTKAUTORAMA_FEATURE_SET_PROC_INFO Fail \n");
        return Retcode;
    }
    Retcode = m_pMTKAutoramaObj->AutoramaMain();
    if(Retcode!=S_AUTORAMA_OK)
    {
        MHAL_LOG("[mHalAutoramaCalcStitch] AutoramaMain Fail\n");
    }
    return Retcode;
}
예제 #2
0
MINT32
halAUTORAMA::mHalAutoramaInit(MTKPipeAutoramaEnvInfo AutoramaInitInData, MTKPipeMotionEnvInfo MotionInitInfo
                             )
{
    MTKAutoramaEnvInfo AutoramaEnvInfo;
    MTKMotionEnvInfo MyMotionEnvInfo;
    MTKMotionTuningPara MyMotionTuningPara;
    MRESULT Retcode = S_AUTORAMA_OK;
    MHAL_LOG("[mHalAutoramaInit] \n");

    if(sizeof(MotionInitInfo)!=sizeof(MyMotionEnvInfo))
        MHAL_LOG("[mHalAutoramaInit] MotionInitInfo not match\n");

    if(sizeof(AutoramaInitInData)!=sizeof(AutoramaEnvInfo))
        MHAL_LOG("[AutoramaInitInData] AutoramaEnvInfo not match\n");

    if (!m_pMTKAutoramaObj) {
        Retcode = E_AUTORAMA_ERR;
        MHAL_LOG("[mHalAutoramaInit] Err, Init has been called \n");
        return Retcode;
    }

    if (!m_pMTKMotionObj) {
        Retcode = E_AUTORAMA_ERR;
        MHAL_LOG("[mHalAutoramaInit] Err, Init has been called \n");
        return Retcode;
    }

    /*  Pano Driver Init  */
    /*  Set Pano Driver Environment Parameters */
    AutoramaEnvInfo.SrcImgWidth = AutoramaInitInData.SrcImgWidth;
    AutoramaEnvInfo.SrcImgHeight = AutoramaInitInData.SrcImgHeight;
    AutoramaEnvInfo.MaxPanoImgWidth = AutoramaInitInData.MaxPanoImgWidth;
    AutoramaEnvInfo.WorkingBufAddr = (MUINT32)AutoramaInitInData.WorkingBufAddr;
    AutoramaEnvInfo.WorkingBufSize = AutoramaInitInData.WorkingBufSize;
    AutoramaEnvInfo.MaxSnapshotNumber = AutoramaInitInData.MaxSnapshotNumber;
    AutoramaEnvInfo.FixAE = AutoramaInitInData.FixAE;
    AutoramaEnvInfo.FocalLength = AutoramaInitInData.FocalLength;
    AutoramaEnvInfo.GPUWarp = AutoramaInitInData.GPUWarp;
    AutoramaEnvInfo.SrcImgFormat = MTKAUTORAMA_IMAGE_NV21;
    Retcode = m_pMTKAutoramaObj->AutoramaInit(&AutoramaEnvInfo, 0);

    MyMotionEnvInfo.WorkingBuffAddr = MotionInitInfo.WorkingBuffAddr;
    MyMotionEnvInfo.pTuningPara = &MyMotionTuningPara;
    MyMotionEnvInfo.SrcImgWidth = MotionInitInfo.SrcImgWidth;
    MyMotionEnvInfo.SrcImgHeight = MotionInitInfo.SrcImgHeight;
    MyMotionEnvInfo.WorkingBuffSize = MotionInitInfo.WorkingBuffSize;
    MyMotionEnvInfo.pTuningPara->OverlapRatio = MotionInitInfo.pTuningPara->OverlapRatio;
    m_pMTKMotionObj->MotionInit(&MyMotionEnvInfo, NULL);


    return Retcode;
}
예제 #3
0
void GetLensDefaultPara(PNVRAM_LENS_PARA_STRUCT pLensParaDefault)
{
	MUINT32 i;

    MUINT32 LensId = LensInitFunc[gMainLensIdx].LensId;

    if (LensInitFunc[0].getLensDefault == NULL)
    {
        MHAL_LOG("[GetLensDefaultPara]: uninit yet\n\n");
        return;
    }
	
    for (i=0; i<MAX_NUM_OF_SUPPORT_LENS; i++)
    {
        if (LensId == LensInitFunc[i].LensId)
        {
            break;
        }
    }

	if (pLensParaDefault != NULL)
	{
        LensInitFunc[i].getLensDefault((VOID*)pLensParaDefault, sizeof(NVRAM_LENS_PARA_STRUCT));
	}

}
MINT32
halFLASHLIGHT::mHalFlashlightSetFire(
    MINT32 fire
)
{
MINT32 err = 0;
    MHAL_LOG("[mHalFlashlightSetFire]:%d \n",fire);

    if (m_pStrobeDrvObj) {
        err = m_pStrobeDrvObj->setFire((unsigned long)fire);
        if (err <0) {
            MHAL_LOG("[mHalFlashlightSetFire] setFire fail \n");
        }
    }

    return err;
}
예제 #5
0
MINT32 halAUTORAMA::mHalAutoramaGetResult(
    MTKPipeAutoramaResultInfo* ResultInfo
)
{
    MINT32 Retcode = S_AUTORAMA_OK;
    MTKAutoramaResultInfo AutoramaResultInfo;
    Retcode = m_pMTKAutoramaObj->AutoramaFeatureCtrl(MTKAUTORAMA_FEATURE_GET_RESULT, 0, &AutoramaResultInfo);
    if(Retcode!=S_AUTORAMA_OK)
    {
        MHAL_LOG("[mHalAutoramaGetResult] MTKAUTORAMA_FEATURE_GET_RESULT Fail\n");
    }
    MHAL_LOG("[mHalAutoramaGetResult] ImgWidth %d ImgHeight %d ImgBufferAddr 0x%x\n",AutoramaResultInfo.ImgWidth,AutoramaResultInfo.ImgHeight,AutoramaResultInfo.ImgBufferAddr);
    ResultInfo->ImgWidth=AutoramaResultInfo.ImgWidth;
    ResultInfo->ImgHeight=AutoramaResultInfo.ImgHeight;
    ResultInfo->ImgBufferAddr=AutoramaResultInfo.ImgBufferAddr;
    return Retcode;
}
예제 #6
0
MINT32
halAUTORAMA::mHalAutoramaDoMotion(MUINT32* ImgSrc,MUINT32* MotionResult
                                 )
{
    MINT32 err = S_AUTORAMA_OK;
    MTKMotionProcInfo MotionInfo;

    if (!m_pMTKMotionObj) {
        err = E_AUTORAMA_ERR;
        MHAL_LOG("[mHalAutoramaDoMotion] Err, Init has been called \n");
    }
    MotionInfo.ImgAddr = (MUINT32)ImgSrc;
    MHAL_LOG("[mHalAutoramaDoMotion] ImgAddr 0x%x\n",MotionInfo.ImgAddr);
    m_pMTKMotionObj->MotionFeatureCtrl(MTKMOTION_FEATURE_SET_PROC_INFO, &MotionInfo, NULL);
    m_pMTKMotionObj->MotionMain();
    m_pMTKMotionObj->MotionFeatureCtrl(MTKMOTION_FEATURE_GET_RESULT, NULL, MotionResult);
    return err;
}
halFLASHLIGHTBase*
halFLASHLIGHT::
getInstance()
{

    MHAL_LOG("[halFLASHLIGHT] getInstance \n");
    static halFLASHLIGHT singleton;
    return &singleton;
}
halPANOBase*
halPANO::
getInstance()
{
    MHAL_LOG("[halPANO] getInstance \n");
    if (pHalPANO == NULL) {
        pHalPANO = new halPANO();
    }
    return pHalPANO;
}
kal_int32
halPANO::mHalPanoInit(
)
{
    kal_int32 err = S_Pano_OK;

    MHAL_LOG("[mHalPanoInit] \n");

    if (m_pMTKPanoObj) {
        err = E_Pano_ERR;
        MHAL_LOG("[mHalPanoInit] Err, Init has been called \n");
    }
    m_pMTKPanoObj = new AppPano();
    MHAL_ASSERT(m_pMTKPanoObj != NULL, "Err");

    memset(pstPanoParam, 0, sizeof(CAMERA_PANO_PROCESS_STRUCT));

    return err;
}
예제 #10
0
halAUTORAMABase*
halAUTORAMA::
getInstance()
{
    MHAL_LOG("[halAUTORAMA] getInstance \n");
    if (pHalAUTORAMA == NULL) {
        pHalAUTORAMA = new halAUTORAMA();
    }
    return pHalAUTORAMA;
}
예제 #11
0
MINT32 halAUTORAMA::mHalAutoramaDoStitch(
)
{
    MINT32 Retcode = S_AUTORAMA_OK;
    MTKAutoramaProcInfo AutoramaProcInfo;

    MHAL_LOG("[mHalAutoramaDoStitch] \n");

    AutoramaProcInfo.AutoramaCtrlEnum = MTKAUTORAMA_CTRL_STITCH;
    Retcode = m_pMTKAutoramaObj->AutoramaFeatureCtrl(MTKAUTORAMA_FEATURE_SET_PROC_INFO, &AutoramaProcInfo, 0);
    if(Retcode!=S_AUTORAMA_OK)
    {
        MHAL_LOG("[mHalAutoramaDoStitch] MTKAUTORAMA_FEATURE_SET_PROC_INFO Fail \n");
        return Retcode;
    }
    /* Stitching the images stored in Pano Driver */
    Retcode = m_pMTKAutoramaObj->AutoramaMain();
    if(Retcode!=S_AUTORAMA_OK)
    {
        MHAL_LOG("[mHalAutoramaDoStitch] AutoramaMain Fail\n");
    }
    return Retcode;
}
kal_int32
halPANO::mHalPanoUninit(
)
{
    MHAL_LOG("[mHalPanoUninit] \n");

    if (m_pMTKPanoObj) {
        m_pMTKPanoObj->camera_pano_exit();
        delete m_pMTKPanoObj;
    }
    m_pMTKPanoObj = NULL;

    return ERROR_NONE;
}
예제 #13
0
halAUTORAMA::halAUTORAMA()
{
    m_pMTKAutoramaObj = NULL;
    m_pMTKMotionObj = NULL;

    /*  Create MTKPano Interface  */
    if (m_pMTKAutoramaObj)
        MHAL_LOG("[mHalAutoramaInit] m_pMTKAutoramaObj Init has been called \n");
    else
        m_pMTKAutoramaObj = MTKAutorama::createInstance(DRV_AUTORAMA_OBJ_SW);
    if (!m_pMTKAutoramaObj)
    {
        MHAL_LOG("[mHalAutoramaInit] m_pMTKAutoramaObj Init has been called \n");
    }
    if (m_pMTKMotionObj)
        MHAL_LOG("[mHalAutoramaInit] m_pMTKMotionObj Init has been called \n");
    else
        m_pMTKMotionObj = MTKMotion::createInstance(DRV_MOTION_OBJ_PANO);

    if (!m_pMTKMotionObj)
    {
        MHAL_LOG("[mHalAutoramaInit] m_pMTKMotionObj Init has been called \n");
    }
}
MINT32
halFLASHLIGHT::mHalFlashlightInit(
    MINT32 sensorDev
)
{
    MINT32 err = 0;

    MHAL_LOG("[mHalFlashlightInit] \n");

    if (m_pStrobeDrvObj) {
        MHAL_LOG("[mHalFlashlightInit] Err, Init has been called \n");
        return err;
    }
	// strobe driver
	m_pStrobeDrvObj = StrobeDrv::createInstance();
    if (NULL == m_pStrobeDrvObj) {
        MHAL_LOG("[mHalFlashlightInit] ERROR:create m_pStrobeDrvObj fail \n");
        return -1;
    }
    //strobe drv init
    m_pStrobeDrvObj->init((unsigned long)sensorDev);
    
    return err;
}
예제 #15
0
void GetCameraDefaultPara(MUINT32 SensorId,
						  PNVRAM_CAMERA_PARA_STRUCT pCameraParaDefault,
						  PNVRAM_CAMERA_3A_STRUCT pCamera3ANVRAMDefault,
						  PNVRAM_CAMERA_SHADING_STRUCT pCameraShadingDefault,
						  PNVRAM_CAMERA_DEFECT_STRUCT pCameraDefectDefault,
						  P3A_PARAM_T pCamera3AParam,
						  P3A_STAT_CONFIG_PARAM_T pCamera3AStatConfigParam)
{
    MUINT32 i;

    if (NULL == pstSensorInitFunc[0].getCameraDefault)
    {
        MHAL_LOG("[GetCameraDefaultPara]: uninit yet\n\n");
        return; //not initial pstSensorInitFunc yet
    }
    
    for (i=0;i<MAX_NUM_OF_SUPPORT_SENSOR;i++)
    {
        if (SensorId == pstSensorInitFunc[i].SensorId)
        {
            break;
        }
    }

    if (MAX_NUM_OF_SUPPORT_SENSOR == i)
    {
        //return 1; //no match sensorId
    }

	if (pCameraParaDefault!=NULL)
        pstSensorInitFunc[i].getCameraDefault(CAMERA_NVRAM_DATA_PARA,(VOID*)pCameraParaDefault,sizeof(NVRAM_CAMERA_PARA_STRUCT));

	if (pCamera3ANVRAMDefault != NULL)
	    pstSensorInitFunc[i].getCameraDefault(CAMERA_NVRAM_DATA_3A,(VOID*)pCamera3ANVRAMDefault,sizeof(NVRAM_CAMERA_3A_STRUCT));

	if (pCameraShadingDefault!=NULL)
	    pstSensorInitFunc[i].getCameraDefault(CAMERA_NVRAM_DATA_SHADING,(VOID*)pCameraShadingDefault,sizeof(NVRAM_CAMERA_SHADING_STRUCT));

	if (pCameraDefectDefault!=NULL)
	    pstSensorInitFunc[i].getCameraDefault(CAMERA_NVRAM_DATA_DEFECT,(VOID*)pCameraDefectDefault,sizeof(NVRAM_CAMERA_DEFECT_STRUCT));

    if (pCamera3AParam!=NULL)
	    pstSensorInitFunc[i].getCameraDefault(CAMERA_DATA_3A_PARA,(VOID*)pCamera3AParam,sizeof(AAA_PARAM_T));

    if (pCamera3AStatConfigParam!=NULL)
	    pstSensorInitFunc[i].getCameraDefault(CAMERA_DATA_3A_STAT_CONFIG_PARA,(VOID*)pCamera3AStatConfigParam,sizeof(AAA_STAT_CONFIG_PARAM_T));

} /* GetCameraNvramValue() */
kal_int32 halPANO::mHalPanoCalcStitch(
)
{
    kal_int32 err = S_Pano_OK;
    PANO_STATE_ENUM state;

    MHAL_LOG("[mHalPanoCalcStitch] \n");

    m_pMTKPanoObj->camera_pano_add_image(pstPanoParam);

    state = PANO_ADD_IMAGE_STATE;
    while (state != PANO_READY_STATE) {
        state = m_pMTKPanoObj->camera_pano_process();
    }

    return err;
}
MINT32
halFLASHLIGHT::mHalFlashlightUninit(
)
{
    MHAL_LOG("[mHalFlashlightUninit] \n");

	// strobe driver
    if (m_pStrobeDrvObj) {
        m_pStrobeDrvObj->uninit();
        m_pStrobeDrvObj->destroyInstance();
		m_pStrobeDrvObj = NULL;
    }
    
    m_pStrobeDrvObj = NULL;

    return 0;
}
예제 #18
0
MINT32
halAUTORAMA::mHalAutoramaGetWokSize(int SrcWidth, int SrcHeight, int ShotNum, int &WorkingSize)
{
    MTKAutoramaGetEnvInfo AutoramaGetEnvInfo;
    MINT32 Retcode = S_AUTORAMA_OK;

    AutoramaGetEnvInfo.ImgWidth          = SrcWidth;
    AutoramaGetEnvInfo.ImgHeight         = SrcHeight;
    AutoramaGetEnvInfo.MaxSnapshotNumber = ShotNum;
    Retcode = m_pMTKAutoramaObj->AutoramaFeatureCtrl(MTKAUTORAMA_FEATURE_GET_ENV_INFO, 0, &AutoramaGetEnvInfo);
    if(Retcode!=S_AUTORAMA_OK)
    {
        MHAL_LOG("[mHalAutoramaGetResult] MTKAUTORAMA_FEATURE_GET_RESULT Fail\n");
    }

    WorkingSize = AutoramaGetEnvInfo.WorkingBuffSize;
    return Retcode;
}
예제 #19
0
MINT32
halAUTORAMA::mHalAutoramaUninit(
)
{
    MHAL_LOG("[mHalAutoramaUninit] \n");
    if (m_pMTKMotionObj) {
        m_pMTKMotionObj->MotionExit();
        m_pMTKMotionObj->destroyInstance();
    }
    m_pMTKMotionObj = NULL;

    if (m_pMTKAutoramaObj) {
        m_pMTKAutoramaObj->AutoramaExit();
        m_pMTKAutoramaObj->destroyInstance();
    }
    m_pMTKAutoramaObj = NULL;

    return S_AUTORAMA_OK;
}
kal_int32 halPANO::mHalPanoDoStitch(
)
{
    kal_int32 err = S_Pano_OK;
    PANO_STATE_ENUM state;

    MHAL_LOG("[mHalPanoDoStitch] \n");

    m_pMTKPanoObj->camera_pano_stitch(pstPanoParam);

    state = PANO_ADD_IMAGE_STATE;
    while (state != PANO_READY_STATE) {
        state = m_pMTKPanoObj->camera_pano_process();
    }

    pstPanoResult = m_pMTKPanoObj->camera_pano_get_result();

    return err;
}
MINT32 halFLASHLIGHT::mHalFlashlightSetParam(
    MINT32 param0,
    MINT32 param1,
    MINT32 param2,
    MINT32 param3
)
{
    MINT32 err = 0;
    MINT32 strobeMode = -1;//AE_STROBE_MODE_UNSUPPORTED;
    
    if (param0) {
        strobeMode = *(MINT32*)param0;
        //AE_STROBE_MODE_FORCE_TORCH
    }
    MHAL_LOG("[mHalFlashlightSetParam]:strobeMode %d \n",strobeMode);

    if (m_pStrobeDrvObj) {
        err = m_pStrobeDrvObj->setFlashlightModeConf(strobeMode);
    }
    return err;
}
예제 #22
0
MUINT32 GetCameraCalData(MUINT32 SensorId, MUINT32* pGetSensorCalData)
{
    MINT32 result = 0xFF;
    MUINT32 i;
//    MHAL_LOG("GetCameraCalData(MainSensorIdx=%d) Enter\n",SensorId);
    for (i=0;i<MAX_NUM_OF_SUPPORT_SENSOR;i++)
    {
        if (SensorId == pstSensorInitFunc[i].SensorId)
        {
//            MHAL_LOG("[i]=%d \n",i);
            break;
        }
    }    
    if (pstSensorInitFunc[i].getCameraCalData != NULL)
    {
        result = pstSensorInitFunc[i].getCameraCalData(pGetSensorCalData);
    }
    else
    {        
        MHAL_LOG("[GetCameraCalData]: uninit yet\n\n");
    }
    return result;
}
MINT32
mHalIoCtrl(
    MUINT32 a_u4CtrlCode,
    MVOID *a_pInBuffer,
    MUINT32 a_u4InBufSize,
    MVOID *a_pOutBuffer,
    MUINT32 a_u4OutBufSize,
    MUINT32 *pBytesReturned
)
{
    MINT32 err = MHAL_NO_ERROR;

    //MHAL_LOG("[mHalIoCtrl] %s, 0x%x \n\n", __TIME__, a_u4CtrlCode);

    if (a_u4CtrlCode & MHAL_IOCTL_VIDEO_GROUP_MASK) {
        //err = mHalVideoIoCtrl(a_u4CtrlCode, a_pInBuffer, a_u4InBufSize, a_pOutBuffer, a_u4OutBufSize, pBytesReturned);
        MHAL_LOG("No Implement !!!");
        return err;
    }

    switch (a_u4CtrlCode) {
    case MHAL_IOCTL_LOCK_RESOURCE:
        break;

    case MHAL_IOCTL_UNLOCK_RESOURCE:
        break;

    case MHAL_IOCTL_JPEG_DEC_SET_READ_FUNC:
        MHAL_LOG("No Implement !!!");
        break;

    case MHAL_IOCTL_JPEG_DEC_START:
        //err = mHalJpgDecStart((MHAL_JPEG_DEC_START_IN*)a_pInBuffer);
        MHAL_LOG("No Implement !!!");
        break;

    case MHAL_IOCTL_JPEG_DEC_GET_INFO:
        //err = mHalJpgDecGetInfo((MHAL_JPEG_DEC_INFO_OUT*)a_pOutBuffer);
        MHAL_LOG("No Implement !!!");
        break;

    case MHAL_IOCTL_JPEG_DEC_PARSER:
        //err = mHalJpgDecParser((unsigned char*)a_pInBuffer, a_u4InBufSize);
        MHAL_LOG("No Implement !!!");
        break;        

    case MHAL_IOCTL_JPEG_ENC:
        err = mHalJpgEncStart((MHAL_JPEG_ENC_START_IN*) a_pInBuffer);
        //MHAL_LOG("No Implement !!!");
        break;

    case MHAL_IOCTL_BITBLT:
        err = mHalBitblt(a_pInBuffer);
        break;

    case MHAL_IOCTL_DIRECT_BITBLT_PREPARE:
        //err= mHalDirectBitbltPrepare(a_pInBuffer);
        MHAL_LOG("No Implement !!!");
        break;

    case MHAL_IOCTL_DIRECT_BITBLT_END:
        //err= mHalDirectBitbltEnd(a_pInBuffer);
        MHAL_LOG("No Implement !!!");
        break;

    case MHAL_IOCTL_FB_CONFIG_IMEDIATE_UPDATE: 
        err = mHalFBConfigImmediateUpdate(*(MINT32 *) a_pInBuffer);
        break;

   case MHAL_IOCTL_FACTORY:
        //err= mHalFactory(a_pInBuffer);
        break;
         
    default:
        MHAL_ASSERT(0, "Err, unknown a_u4CtrlCode");
        break;
    }

    return err;
}
halFLASHLIGHT::halFLASHLIGHT()
{
    m_pStrobeDrvObj = NULL;
    MHAL_LOG("halFLASHLIGHT()\n");
}
MINT32 mtk_AdjustPrio(MHAL_CHAR *name)
{

#ifdef CONFIG_PRIORITY_BY_PROC
    MINT32 fd;

    struct priority_data data;
    struct sched_param sched_set;

    strcpy(data.name, name);

    fd = open("/dev/priority", O_RDONLY, 0);

    if(fd == -1)
    {
        MHAL_LOG("Error: Cannot open the /dev/priority \n");
        return -1;
    }

    ioctl(fd, NULL, (int) &data);

    MHAL_LOG("Schedule policy : %d\n", data.policy);
    MHAL_LOG("Schedule priority : %d\n", data.priority);

    if(data.policy == SCHED_NORMAL)
    {
        int prio_process = 0;
        pid_t pid = gettid();

        sched_set.sched_priority = 0;
        MHAL_LOG("Schedule NORMAL !\n");

        if(0 != sched_setscheduler(pid, SCHED_NORMAL, &sched_set))
        {
            MHAL_LOG("Error: Set scheduler failed \n");
            return -1;
        }

        if(data.priority < 20 || data.priority >= -20)
        {
            setpriority(PRIO_PROCESS, pid, data.priority);
            MHAL_LOG("Set %d Schedule NORMAL priority %d!\n", pid, data.priority);
            prio_process = getpriority(PRIO_PROCESS, pid);
            MHAL_LOG("Get %d Schedule NORMAL priority %d!\n", pid, prio_process);
        }
        else
        {
            MHAL_LOG("Error: Priority exceed the region \n");
            close(fd);
            return -1;
        }
    }
    else if(data.policy == SCHED_FIFO || data.policy == SCHED_RR)
    {
        pid_t pid = gettid();

        if(data.priority > 99 || data.priority < 0)
        {
            MHAL_LOG("Error: Priority exceed the region \n");
            close(fd);
            return -1;
        }

        sched_set.sched_priority = data.priority;
        MHAL_LOG("Set %d Schedule Real-Time !\n", pid);
        if(0 != sched_setscheduler(pid, data.policy, &sched_set))
        {
            MHAL_LOG("Error: Set scheduler failed \n");
            close(fd);
            return -1;
        }
    }
    else
    {
        close(fd);
        return -1;
    }

    close(fd);
    MHAL_LOG("1. mtk_AdjustPrio for proc setting %s\n", name);
#else
    MHAL_LOG("2. mtk_AdjustPrio for header file %s\n", name);
#endif
    return 0;
}