- halt the processor during getc if config option is enabled

This commit is contained in:
Jan Stoess 2007-12-07 19:00:49 +01:00
parent 619d1425d8
commit b7b61e7913
1 changed files with 28 additions and 8 deletions

View File

@ -31,6 +31,7 @@
********************************************************************/ ********************************************************************/
#include INC_ARCH(cpu.h) #include INC_ARCH(cpu.h)
#include INC_ARCH(ioport.h) #include INC_ARCH(ioport.h)
#include INC_GLUE(schedule.h)
#include INC_API(tcb.h) #include INC_API(tcb.h)
#include <kdb/kdb.h> #include <kdb/kdb.h>
#include <kdb/init.h> #include <kdb/init.h>
@ -327,6 +328,7 @@ static void putc_serial (const char c)
if (c == '\n') if (c == '\n')
putc_serial('\r'); putc_serial('\r');
} }
bool getc_blocked = false;
static char getc_serial (bool block) static char getc_serial (bool block)
{ {
@ -334,30 +336,48 @@ static char getc_serial (bool block)
{ {
if (!block) if (!block)
return -1; return -1;
while ((in_u8(COMPORT+5) & 0x01) == 0);
getc_blocked = true;
while ((in_u8(COMPORT+5) & 0x01) == 0)
{
#if defined(CONFIG_KDB_INPUT_HLT)
processor_sleep();
memory_barrier();
#endif
}
getc_blocked = false;
} }
return in_u8(COMPORT); return in_u8(COMPORT);
} }
#if defined(CONFIG_KDB_BREAKIN) #if defined(CONFIG_KDB_BREAKIN)
void kdebug_check_breakin (void) void kdebug_check_breakin (void)
{ {
if (getc_blocked)
return;
#if defined(CONFIG_KDB_BREAKIN_BREAK) || defined(CONFIG_KDB_BREAKIN_ESCAPE)
u8_t c = in_u8(COMPORT+5);
#endif
#if defined(CONFIG_KDB_BREAKIN_BREAK) #if defined(CONFIG_KDB_BREAKIN_BREAK)
// Check for a break interrupt, or for breaks pending in the FIFO. // Check for a break interrupt, or for breaks pending in the FIFO.
// This also catches parity and framing errors contained in the FIFO. // This also catches parity and framing errors contained in the FIFO.
if (in_u8(COMPORT+5) & 0x90) if (c & 0x90)
enter_kdebug("break"); {
enter_kdebug("break");
return;
}
#endif #endif
#if defined(CONFIG_KDB_BREAKIN_ESCAPE) #if defined(CONFIG_KDB_BREAKIN_ESCAPE)
if ((in_u8(COMPORT+5) & 0x01)) if ((c & 0x01) && (in_u8(COMPORT) == 0x1b))
if (in_u8(COMPORT) == 0x1b)
enter_kdebug("breakin"); enter_kdebug("breakin");
#endif #endif
return;
} }
#endif #endif
DECLARE_CMD (cmd_dumpvga, arch, 'V', "screendump", "dump VGA screen contents"); DECLARE_CMD (cmd_dumpvga, arch, 'V', "screendump", "dump VGA screen contents");
CMD(cmd_dumpvga, cg) CMD(cmd_dumpvga, cg)