Subversion Repositories HelenOS

Rev

Rev 4482 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (c) 2009 Jiri Svoboda
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. /** @addtogroup libc
  30.  * @{
  31.  */
  32. /** @file
  33.  */
  34.  
  35. #ifndef LIBC_IO_KEYCODE_H_
  36. #define LIBC_IO_KEYCODE_H_
  37.  
  38. /** Keycode definitions.
  39.  *
  40.  * A keycode identifies a key by its position on the keyboard, rather
  41.  * than by its label. For human readability, key positions are noted
  42.  * with the key label on a keyboard with US layout. This label has
  43.  * nothing to do with the character, that the key produces
  44.  * -- this is determined by the keymap.
  45.  *
  46.  * The keyboard model reflects a standard PC keyboard layout.
  47.  * Non-standard keyboards need to be mapped to this model in some
  48.  * logical way. Scancodes are mapped to keycodes with a scanmap.
  49.  *
  50.  * For easier mapping to the model and to emphasize the nature of keycodes,
  51.  * they really are organized here by position, rather than by label.
  52.  */
  53. enum keycode {
  54.  
  55.     /* Main block row 1 */
  56.  
  57.     KC_BACKTICK = 1,
  58.  
  59.     KC_1,
  60.     KC_2,
  61.     KC_3,
  62.     KC_4,
  63.     KC_5,
  64.     KC_6,
  65.     KC_7,
  66.     KC_8,
  67.     KC_9,
  68.     KC_0,
  69.  
  70.     KC_MINUS,
  71.     KC_EQUALS,
  72.     KC_BACKSPACE,
  73.  
  74.     /* Main block row 2 */
  75.  
  76.     KC_TAB,
  77.  
  78.     KC_Q,
  79.     KC_W,
  80.     KC_E,
  81.     KC_R,
  82.     KC_T,
  83.     KC_Y,
  84.     KC_U,
  85.     KC_I,
  86.     KC_O,
  87.     KC_P,
  88.  
  89.     KC_LBRACKET,
  90.     KC_RBRACKET,
  91.  
  92.     /* Main block row 3 */
  93.  
  94.     KC_CAPS_LOCK,
  95.    
  96.     KC_A,
  97.     KC_S,
  98.     KC_D,
  99.     KC_F,
  100.     KC_G,
  101.     KC_H,
  102.     KC_J,
  103.     KC_K,
  104.     KC_L,
  105.  
  106.     KC_SEMICOLON,
  107.     KC_QUOTE,
  108.     KC_BACKSLASH,
  109.  
  110.     KC_ENTER,
  111.  
  112.     /* Main block row 4 */
  113.  
  114.     KC_LSHIFT,
  115.  
  116.     KC_Z,
  117.     KC_X,
  118.     KC_C,
  119.     KC_V,
  120.     KC_B,
  121.     KC_N,
  122.     KC_M,
  123.  
  124.     KC_COMMA,
  125.     KC_PERIOD,
  126.     KC_SLASH,
  127.  
  128.     KC_RSHIFT,
  129.  
  130.     /* Main block row 5 */
  131.  
  132.     KC_LCTRL,
  133.     KC_LALT,
  134.     KC_SPACE,
  135.     KC_RALT,
  136.     KC_RCTRL,
  137.  
  138.     /* Function keys block */
  139.  
  140.     KC_ESCAPE,
  141.  
  142.     KC_F1,
  143.     KC_F2,
  144.     KC_F3,
  145.     KC_F4,
  146.     KC_F5,
  147.     KC_F6,
  148.     KC_F7,
  149.     KC_F8,
  150.     KC_F9,
  151.     KC_F10,
  152.     KC_F11,
  153.     KC_F12,
  154.  
  155.     KC_PRTSCR,
  156.     KC_SCROLL_LOCK,
  157.     KC_PAUSE,
  158.  
  159.     /* Cursor keys block */
  160.  
  161.     KC_INSERT,
  162.     KC_HOME,
  163.     KC_PAGE_UP,
  164.  
  165.     KC_DELETE,
  166.     KC_END,
  167.     KC_PAGE_DOWN,
  168.  
  169.     KC_UP,
  170.     KC_LEFT,
  171.     KC_DOWN,
  172.     KC_RIGHT,
  173.  
  174.     /* Numeric block */
  175.  
  176.     KC_NUM_LOCK,
  177.     KC_NSLASH,
  178.     KC_NTIMES,
  179.     KC_NMINUS,
  180.  
  181.     KC_NPLUS,
  182.     KC_NENTER,
  183.  
  184.     KC_N7,
  185.     KC_N8,
  186.     KC_N9,
  187.  
  188.     KC_N4,
  189.     KC_N5,
  190.     KC_N6,
  191.  
  192.     KC_N1,
  193.     KC_N2,
  194.     KC_N3,
  195.  
  196.     KC_N0,
  197.     KC_NPERIOD
  198.    
  199. } keycode_t;
  200.  
  201. enum keymod {
  202.     KM_LSHIFT      = 0x001,
  203.     KM_RSHIFT      = 0x002,
  204.     KM_LCTRL       = 0x004,
  205.     KM_RCTRL       = 0x008,
  206.     KM_LALT        = 0x010,
  207.     KM_RALT        = 0x020,
  208.     KM_CAPS_LOCK   = 0x040,
  209.     KM_NUM_LOCK    = 0x080,
  210.     KM_SCROLL_LOCK = 0x100,
  211.    
  212.     KM_SHIFT       = KM_LSHIFT | KM_RSHIFT,
  213.     KM_CTRL        = KM_LCTRL | KM_RCTRL,
  214.     KM_ALT         = KM_LALT | KM_RALT
  215. } keymod_t;
  216.  
  217. #endif
  218.  
  219. /** @}
  220.  */
  221.