1 /* 2 * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "keyboard.h" 8 #include "rom_calls.h" 9 #include "Handle.h" 10 #include "console.h" 11 #include "keyboard.h" 12 13 #include <boot/platform.h> 14 #include <boot/stdio.h> 15 #include <stdarg.h> 16 #include <string.h> 17 18 #include <Errors.h> 19 20 extern FILE *dbgerr; 21 22 /*! This works only after console_init() was called. 23 */ 24 void 25 panic(const char *format, ...) 26 { 27 static struct AlertMessage { 28 uint16 column1; 29 uint8 line1; 30 char message[14]; 31 uint8 cont; 32 uint16 column2; 33 uint8 line2; 34 char buffer[512]; 35 uint8 end; 36 37 } _PACKED alert = { 38 10, 12, 39 "*** PANIC ***", 40 1, 41 10, 22, 42 "", 43 0 44 }; 45 46 char *buffer = alert.buffer; 47 va_list list; 48 49 //platform_switch_to_text_mode(); 50 51 memset(buffer, 0, 512); 52 53 va_start(list, format); 54 vsnprintf(buffer, 512, format, list); 55 va_end(list); 56 57 DisplayAlert(DEADEND_ALERT, &alert, 40); 58 59 //clear_key_buffer(); 60 //wait_for_key(); 61 platform_exit(); 62 } 63 64 65 void 66 dprintf(const char *format, ...) 67 { 68 char buffer[512]; 69 va_list list; 70 71 //platform_switch_to_text_mode(); 72 73 va_start(list, format); 74 if (dbgerr) 75 vfprintf(dbgerr, format, list); 76 //vsnprintf(buffer, sizeof(buffer), format, list); 77 va_end(list); 78 79 //if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) 80 // Bconput(DEV_CONSOLE, buffer); 81 } 82 83 84 char* 85 platform_debug_get_log_buffer(size_t* _size) 86 { 87 return NULL; 88 } 89