]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/vkey.cpp
Update
[l4.git] / kernel / fiasco / src / kern / vkey.cpp
index 451559861c7bf3e5d32a5ffab26ff37ed522c95c..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>
 
@@ -111,7 +131,7 @@ Vkey::check_()
       if (c == -1)
        break;
 
-      if (c == KEY_ESC)
+      if (is_debugger_entry_key(c))
        {
          ret = 0;  // break into kernel debugger
          break;
@@ -166,7 +186,9 @@ Vkey::clear()
 }
 
 //----------------------------------------------------------------------------
-IMPLEMENTATION [!debug || !serial || ux]:
+IMPLEMENTATION [!serial || ux]:
+
+#include "kernel_console.h"
 
 PUBLIC static inline
 void
@@ -183,11 +205,6 @@ void
 Vkey::add_char(int)
 {}
 
-//----------------------------------------------------------------------------
-IMPLEMENTATION [debug && (!serial || ux)]:
-
-#include "kernel_console.h"
-
 PUBLIC static
 int
 Vkey::get()
@@ -195,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)