Mercurial > lcfOS
comparison cos/kernel/keyboard.c @ 32:3a6a9b929db0
Added initial ramdisk and some virtual file system functions
author | windel |
---|---|
date | Fri, 13 Jan 2012 18:18:17 +0100 |
parents | d8627924d40d |
children | 8012221dd740 |
comparison
equal
deleted
inserted
replaced
31:88590c42320f | 32:3a6a9b929db0 |
---|---|
2 | 2 |
3 static int shiftstate = 0; | 3 static int shiftstate = 0; |
4 static volatile uint8_t charAvail = 0; | 4 static volatile uint8_t charAvail = 0; |
5 static volatile char kbdchar = ' '; | 5 static volatile char kbdchar = ' '; |
6 | 6 |
7 static char keymap[128] = { | 7 // TODO: move to user land: |
8 static char keymap[128] = | |
9 { | |
8 '?','?','1','2', '3', '4', '5','6', '7', '8','9', '0', '-','=', 0xe, '?', | 10 '?','?','1','2', '3', '4', '5','6', '7', '8','9', '0', '-','=', 0xe, '?', |
9 'q','w','e','r', 't', 'y', 'u','i', 'o', 'p','[', ']', '\n','?', 'a', 's', | 11 'q','w','e','r', 't', 'y', 'u','i', 'o', 'p','[', ']', '\n','?', 'a', 's', |
10 'd','f','g','h', 'j', 'k', 'l',';', '\'', '?','?', '?', 'z','x', 'c', 'v', | 12 'd','f','g','h', 'j', 'k', 'l',';', '\'', '?','?', '?', 'z','x', 'c', 'v', |
11 'b','n','m',',', '.', '/', '?','?', '?', ' ','?', '?', '?','?', '?', '?', | 13 'b','n','m',',', '.', '/', '?','?', '?', ' ','?', '?', '?','?', '?', '?', |
12 | 14 |
14 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', | 16 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', |
15 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', | 17 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', |
16 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?' | 18 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?' |
17 }; | 19 }; |
18 | 20 |
19 static char keymapUPPER[128] = { | 21 static char keymapUPPER[128] = |
22 { | |
20 '?','?','!','@', '#', '$', '%','^', '&', '*','(', ')', '_','+', '?', '?', | 23 '?','?','!','@', '#', '$', '%','^', '&', '*','(', ')', '_','+', '?', '?', |
21 'Q','W','E','R', 'T', 'Y', 'U','I', 'O', 'P','{', '}', '|','?', 'A', 'S', | 24 'Q','W','E','R', 'T', 'Y', 'U','I', 'O', 'P','{', '}', '|','?', 'A', 'S', |
22 'D','F','G','H', 'J', 'K', 'L',':', '"', '?','?', '?', 'Z','X', 'C', 'V', | 25 'D','F','G','H', 'J', 'K', 'L',':', '"', '?','?', '?', 'Z','X', 'C', 'V', |
23 'B','N','M','<', '>', '?', '?','?', '?', ' ','?', '?', '?','?', '?', '?', | 26 'B','N','M','<', '>', '?', '?','?', '?', ' ','?', '?', '?','?', '?', '?', |
24 | 27 |
26 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', | 29 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', |
27 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', | 30 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?', |
28 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?' | 31 '?','?','?','?', '?', '?', '?','?', '?', '?','?', '?', '?','?', '?', '?' |
29 }; | 32 }; |
30 | 33 |
31 void keyboardDriverUpdate(unsigned char scancode) | 34 void keyboardDriverUpdate() |
32 { | 35 { |
36 unsigned char scancode = inb(0x60); | |
37 | |
33 switch(scancode) { | 38 switch(scancode) { |
34 case 0x2a: | 39 case 0x2a: |
35 shiftstate = 1; | 40 shiftstate = 1; |
36 break; | 41 break; |
37 case 0xaa: | 42 case 0xaa: |
62 char c = kbdchar; | 67 char c = kbdchar; |
63 charAvail = 0; | 68 charAvail = 0; |
64 return c; | 69 return c; |
65 } | 70 } |
66 | 71 |
72 // Move to user code: | |
67 void getline(char *buffer, int len) | 73 void getline(char *buffer, int len) |
68 { | 74 { |
69 char c; | 75 char c; |
70 int i = 0; | 76 int i = 0; |
71 while (i < len-1) { | 77 while (i < len-1) { |