Exemplo n.º 1
0
void config_erodefilter(){
	XImage_filter_SetRows(&xErodeFilter, detailedTiming[currentResolution][V_ACTIVE_TIME]);
	XImage_filter_SetCols(&xErodeFilter, detailedTiming[currentResolution][H_ACTIVE_TIME]);
	//	XImage_filter_InterruptGlobalEnable(&xfilter);
	//	XImage_filter_InterruptEnable(&xfilter, 3);
	XImage_filter_EnableAutoRestart(&xErodeFilter);
	XImage_filter_Start(&xErodeFilter);
}
Exemplo n.º 2
0
void ChangeSobelMode(int newMode)
{
	static int currentStatus = -1;
	static int currentLiveMode = 0;
	struct xFilterConfig sobel_configuration;
	int fd_sobel = 0;
	//int fd_uio = 0;
	XImage_filter        xfilter;


	if (currentStatus == newMode && currentLiveMode == gLiveVideoOn)
		return;

	gActiveState = newMode;

	if (newMode != SOBEL_SW)
	{
		while(gSwSobelState != SW_SOBEL_STATE_OFF)
			sleep(1);
		DEBUG_Text ("Resetting all vdma\n");
		resetStop_VDMA_ALL();
		DEBUG_Text ("Resetting vdma done\n");

	}
	else
	{
		if (currentLiveMode != gLiveVideoOn && currentStatus == SOBEL_SW)
		{
			gActiveState = SOBEL_OFF;
			while(gSwSobelState != SW_SOBEL_STATE_OFF)
				sleep(1);
			gActiveState = newMode;
		}
		while(gSwSobelState != SW_SOBEL_STATE_ON)
			sleep(1);
	}

	currentLiveMode = gLiveVideoOn;

	if (newMode == SOBEL_HW)
	{
		// init sobel filer
		XImage_filter_Initialize(&xfilter, "FILTER");

		// init the configuration for sobel filter
		sobel_configuration.mode = E_xFilterContinousRunning;
		sobel_configuration.height = gVideoParam[gResolution][E_VActive];
		sobel_configuration.width = gVideoParam[gResolution][E_HActive];

		XImage_filter_SetRows(&xfilter, sobel_configuration.height);
		XImage_filter_SetCols(&xfilter, sobel_configuration.width);

		XImage_filter_InterruptGlobalEnable(&xfilter);
		XImage_filter_InterruptEnable(&xfilter, 3);
		XImage_filter_EnableAutoRestart(&xfilter);
		XImage_filter_Start(&xfilter);

		configureVDMA(VDMA_ID_TPG,DMA_DEV_TO_MEM,gLayerBase[SOBEL_LAYER]);
		startVDMA(VDMA_ID_TPG, DMA_DEV_TO_MEM);

		configureVDMA(VDMA_ID_SOBEL,DMA_DEV_TO_MEM,gLayerBase[DISPLAY_LAYER]);
		configureVDMA(VDMA_ID_SOBEL,DMA_MEM_TO_DEV,gLayerBase[SOBEL_LAYER]);

		startVDMA(VDMA_ID_SOBEL, DMA_DEV_TO_MEM);
		startVDMA(VDMA_ID_SOBEL, DMA_MEM_TO_DEV);

		XImage_filter_Release(&xfilter);
	}
	else if(newMode == SOBEL_OFF)
	{
		configureVDMA(VDMA_ID_TPG,DMA_DEV_TO_MEM,gLayerBase[DISPLAY_LAYER]);
		startVDMA(VDMA_ID_TPG, DMA_DEV_TO_MEM);

		DEBUG_Text ("TPG vdma configured\n");

		//open the sobel driver
		//if ((fd_sobel = open("/dev/xfilter", O_RDWR)) < 0)
		//	{
		//	printf("Cannot open device node xfilter\n");
		//	exit(1);
		//	}

		// STOP the sobel filter
		//if (ioctl(fd_sobel, XFILTER_STOP, NULL) < 0)
		//	{
		//	printf("Failed to initialize Sobel Filter driver\n");
		//	}

		//close(fd_sobel);
	}

	// might want to wait here if to activate sw sobel filter.
	currentStatus = newMode;
}