void processor_start(int mode) { const struct video_timing *m = &video_modes[mode]; processor_mode = mode; processor_h_active = m->h_active; processor_v_active = m->v_active; processor_refresh = calculate_refresh_rate(m); hdmi_out0_fi_enable_write(0); hdmi_out1_fi_enable_write(0); hdmi_out0_driver_clocking_pll_reset_write(1); hdmi_in0_edid_hpd_en_write(0); hdmi_in1_edid_hpd_en_write(0); hdmi_in0_disable(); hdmi_in1_disable(); hdmi_in0_clear_framebuffers(); hdmi_in1_clear_framebuffers(); pattern_fill_framebuffer(m->h_active, m->v_active); pll_config_for_clock(m->pixel_clock); fb_set_mode(m); edid_set_mode(m); hdmi_in0_init_video(m->h_active, m->v_active); hdmi_in1_init_video(m->h_active, m->v_active); hdmi_out0_driver_clocking_pll_reset_write(0); hdmi_out0_fi_enable_write(1); hdmi_out1_fi_enable_write(1); hdmi_in0_edid_hpd_en_write(1); hdmi_in1_edid_hpd_en_write(1); }
void hdmi_in0_service(void) { static int last_event; if(hdmi_in0_connected) { if(!hdmi_in0_edid_hpd_notif_read()) { if(hdmi_in0_debug) printf("dvisampler0: disconnected\n"); hdmi_in0_connected = 0; hdmi_in0_locked = 0; hdmi_in0_clocking_pll_reset_write(1); hdmi_in0_clear_framebuffers(); } else { if(hdmi_in0_locked) { if(hdmi_in0_clocking_locked_filtered()) { if(elapsed(&last_event, identifier_frequency_read()/2)) { hdmi_in0_adjust_phase(); if(hdmi_in0_debug) hdmi_in0_print_status(); } } else { if(hdmi_in0_debug) printf("dvisampler0: lost PLL lock\n"); hdmi_in0_locked = 0; hdmi_in0_clear_framebuffers(); } } else { if(hdmi_in0_clocking_locked_filtered()) { if(hdmi_in0_debug) printf("dvisampler0: PLL locked\n"); hdmi_in0_phase_startup(); if(hdmi_in0_debug) hdmi_in0_print_status(); hdmi_in0_locked = 1; } } } } else { if(hdmi_in0_edid_hpd_notif_read()) { if(hdmi_in0_debug) printf("dvisampler0: connected\n"); hdmi_in0_connected = 1; hdmi_in0_clocking_pll_reset_write(0); } } hdmi_in0_check_overflow(); }