void RealView_framebuffer_init(void) { gRealviewPl111Base = ml_io_map(REALVIEW_PL111_BASE, PAGE_SIZE); /* * The hardware demands a framebuffer, but the framebuffer has to be given * in a hardware address. */ void *framebuffer = pmap_steal_memory(1024 * 768 * 4); void *framebuffer_phys = pmap_extract(kernel_pmap, framebuffer); uint32_t depth = 2; uint32_t width = 1024; uint32_t height = 768; uint32_t pitch = (width * depth); uint32_t fb_length = (pitch * width); uint32_t timingRegister, controlRegister; /* * Set framebuffer address */ HARDWARE_REGISTER(gRealviewPl111Base + PL111_UPPER_FB) = framebuffer_phys; HARDWARE_REGISTER(gRealviewPl111Base + PL111_LOWER_FB) = framebuffer_phys; /* * Initialize timings to 1024x768x16 */ HARDWARE_REGISTER(gRealviewPl111Base + PL111_TIMINGS_0) = LCDTIMING0_PPL(width); HARDWARE_REGISTER(gRealviewPl111Base + PL111_TIMINGS_1) = LCDTIMING1_LPP(height); /* * Enable the TFT/LCD Display */ HARDWARE_REGISTER(gRealviewPl111Base + PL111_CONTROL) = LCDCONTROL_LCDEN | LCDCONTROL_LCDTFT | LCDCONTROL_LCDPWR | LCDCONTROL_LCDBPP(5); PE_state.video.v_baseAddr = (unsigned long) framebuffer_phys; PE_state.video.v_rowBytes = width * 4; PE_state.video.v_width = width; PE_state.video.v_height = height; PE_state.video.v_depth = 4 * (8); // 16bpp kprintf(KPRINTF_PREFIX "framebuffer initialized\n"); bzero(framebuffer, (pitch * height)); char tempbuf[16]; if (PE_parse_boot_argn("-graphics-mode", tempbuf, sizeof(tempbuf))) { /* * BootX like framebuffer. */ memset(framebuffer, 0xb9, PE_state.video.v_rowBytes * PE_state.video.v_height); initialize_screen((void *) &PE_state.video, kPEGraphicsMode); } else { initialize_screen((void *) &PE_state.video, kPETextMode); } }
void RealView_framebuffer_init(void) { gRealviewPl111Base = ml_io_map(REALVIEW_PL111_BASE, PAGE_SIZE); /* * The hardware demands a framebuffer, but the framebuffer has to be given * in a hardware address. */ void* framebuffer = pmap_steal_memory(1024 * 768 * 4); void* framebuffer_phys = pmap_get_phys(kernel_pmap, framebuffer); uint32_t depth = 2; uint32_t width = 1024; uint32_t height = 768; uint32_t pitch = (width * depth); uint32_t fb_length = (pitch * width); uint32_t timingRegister, controlRegister; /* Set framebuffer address */ HARDWARE_REGISTER(gRealviewPl111Base + PL111_UPPER_FB) = framebuffer_phys; HARDWARE_REGISTER(gRealviewPl111Base + PL111_LOWER_FB) = framebuffer_phys; /* Initialize timings to 1024x768x16 */ HARDWARE_REGISTER(gRealviewPl111Base + PL111_TIMINGS_0) = LCDTIMING0_PPL(width); HARDWARE_REGISTER(gRealviewPl111Base + PL111_TIMINGS_1) = LCDTIMING1_LPP(height); /* Enable the TFT/LCD Display */ HARDWARE_REGISTER(gRealviewPl111Base + PL111_CONTROL) = LCDCONTROL_LCDEN | LCDCONTROL_LCDTFT | LCDCONTROL_LCDPWR | LCDCONTROL_LCDBPP(4); PE_state.video.v_baseAddr = (unsigned long)framebuffer_phys; PE_state.video.v_rowBytes = width * 2; PE_state.video.v_width = width; PE_state.video.v_height = height; PE_state.video.v_depth = 2 * (8); // 16bpp kprintf(KPRINTF_PREFIX "framebuffer initialized\n"); bzero(framebuffer, (pitch * height)); initialize_screen((void*)&PE_state.video, kPEAcquireScreen); initialize_screen((void*)&PE_state.video, kPEEnableScreen); }