3 * - By John Hodge (thePowersGang)
7 * NOTE: Currently designed for the realview-pb-a8 emulated by Qemu
11 #include <drv_serial.h>
12 #include <debug_hooks.h>
15 //#define UART0_BASE 0x10009000
16 #define UART0_BASE 0xF1000000 // Boot time mapped
19 void Debug_int_SerialIRQHandler(int IRQ, void *unused);
20 void KernelPanic_SetMode(void);
21 void KernelPanic_PutChar(char Ch);
22 void StartupPrint(const char *str);
25 int giDebug_SerialInitialised = 0;
28 void Debug_int_SerialIRQHandler(int IRQ, void *unused)
30 volatile Uint32 *regs = (void*)UART0_BASE;
31 #if PLATFORM_is_realview_pb
32 if( !(regs[15] & 0x10) ) {
34 if( !(regs[5] & 1) ) {
36 // RX Int hadn't fired
37 Debug("No IRQ %x %x", regs[15], regs[0]);
41 Serial_ByteReceived(gSerial_KernelDebugPort, ch);
44 void Debug_PutCharDebug(char ch)
47 Debug_PutCharDebug('\r');
49 volatile Uint32 *regs = (void*)UART0_BASE;
51 if( !giDebug_SerialInitialised ) {
52 #if PLATFORM_is_tegra2
53 // 16550 (i.e. PC) compatible
54 regs[1] = 5; // Enable RX interrupt
56 regs[14] = 0x10; // Enable RX interrupt
57 regs[13] = (1<<1); // Set RX trigger to 1 byte
59 giDebug_SerialInitialised = 1;
62 #if PLATFORM_is_tegra2
64 while( !(regs[5] & (1 << 5)) )
71 void Debug_PutStringDebug(const char *str)
74 Debug_PutCharDebug( *str );
77 void KernelPanic_SetMode(void)
81 void KernelPanic_PutChar(char ch)
83 // Debug_PutCharDebug(ch);
86 void StartupPrint(const char *str)
90 void Proc_PrintBacktrace(void)
92 // TODO: Print backtrace