示例#1
0
static HI_S32 s32StopVi(VI_ATTR_S * pstViAttr)
{
    HI_S32 i;
    HI_S32 s32Ret;
    HI_U32 u32ChnNum;

    if(!pstViAttr)
    {
        printf("%s: null ptr\n", __FUNCTION__);
        return HI_FAILURE;
    }
    
    /*** Stop VI Chn ***/
	u32ChnNum = pstViAttr->u32ChnNum;
    for(i=0;i < u32ChnNum; i++)
    {
        /* Stop vi phy-chn */
        s32Ret = HI_MPI_VI_DisableChn(i);
        if (HI_SUCCESS != s32Ret)
        {
            printf("HI_MPI_VI_DisableChn failed with %#x\n",s32Ret);
            return HI_FAILURE;
        }
    }

    /*** Stop VI Dev ***/
    s32Ret = HI_MPI_VI_DisableDev(pstViAttr->ViDev);
    if (HI_SUCCESS != s32Ret)
    {
        printf("HI_MPI_VI_DisableDev failed with %#x\n", s32Ret);
        return HI_FAILURE;
    }
    return HI_SUCCESS;
}
/*****************************************************************************
* function : stop vi accroding to product type
*****************************************************************************/
HI_S32 SAMPLE_COMM_VI_Stop(SAMPLE_VI_MODE_E enViMode)
{
    VI_DEV ViDev;
    VI_CHN ViChn;
    HI_S32 i;
    HI_S32 s32Ret;
    SAMPLE_VI_PARAM_S stViParam;

    /*** get parameter from Sample_Vi_Mode ***/
    s32Ret = SAMPLE_COMM_VI_Mode2Param(enViMode, &stViParam);
    if (HI_SUCCESS !=s32Ret)
    {
        SAMPLE_PRT("SAMPLE_COMM_VI_Mode2Param failed!\n");
        return HI_FAILURE;
    }

    /*** Stop VI Chn ***/
    for(i=0;i<stViParam.s32ViChnCnt;i++)
    {
        /* Stop vi phy-chn */
        ViChn = i * stViParam.s32ViChnInterval;
        s32Ret = HI_MPI_VI_DisableChn(ViChn);
        if (HI_SUCCESS != s32Ret)
        {
            SAMPLE_PRT("SAMPLE_COMM_VI_StopChn failed with %#x\n",s32Ret);
            return HI_FAILURE;
        }
        /* HD mode, we will stop vi sub-chn */
        if (HI_TRUE == SAMPLE_COMM_VI_IsHd(enViMode))
        {
            ViChn += 16;
            s32Ret = HI_MPI_VI_DisableChn(ViChn);
            if (HI_SUCCESS != s32Ret)
            {
                SAMPLE_PRT("SAMPLE_COMM_VI_StopChn failed with %#x\n", s32Ret);
                return HI_FAILURE;
            }
        }
    }

    /*** Stop VI Dev ***/
    for(i=0; i<stViParam.s32ViDevCnt; i++)
    {
        ViDev = i * stViParam.s32ViDevInterval;
        s32Ret = HI_MPI_VI_DisableDev(ViDev);
        if (HI_SUCCESS != s32Ret)
        {
            SAMPLE_PRT("SAMPLE_COMM_VI_StopDev failed with %#x\n", s32Ret);
            return HI_FAILURE;
        }
    }

    return HI_SUCCESS;
}
HI_S32 SAMPLE_COMM_VI_StopIsp(SAMPLE_VI_CONFIG_S* pstViConfig) {
	VI_DEV ViDev;
	VI_CHN ViChn;
	HI_S32 i;
	HI_S32 s32Ret;
	HI_U32 u32DevNum = 1;
	HI_U32 u32ChnNum = 1;

	if (!pstViConfig) {
		SAMPLE_PRT("%s: null ptr\n", __FUNCTION__);
		return HI_FAILURE;
	}

	/*** Stop VI Chn ***/
	for (i = 0; i < u32ChnNum; i++) {
		/* Stop vi phy-chn */
		ViChn = i;
		s32Ret = HI_MPI_VI_DisableChn(ViChn);
		if (HI_SUCCESS != s32Ret) {
			SAMPLE_PRT("HI_MPI_VI_DisableChn failed with %#x\n", s32Ret);
			return HI_FAILURE;
		}
	}

	/*** Stop VI Dev ***/
	for (i = 0; i < u32DevNum; i++) {
		ViDev = i;
		s32Ret = HI_MPI_VI_DisableDev(ViDev);
		if (HI_SUCCESS != s32Ret) {
			SAMPLE_PRT("HI_MPI_VI_DisableDev failed with %#x\n", s32Ret);
			return HI_FAILURE;
		}
	}

	SAMPLE_COMM_ISP_Stop();
	return HI_SUCCESS;
}