Changeset c8bf88d in mainline for kernel/genarch/src
- Timestamp:
- 2009-04-03T15:52:14Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a7b1071
- Parents:
- 2398ee9
- Location:
- kernel/genarch/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/drivers/dsrln/dsrlnout.c
r2398ee9 rc8bf88d 51 51 pio_write_8(dsrlnout_base, ch); 52 52 else 53 pio_write_8(dsrlnout_base, invalch);53 pio_write_8(dsrlnout_base, U_SPECIAL); 54 54 } 55 55 } -
kernel/genarch/src/drivers/ega/ega.c
r2398ee9 rc8bf88d 45 45 #include <arch/asm.h> 46 46 #include <memstr.h> 47 #include <string.h> 47 48 #include <console/chardev.h> 48 49 #include <console/console.h> … … 486 487 487 488 if ((index >> 8)) { 488 glyph = '?';489 glyph = U_SPECIAL; 489 490 style = INVAL; 490 491 } else { -
kernel/genarch/src/drivers/i8042/i8042.c
r2398ee9 rc8bf88d 35 35 * 36 36 * It takes care of the i8042 serial communication. 37 * 37 38 */ 38 39 -
kernel/genarch/src/fb/fb.c
r2398ee9 rc8bf88d 48 48 #include <bitops.h> 49 49 #include <print.h> 50 #include <string.h> 50 51 #include <ddi/ddi.h> 51 52 #include <arch/types.h> … … 79 80 #define FG_COLOR 0xffff00 80 81 #define INV_COLOR 0xaaaaaa 81 82 #define CURSOR 0x258883 82 84 83 #define RED(x, bits) ((x >> (8 + 8 + 8 - bits)) & ((1 << bits) - 1)) … … 201 200 * 202 201 */ 203 static void glyph_draw(uint16_t glyph, unsigned int col, unsigned int row, bool silent )202 static void glyph_draw(uint16_t glyph, unsigned int col, unsigned int row, bool silent, bool overlay) 204 203 { 205 204 unsigned int x = COL2X(col); … … 210 209 logo_hide(silent); 211 210 212 backbuf[BB_POS(col, row)] = glyph; 211 if (!overlay) 212 backbuf[BB_POS(col, row)] = glyph; 213 213 214 214 if (!silent) { … … 270 270 static void cursor_put(bool silent) 271 271 { 272 glyph_draw(fb_font_glyph(CURSOR), position % cols, position / cols, silent); 272 unsigned int col = position % cols; 273 unsigned int row = position / cols; 274 275 glyph_draw(fb_font_glyph(U_CURSOR), col, row, silent, true); 273 276 } 274 277 … … 276 279 static void cursor_remove(bool silent) 277 280 { 278 glyph_draw(fb_font_glyph(0), position % cols, position / cols, silent); 281 unsigned int col = position % cols; 282 unsigned int row = position / cols; 283 284 glyph_draw(backbuf[BB_POS(col, row)], col, row, silent, true); 279 285 } 280 286 … … 308 314 do { 309 315 glyph_draw(fb_font_glyph(' '), position % cols, 310 position / cols, silent );316 position / cols, silent, false); 311 317 position++; 312 318 } while ((position % 8) && (position < cols * rows)); … … 314 320 default: 315 321 glyph_draw(fb_font_glyph(ch), position % cols, 316 position / cols, silent );322 position / cols, silent, false); 317 323 position++; 318 324 } -
kernel/genarch/src/kbrd/kbrd.c
r2398ee9 rc8bf88d 53 53 #include <macros.h> 54 54 55 #ifdef CONFIG_SUN_KBD 56 #define IGNORE_CODE 0x7f 57 #endif 58 55 #define IGNORE_CODE 0x7f 59 56 #define KEY_RELEASE 0x80 60 57 … … 73 70 static volatile int lockflags; /**< Tracking of multiple keys lockings. */ 74 71 75 static void key_released(uint8_t);76 static void key_pressed(uint8_t);77 78 static void kkbrd(void *arg)79 {80 indev_t *in = (indev_t *) arg;81 82 while (true) {83 uint8_t sc = _getc(in);84 85 #ifdef CONFIG_SUN_KBD86 if (sc == IGNORE_CODE)87 continue;88 #endif89 90 if (sc & KEY_RELEASE)91 key_released(sc ^ KEY_RELEASE);92 else93 key_pressed(sc);94 }95 }96 97 void kbrd_init(indev_t *devin)98 {99 indev_initialize("kbrd", &kbrdout, &kbrdout_ops);100 thread_t *thread101 = thread_create(kkbrd, devin, TASK, 0, "kkbrd", false);102 103 if (thread) {104 stdin = &kbrdout;105 thread_ready(thread);106 }107 }108 109 72 /** Process release of key. 110 73 * 111 74 * @param sc Scancode of the key being released. 112 75 */ 113 void key_released(uint8_t sc)76 static void key_released(wchar_t sc) 114 77 { 115 78 spinlock_lock(&keylock); … … 136 99 * @param sc Scancode of the key being pressed. 137 100 */ 138 void key_pressed(uint8_t sc)101 static void key_pressed(wchar_t sc) 139 102 { 140 char *map = sc_primary_map; 141 char ascii = sc_primary_map[sc]; 142 bool shift, capslock; 143 bool letter = false; 103 bool letter; 104 bool shift; 105 bool capslock; 144 106 145 107 spinlock_lock(&keylock); … … 152 114 keyflags |= PRESSED_CAPSLOCK; 153 115 break; 154 case SC_SPEC_ESCAPE: 155 break; 156 case SC_LEFTARR: 157 indev_push_character(stdin, 0x1b); 158 indev_push_character(stdin, 0x5b); 159 indev_push_character(stdin, 0x44); 160 break; 161 case SC_RIGHTARR: 162 indev_push_character(stdin, 0x1b); 163 indev_push_character(stdin, 0x5b); 164 indev_push_character(stdin, 0x43); 165 break; 166 case SC_UPARR: 167 indev_push_character(stdin, 0x1b); 168 indev_push_character(stdin, 0x5b); 169 indev_push_character(stdin, 0x41); 170 break; 171 case SC_DOWNARR: 172 indev_push_character(stdin, 0x1b); 173 indev_push_character(stdin, 0x5b); 174 indev_push_character(stdin, 0x42); 175 break; 176 case SC_HOME: 177 indev_push_character(stdin, 0x1b); 178 indev_push_character(stdin, 0x4f); 179 indev_push_character(stdin, 0x48); 180 break; 181 case SC_END: 182 indev_push_character(stdin, 0x1b); 183 indev_push_character(stdin, 0x4f); 184 indev_push_character(stdin, 0x46); 185 break; 186 case SC_DELETE: 187 indev_push_character(stdin, 0x1b); 188 indev_push_character(stdin, 0x5b); 189 indev_push_character(stdin, 0x33); 190 indev_push_character(stdin, 0x7e); 116 case SC_SCAN_ESCAPE: 191 117 break; 192 118 default: 193 letter = islower(ascii); 119 letter = islower(sc_primary_map[sc]); 120 shift = keyflags & PRESSED_SHIFT; 194 121 capslock = (keyflags & PRESSED_CAPSLOCK) || 195 122 (lockflags & LOCKED_CAPSLOCK); 196 shift = keyflags & PRESSED_SHIFT;197 if ( letter && capslock)123 124 if ((letter) && (capslock)) 198 125 shift = !shift; 126 199 127 if (shift) 200 map = sc_secondary_map; 201 indev_push_character(stdin, map[sc]); 128 indev_push_character(stdin, sc_secondary_map[sc]); 129 else 130 indev_push_character(stdin, sc_primary_map[sc]); 202 131 break; 203 132 } … … 205 134 } 206 135 136 static void kkbrd(void *arg) 137 { 138 indev_t *in = (indev_t *) arg; 139 140 while (true) { 141 wchar_t sc = _getc(in); 142 143 if ((sc == IGNORE_CODE) || (sc >= SCANCODES)) 144 continue; 145 146 if (sc & KEY_RELEASE) 147 key_released(sc ^ KEY_RELEASE); 148 else 149 key_pressed(sc); 150 } 151 } 152 153 void kbrd_init(indev_t *devin) 154 { 155 indev_initialize("kbrd", &kbrdout, &kbrdout_ops); 156 thread_t *thread 157 = thread_create(kkbrd, devin, TASK, 0, "kkbrd", false); 158 159 if (thread) { 160 stdin = &kbrdout; 161 thread_ready(thread); 162 } 163 } 164 207 165 /** @} 208 166 */ -
kernel/genarch/src/kbrd/scanc_pc.c
r2398ee9 rc8bf88d 27 27 */ 28 28 29 /** @addtogroup genarch 29 /** @addtogroup genarch 30 30 * @{ 31 31 */ 32 32 /** 33 33 * @file 34 * @brief Scan codes for pckeyboards.34 * @brief Scan codes for PC keyboards. 35 35 */ 36 36 37 37 #include <genarch/kbrd/scanc.h> 38 #include <typedefs.h> 39 #include <string.h> 38 40 39 41 /** Primary meaning of scancodes. */ 40 char sc_primary_map[] = {41 SPECIAL, /* 0x00*/42 SPECIAL,/* 0x01 - Esc */42 wchar_t sc_primary_map[SCANCODES] = { 43 U_NULL, /* 0x00 - undefined */ 44 U_ESCAPE, /* 0x01 - Esc */ 43 45 '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 44 '\b', /* 0x0e - Backspace */45 '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n',46 SPECIAL, /* 0x1d - LCtrl */47 ' a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'',48 '`',49 SPECIAL, /* 0x2a - LShift */50 '\\',51 ' z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/',52 SPECIAL, /* 0x36 - RShift */53 '*',54 SPECIAL, /* 0x38 - LAlt */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 */ 55 57 ' ', 56 SPECIAL, /* 0x3a - CapsLock */ 57 SPECIAL, /* 0x3b - F1 */ 58 SPECIAL, /* 0x3c - F2 */ 59 SPECIAL, /* 0x3d - F3 */ 60 SPECIAL, /* 0x3e - F4 */ 61 SPECIAL, /* 0x3f - F5 */ 62 SPECIAL, /* 0x40 - F6 */ 63 SPECIAL, /* 0x41 - F7 */ 64 SPECIAL, /* 0x42 - F8 */ 65 SPECIAL, /* 0x43 - F9 */ 66 SPECIAL, /* 0x44 - F10 */ 67 SPECIAL, /* 0x45 - NumLock */ 68 SPECIAL, /* 0x46 - ScrollLock */ 69 '7', '8', '9', '-', 70 '4', '5', '6', '+', 71 '1', '2', '3', 72 '0', '.', 73 SPECIAL, /* 0x54 - Alt-SysRq */ 74 SPECIAL, /* 0x55 - F11/F12/PF1/FN */ 75 SPECIAL, /* 0x56 - unlabelled key next to LAlt */ 76 SPECIAL, /* 0x57 - F11 */ 77 SPECIAL, /* 0x58 - F12 */ 78 SPECIAL, /* 0x59 */ 79 SPECIAL, /* 0x5a */ 80 SPECIAL, /* 0x5b */ 81 SPECIAL, /* 0x5c */ 82 SPECIAL, /* 0x5d */ 83 SPECIAL, /* 0x5e */ 84 SPECIAL, /* 0x5f */ 85 SPECIAL, /* 0x60 */ 86 SPECIAL, /* 0x61 */ 87 SPECIAL, /* 0x62 */ 88 SPECIAL, /* 0x63 */ 89 SPECIAL, /* 0x64 */ 90 SPECIAL, /* 0x65 */ 91 SPECIAL, /* 0x66 */ 92 SPECIAL, /* 0x67 */ 93 SPECIAL, /* 0x68 */ 94 SPECIAL, /* 0x69 */ 95 SPECIAL, /* 0x6a */ 96 SPECIAL, /* 0x6b */ 97 SPECIAL, /* 0x6c */ 98 SPECIAL, /* 0x6d */ 99 SPECIAL, /* 0x6e */ 100 SPECIAL, /* 0x6f */ 101 SPECIAL, /* 0x70 */ 102 SPECIAL, /* 0x71 */ 103 SPECIAL, /* 0x72 */ 104 SPECIAL, /* 0x73 */ 105 SPECIAL, /* 0x74 */ 106 SPECIAL, /* 0x75 */ 107 SPECIAL, /* 0x76 */ 108 SPECIAL, /* 0x77 */ 109 SPECIAL, /* 0x78 */ 110 SPECIAL, /* 0x79 */ 111 SPECIAL, /* 0x7a */ 112 SPECIAL, /* 0x7b */ 113 SPECIAL, /* 0x7c */ 114 SPECIAL, /* 0x7d */ 115 SPECIAL, /* 0x7e */ 116 SPECIAL, /* 0x7f */ 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 */ 117 128 }; 118 129 119 130 /** Secondary meaning of scancodes. */ 120 char sc_secondary_map[] = {121 SPECIAL, /* 0x00*/122 SPECIAL,/* 0x01 - Esc */131 wchar_t sc_secondary_map[SCANCODES] = { 132 U_NULL, /* 0x00 - undefined */ 133 U_ESCAPE, /* 0x01 - Esc */ 123 134 '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 124 SPECIAL,/* 0x0e - Backspace */125 '\t', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n',126 SPECIAL, /* 0x1d - LCtrl */127 ' A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"',128 '~',129 SPECIAL, /* 0x2a - LShift */130 '|',131 ' Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',132 SPECIAL, /* 0x36 - RShift */133 '*',134 SPECIAL, /* 0x38 - LAlt */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 */ 135 146 ' ', 136 SPECIAL, /* 0x3a - CapsLock */ 137 SPECIAL, /* 0x3b - F1 */ 138 SPECIAL, /* 0x3c - F2 */ 139 SPECIAL, /* 0x3d - F3 */ 140 SPECIAL, /* 0x3e - F4 */ 141 SPECIAL, /* 0x3f - F5 */ 142 SPECIAL, /* 0x40 - F6 */ 143 SPECIAL, /* 0x41 - F7 */ 144 SPECIAL, /* 0x42 - F8 */ 145 SPECIAL, /* 0x43 - F9 */ 146 SPECIAL, /* 0x44 - F10 */ 147 SPECIAL, /* 0x45 - NumLock */ 148 SPECIAL, /* 0x46 - ScrollLock */ 149 '7', '8', '9', '-', 150 '4', '5', '6', '+', 151 '1', '2', '3', 152 '0', '.', 153 SPECIAL, /* 0x54 - Alt-SysRq */ 154 SPECIAL, /* 0x55 - F11/F12/PF1/FN */ 155 SPECIAL, /* 0x56 - unlabelled key next to LAlt */ 156 SPECIAL, /* 0x57 - F11 */ 157 SPECIAL, /* 0x58 - F12 */ 158 SPECIAL, /* 0x59 */ 159 SPECIAL, /* 0x5a */ 160 SPECIAL, /* 0x5b */ 161 SPECIAL, /* 0x5c */ 162 SPECIAL, /* 0x5d */ 163 SPECIAL, /* 0x5e */ 164 SPECIAL, /* 0x5f */ 165 SPECIAL, /* 0x60 */ 166 SPECIAL, /* 0x61 */ 167 SPECIAL, /* 0x62 */ 168 SPECIAL, /* 0x63 */ 169 SPECIAL, /* 0x64 */ 170 SPECIAL, /* 0x65 */ 171 SPECIAL, /* 0x66 */ 172 SPECIAL, /* 0x67 */ 173 SPECIAL, /* 0x68 */ 174 SPECIAL, /* 0x69 */ 175 SPECIAL, /* 0x6a */ 176 SPECIAL, /* 0x6b */ 177 SPECIAL, /* 0x6c */ 178 SPECIAL, /* 0x6d */ 179 SPECIAL, /* 0x6e */ 180 SPECIAL, /* 0x6f */ 181 SPECIAL, /* 0x70 */ 182 SPECIAL, /* 0x71 */ 183 SPECIAL, /* 0x72 */ 184 SPECIAL, /* 0x73 */ 185 SPECIAL, /* 0x74 */ 186 SPECIAL, /* 0x75 */ 187 SPECIAL, /* 0x76 */ 188 SPECIAL, /* 0x77 */ 189 SPECIAL, /* 0x78 */ 190 SPECIAL, /* 0x79 */ 191 SPECIAL, /* 0x7a */ 192 SPECIAL, /* 0x7b */ 193 SPECIAL, /* 0x7c */ 194 SPECIAL, /* 0x7d */ 195 SPECIAL, /* 0x7e */ 196 SPECIAL, /* 0x7f */ 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 */ 197 218 }; 198 219 -
kernel/genarch/src/kbrd/scanc_sun.c
r2398ee9 rc8bf88d 27 27 */ 28 28 29 /** @addtogroup genarch 29 /** @addtogroup genarch 30 30 * @{ 31 31 */ 32 32 /** 33 33 * @file 34 * @brief 34 * @brief Scan codes for Sun keyboards. 35 35 */ 36 36 37 37 #include <genarch/kbrd/scanc.h> 38 #include <typedefs.h> 39 #include <string.h> 38 40 39 41 /** Primary meaning of scancodes. */ 40 char sc_primary_map[] = {41 [0x00] = SPECIAL,42 [0x01] = SPECIAL,43 [0x02] = SPECIAL,44 [0x03] = SPECIAL,45 [0x04] = SPECIAL,46 [0x05] = SPECIAL,/* F1 */47 [0x06] = SPECIAL,/* F2 */48 [0x07] = SPECIAL,/* F10 */49 [0x08] = SPECIAL,/* F3 */50 [0x09] = SPECIAL,/* F11 */51 [0x0a] = SPECIAL,/* F4 */52 [0x0b] = SPECIAL,/* F12 */53 [0x0c] = SPECIAL,/* F5 */54 [0x0d] = SPECIAL, /* RAlt */55 [0x0e] = SPECIAL,/* F6 */56 [0x0f] = SPECIAL,57 [0x10] = SPECIAL,/* F7 */58 [0x11] = SPECIAL,/* F8 */59 [0x12] = SPECIAL,/* F9 */60 [0x13] = SPECIAL, /* LAlt */61 [0x14] = SPECIAL,/* Up Arrow */62 [0x15] = SPECIAL,/* Pause */63 [0x16] = SPECIAL,64 [0x17] = SPECIAL,/* Scroll Lock */65 [0x18] = SPECIAL,/* Left Arrow */66 [0x19] = SPECIAL,67 [0x1a] = SPECIAL,68 [0x1b] = SPECIAL,/* Down Arrow */69 [0x1c] = SPECIAL,/* Right Arrow */70 [0x1d] = SPECIAL,/* Esc */42 wchar_t sc_primary_map[SCANCODES] = { 43 [0x00] = U_SPECIAL, 44 [0x01] = U_SPECIAL, 45 [0x02] = U_SPECIAL, 46 [0x03] = U_SPECIAL, 47 [0x04] = U_SPECIAL, 48 [0x05] = U_SPECIAL, /* F1 */ 49 [0x06] = U_SPECIAL, /* F2 */ 50 [0x07] = U_SPECIAL, /* F10 */ 51 [0x08] = U_SPECIAL, /* F3 */ 52 [0x09] = U_SPECIAL, /* F11 */ 53 [0x0a] = U_SPECIAL, /* F4 */ 54 [0x0b] = U_SPECIAL, /* F12 */ 55 [0x0c] = U_SPECIAL, /* F5 */ 56 [0x0d] = U_SPECIAL, /* Right Alt */ 57 [0x0e] = U_SPECIAL, /* F6 */ 58 [0x0f] = U_SPECIAL, 59 [0x10] = U_SPECIAL, /* F7 */ 60 [0x11] = U_SPECIAL, /* F8 */ 61 [0x12] = U_SPECIAL, /* F9 */ 62 [0x13] = U_SPECIAL, /* Left Alt */ 63 [0x14] = U_UP_ARROW, /* Up Arrow */ 64 [0x15] = U_SPECIAL, /* Pause */ 65 [0x16] = U_SPECIAL, 66 [0x17] = U_SPECIAL, /* Scroll Lock */ 67 [0x18] = U_LEFT_ARROW, /* Left Arrow */ 68 [0x19] = U_SPECIAL, 69 [0x1a] = U_SPECIAL, 70 [0x1b] = U_DOWN_ARROW, /* Down Arrow */ 71 [0x1c] = U_RIGHT_ARROW, /* Right Arrow */ 72 [0x1d] = U_ESCAPE, /* Esc */ 71 73 [0x1e] = '1', 72 74 [0x1f] = '2', … … 82 84 [0x29] = '=', 83 85 [0x2a] = '`', 84 [0x2b] = '\b', 85 [0x2c] = SPECIAL,/* Insert */86 [0x2d] = SPECIAL,87 [0x2e] = '/', /* numeric keypad*/88 [0x2f] = '*', /* numeric keypad*/89 [0x30] = SPECIAL,90 [0x31] = SPECIAL,91 [0x32] = '.', /* numeric keypad*/92 [0x33] = SPECIAL,93 [0x34] = SPECIAL,/* Home */94 [0x35] = '\t', 86 [0x2b] = '\b', /* Backspace */ 87 [0x2c] = U_SPECIAL, /* Insert */ 88 [0x2d] = U_SPECIAL, 89 [0x2e] = '/', /* Numpad / */ 90 [0x2f] = '*', /* Numpad * */ 91 [0x30] = U_SPECIAL, 92 [0x31] = U_SPECIAL, 93 [0x32] = '.', /* Numpad . */ 94 [0x33] = U_SPECIAL, 95 [0x34] = U_HOME_ARROW, /* Home */ 96 [0x35] = '\t', /* Tab */ 95 97 [0x36] = 'q', 96 98 [0x37] = 'w', … … 105 107 [0x40] = '[', 106 108 [0x41] = ']', 107 [0x42] = SPECIAL, /* Del*/108 [0x43] = SPECIAL,109 [0x44] = '7', /* numeric keypad*/110 [0x45] = '8', /* numeric keypad*/111 [0x46] = '9', /* numeric keypad*/112 [0x47] = '-', /* numeric keypad*/113 [0x48] = SPECIAL,114 [0x49] = SPECIAL,115 [0x4a] = SPECIAL,/* End */116 [0x4b] = SPECIAL,117 [0x4c] = SPECIAL,/* Control */109 [0x42] = U_DELETE, /* Delete */ 110 [0x43] = U_SPECIAL, 111 [0x44] = '7', /* Numpad 7 */ 112 [0x45] = '8', /* Numpad 8 */ 113 [0x46] = '9', /* Numpad 9 */ 114 [0x47] = '-', /* Numpad - */ 115 [0x48] = U_SPECIAL, 116 [0x49] = U_SPECIAL, 117 [0x4a] = U_END_ARROW, /* End */ 118 [0x4b] = U_SPECIAL, 119 [0x4c] = U_SPECIAL, /* Control */ 118 120 [0x4d] = 'a', 119 121 [0x4e] = 's', … … 128 130 [0x57] = '\'', 129 131 [0x58] = '\\', 130 [0x59] = '\n', 131 [0x5a] = '\n', /* Enter on numeric keypad*/132 [0x5b] = '4', /* numeric keypad*/133 [0x5c] = '5', /* numeric keypad*/134 [0x5d] = '6', /* numeric keypad*/135 [0x5e] = '0', /* numeric keypad*/136 [0x5f] = SPECIAL,137 [0x60] = SPECIAL,/* Page Up */138 [0x61] = SPECIAL,139 [0x62] = SPECIAL, /* NumLock */140 [0x63] = SPECIAL, /* LShift */132 [0x59] = '\n', /* Enter */ 133 [0x5a] = '\n', /* Numpad Enter */ 134 [0x5b] = '4', /* Numpad 4 */ 135 [0x5c] = '5', /* Numpad 5 */ 136 [0x5d] = '6', /* Numpad 6 */ 137 [0x5e] = '0', /* Numpad 0 */ 138 [0x5f] = U_SPECIAL, 139 [0x60] = U_PAGE_UP, /* Page Up */ 140 [0x61] = U_SPECIAL, 141 [0x62] = U_SPECIAL, /* NumLock */ 142 [0x63] = U_SPECIAL, /* Left Shift */ 141 143 [0x64] = 'z', 142 144 [0x65] = 'x', … … 149 151 [0x6c] = '.', 150 152 [0x6d] = '/', 151 [0x6e] = SPECIAL, /* RShift */152 [0x6f] = SPECIAL,153 [0x70] = '1', /* numeric keypad*/154 [0x71] = '2', /* numeric keypad*/155 [0x72] = '3', /* numeric keypad*/156 [0x73] = SPECIAL,157 [0x74] = SPECIAL,158 [0x75] = SPECIAL,159 [0x76] = SPECIAL,160 [0x77] = SPECIAL, /* CapsLock */161 [0x78] = SPECIAL,153 [0x6e] = U_SPECIAL, /* Right Shift */ 154 [0x6f] = U_SPECIAL, 155 [0x70] = '1', /* Numpad 1 */ 156 [0x71] = '2', /* Numpad 2 */ 157 [0x72] = '3', /* Numpad 3 */ 158 [0x73] = U_SPECIAL, 159 [0x74] = U_SPECIAL, 160 [0x75] = U_SPECIAL, 161 [0x76] = U_SPECIAL, 162 [0x77] = U_SPECIAL, /* CapsLock */ 163 [0x78] = U_SPECIAL, 162 164 [0x79] = ' ', 163 [0x7a] = SPECIAL,164 [0x7b] = SPECIAL,/* Page Down */165 [0x7c] = SPECIAL,166 [0x7d] = '+', /* numeric key pad*/167 [0x7e] = SPECIAL,168 [0x7f] = SPECIAL165 [0x7a] = U_SPECIAL, 166 [0x7b] = U_PAGE_DOWN, /* Page Down */ 167 [0x7c] = U_SPECIAL, 168 [0x7d] = '+', /* Numpad + */ 169 [0x7e] = U_SPECIAL, 170 [0x7f] = U_SPECIAL 169 171 }; 170 172 171 173 /** Secondary meaning of scancodes. */ 172 char sc_secondary_map[] = {173 [0x00] = SPECIAL,174 [0x01] = SPECIAL,175 [0x02] = SPECIAL,176 [0x03] = SPECIAL,177 [0x04] = SPECIAL,178 [0x05] = SPECIAL,/* F1 */179 [0x06] = SPECIAL,/* F2 */180 [0x07] = SPECIAL,/* F10 */181 [0x08] = SPECIAL,/* F3 */182 [0x09] = SPECIAL,/* F11 */183 [0x0a] = SPECIAL,/* F4 */184 [0x0b] = SPECIAL,/* F12 */185 [0x0c] = SPECIAL,/* F5 */186 [0x0d] = SPECIAL, /* RAlt */187 [0x0e] = SPECIAL,/* F6 */188 [0x0f] = SPECIAL,189 [0x10] = SPECIAL,/* F7 */190 [0x11] = SPECIAL,/* F8 */191 [0x12] = SPECIAL,/* F9 */192 [0x13] = SPECIAL, /* LAlt */193 [0x14] = SPECIAL,/* Up Arrow */194 [0x15] = SPECIAL,/* Pause */195 [0x16] = SPECIAL,196 [0x17] = SPECIAL,/* Scroll Lock */197 [0x18] = SPECIAL,/* Left Arrow */198 [0x19] = SPECIAL,199 [0x1a] = SPECIAL,200 [0x1b] = SPECIAL,/* Down Arrow */201 [0x1c] = SPECIAL,/* Right Arrow */202 [0x1d] = SPECIAL,/* Esc */174 wchar_t sc_secondary_map[SCANCODES] = { 175 [0x00] = U_SPECIAL, 176 [0x01] = U_SPECIAL, 177 [0x02] = U_SPECIAL, 178 [0x03] = U_SPECIAL, 179 [0x04] = U_SPECIAL, 180 [0x05] = U_SPECIAL, /* F1 */ 181 [0x06] = U_SPECIAL, /* F2 */ 182 [0x07] = U_SPECIAL, /* F10 */ 183 [0x08] = U_SPECIAL, /* F3 */ 184 [0x09] = U_SPECIAL, /* F11 */ 185 [0x0a] = U_SPECIAL, /* F4 */ 186 [0x0b] = U_SPECIAL, /* F12 */ 187 [0x0c] = U_SPECIAL, /* F5 */ 188 [0x0d] = U_SPECIAL, /* Right Alt */ 189 [0x0e] = U_SPECIAL, /* F6 */ 190 [0x0f] = U_SPECIAL, 191 [0x10] = U_SPECIAL, /* F7 */ 192 [0x11] = U_SPECIAL, /* F8 */ 193 [0x12] = U_SPECIAL, /* F9 */ 194 [0x13] = U_SPECIAL, /* Left Alt */ 195 [0x14] = U_UP_ARROW, /* Up Arrow */ 196 [0x15] = U_SPECIAL, /* Pause */ 197 [0x16] = U_SPECIAL, 198 [0x17] = U_SPECIAL, /* Scroll Lock */ 199 [0x18] = U_LEFT_ARROW, /* Left Arrow */ 200 [0x19] = U_SPECIAL, 201 [0x1a] = U_SPECIAL, 202 [0x1b] = U_DOWN_ARROW, /* Down Arrow */ 203 [0x1c] = U_RIGHT_ARROW, /* Right Arrow */ 204 [0x1d] = U_ESCAPE, /* Esc */ 203 205 [0x1e] = '!', 204 206 [0x1f] = '@', … … 214 216 [0x29] = '+', 215 217 [0x2a] = '~', 216 [0x2b] = SPECIAL,/* Backspace */217 [0x2c] = SPECIAL,/* Insert */218 [0x2d] = SPECIAL,219 [0x2e] = '/', /* numeric keypad*/220 [0x2f] = '*', /* numeric keypad*/221 [0x30] = SPECIAL,222 [0x31] = SPECIAL,223 [0x32] = '.', /* numeric keypad*/224 [0x33] = SPECIAL,225 [0x34] = SPECIAL,/* Home */226 [0x35] = SPECIAL,/* Tab */218 [0x2b] = '\b', /* Backspace */ 219 [0x2c] = U_SPECIAL, /* Insert */ 220 [0x2d] = U_SPECIAL, 221 [0x2e] = '/', /* Numpad / */ 222 [0x2f] = '*', /* Numpad * */ 223 [0x30] = U_SPECIAL, 224 [0x31] = U_SPECIAL, 225 [0x32] = '.', /* Numpad . */ 226 [0x33] = U_SPECIAL, 227 [0x34] = U_HOME_ARROW, /* Home */ 228 [0x35] = '\t', /* Tab */ 227 229 [0x36] = 'Q', 228 230 [0x37] = 'W', … … 237 239 [0x40] = '{', 238 240 [0x41] = '}', 239 [0x42] = SPECIAL, /* Del*/240 [0x43] = SPECIAL,241 [0x44] = '7', /* numeric keypad*/242 [0x45] = '8', /* numeric keypad*/243 [0x46] = '9', /* numeric keypad*/244 [0x47] = '-', /* numeric keypad*/245 [0x48] = SPECIAL,246 [0x49] = SPECIAL,247 [0x4a] = SPECIAL,/* End */248 [0x4b] = SPECIAL,249 [0x4c] = SPECIAL,/* Control */241 [0x42] = U_DELETE, /* Delete */ 242 [0x43] = U_SPECIAL, 243 [0x44] = '7', /* Numpad 7 */ 244 [0x45] = '8', /* Numpad 8 */ 245 [0x46] = '9', /* Numpad 9 */ 246 [0x47] = '-', /* Numpad - */ 247 [0x48] = U_SPECIAL, 248 [0x49] = U_SPECIAL, 249 [0x4a] = U_END_ARROW, /* End */ 250 [0x4b] = U_SPECIAL, 251 [0x4c] = U_SPECIAL, /* Control */ 250 252 [0x4d] = 'A', 251 253 [0x4e] = 'S', … … 260 262 [0x57] = '"', 261 263 [0x58] = '|', 262 [0x59] = SPECIAL,/* Enter */263 [0x5a] = SPECIAL, /* Enter on numeric keypad*/264 [0x5b] = '4', /* numeric keypad*/265 [0x5c] = '5', /* numeric keypad*/266 [0x5d] = '6', /* numeric keypad*/267 [0x5e] = '0', /* numeric keypad*/268 [0x5f] = SPECIAL,269 [0x60] = SPECIAL,/* Page Up */270 [0x61] = SPECIAL,271 [0x62] = SPECIAL, /* NumLock */272 [0x63] = SPECIAL, /* LShift */264 [0x59] = '\n', /* Enter */ 265 [0x5a] = '\n', /* Numpad Enter */ 266 [0x5b] = '4', /* Numpad 4 */ 267 [0x5c] = '5', /* Numpad 5 */ 268 [0x5d] = '6', /* Numpad 6 */ 269 [0x5e] = '0', /* Numpad 0 */ 270 [0x5f] = U_SPECIAL, 271 [0x60] = U_PAGE_UP, /* Page Up */ 272 [0x61] = U_SPECIAL, 273 [0x62] = U_SPECIAL, /* NumLock */ 274 [0x63] = U_SPECIAL, /* Left Shift */ 273 275 [0x64] = 'Z', 274 276 [0x65] = 'X', … … 281 283 [0x6c] = '>', 282 284 [0x6d] = '?', 283 [0x6e] = SPECIAL, /* RShift */284 [0x6f] = SPECIAL,285 [0x70] = '1', /* numeric keypad*/286 [0x71] = '2', /* numeric keypad*/287 [0x72] = '3', /* numeric keypad*/288 [0x73] = SPECIAL,289 [0x74] = SPECIAL,290 [0x75] = SPECIAL,291 [0x76] = SPECIAL,292 [0x77] = SPECIAL, /* CapsLock */293 [0x78] = SPECIAL,285 [0x6e] = U_SPECIAL, /* Right Shift */ 286 [0x6f] = U_SPECIAL, 287 [0x70] = '1', /* Numpad 1 */ 288 [0x71] = '2', /* Numpad 2 */ 289 [0x72] = '3', /* Numpad 3 */ 290 [0x73] = U_SPECIAL, 291 [0x74] = U_SPECIAL, 292 [0x75] = U_SPECIAL, 293 [0x76] = U_SPECIAL, 294 [0x77] = U_SPECIAL, /* CapsLock */ 295 [0x78] = U_SPECIAL, 294 296 [0x79] = ' ', 295 [0x7a] = SPECIAL,296 [0x7b] = SPECIAL,/* Page Down */297 [0x7c] = SPECIAL,298 [0x7d] = '+', /* numeric key pad*/299 [0x7e] = SPECIAL,300 [0x7f] = SPECIAL297 [0x7a] = U_SPECIAL, 298 [0x7b] = U_PAGE_DOWN, /* Page Down */ 299 [0x7c] = U_SPECIAL, 300 [0x7d] = '+', /* Numpad + */ 301 [0x7e] = U_SPECIAL, 302 [0x7f] = U_SPECIAL 301 303 }; 302 304 -
kernel/genarch/src/srln/srln.c
r2398ee9 rc8bf88d 40 40 #include <proc/thread.h> 41 41 #include <arch.h> 42 #include <string.h> 42 43 43 44 static indev_t srlnout; … … 51 52 indev_t *in = (indev_t *) arg; 52 53 bool cr = false; 54 uint32_t escape = 0; 53 55 54 56 while (true) { 55 uint8_t ch = _getc(in);57 wchar_t ch = _getc(in); 56 58 59 /* ANSI escape sequence processing */ 60 if (escape != 0) { 61 escape <<= 8; 62 escape |= ch & 0xff; 63 64 if ((escape == 0x1b4f) || (escape == 0x1b5b) || (escape == 0x1b5b33)) 65 continue; 66 67 switch (escape) { 68 case 0x1b4f46: 69 case 0x1b5b46: 70 ch = U_END_ARROW; 71 escape = 0; 72 break; 73 case 0x1b4f48: 74 case 0x1b5b48: 75 ch = U_HOME_ARROW; 76 escape = 0; 77 break; 78 case 0x1b5b41: 79 ch = U_UP_ARROW; 80 escape = 0; 81 break; 82 case 0x1b5b42: 83 ch = U_DOWN_ARROW; 84 escape = 0; 85 break; 86 case 0x1b5b43: 87 ch = U_RIGHT_ARROW; 88 escape = 0; 89 break; 90 case 0x1b5b44: 91 ch = U_LEFT_ARROW; 92 escape = 0; 93 break; 94 case 0x1b5b337e: 95 ch = U_DELETE; 96 escape = 0; 97 break; 98 default: 99 escape = 0; 100 } 101 } 102 103 if (ch == 0x1b) { 104 escape = ch & 0xff; 105 continue; 106 } 107 108 /* Replace carriage return with line feed 109 and suppress any following line feed */ 57 110 if ((ch == '\n') && (cr)) { 58 111 cr = false; … … 66 119 cr = false; 67 120 121 /* Backspace */ 68 122 if (ch == 0x7f) 69 123 ch = '\b';
Note:
See TracChangeset
for help on using the changeset viewer.