Exemple #1
0
bool HimppSysctl::disableObject()
{
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    return true;
}
Exemple #2
0
HI_S32 MppSysInit(HI_VOID)
{
	HI_S32 i = 0;
	MPP_SYS_CONF_S stSysConf = {0};

	HI_MPI_SYS_Exit();
	
	stSysConf.u32AlignWidth = 16;
    if (HI_MPI_SYS_SetConf(&stSysConf))
    {
        printf("conf : system config failed!\n");
        return -1;
    }

    if (HI_MPI_SYS_Init())
    {
        printf("sys init failed!\n");
        return -1;
    }

	/*to ensure all vo device are disabled*/
	for(i=0; i<VOU_DEV_BUTT; i++)
	{
		(HI_VOID)HI_MPI_VO_Disable(i);
	}

    return HI_SUCCESS;
}
Exemple #3
0
static int _mem_init()
{
    //printf("Init hisi mpp sys & vb\n");
    
    MPP_SYS_CONF_S stSysConf = {0};
    stSysConf.u32AlignWidth = MPP_SYS_ALIGN_WIDTH;
    
    VB_CONF_S stVbConf;
    memset(&stVbConf,0,sizeof(VB_CONF_S));

    unsigned int u32BlkSize;
    stVbConf.u32MaxPoolCnt = 128;
    SIZE_S size;
    size.u32Height = 1088;
    size.u32Width = 1920;
    u32BlkSize = calc_pic_vb_blk_size(&size, PIXEL_FORMAT_YUV_SEMIPLANAR_420, MPP_SYS_ALIGN_WIDTH);
    stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
    stVbConf.astCommPool[0].u32BlkCnt = 15;
    
    CHECK_RET(HI_MPI_VB_Exit(),"HI_MPI_VB_Exit");
    CHECK_RET(HI_MPI_SYS_Exit(),"HI_MPI_SYS_Exit");

    CHECK_RET(HI_MPI_VB_SetConf(&stVbConf),"HI_MPI_VB_SetConf");
    CHECK_RET(HI_MPI_VB_Init(),"HI_MPI_VB_Init");

    CHECK_RET(HI_MPI_SYS_SetConf(&stSysConf),"HI_MPI_SYS_SetConf");
    CHECK_RET(HI_MPI_SYS_Init(),"HI_MPI_SYS_Init");

    return HI_SUCCESS;
}
Exemple #4
0
/* function to process abnormal case                                        */
HI_VOID HandleSig(HI_S32 signo)
{
    if (SIGINT == signo || SIGTSTP == signo)
    {
    	(HI_VOID)HI_MPI_SYS_Exit();
    	(HI_VOID)HI_MPI_VB_Exit();
    	printf("\033[0;31mprogram exit abnormally!\033[0;39m\n");
    }
    exit(0);
}
Exemple #5
0
HI_S32 PCIV_Slave_SysInit()
{
    HI_S32         s32Ret, i;
    MPP_SYS_CONF_S stSysConf = {0};
    VB_CONF_S      stVbConf = {0};
    VI_PUB_ATTR_S  stviAttr;
    VO_PUB_ATTR_S  stvoAttr;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    stVbConf.u32MaxPoolCnt = 128;
    stVbConf.astCommPool[0].u32BlkSize = 884736;/* 768*576*1.5*/
    stVbConf.astCommPool[0].u32BlkCnt  = 20;
    stVbConf.astCommPool[1].u32BlkSize = 221184;/* 384*288*1.5*/
    stVbConf.astCommPool[1].u32BlkCnt  = 60;
    s32Ret = HI_MPI_VB_SetConf(&stVbConf);
    HI_ASSERT((HI_SUCCESS == s32Ret));

    s32Ret = HI_MPI_VB_Init();
    HI_ASSERT((HI_SUCCESS == s32Ret));

    stSysConf.u32AlignWidth = 64;
    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    HI_ASSERT((HI_SUCCESS == s32Ret));

    s32Ret = HI_MPI_SYS_Init();
    HI_ASSERT((HI_SUCCESS == s32Ret));

    /* Enable VI device*/
    memset(&stviAttr,0,sizeof(VI_PUB_ATTR_S));
    stviAttr.enInputMode = VI_MODE_BT656;
    stviAttr.enWorkMode  = VI_WORK_MODE_2D1;
    stviAttr.u32AdType   = AD_2815;
    stviAttr.enViNorm    = VIDEO_ENCODING_MODE_PAL;
    for (i = 0; i < VIU_MAX_DEV_NUM; i++)
    {
        s32Ret = HI_MPI_VI_SetPubAttr(i, &stviAttr);
        HI_ASSERT((HI_SUCCESS == s32Ret));

        s32Ret = HI_MPI_VI_Enable(i);
        HI_ASSERT((HI_SUCCESS == s32Ret));
    }

    /* Enable VO device*/
    stvoAttr.stTvConfig.stComposeMode = VIDEO_ENCODING_MODE_PAL;
    stvoAttr.u32BgColor = 0x000000;
    s32Ret = HI_MPI_VO_SetPubAttr(&stvoAttr);
    HI_ASSERT((HI_SUCCESS == s32Ret));

    s32Ret = HI_MPI_VO_Enable();
    HI_ASSERT((HI_SUCCESS == s32Ret));

    return HI_SUCCESS;
}
Exemple #6
0
int mpp_system_init(void)
{
	HI_S32 s32Ret;
	MPP_SYS_CONF_S stSysConf = {0};
	VB_CONF_S stVbConf ={0};
	static int mpp_inited = 0;

	if(mpp_inited == 1)
	{
		msg_dbg("Mpp system have inited!\n");
		return 0;
	}

	HI_MPI_SYS_Exit();
	HI_MPI_VB_Exit();
//	stVbConf.u32MaxPoolCnt = 128;
	stVbConf.astCommPool[0].u32BlkSize = 720 * 576 * 4;
	stVbConf.astCommPool[0].u32BlkCnt = 20;

	s32Ret = HI_MPI_VB_SetConf(&stVbConf);
	if (HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_SetConf failed 0x%x!\n",s32Ret);
		return -1;
	}

	s32Ret = HI_MPI_VB_Init();
	if(HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_Init failed 0x%x!\n",s32Ret);
		return -1;
	}

	stSysConf.u32AlignWidth = 16;
	s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
	if (HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("conf : system config failed 0x%x!\n",s32Ret);
		return -1;
	}

	s32Ret = HI_MPI_SYS_Init();
	if(HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("HI_MPI_SYS_Init err 0x%x\n",s32Ret);
		return -1;
	}

	mpp_inited = 1;
	
	return 0;
}
Exemple #7
0
HI_S32 SampleSysInit(HI_VOID)
{
    HI_S32 s32Ret;
    MPP_SYS_CONF_S stSysConf = {0};
    VB_CONF_S stVbConf ={0};
    
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();
    
    stVbConf.u32MaxPoolCnt = 64;
    stVbConf.astCommPool[0].u32BlkSize = 768*576*2;
    stVbConf.astCommPool[0].u32BlkCnt = 20; 
    stVbConf.astCommPool[1].u32BlkSize = 384*288*2;
    stVbConf.astCommPool[1].u32BlkCnt = 40; 

    s32Ret = HI_MPI_VB_SetConf(&stVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        printf("HI_MPI_VB_SetConf failed 0x%x!\n",s32Ret);
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_Init();
    if(HI_SUCCESS != s32Ret)
    {
        printf("HI_MPI_VB_Init failed 0x%x!\n",s32Ret);
        return HI_FAILURE;
    }

    stSysConf.u32AlignWidth = 64;

    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        HI_MPI_VB_Exit();
        printf("conf : system config failed 0x%x!\n",s32Ret);
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_SYS_Init();
    if(HI_SUCCESS != s32Ret)
    {
        HI_MPI_VB_Exit();
        printf("HI_MPI_SYS_Init err 0x%x\n",s32Ret);
        return HI_FAILURE;
    }

    return HI_SUCCESS;
}
Exemple #8
0
HI_VOID SampleSysExit(HI_VOID)
{
	HI_S32 s32Ret;

	s32Ret = HI_MPI_SYS_Exit();
	if (HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_SYS_Exit 0x%x!\n",s32Ret);
	}

	s32Ret = HI_MPI_VB_Exit();
	if (HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_Exit 0x%x!\n",s32Ret);
	}
}
Exemple #9
0
int mpp_system_deinit(void)
{
    if (HI_MPI_SYS_Exit())
    {
        printf("sys exit fail\n");
        return -1;
    }

    if (HI_MPI_VB_Exit())
    {
        printf("vb exit fail\n");
        return -1;
    }

    return 0;
}
void ipcam_media_sys_ctrl_init_media_system(IpcamMediaSysCtrl *self)
{
    VB_CONF_S stVbConf;
    MPP_SYS_CONF_S stSysConf = {0};
    HI_S32 s32Ret = HI_FAILURE;

    memset(&stVbConf, 0, sizeof(VB_CONF_S));
    stVbConf.u32MaxPoolCnt = VB_MAX_POOLS;
    stVbConf.astCommPool[0].u32BlkSize = (CEILING_2_POWER(IMAGE_MAX_WIDTH, SYS_ALIGN_WIDTH) * \
                                          CEILING_2_POWER(IMAGE_MAX_HEIGHT, SYS_ALIGN_WIDTH) * \
                                          2);
    stVbConf.astCommPool[0].u32BlkCnt = 12;
    memset(stVbConf.astCommPool[0].acMmzName, 0, sizeof(stVbConf.astCommPool[0].acMmzName));

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    s32Ret = HI_MPI_VB_SetConf(&stVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_VB_SetConf failed with %#x!\n", s32Ret);
        return;
    }

    s32Ret = HI_MPI_VB_Init();
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_VB_Init failed with %#x!\n", s32Ret);
        return;
    }

    stSysConf.u32AlignWidth = SYS_ALIGN_WIDTH;
    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_SYS_SetConf failed with %#x!\n", s32Ret);
        return;
    }

    s32Ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32Ret)
    {
        g_critical("HI_MPI_SYS_Init failed with %#x!\n", s32Ret);
        return;
    }
}
HI_S32 SAMPLE_COMM_IVE_IveMpiExit(HI_VOID)
{
	bMpiInit = HI_FALSE;
	if (HI_MPI_SYS_Exit())
	{
		SAMPLE_PRT("Sys exit failed!\n");  
		return HI_FAILURE;
	}

	if (HI_MPI_VB_Exit())
	{
        SAMPLE_PRT("Vb exit failed!\n");        
        return HI_FAILURE;
    }
    
	return HI_SUCCESS;
}
Exemple #12
0
/******************************************************************************
* function : vb init & MPI system init
******************************************************************************/
HI_S32 SAMPLE_COMM_SYS_Init(VB_CONF_S *pstVbConf)
{
    MPP_SYS_CONF_S stSysConf = {0};
    HI_S32 s32Ret = HI_FAILURE;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    if (NULL == pstVbConf)
    {
        SAMPLE_PRT("input parameter is null, it is invaild!\n");
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_SetConf(pstVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_SetConf failed!\n");
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_Init failed!\n");
        return HI_FAILURE;
    }

    stSysConf.u32AlignWidth = SAMPLE_SYS_ALIGN_WIDTH;
    s32Ret = HI_MPI_SYS_SetConf(&stSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_SetConf failed\n");
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_Init failed!\n");
        return HI_FAILURE;
    }

    return HI_SUCCESS;
}
Exemple #13
0
bool HimppSysctl::enableObject()
{
    HI_S32 s32Ret = HI_FAILURE;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();


    VB_CONF_S vbconf;
    memset(&vbconf, 0, sizeof(vbconf));
    vbconf.u32MaxPoolCnt = maxPoolCount;
    int i = 0;
    for (auto &b : buffers) {
        vbconf.astCommPool[i].u32BlkSize = b.blksiz;
        vbconf.astCommPool[i].u32BlkCnt = b.blkcnt;
        i++;
    }
    s32Ret = HI_MPI_VB_SetConf(&vbconf);
    if (s32Ret != HI_SUCCESS) {
        return HI_FAILURE;
    }

    s32Ret = HI_MPI_VB_Init();
    if (s32Ret != HI_SUCCESS) {
        return HI_FAILURE;
    }

    MPP_SYS_CONF_S sysconf = {
        .u32AlignWidth = alignWidth
    };
    s32Ret = HI_MPI_SYS_SetConf(&sysconf);
    if (s32Ret != HI_SUCCESS) {
        goto err_vb_cleanup;
    }

    s32Ret = HI_MPI_SYS_Init();
    if (s32Ret != HI_SUCCESS) {
        goto err_vb_cleanup;
    }
    return true;

err_vb_cleanup:
    HI_MPI_VB_Exit();
    return false;
}
static HI_S32 SAMPLE_IVE_MPI_Init(HI_VOID)
{
    HI_S32 s32Ret;
    VB_CONF_S struVbConf;
    MPP_SYS_CONF_S struSysConf;

    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();

    memset(&struVbConf,0,sizeof(VB_CONF_S));
    struVbConf.u32MaxPoolCnt             = 128;
    struVbConf.astCommPool[0].u32BlkSize = 1920*1080*3/2;
    struVbConf.astCommPool[0].u32BlkCnt  = 4;
    s32Ret = HI_MPI_VB_SetConf(&struVbConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_SetConf fail,Error(%#x)\n",s32Ret);
        return s32Ret;
    }
    s32Ret = HI_MPI_VB_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_VB_Init fail,Error(%#x)\n",s32Ret);
        return s32Ret;
    }
    struSysConf.u32AlignWidth = 64;
    s32Ret = HI_MPI_SYS_SetConf(&struSysConf);
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_SetConf fail,Error(%#x)\n",s32Ret);
        (HI_VOID)HI_MPI_VB_Exit();
        return s32Ret;
    }
    
    s32Ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32Ret)
    {
        SAMPLE_PRT("HI_MPI_SYS_Init fail,Error(%#x)\n",s32Ret);
        (HI_VOID)HI_MPI_VB_Exit();
        return s32Ret;
    }    

    return HI_SUCCESS;
}
int framework_init ()
{
	VB_CONF_S stVbConf;
	MPP_SYS_CONF_S stSysConf = {0};
	HI_S32 ret = HI_FAILURE;
	int result = FAILURE;

	HI_MPI_SYS_Exit ();
	HI_MPI_VB_Exit ();

	memset (&stVbConf, 0x00, sizeof (stVbConf));
	ret = HI_MPI_VB_SetConf (&stVbConf);
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_VB_SetConf Eorr[%x]\n", ret);
		return result;
	}

	ret = HI_MPI_VB_Init ();
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_VB_Init Eorr[%x]\n", ret);
		return result;
	}

	stSysConf.u32AlignWidth = 64;
	ret = HI_MPI_SYS_SetConf (&stSysConf);
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_SYS_SetConf Eorr[%x]\n", ret);
		return result;
	}

	ret = HI_MPI_SYS_Init ();
	if (ret != HI_SUCCESS)
	{
		printf ("HI_MPI_SYS_Init Eorr[%x]\n", ret);
		return result;
	}

	result = SUCCESS;
	return result;
}
Exemple #16
0
HI_S32 SampleSysInit(MPP_SYS_CONF_S * pstSysConf,VB_CONF_S* pstVbConf)
{
	HI_S32 s32Ret;

    HI_MPI_SYS_Exit();
	HI_MPI_VB_Exit();

	s32Ret = HI_MPI_VB_SetConf(pstVbConf);
	if (HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_SetConf failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_VB_Init();
	if(HI_SUCCESS != s32Ret)
	{
		printf("HI_MPI_VB_Init failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_SYS_SetConf(pstSysConf);
	if (HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("conf : system config failed 0x%x!\n",s32Ret);
		return HI_FAILURE;
	}

	s32Ret = HI_MPI_SYS_Init();
	if(HI_SUCCESS != s32Ret)
	{
		HI_MPI_VB_Exit();
		printf("HI_MPI_SYS_Init err 0x%x\n",s32Ret);
		return HI_FAILURE;
	}

    return HI_SUCCESS;
}
Exemple #17
0
HI_VOID SampleSysExit(HI_VOID)
{   
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();
}
Exemple #18
0
HI_VOID MppSysExit(HI_VOID)
{	
	HI_MPI_SYS_Exit();
}
Exemple #19
0
void SYSTEM_Destroy()
{
	DVR_ASSERT(HI_MPI_SYS_Exit());
	DVR_ASSERT(HI_MPI_VB_Exit());
}
Exemple #20
0
/******************************************************************************
* function : vb exit & MPI system exit
******************************************************************************/
HI_VOID SAMPLE_COMM_SYS_Exit(void)
{
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();
    return;
}
Exemple #21
0
/*****************************************************************************
 Prototype       : main
 Description     : main entry
 Input           : argc    : "reset", "N", "n" is optional.
                   argv[]  : 0 or 1 is optional
 Output          : None
 Return Value    :
 Global Variable
    Read Only    :
    Read & Write :
  History
  1.Date         : 2008/8/30
    Author       : x00100808
    Modification : Created function

*****************************************************************************/
int main(int argc, char *argv[])
{
	char ch;

    /* configure for vi2vo preview                                         */
	MPP_SYS_CONF_S stSysConf = {0};
	VB_CONF_S stVbConf ={0};

	stVbConf.u32MaxPoolCnt = 64;
	stVbConf.astCommPool[0].u32BlkSize = 768*576*2;
	stVbConf.astCommPool[0].u32BlkCnt = 20;
	stVbConf.astCommPool[1].u32BlkSize = 384*288*2;
	stVbConf.astCommPool[1].u32BlkCnt = 60;
	stSysConf.u32AlignWidth = 64;

    if (argc > 1)
    {
        /* if program can not run anymore, you may try 'reset' adhere command  */
        if (!strcmp(argv[1],"reset"))
        {
           	CHECK(HI_MPI_SYS_Exit(),"HI_MPI_SYS_Exit");
        	CHECK(HI_MPI_VB_Exit(),"HI_MPI_VB_Exit");
        	return HI_SUCCESS;
        }
        else if ((!strcmp(argv[1],"N") || (!strcmp(argv[1],"n"))))
        {
            /* if you live in Japan or North America, you may need adhere 'N/n' */
            g_u32TvMode = VIDEO_ENCODING_MODE_NTSC;
            g_u32ScreenHeight = 480;
        }
        else if (!strcmp(argv[1],"vi2vo"))
        {
            /* you can open vi2vo preview only                              */
            g_bPreviewOnly = HI_TRUE;
        }
    }

    /* process abnormal case                                                */
    signal(SIGINT, HandleSig);
    signal(SIGTERM, HandleSig);

    /* configure video buffer and initial system                            */
	CHECK(HI_MPI_VB_SetConf(&stVbConf),"HI_MPI_VB_SetConf");
	CHECK(HI_MPI_VB_Init(),"HI_MPI_VB_Init");
	CHECK(HI_MPI_SYS_SetConf(&stSysConf),"HI_MPI_SYS_SetConf");
	CHECK(HI_MPI_SYS_Init(),"HI_MPI_SYS_Init");


    /* set AD and DA for VI and VO                                          */
    do_Set2815_2d1();
    if (VIDEO_ENCODING_MODE_NTSC == g_u32TvMode)
    {
        do_Set7179(VIDEO_ENCODING_MODE_NTSC);
    }
    else
    {
        do_Set7179(VIDEO_ENCODING_MODE_PAL);;
    }

	Usage();
	while((ch = getchar())!= 'q')
	{

		if('\n' == ch)
		{
			continue;
		}

		switch(ch)
		{
			case '1':
			{
			    printf("\033[0;33mwhat you see is codecing!\033[0;39m\n");
				CHECK(CODEC_1D1_H264(),"CODEC_1D1_H264");
				break;
			}

			case '2':
			{
    			printf("\033[0;33mthe last window is codecing!\033[0;39m\n");
				CHECK(VI2VO_3CIF_CODEC_1CIF_H264(),"VI2VO_3CIF_CODEC_1CIF_H264");
				break;
			}

			case '3':
			{
    			printf("\033[0;33mthe last window is codecing!\033[0;39m\n");
				CHECK(VI2VO_8CIF_CODEC_1CIF_H264(),"VI2VO_8CIF_CODEC_1CIF_H264");
				break;
			}

			default:
				printf("\033[0;31mno order!\033[0;39m\n");
		}

		Usage();
	}

    /* de-init sys and vb */
	CHECK(HI_MPI_SYS_Exit(),"HI_MPI_SYS_Exit");
	CHECK(HI_MPI_VB_Exit(),"HI_MPI_VB_Exit");

	return HI_SUCCESS;
}
Exemple #22
0
HI_S32 main(HI_VOID)
{
    HI_U32 u32Size;
    HI_S32 s32Fd;
    HI_U32 u32Times;
    HI_U8* pu8Screen;

    HI_U32 u32PhyAddr;
    HI_S32 s32Ret = -1;
    HI_U32 i = 0;

    MPP_SYS_CONF_S struSysConf;
    HI_S32 s32ret;

    /* mpi sys init */
    HI_MPI_SYS_Exit();
    struSysConf.u32AlignWidth = 64;
    s32ret = HI_MPI_SYS_SetConf(&struSysConf);
    if (HI_SUCCESS != s32ret)
    {
        printf("HI_MPI_SYS_SetConf err\n");
        return s32ret;
    }
    s32ret = HI_MPI_SYS_Init();
    if (HI_SUCCESS != s32ret)
    {
        printf("HI_MPI_SYS_Init err\n");
        return s32ret;
    }

    struct fb_fix_screeninfo stFixInfo;
    struct fb_var_screeninfo stVarInfo;
    struct fb_bitfield stR32 = {16, 8, 0};
    struct fb_bitfield stG32 = {8, 8, 0};
    struct fb_bitfield stB32 = {0, 8, 0};
    struct fb_bitfield stA32 = {24, 8, 0};

    /* 1. open tde device */
    HI_API_TDE_Open();

    /* 2. framebuffer operation */
    s32Fd = open("/dev/fb/0", O_RDWR);
    if (s32Fd == -1)
    {
        printf("open frame buffer device error\n");
        goto FB_OPEN_ERROR;
    }

    stVarInfo.xres_virtual	 	= SCREEN_WIDTH;
    stVarInfo.yres_virtual		= SCREEN_HEIGHT*2;
    stVarInfo.xres      		= SCREEN_WIDTH;
    stVarInfo.yres      		= SCREEN_HEIGHT;
    stVarInfo.activate  		= FB_ACTIVATE_FORCE;
    stVarInfo.bits_per_pixel	= 32;
    stVarInfo.xoffset = 0;
    stVarInfo.yoffset = 0;
    stVarInfo.red   = stR32;
    stVarInfo.green = stG32;
    stVarInfo.blue  = stB32;
    stVarInfo.transp = stA32;

    if (ioctl(s32Fd, FBIOPUT_VSCREENINFO, &stVarInfo) < 0)
    {
        printf("process frame buffer device error\n");
        goto FB_PROCESS_ERROR0;
    }

    if (ioctl(s32Fd, FBIOGET_FSCREENINFO, &stFixInfo) < 0)
    {
        printf("process frame buffer device error\n");
        goto FB_PROCESS_ERROR0;
    }

    u32Size 	= stFixInfo.smem_len;
    if(u32Size < MIN_VIDEO_MEMORY)
    {
        printf("need more video memory to run the sample, the minimum size is %d\n", MIN_VIDEO_MEMORY);
        goto FB_PROCESS_ERROR0;
    }
    u32PhyAddr  = stFixInfo.smem_start;
    pu8Screen   = mmap(NULL, u32Size, PROT_READ|PROT_WRITE, MAP_SHARED, s32Fd, 0);

    memset(pu8Screen, 0xff, SCREEN_WIDTH*SCREEN_HEIGHT*4);

    /* 3. create surface */
    g_stScreen[0].enColorFmt = PIXFMT;
    g_stScreen[0].pu8PhyAddr = (HI_U8*)u32PhyAddr;
    g_stScreen[0].u16Width = SCREEN_WIDTH;
    g_stScreen[0].u16Height = SCREEN_HEIGHT;
    g_stScreen[0].u16Stride = g_stScreen[0].u16Width * BPP;

    g_stScreen[1] = g_stScreen[0];
    g_stScreen[1].pu8PhyAddr = g_stScreen[0].pu8PhyAddr + g_stScreen[0].u16Stride * g_stScreen[0].u16Height;

    g_stBackGround.pu8PhyAddr = g_stScreen[1].pu8PhyAddr + g_stScreen[1].u16Stride * g_stScreen[1].u16Height;
    CreateSurfaceByBitMap(BACKGROUND_NAME, &g_stBackGround, pu8Screen + ((HI_U32)g_stBackGround.pu8PhyAddr - u32PhyAddr));
    g_stImgSur[0].pu8PhyAddr = g_stBackGround.pu8PhyAddr + g_stBackGround.u16Stride * g_stBackGround.u16Height;
    for(i = 0; i < N_IMAGES - 1; i++)
    {
        CreateSurfaceByBitMap(pszImageNames[i], &g_stImgSur[i], pu8Screen + ((HI_U32)g_stImgSur[i].pu8PhyAddr - u32PhyAddr));
        g_stImgSur[i+1].pu8PhyAddr = g_stImgSur[i].pu8PhyAddr + g_stImgSur[i].u16Stride * g_stImgSur[i].u16Height;
    }
    CreateSurfaceByBitMap(pszImageNames[i], &g_stImgSur[i], pu8Screen + ((HI_U32)g_stImgSur[i].pu8PhyAddr - u32PhyAddr));

    g_s32FrameNum = 0;

    /* 3. use tde and framebuffer to realize rotational effect */
    for (u32Times = 0; u32Times < 1000; u32Times++)
    {
        circumrotate(u32Times%2);
        stVarInfo.yoffset = (u32Times%2)?0:576;

        /*set frame buffer start position*/
        if (ioctl(s32Fd, FBIOPAN_DISPLAY, &stVarInfo) < 0)
        {
            printf("process frame buffer device error\n");
            goto FB_PROCESS_ERROR1;
        }
    }

    s32Ret = 0;

FB_PROCESS_ERROR1:
    munmap(pu8Screen, u32Size);
FB_PROCESS_ERROR0:
    close(s32Fd);
FB_OPEN_ERROR:
    HI_API_TDE_Close();

    return s32Ret;
}
void ipcam_media_sys_ctrl_uninit_media_system(IpcamMediaSysCtrl *self)
{
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();
}
Exemple #24
0
HI_VOID sw_COMM_SYS_Exit(void)
{
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();
    return;
}
Exemple #25
0
int main(int argc, char *argv[])
{
    pthread_t phifb0 = -1,phifb1=-1;
    PTHREAD_HIFB_sw_INFO stInfo0;
    PTHREAD_HIFB_sw_INFO stInfo1;
    VO_PUB_ATTR_S stPubAttr;
    VB_CONF_S stVbConf;
    HI_S32 s32Ret = HI_SUCCESS;
    HI_S32 i;
    sw_VI_MODE_E enViMode = sw_VI_MODE_1_D1;
    sw_VO_MODE_E stVoMode = VO_MODE_1MUX;
    HI_BOOL bExtendedMode=HI_TRUE;
    HI_CHAR ch;
    initFb();
    InitQueue();
    FontInit();
    memset(&stVbConf, 0, sizeof(VB_CONF_S));
    stVbConf.u32MaxPoolCnt             = 16;
    stVbConf.astCommPool[0].u32BlkSize = 720*576*2;
    stVbConf.astCommPool[0].u32BlkCnt  = 16;

    stPubAttr.u32BgColor = 0xff00ff00;
    stPubAttr.enIntfType = VO_INTF_VGA;
    stPubAttr.enIntfSync = VO_OUTPUT_720P50;
    stPubAttr.bDoubleFrame = HI_FALSE;
    if (HI_SUCCESS != sw_COMM_SYS_Init(&stVbConf))
    {
        printf("func:%s,line:%d\n", __FUNCTION__, __LINE__);
        return -1;
    }


    s32Ret = sw_COMM_VO_StartDevLayer(VoDev,&stPubAttr,25);
    if (HI_SUCCESS != s32Ret)
    {
        printf("%s: Start DevLayer failed!\n", __FUNCTION__);
        sw_COMM_SYS_Exit();
        return -1;
    }

    if (HI_SUCCESS != sw_COMM_VO_StartChn(VoDev, &stPubAttr, stVoMode))
    {
        printf("%s: Start VOChn failed!\n", __FUNCTION__);
        sw_COMM_SYS_Exit();
        return -1;
    }

    stInfo0.layer   =  0;
    stInfo0.fd      = -1;
    stInfo0.ctrlkey =  2;
    pthread_create(&phifb0,0,sw_HIFB_REFRESH,(void *)(&stInfo0));
    stInfo1.layer   =  3;
    stInfo1.fd      = -1;
    stInfo1.ctrlkey =  3;

    if (HI_SUCCESS != HI_MPI_VO_GfxLayerUnBindDev(GRAPHICS_LAYER_HC0, sw_VO_DEV_DHD0))
    {
        printf("%s: Graphic UnBind to VODev failed!,line:%d\n", __FUNCTION__, __LINE__);
        sw_COMM_SYS_Exit();
        sw_HIFB_VO_Stop();
        return -1;
    }

    if (HI_SUCCESS != HI_MPI_VO_GfxLayerBindDev(GRAPHICS_LAYER_HC0, sw_VO_DEV_DHD0))
    {
        printf("%s: Graphic Bind to VODev failed!,line:%d\n", __FUNCTION__, __LINE__);
        sw_COMM_SYS_Exit();
        sw_HIFB_VO_Stop();
        return -1;
    }
    pthread_create(&phifb1,0,SAMPLE_HIFB_PANDISPLAY,(void *)(&stInfo1));
    pthread_join(phifb0,0);
    pthread_join(phifb1,0);
    while(1);
    HI_MPI_SYS_Exit();
    HI_MPI_VB_Exit();
    return 0;
}