Battery blinks if >BATTERY_LEVEL_DANGEROUS
[kugel-rb.git] / firmware / panic.c
blobf9023fe7040d88884099b002a77895b9319720f1
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by wavey@wavey.org
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 "debug.h"
26 static char panic_buf[128];
29 * "Dude. This is pretty fucked-up, right here."
31 void panicf( char *fmt, ...)
33 va_list ap;
35 #ifndef SIMULATOR
36 /* Disable interrupts */
37 asm volatile ("ldc\t%0,sr" : : "r"(15<<4));
38 #endif
40 va_start( ap, fmt );
41 vsnprintf( panic_buf, sizeof(panic_buf), fmt, ap );
42 va_end( ap );
44 #ifdef HAVE_LCD_CHARCELLS
45 #ifdef HAVE_NEW_CHARCELL_LCD
46 lcd_double_height(false);
47 #endif
48 lcd_puts(0,0,panic_buf);
49 #elif defined(HAVE_LCD_BITMAP)
50 lcd_clear_display();
51 lcd_puts(0,0,panic_buf);
52 lcd_update();
53 #else
54 /* no LCD */
55 #endif
56 DEBUGF(panic_buf);
57 while(1);