Fixed red build
[kugel-rb.git] / firmware / panic.c
blob3dd5e157bf8b3ad78560a4ad7601c545f7974996
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by wavey@wavey.org
11 *nn
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include <stdio.h>
21 #include <stdarg.h>
22 #include "panic.h"
23 #include "lcd.h"
24 #include "font.h"
25 #include "debug.h"
27 static char panic_buf[128];
30 * "Dude. This is pretty fucked-up, right here."
32 void panicf( char *fmt, ...)
34 va_list ap;
36 #ifndef SIMULATOR
37 /* Disable interrupts */
38 asm volatile ("ldc\t%0,sr" : : "r"(15<<4));
39 #endif
41 va_start( ap, fmt );
42 vsnprintf( panic_buf, sizeof(panic_buf), fmt, ap );
43 va_end( ap );
45 #ifdef HAVE_LCD_CHARCELLS
46 lcd_double_height(false);
47 lcd_puts(0,0,panic_buf);
48 #elif defined(HAVE_LCD_BITMAP)
49 lcd_clear_display();
51 lcd_setfont(FONT_SYSFIXED);
52 lcd_putsxy(0,0,panic_buf);
53 lcd_update();
55 #else
56 /* no LCD */
57 #endif
58 DEBUGF(panic_buf);
59 while(1);