Exemple #1
0
int demo_start_cam_in( demo_t *pdemo )
{
	int status;

    // PYTHON Receiver Initialization
	if ( pdemo->bVerbose )
	{
		xil_printf( "PYTHON Receiver Initialization ...\n\r" );
	}
	onsemi_python_init(pdemo->ppython_receiver, "PYTHON-1300-C",
			XPAR_ONSEMI_PYTHON_SPI_0_S00_AXI_BASEADDR,
			XPAR_ONSEMI_PYTHON_CAM_0_S00_AXI_BASEADDR);
	pdemo->ppython_receiver->uManualTap = 25; // IDELAY setting (0-31)
    //xil_printf( "PYTHON SPI Config for 10MHz ...\n\r" );
    // axi4lite_0_clk = 75MHz
    onsemi_python_spi_config( pdemo->ppython_receiver, (75000000/10000000) );

    // PYTHON Sensor Initialization
	if ( pdemo->bVerbose )
	{
		xil_printf( "PYTHON Sensor Initialization ...\n\r" );
	}

	// Camera Power Sequence
	fmc_hdmi_cam_iic_mux( pdemo->pfmc_hdmi_cam, FMC_HDMI_CAM_I2C_SELECT_CAM );
	cat9554_initialize(pdemo->pfmc_hdmi_cam_iic);
	usleep(10);

	cat9554_vdd18_en(pdemo->pfmc_hdmi_cam_iic);
	usleep(10);
	cat9554_vdd33_en(pdemo->pfmc_hdmi_cam_iic);
	usleep(10);
	cat9554_vddpix_en(pdemo->pfmc_hdmi_cam_iic);
	usleep(10);

	onsemi_python_sensor_initialize(
			pdemo->ppython_receiver, SENSOR_INIT_ENABLE, pdemo->bVerbose);
	onsemi_python_cam_reg_write(pdemo->ppython_receiver,
			ONSEMI_PYTHON_CAM_SYNCGEN_HTIMING1_REG, 0x00300500);
	onsemi_python_sensor_cds(pdemo->ppython_receiver, pdemo->bVerbose);

	if ( pdemo->bVerbose )
	{
		xil_printf("CFA Initialization\r\n");
	}
	XCfa_Reset(pdemo->pcfa);
	XCfa_RegUpdateEnable(pdemo->pcfa);
	XCfa_Enable(pdemo->pcfa);

	//XCfa_WriteReg(pdemo->pcfa, CFA_BAYER_PHASE, 0x00);
	XCfa_SetBayerPhase(pdemo->pcfa, XCFA_RGRG_COMBINATION);
	XCfa_SetActiveSize(pdemo->pcfa, 1280, 1024);

	return 1;
}
Exemple #2
0
void avnet_config_vgap60_video(demo_t *pInstance) {
	int status;

	Xil_Out32(XPAR_TCM_RECEIVER_0_S00_AXI_BASEADDR + 0x0000, 0x0001);
	XCfa_Reset(pInstance->pcfa);
	XCcm_Reset(pInstance->pccm);
	XRgb2YCrCb_Reset(pInstance->prgb2ycrcb);
	XCresample_Reset(pInstance->pcresample);
	XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_WRITE);
	XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_READ);
	XVtc_Reset(pInstance->pvtc);
	XOSD_Reset(pInstance->posd);

	/* CLKWIZ */
	Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x0200, 0x00002203);
	Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x0208, 0x0000002D);
	Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x025C, 0x00000007);
	Xil_Out32(XPAR_CLK_WIZ_1_BASEADDR + 0x025C, 0x00000002);

	status = 0;
	while (!status) {
		status = Xil_In32(XPAR_CLK_WIZ_1_BASEADDR + 0x0004);
	}

	/* ISERDES Reset Assert */
	Xil_Out32(XPAR_TCM_RECEIVER_0_S00_AXI_BASEADDR + 0x0000, 0x0001);

	/* TCM Initialization */
	tca9548_i2c_mux_select(pInstance->piicps, EMBV_IIC_MUX_CAM);
