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