Пример #1
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();
}
Пример #2
0
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;
}