//	tcm5117pl_get_chip_id(pInstance->piicps);
	tcm5117pl_init(pInstance->piicps, TCM5117PL_VGAP60);

	/* CFA */
	XCfa_Reset(pInstance->pcfa);
	XCfa_Enable(pInstance->pcfa);

	XCfa_SetBayerPhase(pInstance->pcfa, 0x00000001);
	XCfa_SetActiveSize(pInstance->pcfa, 656, 496);
	XCfa_RegUpdateEnable(pInstance->pcfa);

	/* CCM */
	XCcm_Reset(pInstance->pccm);
	XCcm_Enable(pInstance->pccm);

	XCcm_SetCoefMatrix(pInstance->pccm, &CCM_IDENTITY);
	XCcm_SetRgbOffset(pInstance->pccm, 0, 0, 0);
	XCcm_SetActiveSize(pInstance->pccm, 656, 496);
	XCcm_RegUpdateEnable(pInstance->pccm);

	/* RGB2YCRCB */
	XRgb2YCrCb_Reset(pInstance->prgb2ycrcb);
	XRgb2YCrCb_Enable(pInstance->prgb2ycrcb);

	XRgb2YCrCb_Configuration(pInstance->prgb2ycrcb, XRGB_STANDARD_ITU_601_SD, XRGB_TV_16_TO_240, XRGB_DATA_WIDTH_10);
	XRgb2YCrCb_SetActiveSize(pInstance->prgb2ycrcb, 656, 496);
	XRgb2YCrCb_RegUpdateEnable(pInstance->prgb2ycrcb);

	/* CRESAMPLE */
	XCresample_Reset(pInstance->pcresample);
	XCresample_Enable(pInstance->pcresample);

	XCresample_Configuration(pInstance->pcresample);
	XCresample_SetActiveSize(pInstance->pcresample, 656, 496);
	XCresample_RegUpdateEnable(pInstance->pcresample);

	/* AXIVDMA */
	XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_WRITE);
	XAxiVdma_Reset(pInstance->paxivdma, XAXIVDMA_READ);
	ReadSetup(pInstance->paxivdma, 0x30000000, 2, 0, 1, 1, 0, 0, 656, 496, 2048,
			2048);
	WriteSetup(pInstance->paxivdma, 0x30000000, 2, 0, 1, 1, 0, 0, 656, 496, 2048,
			2048);
	StartTransfer(pInstance->paxivdma);

	/* VTC */
	XVtc_Timing Timing;

	XVtc_Reset(pInstance->pvtc);
	XVtc_RegUpdateEnable(pInstance->pvtc);
	XVtc_Enable(pInstance->pvtc);
	XVtc_ConvVideoMode2Timing(pInstance->pvtc, XVTC_VMODE_VGA, &Timing);
	Timing.HSyncPolarity = 1;
	Timing.VSyncPolarity = 1;
	XVtc_SetGeneratorTiming(pInstance->pvtc, &Timing);

	/* OSD */
	XOSD_Reset(pInstance->posd);
	XOSD_RegUpdateEnable(pInstance->posd);
	XOSD_Enable(pInstance->posd);

	XOSD_SetScreenSize(pInstance->posd, 656, 496);
	XOSD_SetBackgroundColor(pInstance->posd, 0x80, 0x80, 0x80);

	// Layer 0 - Test Pattern Generator
	XOSD_SetLayerPriority(pInstance->posd, 0, XOSD_LAYER_PRIORITY_0);
	XOSD_SetLayerAlpha(pInstance->posd, 0, 1, 0xFF);
	XOSD_SetLayerDimension(pInstance->posd, 0, 0, 0, 656, 496);
	XOSD_EnableLayer(pInstance->posd, 0);

	// ISERDES Reset De-Assert
	Xil_Out32(XPAR_TCM_RECEIVER_0_S00_AXI_BASEADDR + 0x0000, 0x0000);
}
int fmc_imageon_vita_passthrough_init( fmc_imageon_vita_passthrough_t *pDemo )
{
   int ret;
   Xuint32 timeout = 100;
   Xuint32 iterations = 0;

   printf("\n\r");
   printf("------------------------------------------------------\n\r");
   printf("--          FMC-IMAGEON VITA Pass-Through           --\n\r");
   printf("------------------------------------------------------\n\r");
   printf("\n\r");

   printf( "FMC-IMAGEON Initialization ...\n\r" );

   ret = fmc_iic_xps_init(&(pDemo->fmc_imageon_iic),"FMC-IMAGEON I2C Controller", pDemo->uBaseAddr_IIC_FmcImageon );
   if ( !ret )
   {
      printf( "ERROR : Failed to open FMC-IIC driver\n\r" );
      exit(0);
   }

   fmc_imageon_init(&(pDemo->fmc_imageon), "FMC-IMAGEON", &(pDemo->fmc_imageon_iic));
   pDemo->fmc_imageon.bVerbose = pDemo->bVerbose;

   // Configure Video Clock Synthesizer
   printf( "Video Clock Synthesizer Configuration ...\n\r" );
   fmc_imageon_vclk_init( &(pDemo->fmc_imageon) );
   fmc_imageon_vclk_config( &(pDemo->fmc_imageon), FMC_IMAGEON_VCLK_FREQ_148_500_000);
   sleep(1);

   // Set HDMI output to 1080P60
   pDemo->hdmio_resolution = VIDEO_RESOLUTION_1080P;
   pDemo->hdmio_width  = 1920;
   pDemo->hdmio_height = 1080;

   //pDemo->hdmio_timing.IsHDMI        = 1; // HDMI Mode
   pDemo->hdmio_timing.IsHDMI        = 0; // DVI Mode
   pDemo->hdmio_timing.IsEncrypted   = 0;
   pDemo->hdmio_timing.IsInterlaced  = 0;
   pDemo->hdmio_timing.ColorDepth    = 8;

   pDemo->hdmio_timing.HActiveVideo  = 1920;
   pDemo->hdmio_timing.HFrontPorch   =   88;
   pDemo->hdmio_timing.HSyncWidth    =   44;
   pDemo->hdmio_timing.HSyncPolarity =    1;
   pDemo->hdmio_timing.HBackPorch    =  148;

   pDemo->hdmio_timing.VActiveVideo  = 1080;
   pDemo->hdmio_timing.VFrontPorch   =    4;
   pDemo->hdmio_timing.VSyncWidth    =    5;
   pDemo->hdmio_timing.VSyncPolarity =    1;
   pDemo->hdmio_timing.VBackPorch    =   36;

   printf( "ADV7511 Video Output Information\n\r" );
   printf( "\tVideo Output     = %s", pDemo->hdmio_timing.IsHDMI ? "HDMI" : "DVI" );
   printf( "%s", pDemo->hdmio_timing.IsEncrypted ? ", HDCP Encrypted" : "" );
   printf( ", %s\n\r", pDemo->hdmio_timing.IsInterlaced ? "Interlaced" : "Progressive" );
   printf( "\tColor Depth      = %d bits per channel\n\r", pDemo->hdmio_timing.ColorDepth );
   printf( "\tHSYNC Timing     = hav=%04d, hfp=%02d, hsw=%02d(hsp=%d), hbp=%03d\n\r",
      pDemo->hdmio_timing.HActiveVideo,
      pDemo->hdmio_timing.HFrontPorch,
      pDemo->hdmio_timing.HSyncWidth, pDemo->hdmio_timing.HSyncPolarity,
      pDemo->hdmio_timing.HBackPorch
      );
   printf( "\tVSYNC Timing     = vav=%04d, vfp=%02d, vsw=%02d(vsp=%d), vbp=%03d\n\r",
      pDemo->hdmio_timing.VActiveVideo,
      pDemo->hdmio_timing.VFrontPorch,
      pDemo->hdmio_timing.VSyncWidth, pDemo->hdmio_timing.VSyncPolarity,
      pDemo->hdmio_timing.VBackPorch
      );
   printf( "\tVideo Dimensions = %d x %d\n\r", pDemo->hdmio_width, pDemo->hdmio_height );

   printf( "HDMI Output Initialization ...\n\r" );
   ret = fmc_imageon_hdmio_init( &(pDemo->fmc_imageon),
 	                             1,                      // hdmioEnable = 1
 	                             &(pDemo->hdmio_timing), // pTiming
 	                             0                       // waitHPD = 0
 	                             );
   if ( !ret )
   {
      printf( "ERROR : Failed to init HDMI Output Interface\n\r" );
      exit(0);
   }

  while (1)
  {

   if ( iterations > 0 )
   {
      printf( "\n\rPress ENTER to re-start ...\n\r" );
      getchar();
   }
   iterations++;

   // FMC-IMAGEON VITA Receiver Initialization
   printf( "FMC-IMAGEON VITA Receiver Initialization ...\n\r" );
   onsemi_vita_init( &(pDemo->vita_receiver), "VITA-2000", pDemo->uBaseAddr_VITA_SPI, pDemo->uBaseAddr_VITA_CAM );
   pDemo->vita_receiver.uManualTap = 25;
   printf( "FMC-IMAGEON VITA SPI Config for 10MHz ...\n\r" );
   // axi4lite_0_clk = 50MHz
   onsemi_vita_spi_config( &(pDemo->vita_receiver), (50000000/10000000) );

   // VITA-2000 Initialization
   printf( "FMC-IMAGEON VITA Initialization ...\n\r" );
   ret = onsemi_vita_sensor_initialize( &(pDemo->vita_receiver), SENSOR_INIT_ENABLE, 1 ); // Be verbose
   if ( ret == 0 )
   {
       printf( "VITA sensor failed to initialize ...\n\r" );
      //return -1;
      return XST_SUCCESS;
   }

   sleep(1);

   printf( "FMC-IMAGEON VITA Configuration for 1080P60 timing ...\n\r" );
   ret = onsemi_vita_sensor_1080P60( &(pDemo->vita_receiver), pDemo->bVerbose );
   if ( ret == 0 )
   {
      printf( "VITA sensor failed to configure for 1080P60 timing ...\n\r" );
      //return -1;
      return XST_SUCCESS;
   }

   sleep(1);
   onsemi_vita_get_status( &(pDemo->vita_receiver), &(pDemo->vita_status_t1), 0 );
   sleep(1);
   onsemi_vita_get_status( &(pDemo->vita_receiver), &(pDemo->vita_status_t2), 0 );
   //
   printf( "VITA Status = \n\r" );
   printf("\tImage Width  = %d\n\r", pDemo->vita_status_t1.cntImagePixels * 4 );
   printf("\tImage Height = %d\n\r", pDemo->vita_status_t1.cntImageLines  );
   printf("\tFrame Rate   = %d frames/sec\n\r", pDemo->vita_status_t2.cntFrames - pDemo->vita_status_t1.cntFrames );
   printf("\tCRC Status   = %X\n\r", pDemo->vita_status_t2.crcStatus );

   if ( pDemo->bVerbose )
   {
   	onsemi_vita_get_status( &(pDemo->vita_receiver), &(pDemo->vita_status_t2), 1 );
   }

#if 0
   // accept 1920x1080 resolution
   if ( (pDemo->vita_status_t1.cntImagePixels * 4)==1920 && (pDemo->vita_status_t1.cntImageLines)==1080 )
   {
   	// accept 60-64fps range
   	if ( (pDemo->vita_status_t2.cntFrames - pDemo->vita_status_t1.cntFrames)>=60 && (pDemo->vita_status_t2.cntFrames - pDemo->vita_status_t1.cntFrames)<=64 )
   	{
           ; //break;
   	}
   }
#endif


#if defined(XPAR_XVTC_NUM_INSTANCES)
   // Configure VTC on output data path
   printf( "Video Timing Controller (generator) Initialization ...\n\r" );
   vgen_init( &(pDemo->vtc_hdmio_generator), pDemo->uDeviceId_VTC_HdmioGenerator );
   vgen_config( &(pDemo->vtc_hdmio_generator), pDemo->hdmio_resolution, 1 );
#endif

//#if defined(XPAR_CFA_NUM_INSTANCES)
#if defined(XPAR_CFA_0_BASEADDR)
   printf( "Color Filter Array Interpolation (CFA) Initialization ...\n\r" );
   pDemo->pCfa_config = XCfa_LookupConfig(pDemo->uDeviceId_CFA);
   XCfa_CfgInitialize(&(pDemo->cfa), pDemo->pCfa_config, pDemo->pCfa_config->BaseAddress);
   XCfa_Reset( &(pDemo->cfa) );
   XCfa_SetBayerPhase( &(pDemo->cfa), XCFA_RGRG_COMBINATION );
   XCfa_RegUpdateEnable( &(pDemo->cfa) );
   XCfa_Enable( &(pDemo->cfa) );
   printf("\tCFA done\r\n");
#endif

   printf("\n\r");
   printf( "Done\n\r" );
   printf("\n\r");

   sleep(1);
  }

   return 0;
}