1 /* 2 * Copyright 2009, Johannes Wischert 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "video.h" 8 9 #include <arch/cpu.h> 10 #include <boot/stage2.h> 11 #include <boot/platform.h> 12 #include <boot/menu.h> 13 #include <boot/kernel_args.h> 14 #include <boot/platform/generic/video.h> 15 #include <util/list.h> 16 #include <drivers/driver_settings.h> 17 #include <board_config.h> 18 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include <string.h> 22 23 #include "arch_framebuffer.h" 24 25 26 ArchFramebuffer *gFramebuffer = NULL; 27 28 29 // #pragma mark - 30 31 32 bool 33 video_mode_hook(Menu *menu, MenuItem *item) 34 { 35 return true; 36 } 37 38 39 Menu * 40 video_mode_menu() 41 { 42 Menu *menu = new(nothrow) Menu(CHOICE_MENU, "Select Video Mode"); 43 MenuItem *item; 44 45 menu->AddItem(item = new(nothrow) MenuItem("Default")); 46 item->SetMarked(true); 47 item->Select(true); 48 item->SetHelpText("The Default video mode is the one currently configured " 49 "in the system. If there is no mode configured yet, a viable mode will " 50 "be chosen automatically."); 51 52 53 menu->AddSeparatorItem(); 54 menu->AddItem(item = new(nothrow) MenuItem("Return to main menu")); 55 item->SetType(MENU_ITEM_NO_CHOICE); 56 57 return menu; 58 } 59 60 61 // #pragma mark - 62 63 64 extern "C" void 65 platform_set_palette(const uint8 *palette) 66 { 67 } 68 69 70 extern "C" void 71 platform_blit4(addr_t frameBuffer, const uint8 *data, uint16 width, 72 uint16 height, uint16 imageWidth, uint16 left, uint16 top) 73 { 74 } 75 76 77 extern "C" void 78 platform_switch_to_logo(void) 79 { 80 // in debug mode, we'll never show the logo 81 if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0) 82 return; 83 84 status_t err; 85 86 if (gFramebuffer != NULL) { 87 err = gFramebuffer->SetDefaultMode(); 88 if (err < B_OK) { 89 ERROR("Framebuffer SetDefaultMode failed!\n"); 90 return; 91 } 92 93 err = video_display_splash(gFramebuffer->Base()); 94 } 95 } 96 97 98 extern "C" void 99 platform_switch_to_text_mode(void) 100 { 101 } 102 103 104 extern "C" status_t 105 platform_init_video(void) 106 { 107 #ifdef __ARM__ 108 #if defined(BOARD_CPU_ARM920T) 109 extern ArchFramebuffer *arch_get_fb_arm_920(addr_t base); 110 gFramebuffer = arch_get_fb_arm_920(0x88000000); 111 #elif defined(BOARD_CPU_OMAP3) 112 extern ArchFramebuffer *arch_get_fb_arm_omap3(addr_t base); 113 gFramebuffer = arch_get_fb_arm_omap3(0x88000000); 114 #elif defined(BOARD_CPU_PXA270) 115 ArchFramebuffer *arch_get_fb_arm_pxa270(addr_t base); 116 gFramebuffer = arch_get_fb_arm_pxa270(0xA3000000); 117 #endif 118 #endif 119 120 if (gFramebuffer != NULL) { 121 gFramebuffer->Probe(); 122 gFramebuffer->Init(); 123 } 124 125 return B_OK; 126 } 127