xref: /haiku/src/system/boot/platform/u-boot/video.cpp (revision 04b1c44b89086a9521bb478c8e99d024cef8f6a6)
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 
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 
22 #include "arch_framebuffer.h"
23 
24 
25 ArchFramebuffer *gFramebuffer = NULL;
26 
27 
28 //	#pragma mark -
29 
30 
31 bool
32 video_mode_hook(Menu *menu, MenuItem *item)
33 {
34 	return true;
35 }
36 
37 
38 Menu *
39 video_mode_menu()
40 {
41 	Menu *menu = new(nothrow) Menu(CHOICE_MENU, "Select Video Mode");
42 	MenuItem *item;
43 
44 	menu->AddItem(item = new(nothrow) MenuItem("Default"));
45 	item->SetMarked(true);
46 	item->Select(true);
47 	item->SetHelpText("The Default video mode is the one currently configured "
48 		"in the system. If there is no mode configured yet, a viable mode will "
49 		"be chosen automatically.");
50 
51 
52 	menu->AddSeparatorItem();
53 	menu->AddItem(item = new(nothrow) MenuItem("Return to main menu"));
54 	item->SetType(MENU_ITEM_NO_CHOICE);
55 
56 	return menu;
57 }
58 
59 
60 //	#pragma mark -
61 
62 
63 extern "C" void
64 platform_set_palette(const uint8 *palette)
65 {
66 }
67 
68 
69 extern "C" void
70 platform_blit4(addr_t frameBuffer, const uint8 *data, uint16 width,
71 	uint16 height, uint16 imageWidth, uint16 left, uint16 top)
72 {
73 }
74 
75 
76 extern "C" void
77 platform_switch_to_logo(void)
78 {
79 	CALLED();
80 	// in debug mode, we'll never show the logo
81 	if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0)
82 		return;
83 
84 	//XXX: not yet, DISABLED
85 	return;
86 
87 	status_t err;
88 
89 	if (gFramebuffer != NULL) {
90 		err = gFramebuffer->SetDefaultMode();
91 		if (err < B_OK) {
92 			ERROR("Framebuffer SetDefaultMode failed!\n");
93 			return;
94 		}
95 
96 		err = video_display_splash(gFramebuffer->Base());
97 	}
98 	#warning U-Boot:TODO
99 }
100 
101 
102 extern "C" void
103 platform_switch_to_text_mode(void)
104 {
105 	CALLED();
106 	#warning U-Boot:TODO
107 }
108 
109 
110 extern "C" status_t
111 platform_init_video(void)
112 {
113 	CALLED();
114 
115 #ifdef __ARM__
116 	#if defined(BOARD_CPU_ARM920T)
117 		gFramebuffer = arch_get_fb_arm_920(0x88000000);
118 	#elif defined(BOARD_CPU_OMAP3)
119 		gFramebuffer = arch_get_fb_arm_omap3(0x88000000);
120 	#elif defined(BOARD_CPU_PXA270)
121 		gFramebuffer = arch_get_fb_arm_pxa270(0xA4000000);
122 	#endif
123 #endif
124 
125 	if (gFramebuffer != NULL) {
126 		gFramebuffer->Probe();
127 		gFramebuffer->Init();
128 	}
129 
130 	//XXX for testing
131 	//platform_switch_to_logo();
132 	//return arch_probe_video_mode();
133 
134 	return B_OK;
135 }
136