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();
}
void hdmi_in1_print_status(void)
{
	hdmi_in1_data0_wer_update_write(1);
	hdmi_in1_data1_wer_update_write(1);
	hdmi_in1_data2_wer_update_write(1);
	printf("dvisampler1: ph:%4d %4d %4d // charsync:%d%d%d [%d %d %d] // WER:%3d %3d %3d // chansync:%d // res:%dx%d\r\n",
		hdmi_in1_d0, hdmi_in1_d1, hdmi_in1_d2,
		hdmi_in1_data0_charsync_char_synced_read(),
		hdmi_in1_data1_charsync_char_synced_read(),
		hdmi_in1_data2_charsync_char_synced_read(),
		hdmi_in1_data0_charsync_ctl_pos_read(),
		hdmi_in1_data1_charsync_ctl_pos_read(),
		hdmi_in1_data2_charsync_ctl_pos_read(),
		hdmi_in1_data0_wer_value_read(),
		hdmi_in1_data1_wer_value_read(),
		hdmi_in1_data2_wer_value_read(),
		hdmi_in1_chansync_channels_synced_read(),
		hdmi_in1_resdetection_hres_read(),
		hdmi_in1_resdetection_vres_read());
}
Example #3
0
static void status_print(void)
{
#ifdef CSR_HDMI_IN0_BASE
	printf(
		"input0:  %dx%d",
		hdmi_in0_resdetection_hres_read(),
		hdmi_in0_resdetection_vres_read());
	printf("\r\n");
#endif

#ifdef CSR_HDMI_IN1_BASE
	printf(
		"input1:  %dx%d",
		hdmi_in1_resdetection_hres_read(),
		hdmi_in1_resdetection_vres_read());
	printf("\r\n");
#endif

#ifdef CSR_HDMI_OUT0_BASE
	printf("output0: ");
	if(hdmi_out0_fi_enable_read())
		printf(
			"%dx%d@%dHz from %s",
			processor_h_active,
			processor_v_active,
			processor_refresh,
			processor_get_source_name(processor_hdmi_out0_source));
	else
		printf("off");
	printf("\r\n");
#endif

#ifdef CSR_HDMI_OUT1_BASE
	printf("output1: ");
	if(hdmi_out1_fi_enable_read())
		printf(
			"%dx%d@%uHz from %s",
			processor_h_active,
			processor_v_active,
			processor_refresh,
			processor_get_source_name(processor_hdmi_out1_source));
	else
		printf("off");
	printf("\r\n");
#endif

#ifdef ENCODER_BASE
	printf("encoder: ");
	if(encoder_enabled) {
		printf(
			"%dx%d @ %dfps (%dMbps) from %s (q: %d)",
			processor_h_active,
			processor_v_active,
			encoder_fps,
			encoder_bandwidth_nbytes_read()*8/1000000,
			processor_get_source_name(processor_encoder_source),
			encoder_quality);
		encoder_bandwidth_nbytes_clear_write(1);
	} else
		printf("off");
	printf("\r\n");
#endif
	printf("ddr: ");
	debug_ddr();
}