Exemple #1
0
void gpio_reset(int level)
{
	// reset TPG
	gpio_export(TPG_RST_PIN);
	gpio_dir_out(TPG_RST_PIN);
	gpio_value(TPG_RST_PIN, level);
	gpio_unexport(TPG_RST_PIN);

	// reset SOBEL
	gpio_export(SOBEL_RST_PIN);
	gpio_dir_out(SOBEL_RST_PIN);
	gpio_value(SOBEL_RST_PIN, level);
	gpio_unexport(SOBEL_RST_PIN);

	// set the external clock for the
	gpio_export(EXT_SYNC_PIN);
	gpio_dir_out(EXT_SYNC_PIN);
	gpio_value(EXT_SYNC_PIN, gLiveVideoOn);
	gpio_unexport(EXT_SYNC_PIN);

	//printf("\nReset Done\n");
}
Exemple #2
0
void resetStop_VDMA_ALL(void)
{
	static int currentLiveMode = 0;
	gpio_reset(RST_ACTIVE);	// pull the reset line.

	// reset and enable the Chroma-resampler and YUV to rgb converter.
	chr_stop_reset(gResolution);
	yuv2rgb_stop_reset(gResolution);

	DEBUG_Text("Reseting TPG_VDMA\n");
	// Reset TPG VDMA
	vdma_reset(VDMA_ID_TPG, DMA_DEV_TO_MEM);		// tpg
	DEBUG_Text("Reseting Sobel_out_VDMA\n");
	// Reset Sobel VDMA (IN and OUT)
	vdma_reset(VDMA_ID_SOBEL, DMA_DEV_TO_MEM);		// sobel out
	DEBUG_Text("Reseting Soble_in_VDMA\n");
	vdma_reset(VDMA_ID_SOBEL, DMA_MEM_TO_DEV);		// Soble in
	DEBUG_Text("VDMA Reset Done\n");

	// release the reset ( and set the required external clock)
	chr_start();
	yuv2rgb_start();

	gpio_reset(RST_INACTIVE);

	if (gLiveVideoOn && (gLiveVideoOn != currentLiveMode))
	{
		unsigned long clk = detect_input_clk()/1000;
		// check if the input clock is in range +- 2MHz
		if (  (clk < (gVideoParam[gResolution][E_Clk] - 2000)) |
				(clk > (gVideoParam[gResolution][E_Clk] + 2000))  )
		{
			printf("Incorrect Input [Required:%d x %d @ 60fps(Hz)] \nTurning on the previous pattern",
															gVideoParam[gResolution][E_HActive],
															gVideoParam[gResolution][E_VActive]);
			gLiveVideoOn = 0;
			gpio_export(EXT_SYNC_PIN);
			gpio_dir_out(EXT_SYNC_PIN);
			gpio_value(EXT_SYNC_PIN, gLiveVideoOn);
			gpio_unexport(EXT_SYNC_PIN);
		}
		else
		{
			SetTpgPattern(gResolution, 0);
		}
	}
	currentLiveMode = gLiveVideoOn;
}
int GPIO_Controller::GPIO_Value(int number)
{
    stringstream ss;
    ss << this->gpio_number;
    string numb_string = ss.str();
 
 
    string gpio_direction = "/sys/class/gpio/gpio" + numb_string + "/value";
    ofstream gpio_value(gpio_direction.c_str());
    if(gpio_value.is_open())
    {
        gpio_value << number;
        gpio_value.close();
 
    }
    else
    {
        cout << "Error while opening file" << endl;
        return -1;
    }
    return 1;
}