#include #include #include #include #include "dvisampler0.h" #include "dvisampler1.h" #include "edid.h" #include "processor.h" static const struct video_timing video_modes[PROCESSOR_MODE_COUNT] = { { .pixel_clock = 3150, .h_active = 640, .h_blanking = 192, .h_sync_offset = 24, .h_sync_width = 40, .v_active = 480, .v_blanking = 40, .v_sync_offset = 9, .v_sync_width = 3, .established_timing = 0x0800 }, { .pixel_clock = 4000, .h_active = 800, .h_blanking = 256, .h_sync_offset = 32, .h_sync_width = 128, .v_active = 600, .v_blanking = 28, .v_sync_offset = 1, .v_sync_width = 6, .established_timing = 0x0100 }, { .pixel_clock = 6500, .h_active = 1024, .h_blanking = 320, .h_sync_offset = 24, .h_sync_width = 136, .v_active = 768, .v_blanking = 38, .v_sync_offset = 3, .v_sync_width = 6, .established_timing = 0x0008 }, { .pixel_clock = 7425, .h_active = 1280, .h_blanking = 370, .h_sync_offset = 220, .h_sync_width = 40, .v_active = 720, .v_blanking = 30, .v_sync_offset = 20, .v_sync_width = 5 } }; void processor_list_modes(char *mode_descriptors) { int i; unsigned int refresh_span; unsigned int refresh_rate; for(i=0;ipixel_clock, &clock_m, &clock_d); fb_fi_hres_write(mode->h_active); fb_fi_hsync_start_write(mode->h_active + mode->h_sync_offset); fb_fi_hsync_end_write(mode->h_active + mode->h_sync_offset + mode->h_sync_width); fb_fi_hscan_write(mode->h_active + mode->h_blanking); fb_fi_vres_write(mode->v_active); fb_fi_vsync_start_write(mode->v_active + mode->v_sync_offset); fb_fi_vsync_end_write(mode->v_active + mode->v_sync_offset + mode->v_sync_width); fb_fi_vscan_write(mode->v_active + mode->v_blanking); fb_dma0_length_write(mode->h_active*mode->v_active*4); fb_dma1_length_write(mode->h_active*mode->v_active*4); fb_clkgen_write(0x1, clock_d-1); fb_clkgen_write(0x3, clock_m-1); fb_driver_clocking_send_go_write(1); printf("waiting for PROGDONE..."); while(!(fb_driver_clocking_status_read() & CLKGEN_STATUS_PROGDONE)); printf("ok\n"); printf("waiting for LOCKED..."); while(!(fb_driver_clocking_status_read() & CLKGEN_STATUS_LOCKED)); printf("ok\n"); printf("Video mode set to %dx%d\n", mode->h_active, mode->v_active); } static void edid_set_mode(const struct video_timing *mode) { unsigned char edid[128]; int i; generate_edid(&edid, "OHW", "MX", 2013, "Mixxeo ch.A", mode); for(i=0;ih_active, m->v_active); dvisampler1_init_video(m->h_active, m->v_active); fb_enable_write(1); dvisampler0_edid_hpd_en_write(1); dvisampler1_edid_hpd_en_write(1); } void processor_service(void) { dvisampler0_service(); dvisampler1_service(); }