Kernel/armv7 - Stub backtrace to make compilation happy
[tpg/acess2.git] / KernelLand / Kernel / arch / armv7 / debug.c
1 /**
2  * Acess2
3  * - By John Hodge (thePowersGang)
4  *
5  * arch/arm7/debug.c
6  * - ARM7 Debug output
7  * NOTE: Currently designed for the realview-pb-a8 emulated by Qemu
8  * - PL011
9  */
10 #include <acess.h>
11 #include <drv_serial.h>
12
13 // === CONSTANTS ===
14 //#define UART0_BASE    0x10009000
15 #define UART0_BASE      0xF1000000      // Boot time mapped
16
17 // === PROTOTYPES ===
18 void    Debug_int_SerialIRQHandler(int IRQ, void *unused);
19 void    KernelPanic_SetMode(void);
20 void    KernelPanic_PutChar(char Ch);
21 void    StartupPrint(const char *str);
22
23 // === GLOBALS ===
24  int    giDebug_SerialInitialised = 0;
25
26 // === CODE ===
27 void Debug_int_SerialIRQHandler(int IRQ, void *unused)
28 {
29         volatile Uint32 *regs = (void*)UART0_BASE;
30         #if PLATFORM_is_realview_pb
31         if( !(regs[15] & 0x10) ) {
32         #else
33         if( !(regs[5] & 1) ) {
34         #endif
35                 // RX Int hadn't fired
36                 Debug("No IRQ %x %x", regs[15], regs[0]);
37                 return ;
38         }
39         char ch = regs[0];
40         Serial_ByteReceived(gSerial_KernelDebugPort, ch);
41 }
42
43 void Debug_PutCharDebug(char ch)
44 {
45         if(ch == '\n')
46                 Debug_PutCharDebug('\r');
47         
48         volatile Uint32 *regs = (void*)UART0_BASE;
49         
50         if( !giDebug_SerialInitialised ) {
51                 #if PLATFORM_is_tegra2
52                 // 16550 (i.e. PC) compatible
53                 regs[1] = 5;    // Enable RX interrupt
54                 #else
55                 regs[14] = 0x10;        // Enable RX interrupt
56                 regs[13] = (1<<1);      // Set RX trigger to 1 byte
57                 #endif
58                 giDebug_SerialInitialised = 1;
59         }
60
61         #if PLATFORM_is_tegra2
62         // Tegra2
63         while( !(regs[5] & (1 << 5)) )
64                 ;
65         #endif
66         
67         regs[0] = ch;
68 }
69
70 void Debug_PutStringDebug(const char *str)
71 {
72         for( ; *str; str++ )
73                 Debug_PutCharDebug( *str );
74 }
75
76 void KernelPanic_SetMode(void)
77 {
78 }
79
80 void KernelPanic_PutChar(char ch)
81 {
82 //      Debug_PutCharDebug(ch);
83 }
84
85 void StartupPrint(const char *str)
86 {
87 }
88
89 void Proc_PrintBacktrace(void)
90 {
91         // TODO: Print backtrace
92 }
93

UCC git Repository :: git.ucc.asn.au