xref: /haiku/src/system/boot/platform/atari_m68k/debug.cpp (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2008-2010, François Revol, revol@free.fr. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "keyboard.h"
8 #include "toscalls.h"
9 
10 #include <boot/stage2.h>
11 #include <boot/platform.h>
12 #include <boot/stdio.h>
13 #include <stdarg.h>
14 
15 #include <Errors.h>
16 
17 /*!	This works only after console_init() was called.
18 */
19 void
20 panic(const char *format, ...)
21 {
22 	const char greetings[] = "\n*** PANIC ***";
23 	char buffer[512];
24 	va_list list;
25 
26 	//platform_switch_to_text_mode();
27 
28 	Bconputs(DEV_CONSOLE, greetings);
29 	// send to the emulator's stdout if available
30 	nat_feat_debugprintf(greetings);
31 	nat_feat_debugprintf("\n");
32 
33 	va_start(list, format);
34 	vsnprintf(buffer, sizeof(buffer), format, list);
35 	va_end(list);
36 
37 	Bconputs(DEV_CONSOLE, buffer);
38 	// send to the emulator's stdout if available
39 	nat_feat_debugprintf(buffer);
40 	nat_feat_debugprintf("\n");
41 
42 	Bconputs(DEV_CONSOLE, "\nPress key to reboot.");
43 
44 	clear_key_buffer();
45 	wait_for_key();
46 	platform_exit();
47 }
48 
49 
50 void
51 dprintf(const char *format, ...)
52 {
53 	char buffer[512];
54 	va_list list;
55 
56 	va_start(list, format);
57 	vsnprintf(buffer, sizeof(buffer), format, list);
58 	va_end(list);
59 
60 	Bconput(DEV_AUX, buffer);
61 
62 	// send to the emulator's stdout if available
63 	nat_feat_debugprintf(buffer);
64 
65 	//if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT)
66 	if (!gKernelArgs.frame_buffer.enabled)
67 		Bconput(DEV_CONSOLE, buffer);
68 }
69 
70 
71 char*
72 platform_debug_get_log_buffer(size_t* _size)
73 {
74 	return NULL;
75 }
76