void hdmi_in1_init_video(int hres, int vres)
{
	unsigned int mask;

	hdmi_in1_clocking_pll_reset_write(1);
	hdmi_in1_connected = hdmi_in1_locked = 0;
	hdmi_in1_hres = hres; hdmi_in1_vres = vres;

	hdmi_in1_dma_frame_size_write(hres*vres*2);
	hdmi_in1_fb_slot_indexes[0] = 0;
	hdmi_in1_dma_slot0_address_write(hdmi_in1_framebuffer_base(0));
	hdmi_in1_dma_slot0_status_write(DVISAMPLER_SLOT_LOADED);
	hdmi_in1_fb_slot_indexes[1] = 1;
	hdmi_in1_dma_slot1_address_write(hdmi_in1_framebuffer_base(1));
	hdmi_in1_dma_slot1_status_write(DVISAMPLER_SLOT_LOADED);
	hdmi_in1_next_fb_index = 2;

	hdmi_in1_dma_ev_pending_write(hdmi_in1_dma_ev_pending_read());
	hdmi_in1_dma_ev_enable_write(0x3);
	mask = irq_getmask();
	mask |= 1 << HDMI_IN1_INTERRUPT;
	irq_setmask(mask);

	hdmi_in1_fb_index = 3;
}
void processor_update(void)
{
	/*  hdmi_out0 */
	if(processor_hdmi_out0_source == VIDEO_IN_HDMI_IN0)
		hdmi_out0_fi_base0_write(hdmi_in0_framebuffer_base(hdmi_in0_fb_index));
	else if(processor_hdmi_out0_source == VIDEO_IN_HDMI_IN1)
		hdmi_out0_fi_base0_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_index));
	else if(processor_hdmi_out0_source == VIDEO_IN_PATTERN)
		hdmi_out0_fi_base0_write(pattern_framebuffer_base());

	/*  hdmi_out1 */
	if(processor_hdmi_out1_source == VIDEO_IN_HDMI_IN0)
		hdmi_out1_fi_base0_write(hdmi_in0_framebuffer_base(hdmi_in0_fb_index));
	else if(processor_hdmi_out1_source == VIDEO_IN_HDMI_IN1)
		hdmi_out1_fi_base0_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_index));
	else if(processor_hdmi_out1_source == VIDEO_IN_PATTERN)
		hdmi_out1_fi_base0_write(pattern_framebuffer_base());

#ifdef ENCODER_BASE
	/*  encoder */
	if(processor_encoder_source == VIDEO_IN_HDMI_IN0) {
		encoder_reader_dma_base_write((hdmi_in0_framebuffer_base(hdmi_in0_fb_index)));
	}
	else if(processor_encoder_source == VIDEO_IN_HDMI_IN1) {
		encoder_reader_dma_base_write((hdmi_in1_framebuffer_base(hdmi_in1_fb_index)));
	}
	else if(processor_encoder_source == VIDEO_IN_PATTERN)
		encoder_reader_dma_base_write(pattern_framebuffer_base());
#endif
}
void processor_update(void)
{
#ifdef CSR_HDMI_OUT0_BASE
	/*  hdmi_out0 */
#ifdef CSR_HDMI_IN0_BASE
	if(processor_hdmi_out0_source == VIDEO_IN_HDMI_IN0)
		hdmi_out0_fi_base0_write(hdmi_in0_framebuffer_base(hdmi_in0_fb_index));
#endif
#ifdef CSR_HDMI_IN1_BASE
	if(processor_hdmi_out0_source == VIDEO_IN_HDMI_IN1)
		hdmi_out0_fi_base0_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_index));
#endif
	if(processor_hdmi_out0_source == VIDEO_IN_PATTERN)
		hdmi_out0_fi_base0_write(pattern_framebuffer_base());

	hb_service(VIDEO_OUT_HDMI_OUT0);
#endif

#ifdef CSR_HDMI_OUT1_BASE
	/*  hdmi_out1 */
#ifdef CSR_HDMI_IN0_BASE
	if(processor_hdmi_out1_source == VIDEO_IN_HDMI_IN0)
		hdmi_out1_fi_base0_write(hdmi_in0_framebuffer_base(hdmi_in0_fb_index));
#endif
#ifdef CSR_HDMI_IN1_BASE
	if(processor_hdmi_out1_source == VIDEO_IN_HDMI_IN1)
		hdmi_out1_fi_base0_write(hdmi_in1_framebuffer_base(hdmi_in1_fb_index));
#endif
	if(processor_hdmi_out1_source == VIDEO_IN_PATTERN)
		hdmi_out1_fi_base0_write(pattern_framebuffer_base());

	hb_service(VIDEO_OUT_HDMI_OUT1);
#endif

#ifdef ENCODER_BASE
	/*  encoder */
#ifdef CSR_HDMI_IN0_BASE
	if(processor_encoder_source == VIDEO_IN_HDMI_IN0) {
		encoder_reader_base_write((hdmi_in0_framebuffer_base(hdmi_in0_fb_index)));
	}
#endif
#ifdef CSR_HDMI_IN1_BASE
	if(processor_encoder_source == VIDEO_IN_HDMI_IN1) {
		encoder_reader_base_write((hdmi_in1_framebuffer_base(hdmi_in1_fb_index)));
	}
#endif
	if(processor_encoder_source == VIDEO_IN_PATTERN)
		encoder_reader_base_write(pattern_framebuffer_base());

	hb_service(VIDEO_OUT_ENCODER);
#endif
}
示例#4
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();
}