X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Farch%2Farmv7%2Fdebug.c;h=4f169a3528088b15dec966324fcd5e67be9e5cde;hb=eed2742c47bafbfd6fb8374aff563a50a03af40e;hp=7b9e55dd79e242708f7550e54d7cfa6321df2649;hpb=51ab5f489bc356940c95cc936fd0508e8f07ea97;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/arch/armv7/debug.c b/KernelLand/Kernel/arch/armv7/debug.c index 7b9e55dd..4f169a35 100644 --- a/KernelLand/Kernel/arch/armv7/debug.c +++ b/KernelLand/Kernel/arch/armv7/debug.c @@ -5,14 +5,17 @@ * arch/arm7/debug.c * - ARM7 Debug output * NOTE: Currently designed for the realview-pb-a8 emulated by Qemu + * - PL011 */ #include +#include // === CONSTANTS === //#define UART0_BASE 0x10009000 #define UART0_BASE 0xF1000000 // Boot time mapped // === PROTOTYPES === +void Debug_int_SerialIRQHandler(int IRQ, void *unused); void KernelPanic_SetMode(void); void KernelPanic_PutChar(char Ch); void StartupPrint(const char *str); @@ -21,19 +24,47 @@ void StartupPrint(const char *str); int giDebug_SerialInitialised = 0; // === CODE === +void Debug_int_SerialIRQHandler(int IRQ, void *unused) +{ + volatile Uint32 *regs = (void*)UART0_BASE; + #if PLATFORM_is_realview_pb + if( !(regs[15] & 0x10) ) { + #else + if( !(regs[5] & 1) ) { + #endif + // RX Int hadn't fired + Debug("No IRQ %x %x", regs[15], regs[0]); + return ; + } + char ch = regs[0]; + Serial_ByteReceived(gSerial_KernelDebugPort, ch); +} + void Debug_PutCharDebug(char ch) { if(ch == '\n') Debug_PutCharDebug('\r'); + + volatile Uint32 *regs = (void*)UART0_BASE; + + if( !giDebug_SerialInitialised ) { + #if PLATFORM_is_tegra2 + // 16550 (i.e. PC) compatible + regs[1] = 5; // Enable RX interrupt + #else + regs[14] = 0x10; // Enable RX interrupt + regs[13] = (1<<1); // Set RX trigger to 1 byte + #endif + giDebug_SerialInitialised = 1; + } #if PLATFORM_is_tegra2 // Tegra2 - while( !(*(volatile Uint32*)(UART0_BASE + 0x14) & (1 << 5)) ) + while( !(regs[5] & (1 << 5)) ) ; #endif -// *(volatile Uint32*)(SERIAL_BASE + SERIAL_REG_DATA) = ch; - *(volatile Uint32*)(UART0_BASE) = ch; + regs[0] = ch; } void Debug_PutStringDebug(const char *str)