Changeset c8bf88d in mainline
- 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
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/arm32.c
r2398ee9 rc8bf88d 129 129 #ifdef CONFIG_ARM_KBD 130 130 /* 131 * Initialize the msim/GXemul keyboard port. Then initialize the serial line132 * module and connect it to the msim/GXemul keyboard. Enable keyboard interrupts.131 * Initialize the GXemul keyboard port. Then initialize the serial line 132 * module and connect it to the GXemul keyboard. Enable keyboard interrupts. 133 133 */ 134 134 indev_t *kbrdin = dsrlnin_init((dsrlnin_t *) gxemul_kbd, GXEMUL_KBD_IRQ); -
kernel/arch/ia64/src/ski/ski.c
r2398ee9 rc8bf88d 27 27 */ 28 28 29 /** @addtogroup ia64 29 /** @addtogroup ia64 30 30 * @{ 31 31 */ … … 79 79 ski_do_putchar(ch); 80 80 } else 81 ski_do_putchar( invalch);81 ski_do_putchar(SPECIAL); 82 82 } 83 83 } -
kernel/arch/ppc32/src/drivers/cuda.c
r2398ee9 rc8bf88d 42 42 #include <stdarg.h> 43 43 #include <ddi/device.h> 44 #include <string.h> 44 45 45 46 #define CUDA_IRQ 10 46 #define SPECIAL '?' 47 48 #define PACKET_ ADB 0x0049 #define PACKET_CUDA 0x01 50 51 #define CUDA_ POWERDOWN 0x0a52 #define CUDA_RESET 0x11 53 54 #define RS 0x20055 #define B (0* RS)56 #define A (1* RS)57 #define SR (10* RS)58 #define ACR (11 * RS) 59 60 #define SR_OUT0x1061 #define T ACK 0x1062 #define TIP 0x20 63 47 48 #define PACKET_ADB 0x00 49 #define PACKET_CUDA 0x01 50 51 #define CUDA_POWERDOWN 0x0a 52 #define CUDA_RESET 0x11 53 54 #define RS 0x200 55 #define B (0 * RS) 56 #define A (1 * RS) 57 #define SR (10 * RS) 58 #define ACR (11 * RS) 59 60 #define SR_OUT 0x10 61 #define TACK 0x10 62 #define TIP 0x20 63 64 #define SCANCODES 128 64 65 65 66 static volatile uint8_t *cuda = NULL; 66 static irq_t cuda_irq; /**< Cuda's IRQ. */ 67 68 static char lchars[0x80] = { 69 'a', 70 's', 71 'd', 72 'f', 73 'h', 74 'g', 75 'z', 76 'x', 77 'c', 78 'v', 79 SPECIAL, 80 'b', 81 'q', 82 'w', 83 'e', 84 'r', 85 'y', 86 't', 87 '1', 88 '2', 89 '3', 90 '4', 91 '6', 92 '5', 93 '=', 94 '9', 95 '7', 96 '-', 97 '8', 98 '0', 99 ']', 100 'o', 101 'u', 102 '[', 103 'i', 104 'p', 105 '\n', /* Enter */ 106 'l', 107 'j', 108 '\'', 109 'k', 110 ';', 111 '\\', 112 ',', 113 '/', 114 'n', 115 'm', 116 '.', 117 '\t', /* Tab */ 118 ' ', 119 '`', 120 '\b', /* Backspace */ 121 SPECIAL, 122 SPECIAL, /* Escape */ 123 SPECIAL, /* Ctrl */ 124 SPECIAL, /* Alt */ 125 SPECIAL, /* Shift */ 126 SPECIAL, /* Caps-Lock */ 127 SPECIAL, /* RAlt */ 128 SPECIAL, /* Left */ 129 SPECIAL, /* Right */ 130 SPECIAL, /* Down */ 131 SPECIAL, /* Up */ 132 SPECIAL, 133 SPECIAL, 134 '.', /* Keypad . */ 135 SPECIAL, 136 '*', /* Keypad * */ 137 SPECIAL, 138 '+', /* Keypad + */ 139 SPECIAL, 140 SPECIAL, /* NumLock */ 141 SPECIAL, 142 SPECIAL, 143 SPECIAL, 144 '/', /* Keypad / */ 145 '\n', /* Keypad Enter */ 146 SPECIAL, 147 '-', /* Keypad - */ 148 SPECIAL, 149 SPECIAL, 150 SPECIAL, 151 '0', /* Keypad 0 */ 152 '1', /* Keypad 1 */ 153 '2', /* Keypad 2 */ 154 '3', /* Keypad 3 */ 155 '4', /* Keypad 4 */ 156 '5', /* Keypad 5 */ 157 '6', /* Keypad 6 */ 158 '7', /* Keypad 7 */ 159 SPECIAL, 160 '8', /* Keypad 8 */ 161 '9', /* Keypad 9 */ 162 SPECIAL, 163 SPECIAL, 164 SPECIAL, 165 SPECIAL, /* F5 */ 166 SPECIAL, /* F6 */ 167 SPECIAL, /* F7 */ 168 SPECIAL, /* F3 */ 169 SPECIAL, /* F8 */ 170 SPECIAL, /* F9 */ 171 SPECIAL, 172 SPECIAL, /* F11 */ 173 SPECIAL, 174 SPECIAL, /* F13 */ 175 SPECIAL, 176 SPECIAL, /* ScrollLock */ 177 SPECIAL, 178 SPECIAL, /* F10 */ 179 SPECIAL, 180 SPECIAL, /* F12 */ 181 SPECIAL, 182 SPECIAL, /* Pause */ 183 SPECIAL, /* Insert */ 184 SPECIAL, /* Home */ 185 SPECIAL, /* PageUp */ 186 SPECIAL, /* Delete */ 187 SPECIAL, /* F4 */ 188 SPECIAL, /* End */ 189 SPECIAL, /* F2 */ 190 SPECIAL, /* PageDown */ 191 SPECIAL /* F1 */ 67 static irq_t cuda_irq; /**< Cuda's IRQ. */ 68 69 static wchar_t lchars[SCANCODES] = { 70 'a', 's', 'd', 'f', 'h', 'g', 'z', 'x', 'c', 'v', 71 U_SPECIAL, 72 'b', 'q', 'w', 'e', 'r', 'y', 't', '1', '2', '3', '4', '6', '5', 73 '=', '9', '7', '-', '8', '0', ']', 'o', 'u', '[', 'i', 'p', 74 '\n', /* Enter */ 75 'l', 'j', '\'', 'k', ';', '\\', ',', '/', 'n', 'm', '.', 76 '\t', /* Tab */ 77 ' ', '`', 78 '\b', /* Backspace */ 79 U_SPECIAL, 80 U_ESCAPE, /* Escape */ 81 U_SPECIAL, /* Ctrl */ 82 U_SPECIAL, /* Alt */ 83 U_SPECIAL, /* Shift */ 84 U_SPECIAL, /* CapsLock */ 85 U_SPECIAL, /* Right Alt */ 86 U_LEFT_ARROW, /* Left */ 87 U_RIGHT_ARROW, /* Right */ 88 U_DOWN_ARROW, /* Down */ 89 U_UP_ARROW, /* Up */ 90 U_SPECIAL, 91 U_SPECIAL, 92 '.', /* Keypad . */ 93 U_SPECIAL, 94 '*', /* Keypad * */ 95 U_SPECIAL, 96 '+', /* Keypad + */ 97 U_SPECIAL, 98 U_SPECIAL, /* NumLock */ 99 U_SPECIAL, 100 U_SPECIAL, 101 U_SPECIAL, 102 '/', /* Keypad / */ 103 '\n', /* Keypad Enter */ 104 U_SPECIAL, 105 '-', /* Keypad - */ 106 U_SPECIAL, 107 U_SPECIAL, 108 U_SPECIAL, 109 '0', /* Keypad 0 */ 110 '1', /* Keypad 1 */ 111 '2', /* Keypad 2 */ 112 '3', /* Keypad 3 */ 113 '4', /* Keypad 4 */ 114 '5', /* Keypad 5 */ 115 '6', /* Keypad 6 */ 116 '7', /* Keypad 7 */ 117 U_SPECIAL, 118 '8', /* Keypad 8 */ 119 '9', /* Keypad 9 */ 120 U_SPECIAL, 121 U_SPECIAL, 122 U_SPECIAL, 123 U_SPECIAL, /* F5 */ 124 U_SPECIAL, /* F6 */ 125 U_SPECIAL, /* F7 */ 126 U_SPECIAL, /* F3 */ 127 U_SPECIAL, /* F8 */ 128 U_SPECIAL, /* F9 */ 129 U_SPECIAL, 130 U_SPECIAL, /* F11 */ 131 U_SPECIAL, 132 U_SPECIAL, /* F13 */ 133 U_SPECIAL, 134 U_SPECIAL, /* ScrollLock */ 135 U_SPECIAL, 136 U_SPECIAL, /* F10 */ 137 U_SPECIAL, 138 U_SPECIAL, /* F12 */ 139 U_SPECIAL, 140 U_SPECIAL, /* Pause */ 141 U_SPECIAL, /* Insert */ 142 U_HOME_ARROW, /* Home */ 143 U_PAGE_UP, /* Page Up */ 144 U_DELETE, /* Delete */ 145 U_SPECIAL, /* F4 */ 146 U_END_ARROW, /* End */ 147 U_SPECIAL, /* F2 */ 148 U_PAGE_DOWN, /* Page Down */ 149 U_SPECIAL /* F1 */ 192 150 }; 193 194 151 195 152 static void receive_packet(uint8_t *kind, index_t count, uint8_t data[]) … … 204 161 cuda[B] = cuda[B] | TIP; 205 162 } 206 207 163 208 164 static indev_t kbrd; … … 210 166 .poll = NULL 211 167 }; 212 213 168 214 169 int cuda_get_scancode(void) … … 264 219 } 265 220 266 267 221 static void send_packet(const uint8_t kind, count_t count, ...) 268 222 { … … 288 242 } 289 243 290 291 244 void cpu_halt(void) { 292 245 asm volatile ( -
kernel/arch/sparc64/src/drivers/sgcn.c
r2398ee9 rc8bf88d 32 32 /** 33 33 * @file 34 * @brief 34 * @brief SGCN driver. 35 35 */ 36 36 … … 278 278 sgcn_do_putchar(ch); 279 279 } else 280 sgcn_do_putchar( invalch);280 sgcn_do_putchar(U_SPECIAL); 281 281 282 282 spinlock_unlock(&sgcn_output_lock); -
kernel/arch/sparc64/src/mm/page.c
r2398ee9 rc8bf88d 54 54 * We are currently using identity mapping for mapping device registers. 55 55 * 56 * @param physaddr Physical address of the page where the device is 57 * located. 58 * @param size Size of the device's registers. This argument is 59 * ignored. 56 * @param physaddr Physical address of the page where the device is 57 * located. 58 * @param size Size of the device's registers. 60 59 * 61 * @return Virtual address of the page where the device is mapped. 60 * @return Virtual address of the page where the device is mapped. 61 * 62 62 */ 63 63 uintptr_t hw_map(uintptr_t physaddr, size_t size) -
kernel/genarch/include/kbrd/scanc.h
r2398ee9 rc8bf88d 27 27 */ 28 28 29 /** @addtogroup genarch 29 /** @addtogroup genarch 30 30 * @{ 31 31 */ … … 37 37 #define KERN_SCANC_H_ 38 38 39 # define SPECIAL '?'39 #include <typedefs.h> 40 40 41 extern char sc_primary_map[]; 42 extern char sc_secondary_map[]; 41 #define SCANCODES 128 42 43 extern wchar_t sc_primary_map[SCANCODES]; 44 extern wchar_t sc_secondary_map[SCANCODES]; 43 45 44 46 #endif -
kernel/genarch/include/kbrd/scanc_pc.h
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 … … 38 38 #define KERN_SCANC_PC_H_ 39 39 40 #define SC_ESC 0x0141 #define SC_BACKSPACE 0x0e42 40 #define SC_LSHIFT 0x2a 43 41 #define SC_RSHIFT 0x36 44 42 #define SC_CAPSLOCK 0x3a 45 #define SC_SPEC_ESCAPE 0xe0 46 #define SC_LEFTARR 0x4b 47 #define SC_RIGHTARR 0x4d 48 #define SC_UPARR 0x48 49 #define SC_DOWNARR 0x50 50 #define SC_DELETE 0x53 51 #define SC_HOME 0x47 52 #define SC_END 0x4f 43 #define SC_SCAN_ESCAPE 0xe0 53 44 54 45 #endif -
kernel/genarch/include/kbrd/scanc_sun.h
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 sun keyboards.34 * @brief Scan codes for Sun keyboards. 35 35 */ 36 36 … … 38 38 #define KERN_SCANC_SUN_H_ 39 39 40 #define SC_ESC 0x1d41 #define SC_BACKSPACE 0x2b42 40 #define SC_LSHIFT 0x63 43 41 #define SC_RSHIFT 0x6e 44 42 #define SC_CAPSLOCK 0x77 45 #define SC_SPEC_ESCAPE 0xe0 /* ??? */ 46 #define SC_LEFTARR 0x18 47 #define SC_RIGHTARR 0x1c 48 #define SC_UPARR 0x14 49 #define SC_DOWNARR 0x1b 50 #define SC_DELETE 0x42 51 #define SC_HOME 0x34 52 #define SC_END 0x4a 43 #define SC_SCAN_ESCAPE 0xe0 53 44 54 45 #endif -
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'; -
kernel/generic/include/string.h
r2398ee9 rc8bf88d 38 38 #include <typedefs.h> 39 39 40 /**< Common Unicode characters */ 41 #define U_SPECIAL '?' 42 43 #define U_LEFT_ARROW 0x2190 44 #define U_UP_ARROW 0x2191 45 #define U_RIGHT_ARROW 0x2192 46 #define U_DOWN_ARROW 0x2193 47 48 #define U_PAGE_UP 0x21de 49 #define U_PAGE_DOWN 0x21df 50 51 #define U_HOME_ARROW 0x21f1 52 #define U_END_ARROW 0x21f2 53 54 #define U_NULL 0x2400 55 #define U_ESCAPE 0x241b 56 #define U_DELETE 0x2421 57 58 #define U_CURSOR 0x2588 59 60 /**< No size limit constant */ 40 61 #define STR_NO_LIMIT ((size_t) -1) 41 62 42 63 /**< Maximum size of a string containing cnt characters */ 43 64 #define STR_BOUNDS(cnt) (cnt << 2) 44 45 extern char invalch;46 65 47 66 extern wchar_t str_decode(const char *str, size_t *offset, size_t sz); -
kernel/generic/include/sysinfo/sysinfo.h
r2398ee9 rc8bf88d 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 37 37 38 38 #include <arch/types.h> 39 #include <string.h> 39 40 40 41 typedef union sysinfo_item_val { … … 60 61 } sysinfo_item_t; 61 62 62 #define SYSINFO_VAL_VAL 063 #define SYSINFO_VAL_FUNCTION 164 #define SYSINFO_VAL_UNDEFINED '?'63 #define SYSINFO_VAL_VAL 0 64 #define SYSINFO_VAL_FUNCTION 1 65 #define SYSINFO_VAL_UNDEFINED U_SPECIAL 65 66 66 #define SYSINFO_SUBINFO_NONE 067 #define SYSINFO_SUBINFO_TABLE 168 #define SYSINFO_SUBINFO_FUNCTION 267 #define SYSINFO_SUBINFO_NONE 0 68 #define SYSINFO_SUBINFO_TABLE 1 69 #define SYSINFO_SUBINFO_FUNCTION 2 69 70 70 71 typedef unative_t (*sysinfo_val_fn_t)(sysinfo_item_t *root); -
kernel/generic/src/console/kconsole.c
r2398ee9 rc8bf88d 260 260 261 261 if (wstr_remove(current, position - 1)) { 262 position--; 262 263 putchar('\b'); 263 printf("%ls", current + position); 264 position--; 265 print_cc('\b', wstr_length(current) - position); 264 printf("%ls ", current + position); 265 print_cc('\b', wstr_length(current) - position + 1); 266 266 continue; 267 267 } … … 334 334 } 335 335 336 if (ch == 0x1b) { 337 /* Special command */ 338 wchar_t mod = _getc(indev); 339 wchar_t ch = _getc(indev); 340 341 if ((mod != 0x5b) && (mod != 0x4f)) 336 if (ch == U_LEFT_ARROW) { 337 /* Left */ 338 if (position > 0) { 339 putchar('\b'); 340 position--; 341 } 342 continue; 343 } 344 345 if (ch == U_RIGHT_ARROW) { 346 /* Right */ 347 if (position < wstr_length(current)) { 348 putchar(current[position]); 349 position++; 350 } 351 continue; 352 } 353 354 if ((ch == U_UP_ARROW) || (ch == U_DOWN_ARROW)) { 355 /* Up, down */ 356 print_cc('\b', position); 357 print_cc(' ', wstr_length(current)); 358 print_cc('\b', wstr_length(current)); 359 360 if (ch == U_UP_ARROW) { 361 /* Up */ 362 if (history_pos == 0) 363 history_pos = KCONSOLE_HISTORY - 1; 364 else 365 history_pos--; 366 } else { 367 /* Down */ 368 history_pos++; 369 history_pos = history_pos % KCONSOLE_HISTORY; 370 } 371 current = history[history_pos]; 372 printf("%ls", current); 373 position = wstr_length(current); 374 continue; 375 } 376 377 if (ch == U_HOME_ARROW) { 378 /* Home */ 379 print_cc('\b', position); 380 position = 0; 381 continue; 382 } 383 384 if (ch == U_END_ARROW) { 385 /* End */ 386 printf("%ls", current + position); 387 position = wstr_length(current); 388 continue; 389 } 390 391 if (ch == U_DELETE) { 392 /* Delete */ 393 if (position == wstr_length(current)) 342 394 continue; 343 395 344 if ((ch == 0x33) && (_getc(indev) == 0x7e)) { 345 /* Delete */ 346 if (position == wstr_length(current)) 347 continue; 348 349 if (wstr_remove(current, position)) { 350 putchar('\b'); 351 printf("%ls", current + position); 352 position--; 353 print_cc('\b', wstr_length(current) - position); 354 } 355 } else if (ch == 0x48) { 356 /* Home */ 357 print_cc('\b', position); 358 position = 0; 359 } else if (ch == 0x46) { 360 /* End */ 361 printf("%ls", current + position); 362 position = wstr_length(current); 363 } else if (ch == 0x44) { 364 /* Left */ 365 if (position > 0) { 366 putchar('\b'); 367 position--; 368 } 369 } else if (ch == 0x43) { 370 /* Right */ 371 if (position < wstr_length(current)) { 372 putchar(current[position]); 373 position++; 374 } 375 } else if ((ch == 0x41) || (ch == 0x42)) { 376 /* Up, down */ 377 print_cc('\b', position); 378 print_cc(' ', wstr_length(current)); 379 print_cc('\b', wstr_length(current)); 380 381 if (ch == 0x41) { 382 /* Up */ 383 if (history_pos == 0) 384 history_pos = KCONSOLE_HISTORY - 1; 385 else 386 history_pos--; 387 } else { 388 /* Down */ 389 history_pos++; 390 history_pos = history_pos % KCONSOLE_HISTORY; 391 } 392 current = history[history_pos]; 393 printf("%ls", current); 394 position = wstr_length(current); 396 if (wstr_remove(current, position)) { 397 printf("%ls ", current + position); 398 print_cc('\b', wstr_length(current) - position + 1); 395 399 } 396 400 continue; -
kernel/generic/src/lib/string.c
r2398ee9 rc8bf88d 110 110 #include <align.h> 111 111 112 char invalch = '?';113 114 112 /** Byte mask consisting of lowest @n bits (out of 8) */ 115 113 #define LO_MASK_8(n) ((uint8_t) ((1 << (n)) - 1)) … … 135 133 * @param size Size of the string (in bytes). 136 134 * 137 * @return Value of decoded character, invalchon decoding error or135 * @return Value of decoded character, U_SPECIAL on decoding error or 138 136 * NULL if attempt to decode beyond @a size. 139 137 * … … 170 168 } else { 171 169 /* 10xxxxxx -- unexpected continuation byte */ 172 return invalch;170 return U_SPECIAL; 173 171 } 174 172 175 173 if (*offset + cbytes > size) 176 return invalch;174 return U_SPECIAL; 177 175 178 176 wchar_t ch = b0 & LO_MASK_8(b0_bits); … … 184 182 /* Must be 10xxxxxx */ 185 183 if ((b & 0xc0) != 0x80) 186 return invalch;184 return U_SPECIAL; 187 185 188 186 /* Shift data bits to ch */ -
kernel/generic/src/printf/printf_core.c
r2398ee9 rc8bf88d 82 82 static char digits_small[] = "0123456789abcdef"; 83 83 static char digits_big[] = "0123456789ABCDEF"; 84 static char invalch = U_SPECIAL; 84 85 85 86 /** Print one or more characters without adding newline.
Note:
See TracChangeset
for help on using the changeset viewer.