diff --git a/src/system/boot/platform/raspberrypi_arm/debug.cpp b/src/system/boot/platform/raspberrypi_arm/debug.cpp index 091cb414a2..4e47bc757e 100644 --- a/src/system/boot/platform/raspberrypi_arm/debug.cpp +++ b/src/system/boot/platform/raspberrypi_arm/debug.cpp @@ -1,25 +1,62 @@ /* + * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. + * All rights reserved. Distributed under the terms of the MIT License. + * * Copyright 2009 Jonas Sundström, jonas@kirilla.com * All rights reserved. Distributed under the terms of the MIT License. */ +#include "serial.h" + #include #include #include -void +extern "C" void panic(const char* format, ...) { -#warning IMPLEMENT panic + const char hint[] = "*** PANIC ***"; + char buffer[512]; + va_list list; + int length; + + serial_puts(hint, sizeof(hint)); + va_start(list, format); + length = vsnprintf(buffer, sizeof(buffer), format, list); + va_end(list); + + if (length >= (int)sizeof(buffer)) + length = sizeof(buffer) - 1; + + serial_puts(buffer, length); + //fprintf(stderr, "%s", buffer); + + serial_puts("\nPress key to reboot.", 21); + + platform_exit(); } -void +extern "C" void dprintf(const char* format, ...) { -#warning IMPLEMENT dprintf + char buffer[512]; + va_list list; + int length; + + va_start(list, format); + length = vsnprintf(buffer, sizeof(buffer), format, list); + va_end(list); + + if (length >= (int)sizeof(buffer)) + length = sizeof(buffer) - 1; + + serial_puts(buffer, length); + + if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) + fprintf(stderr, "%s", buffer); }