Subversion Repositories HelenOS

Rev

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

  1. /*
  2.  * Copyright (c) 2006 Jakub Jermar
  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 genarch
  30.  * @{
  31.  */
  32. /**
  33.  * @file
  34.  * @brief Scan codes for PC keyboards.
  35.  */
  36.  
  37. #include <genarch/kbrd/scanc.h>
  38. #include <typedefs.h>
  39. #include <string.h>
  40.  
  41. /** Primary meaning of scancodes. */
  42. wchar_t sc_primary_map[SCANCODES] = {
  43.     U_NULL,         /* 0x00 - undefined */
  44.     U_ESCAPE,       /* 0x01 - Esc */
  45.     '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
  46.     '\b',           /* 0x0e - Backspace */
  47.     '\t',           /* 0x0f - Tab */
  48.     'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']',
  49.     '\n',           /* 0x1e - Enter */
  50.     U_SPECIAL,      /* 0x1d - Left Ctrl */
  51.     'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`',
  52.     U_SPECIAL,      /* 0x2a - Left Shift */
  53.     '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',
  54.     U_SPECIAL,      /* 0x36 - Right Shift */
  55.     U_SPECIAL,      /* 0x37 - Print Screen */
  56.     U_SPECIAL,      /* 0x38 - Left Alt */
  57.     ' ',
  58.     U_SPECIAL,      /* 0x3a - CapsLock */
  59.     U_SPECIAL,      /* 0x3b - F1 */
  60.     U_SPECIAL,      /* 0x3c - F2 */
  61.     U_SPECIAL,      /* 0x3d - F3 */
  62.     U_SPECIAL,      /* 0x3e - F4 */
  63.     U_SPECIAL,      /* 0x3f - F5 */
  64.     U_SPECIAL,      /* 0x40 - F6 */
  65.     U_SPECIAL,      /* 0x41 - F7 */
  66.     U_SPECIAL,      /* 0x42 - F8 */
  67.     U_SPECIAL,      /* 0x43 - F9 */
  68.     U_SPECIAL,      /* 0x44 - F10 */
  69.     U_SPECIAL,      /* 0x45 - NumLock */
  70.     U_SPECIAL,      /* 0x46 - ScrollLock */
  71.     U_HOME_ARROW,   /* 0x47 - Home */
  72.     U_UP_ARROW,     /* 0x48 - Up Arrow */
  73.     U_PAGE_UP,      /* 0x49 - Page Up */
  74.     '-',
  75.     U_LEFT_ARROW,   /* 0x4b - Left Arrow */
  76.     '5',            /* 0x4c - Numpad Center */
  77.     U_RIGHT_ARROW,  /* 0x4d - Right Arrow */
  78.     '+',
  79.     U_END_ARROW,    /* 0x4f - End */
  80.     U_DOWN_ARROW,   /* 0x50 - Down Arrow */
  81.     U_PAGE_DOWN,    /* 0x51 - Page Down */
  82.     '0',            /* 0x52 - Numpad Insert */
  83.     U_DELETE,       /* 0x53 - Delete */
  84.     U_SPECIAL,      /* 0x54 - Alt-SysRq */
  85.     U_SPECIAL,      /* 0x55 - F11/F12/PF1/FN */
  86.     U_SPECIAL,      /* 0x56 - unlabelled key next to LAlt */
  87.     U_SPECIAL,      /* 0x57 - F11 */
  88.     U_SPECIAL,      /* 0x58 - F12 */
  89.     U_SPECIAL,      /* 0x59 */
  90.     U_SPECIAL,      /* 0x5a */
  91.     U_SPECIAL,      /* 0x5b */
  92.     U_SPECIAL,      /* 0x5c */
  93.     U_SPECIAL,      /* 0x5d */
  94.     U_SPECIAL,      /* 0x5e */
  95.     U_SPECIAL,      /* 0x5f */
  96.     U_SPECIAL,      /* 0x60 */
  97.     U_SPECIAL,      /* 0x61 */
  98.     U_SPECIAL,      /* 0x62 */
  99.     U_SPECIAL,      /* 0x63 */
  100.     U_SPECIAL,      /* 0x64 */
  101.     U_SPECIAL,      /* 0x65 */
  102.     U_SPECIAL,      /* 0x66 */
  103.     U_SPECIAL,      /* 0x67 */
  104.     U_SPECIAL,      /* 0x68 */
  105.     U_SPECIAL,      /* 0x69 */
  106.     U_SPECIAL,      /* 0x6a */
  107.     U_SPECIAL,      /* 0x6b */
  108.     U_SPECIAL,      /* 0x6c */
  109.     U_SPECIAL,      /* 0x6d */
  110.     U_SPECIAL,      /* 0x6e */
  111.     U_SPECIAL,      /* 0x6f */
  112.     U_SPECIAL,      /* 0x70 */
  113.     U_SPECIAL,      /* 0x71 */
  114.     U_SPECIAL,      /* 0x72 */
  115.     U_SPECIAL,      /* 0x73 */
  116.     U_SPECIAL,      /* 0x74 */
  117.     U_SPECIAL,      /* 0x75 */
  118.     U_SPECIAL,      /* 0x76 */
  119.     U_SPECIAL,      /* 0x77 */
  120.     U_SPECIAL,      /* 0x78 */
  121.     U_SPECIAL,      /* 0x79 */
  122.     U_SPECIAL,      /* 0x7a */
  123.     U_SPECIAL,      /* 0x7b */
  124.     U_SPECIAL,      /* 0x7c */
  125.     U_SPECIAL,      /* 0x7d */
  126.     U_SPECIAL,      /* 0x7e */
  127.     U_SPECIAL       /* 0x7f */
  128. };
  129.  
  130. /** Secondary meaning of scancodes. */
  131. wchar_t sc_secondary_map[SCANCODES] = {
  132.     U_NULL,         /* 0x00 - undefined */
  133.     U_ESCAPE,       /* 0x01 - Esc */
  134.     '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',
  135.     '\b',           /* 0x0e - Backspace */
  136.     '\t',           /* 0x0f - Tab */
  137.     'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}',
  138.     '\n',           /* 0x1e - Enter */
  139.     U_SPECIAL,      /* 0x1d - Left Ctrl */
  140.     'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~',
  141.     U_SPECIAL,      /* 0x2a - Left Shift */
  142.     '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
  143.     U_SPECIAL,      /* 0x36 - Right Shift */
  144.     U_SPECIAL,      /* 0x37 - Print Screen */
  145.     U_SPECIAL,      /* 0x38 - Left Alt */
  146.     ' ',
  147.     U_SPECIAL,      /* 0x3a - CapsLock */
  148.     U_SPECIAL,      /* 0x3b - F1 */
  149.     U_SPECIAL,      /* 0x3c - F2 */
  150.     U_SPECIAL,      /* 0x3d - F3 */
  151.     U_SPECIAL,      /* 0x3e - F4 */
  152.     U_SPECIAL,      /* 0x3f - F5 */
  153.     U_SPECIAL,      /* 0x40 - F6 */
  154.     U_SPECIAL,      /* 0x41 - F7 */
  155.     U_SPECIAL,      /* 0x42 - F8 */
  156.     U_SPECIAL,      /* 0x43 - F9 */
  157.     U_SPECIAL,      /* 0x44 - F10 */
  158.     U_SPECIAL,      /* 0x45 - NumLock */
  159.     U_SPECIAL,      /* 0x46 - ScrollLock */
  160.    
  161.     U_HOME_ARROW,   /* 0x47 - Home */
  162.     U_UP_ARROW,     /* 0x48 - Up Arrow */
  163.     U_PAGE_UP,      /* 0x49 - Page Up */
  164.     '-',
  165.     U_LEFT_ARROW,   /* 0x4b - Left Arrow */
  166.     '5',            /* 0x4c - Numpad Center */
  167.     U_RIGHT_ARROW,  /* 0x4d - Right Arrow */
  168.     '+',
  169.     U_END_ARROW,    /* 0x4f - End */
  170.     U_DOWN_ARROW,   /* 0x50 - Down Arrow */
  171.     U_PAGE_DOWN,    /* 0x51 - Page Down */
  172.     '0',            /* 0x52 - Numpad Insert */
  173.     U_DELETE,       /* 0x53 - Delete */
  174.     U_SPECIAL,      /* 0x54 - Alt-SysRq */
  175.     U_SPECIAL,      /* 0x55 - F11/F12/PF1/FN */
  176.     U_SPECIAL,      /* 0x56 - unlabelled key next to LAlt */
  177.     U_SPECIAL,      /* 0x57 - F11 */
  178.     U_SPECIAL,      /* 0x58 - F12 */
  179.     U_SPECIAL,      /* 0x59 */
  180.     U_SPECIAL,      /* 0x5a */
  181.     U_SPECIAL,      /* 0x5b */
  182.     U_SPECIAL,      /* 0x5c */
  183.     U_SPECIAL,      /* 0x5d */
  184.     U_SPECIAL,      /* 0x5e */
  185.     U_SPECIAL,      /* 0x5f */
  186.     U_SPECIAL,      /* 0x60 */
  187.     U_SPECIAL,      /* 0x61 */
  188.     U_SPECIAL,      /* 0x62 */
  189.     U_SPECIAL,      /* 0x63 */
  190.     U_SPECIAL,      /* 0x64 */
  191.     U_SPECIAL,      /* 0x65 */
  192.     U_SPECIAL,      /* 0x66 */
  193.     U_SPECIAL,      /* 0x67 */
  194.     U_SPECIAL,      /* 0x68 */
  195.     U_SPECIAL,      /* 0x69 */
  196.     U_SPECIAL,      /* 0x6a */
  197.     U_SPECIAL,      /* 0x6b */
  198.     U_SPECIAL,      /* 0x6c */
  199.     U_SPECIAL,      /* 0x6d */
  200.     U_SPECIAL,      /* 0x6e */
  201.     U_SPECIAL,      /* 0x6f */
  202.     U_SPECIAL,      /* 0x70 */
  203.     U_SPECIAL,      /* 0x71 */
  204.     U_SPECIAL,      /* 0x72 */
  205.     U_SPECIAL,      /* 0x73 */
  206.     U_SPECIAL,      /* 0x74 */
  207.     U_SPECIAL,      /* 0x75 */
  208.     U_SPECIAL,      /* 0x76 */
  209.     U_SPECIAL,      /* 0x77 */
  210.     U_SPECIAL,      /* 0x78 */
  211.     U_SPECIAL,      /* 0x79 */
  212.     U_SPECIAL,      /* 0x7a */
  213.     U_SPECIAL,      /* 0x7b */
  214.     U_SPECIAL,      /* 0x7c */
  215.     U_SPECIAL,      /* 0x7d */
  216.     U_SPECIAL,      /* 0x7e */
  217.     U_SPECIAL       /* 0x7f */
  218. };
  219.  
  220. /** @}
  221.  */
  222.