コード例 #1
0
int main(void)
{
	irq_setmask(0);
	irq_setie(1);
	uart_init();
#ifdef CSR_HDMI_OUT0_I2C_W_ADDR
	hdmi_out0_i2c_init();
#endif
#ifdef CSR_HDMI_OUT1_I2C_W_ADDR
	hdmi_out1_i2c_init();
#endif

	puts("\r\nHDMI2USB firmware  http://timvideos.us/");
	print_version();

	fx2_reset_out_write(1);

	config_init();
	time_init();
	processor_init();
	processor_start(config_get(CONFIG_KEY_RESOLUTION));

	// Set HDMI Output 0 to be pattern
#ifdef CSR_HDMI_OUT0_BASE
	processor_set_hdmi_out0_source(VIDEO_IN_PATTERN);
#endif
	// Set HDMI Output 1 to be pattern
#ifdef CSR_HDMI_OUT1_BASE
	processor_set_hdmi_out1_source(VIDEO_IN_PATTERN);
#endif
	processor_update();

	// Reboot the FX2 chip into HDMI2USB mode
#ifdef CSR_FX2_RESET_OUT_ADDR
	//fx2_init();
#endif

	// Set Encoder to be pattern
#ifdef ENCODER_BASE
	processor_set_encoder_source(VIDEO_IN_PATTERN);
	encoder_enable(1);
	processor_update();
#endif
	ci_prompt();
	while(1) {
		processor_service();
		ci_service();

#ifdef CSR_FX2_RESET_OUT_ADDR
		//fx2_service(true);
#endif

/* XXX FIX DDR conflict between DMA and L2 cache */
#if 0
		pattern_service();
#endif
	}

	return 0;
}
コード例 #2
0
void hdmi_in1_isr(void)
{
    int fb_index = -1;
    int length;
    int expected_length;
    unsigned int address_min, address_max;

    address_min = HDMI_IN1_FRAMEBUFFERS_BASE & 0x0fffffff;
    address_max = address_min + HDMI_IN1_FRAMEBUFFERS_SIZE*FRAMEBUFFER_COUNT;
    if((hdmi_in1_dma_slot0_status_read() == DVISAMPLER_SLOT_PENDING)
            && ((hdmi_in1_dma_slot0_address_read() < address_min) || (hdmi_in1_dma_slot0_address_read() > address_max)))
        printf("dvisampler1: slot0: stray DMA\n");
    if((hdmi_in1_dma_slot1_status_read() == DVISAMPLER_SLOT_PENDING)
            && ((hdmi_in1_dma_slot1_address_read() < address_min) || (hdmi_in1_dma_slot1_address_read() > address_max)))
        printf("dvisampler1: slot1: stray DMA\n");

    if((hdmi_in1_resdetection_hres_read() != hdmi_in1_hres)
            || (hdmi_in1_resdetection_vres_read() != hdmi_in1_vres)) {
        /* Dump frames until we get the expected resolution */
        if(hdmi_in1_dma_slot0_status_read() == DVISAMPLER_SLOT_PENDING) {
            hdmi_in1_dma_slot0_address_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_slot_indexes[0]));
            hdmi_in1_dma_slot0_status_write(DVISAMPLER_SLOT_LOADED);
        }
        if(hdmi_in1_dma_slot1_status_read() == DVISAMPLER_SLOT_PENDING) {
            hdmi_in1_dma_slot1_address_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_slot_indexes[1]));
            hdmi_in1_dma_slot1_status_write(DVISAMPLER_SLOT_LOADED);
        }
        return;
    }

    expected_length = hdmi_in1_hres*hdmi_in1_vres*2;
    if(hdmi_in1_dma_slot0_status_read() == DVISAMPLER_SLOT_PENDING) {
        length = hdmi_in1_dma_slot0_address_read() - (hdmi_in1_framebuffer_base(hdmi_in1_fb_slot_indexes[0]) & 0x0fffffff);
        if(length == expected_length) {
            fb_index = hdmi_in1_fb_slot_indexes[0];
            hdmi_in1_fb_slot_indexes[0] = hdmi_in1_next_fb_index;
            hdmi_in1_next_fb_index = (hdmi_in1_next_fb_index + 1) & FRAMEBUFFER_MASK;
        } else
            printf("dvisampler1: slot0: unexpected frame length: %d\n", length);
        hdmi_in1_dma_slot0_address_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_slot_indexes[0]));
        hdmi_in1_dma_slot0_status_write(DVISAMPLER_SLOT_LOADED);
    }
    if(hdmi_in1_dma_slot1_status_read() == DVISAMPLER_SLOT_PENDING) {
        length = hdmi_in1_dma_slot1_address_read() - (hdmi_in1_framebuffer_base(hdmi_in1_fb_slot_indexes[1]) & 0x0fffffff);
        if(length == expected_length) {
            fb_index = hdmi_in1_fb_slot_indexes[1];
            hdmi_in1_fb_slot_indexes[1] = hdmi_in1_next_fb_index;
            hdmi_in1_next_fb_index = (hdmi_in1_next_fb_index + 1) & FRAMEBUFFER_MASK;
        } else
            printf("dvisampler1: slot1: unexpected frame length: %d\n", length);
        hdmi_in1_dma_slot1_address_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_slot_indexes[1]));
        hdmi_in1_dma_slot1_status_write(DVISAMPLER_SLOT_LOADED);
    }

    if(fb_index != -1)
        hdmi_in1_fb_index = fb_index;

    processor_update();
}
コード例 #3
0
void processor_service(void)
{
	hdmi_in0_service();
	hdmi_in1_service();
	processor_update();
#ifdef ENCODER_BASE
		encoder_service();
#endif
}
コード例 #4
0
void processor_service(void)
{
#ifdef CSR_HDMI_IN0_BASE
	hdmi_in0_service();
#endif
#ifdef CSR_HDMI_IN1_BASE
	hdmi_in1_service();
#endif
	processor_update();
#ifdef ENCODER_BASE
	encoder_service();
#endif
}
コード例 #5
0
ファイル: ci.c プロジェクト: rohit91/HDMI2USB-misoc-firmware
static void video_matrix_connect(int source, int sink)
{
	if(source >= 0 && source <= VIDEO_IN_PATTERN)
	{
		if(sink >= 0 && sink <= VIDEO_OUT_HDMI_OUT1) {
			printf("Connecting %s to output%d\r\n", processor_get_source_name(source), sink);
			if(sink == VIDEO_OUT_HDMI_OUT0)
#ifdef CSR_HDMI_OUT0_BASE
				processor_set_hdmi_out0_source(source);
#else
				printf("hdmi_out0 is missing.\r\n");
#endif
			else if(sink == VIDEO_OUT_HDMI_OUT1)
#ifdef CSR_HDMI_OUT1_BASE
				processor_set_hdmi_out1_source(source);
#else
				printf("hdmi_out1 is missing.\r\n");
#endif
			processor_update();
		}