Vkey::irq(Irq_base *i)
{ vkey_irq = i; }
+// ------------------------------------------------------------------------
+IMPLEMENTATION [serial && !ux && debug]:
+
+PRIVATE static inline
+bool
+Vkey::is_debugger_entry_key(int key)
+{
+ return key == KEY_ESC;
+}
+
+// ------------------------------------------------------------------------
+IMPLEMENTATION [serial && !ux && !debug]:
+
+PRIVATE static inline
+bool
+Vkey::is_debugger_entry_key(int)
+{
+ return false;
+}
+
// ---------------------------------------------------------------------------
-IMPLEMENTATION [debug && serial && !ux]:
+IMPLEMENTATION [serial && !ux]:
#include <cstdio>
#include "globals.h"
#include "kernel_console.h"
#include "keycodes.h"
-#include "uart.h"
static Vkey::Echo_type vkey_echo;
static char vkey_buffer[256];
static unsigned vkey_tail, vkey_head;
-static Console *uart = Kconsole::console()->find_console(Console::UART);
PUBLIC static
void
int
Vkey::check_()
{
- if (!uart)
- return 1;
-
int ret = 1;
bool hit = false;
while (1)
{
- int c = uart->getchar(false);
+ int c = Kconsole::console()->getchar(false);
if (c == -1)
break;
- if (c == KEY_ESC)
+ if (is_debugger_entry_key(c))
{
ret = 0; // break into kernel debugger
break;
if (hit)
trigger();
- // Hmmm, we assume that a console with the UART flag set is of type Uart
- if (Config::serial_esc == Config::SERIAL_ESC_IRQ)
- static_cast<Uart*>(uart)->enable_rcv_irq();
-
// reenable debug stuff (undo debugctl_disable)
Cpu::cpus.cpu(current_cpu()).debugctl_enable();
}
//----------------------------------------------------------------------------
-IMPLEMENTATION [!debug || !serial || ux]:
+IMPLEMENTATION [!serial || ux]:
+
+#include "kernel_console.h"
PUBLIC static inline
void
Vkey::add_char(int)
{}
-//----------------------------------------------------------------------------
-IMPLEMENTATION [debug && (!serial || ux)]:
-
-#include "kernel_console.h"
-
PUBLIC static
int
Vkey::get()
return Kconsole::console()->getchar(0);
}
-//----------------------------------------------------------------------------
-IMPLEMENTATION [!debug && serial]:
-
-#include "kernel_console.h"
-
-static Console *uart = Kconsole::console()->find_console(Console::UART);
-
-PUBLIC static
-int
-Vkey::get()
-{
- return uart->getchar(false);
-}
-
-//----------------------------------------------------------------------------
-IMPLEMENTATION[!debug && !serial]:
-
-PUBLIC static
-int
-Vkey::get()
-{ return -1; }
-
-//----------------------------------------------------------------------------
-IMPLEMENTATION[!debug || !serial]:
-
PUBLIC static inline
int
Vkey::check_(int = -1)