Rev 1645 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1645 | Rev 1649 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2006 Josef Cejka |
2 | * Copyright (C) 2006 Josef Cejka |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
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 |
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. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
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 |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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 |
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. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
- | 29 | /** @addtogroup kbdia64 ia64 |
|
- | 30 | * @brief HelenOS ia64 arch dependent parts of uspace keyboard handler. |
|
- | 31 | * @ingroup kbd |
|
- | 32 | * @{ |
|
- | 33 | */ |
|
- | 34 | /** @file |
|
- | 35 | */ |
|
- | 36 | ||
29 | #include <arch/kbd.h> |
37 | #include <arch/kbd.h> |
30 | #include <ipc/ipc.h> |
38 | #include <ipc/ipc.h> |
31 | #include <sysinfo.h> |
39 | #include <sysinfo.h> |
32 | 40 | ||
33 | #define KEY_F1 0x504f1b |
41 | #define KEY_F1 0x504f1b |
34 | #define KEY_F2 0x514f1b |
42 | #define KEY_F2 0x514f1b |
35 | #define KEY_F3 0x524f1b |
43 | #define KEY_F3 0x524f1b |
36 | #define KEY_F4 0x534f1b |
44 | #define KEY_F4 0x534f1b |
37 | #define KEY_F5 0x7e35315b1b |
45 | #define KEY_F5 0x7e35315b1b |
38 | #define KEY_F6 0x7e37315b1b |
46 | #define KEY_F6 0x7e37315b1b |
39 | #define KEY_F7 0x7e38315b1b |
47 | #define KEY_F7 0x7e38315b1b |
40 | #define KEY_F8 0x7e39315b1b |
48 | #define KEY_F8 0x7e39315b1b |
41 | #define KEY_F9 0x7e30325b1b |
49 | #define KEY_F9 0x7e30325b1b |
42 | #define KEY_F10 0x7e31325b1b |
50 | #define KEY_F10 0x7e31325b1b |
43 | #define KEY_F11 0x7e33325b1b |
51 | #define KEY_F11 0x7e33325b1b |
44 | #define KEY_F12 0x7e34325b1b |
52 | #define KEY_F12 0x7e34325b1b |
45 | 53 | ||
46 | 54 | ||
47 | #define FUNCTION_KEYS 0x100 |
55 | #define FUNCTION_KEYS 0x100 |
48 | 56 | ||
49 | irq_cmd_t ski_cmds[1] = { |
57 | irq_cmd_t ski_cmds[1] = { |
50 | { CMD_IA64_GETCHAR, 0, 0 } |
58 | { CMD_IA64_GETCHAR, 0, 0 } |
51 | }; |
59 | }; |
52 | 60 | ||
53 | irq_code_t ski_kbd = { |
61 | irq_code_t ski_kbd = { |
54 | 1, |
62 | 1, |
55 | ski_cmds |
63 | ski_cmds |
56 | }; |
64 | }; |
57 | 65 | ||
58 | int kbd_arch_init(void) |
66 | int kbd_arch_init(void) |
59 | { |
67 | { |
60 | if(sysinfo_value("kbd")) { |
68 | if(sysinfo_value("kbd")) { |
61 | ipc_register_irq(sysinfo_value("kbd.irq"), &ski_kbd); |
69 | ipc_register_irq(sysinfo_value("kbd.irq"), &ski_kbd); |
62 | return 1; |
70 | return 1; |
63 | } |
71 | } |
64 | 72 | ||
65 | } |
73 | } |
66 | 74 | ||
67 | /* |
75 | /* |
68 | * Please preserve this code (it can be used to determine scancodes) |
76 | * Please preserve this code (it can be used to determine scancodes) |
69 | * |
77 | * |
70 | int to_hex(int v) |
78 | int to_hex(int v) |
71 | { |
79 | { |
72 | return "0123456789ABCDEF"[v]; |
80 | return "0123456789ABCDEF"[v]; |
73 | } |
81 | } |
74 | */ |
82 | */ |
75 | 83 | ||
76 | int kbd_arch_process(keybuffer_t *keybuffer, int scan_code) |
84 | int kbd_arch_process(keybuffer_t *keybuffer, int scan_code) |
77 | { |
85 | { |
78 | static unsigned long long buf=0; |
86 | static unsigned long long buf=0; |
79 | static int count=0; |
87 | static int count=0; |
80 | static int esc_count=0; |
88 | static int esc_count=0; |
81 | 89 | ||
82 | 90 | ||
83 | /* |
91 | /* |
84 | * Please preserve this code (it can be used to determine scancodes) |
92 | * Please preserve this code (it can be used to determine scancodes) |
85 | */ |
93 | */ |
86 | //keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf)); |
94 | //keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf)); |
87 | //keybuffer_push(keybuffer, to_hex(scan_code&0xf)); |
95 | //keybuffer_push(keybuffer, to_hex(scan_code&0xf)); |
88 | //keybuffer_push(keybuffer, ' '); |
96 | //keybuffer_push(keybuffer, ' '); |
89 | //keybuffer_push(keybuffer, ' '); |
97 | //keybuffer_push(keybuffer, ' '); |
90 | //*/ |
98 | //*/ |
91 | 99 | ||
92 | 100 | ||
93 | if (scan_code){ |
101 | if (scan_code){ |
94 | buf|=(unsigned long long) scan_code<<(8*(count++)); |
102 | buf|=(unsigned long long) scan_code<<(8*(count++)); |
95 | } else { |
103 | } else { |
96 | 104 | ||
97 | 105 | ||
98 | if ( buf == 0x1b ) { |
106 | if ( buf == 0x1b ) { |
99 | esc_count++; |
107 | esc_count++; |
100 | if ( esc_count == 3 ) { |
108 | if ( esc_count == 3 ) { |
101 | __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE); |
109 | __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE); |
102 | } |
110 | } |
103 | } else { |
111 | } else { |
104 | esc_count=0; |
112 | esc_count=0; |
105 | } |
113 | } |
106 | 114 | ||
107 | if ( ! ( buf & 0xff00 )) |
115 | if ( ! ( buf & 0xff00 )) |
108 | keybuffer_push(keybuffer, buf); |
116 | keybuffer_push(keybuffer, buf); |
109 | else { |
117 | else { |
110 | switch (buf){ |
118 | switch (buf){ |
111 | case KEY_F1: |
119 | case KEY_F1: |
112 | keybuffer_push(keybuffer,FUNCTION_KEYS | 1 ); |
120 | keybuffer_push(keybuffer,FUNCTION_KEYS | 1 ); |
113 | break; |
121 | break; |
114 | case KEY_F2: |
122 | case KEY_F2: |
115 | keybuffer_push(keybuffer,FUNCTION_KEYS | 2 ); |
123 | keybuffer_push(keybuffer,FUNCTION_KEYS | 2 ); |
116 | break; |
124 | break; |
117 | case KEY_F3: |
125 | case KEY_F3: |
118 | keybuffer_push(keybuffer,FUNCTION_KEYS | 3 ); |
126 | keybuffer_push(keybuffer,FUNCTION_KEYS | 3 ); |
119 | break; |
127 | break; |
120 | case KEY_F4: |
128 | case KEY_F4: |
121 | keybuffer_push(keybuffer,FUNCTION_KEYS | 4 ); |
129 | keybuffer_push(keybuffer,FUNCTION_KEYS | 4 ); |
122 | break; |
130 | break; |
123 | case KEY_F5: |
131 | case KEY_F5: |
124 | keybuffer_push(keybuffer,FUNCTION_KEYS | 5 ); |
132 | keybuffer_push(keybuffer,FUNCTION_KEYS | 5 ); |
125 | break; |
133 | break; |
126 | case KEY_F6: |
134 | case KEY_F6: |
127 | keybuffer_push(keybuffer,FUNCTION_KEYS | 6 ); |
135 | keybuffer_push(keybuffer,FUNCTION_KEYS | 6 ); |
128 | break; |
136 | break; |
129 | case KEY_F7: |
137 | case KEY_F7: |
130 | keybuffer_push(keybuffer,FUNCTION_KEYS | 7 ); |
138 | keybuffer_push(keybuffer,FUNCTION_KEYS | 7 ); |
131 | break; |
139 | break; |
132 | case KEY_F8: |
140 | case KEY_F8: |
133 | keybuffer_push(keybuffer,FUNCTION_KEYS | 8 ); |
141 | keybuffer_push(keybuffer,FUNCTION_KEYS | 8 ); |
134 | break; |
142 | break; |
135 | 143 | ||
136 | case KEY_F9: |
144 | case KEY_F9: |
137 | keybuffer_push(keybuffer,FUNCTION_KEYS | 9 ); |
145 | keybuffer_push(keybuffer,FUNCTION_KEYS | 9 ); |
138 | break; |
146 | break; |
139 | case KEY_F10: |
147 | case KEY_F10: |
140 | keybuffer_push(keybuffer,FUNCTION_KEYS | 10 ); |
148 | keybuffer_push(keybuffer,FUNCTION_KEYS | 10 ); |
141 | break; |
149 | break; |
142 | 150 | ||
143 | case KEY_F11: |
151 | case KEY_F11: |
144 | keybuffer_push(keybuffer,FUNCTION_KEYS | 11 ); |
152 | keybuffer_push(keybuffer,FUNCTION_KEYS | 11 ); |
145 | break; |
153 | break; |
146 | case KEY_F12: |
154 | case KEY_F12: |
147 | keybuffer_push(keybuffer,FUNCTION_KEYS | 12 ); |
155 | keybuffer_push(keybuffer,FUNCTION_KEYS | 12 ); |
148 | break; |
156 | break; |
149 | 157 | ||
150 | 158 | ||
151 | } |
159 | } |
152 | } |
160 | } |
153 | buf=count=0; |
161 | buf=count=0; |
154 | } |
162 | } |
155 | 163 | ||
156 | return 1; |
164 | return 1; |
157 | } |
165 | } |
- | 166 | ||
- | 167 | /** |
|
- | 168 | * @} |
|
- | 169 | */ |
|
158 | 170 |