]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/vkey.cpp
Update
[l4.git] / kernel / fiasco / src / kern / vkey.cpp
index 57d29600d03af38da865f8651ee789cb12dfb2b7..e5b9f1d213615427d30821633418f52a80d30d4c 100644 (file)
@@ -21,8 +21,28 @@ void
 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>
 
@@ -31,12 +51,10 @@ IMPLEMENTATION [debug && serial && !ux]:
 #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
@@ -100,9 +118,6 @@ PUBLIC static
 int
 Vkey::check_()
 {
-  if (!uart)
-    return 1;
-
   int  ret = 1;
   bool hit = false;
 
@@ -111,12 +126,12 @@ Vkey::check_()
 
   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;
@@ -146,10 +161,6 @@ Vkey::check_()
   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();
 
@@ -175,7 +186,9 @@ Vkey::clear()
 }
 
 //----------------------------------------------------------------------------
-IMPLEMENTATION [!debug || !serial || ux]:
+IMPLEMENTATION [!serial || ux]:
+
+#include "kernel_console.h"
 
 PUBLIC static inline
 void
@@ -192,11 +205,6 @@ void
 Vkey::add_char(int)
 {}
 
-//----------------------------------------------------------------------------
-IMPLEMENTATION [debug && (!serial || ux)]:
-
-#include "kernel_console.h"
-
 PUBLIC static
 int
 Vkey::get()
@@ -204,31 +212,6 @@ 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)