Subversion Repositories HelenOS-historic

Rev

Rev 1694 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1694 Rev 1699
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 kbdmips32 mips32
29
/** @addtogroup kbdmips32 mips32
30
 * @brief   HelenOS mips32 arch dependent parts of uspace keyboard handler.
30
 * @brief   HelenOS mips32 arch dependent parts of uspace keyboard handler.
31
 * @ingroup  kbd
31
 * @ingroup  kbd
32
 * @{
32
 * @{
33
 */
33
 */
34
/** @file
34
/** @file
35
 */
35
 */
36
#include <arch/kbd.h>
36
#include <arch/kbd.h>
37
#include <ipc/ipc.h>
37
#include <ipc/ipc.h>
38
#include <sysinfo.h>
38
#include <sysinfo.h>
39
#include <kbd.h>
39
#include <kbd.h>
40
#include <keys.h>
40
#include <keys.h>
41
 
41
 
42
#define MSIM_KEY_F1 0x504f1bL
42
#define MSIM_KEY_F1 0x504f1bL
43
#define MSIM_KEY_F2 0x514f1bL
43
#define MSIM_KEY_F2 0x514f1bL
44
#define MSIM_KEY_F3 0x524f1bL
44
#define MSIM_KEY_F3 0x524f1bL
45
#define MSIM_KEY_F4 0x534f1bL
45
#define MSIM_KEY_F4 0x534f1bL
46
#define MSIM_KEY_F5 0x35315b1bL
46
#define MSIM_KEY_F5 0x35315b1bL
47
#define MSIM_KEY_F6 0x37315b1bL
47
#define MSIM_KEY_F6 0x37315b1bL
48
#define MSIM_KEY_F7 0x38315b1bL
48
#define MSIM_KEY_F7 0x38315b1bL
49
#define MSIM_KEY_F8 0x39315b1bL
49
#define MSIM_KEY_F8 0x39315b1bL
50
#define MSIM_KEY_F9 0x30325b1bL
50
#define MSIM_KEY_F9 0x30325b1bL
51
#define MSIM_KEY_F10 0x31325b1bL
51
#define MSIM_KEY_F10 0x31325b1bL
52
#define MSIM_KEY_F11 0x33325b1bL
52
#define MSIM_KEY_F11 0x33325b1bL
53
#define MSIM_KEY_F12 0x34325b1bL
53
#define MSIM_KEY_F12 0x34325b1bL
54
 
54
 
55
 
55
 
56
#define GXEMUL_KEY_F1 0x504f5b1bL
56
#define GXEMUL_KEY_F1 0x504f5b1bL
57
#define GXEMUL_KEY_F2 0x514f5b1bL
57
#define GXEMUL_KEY_F2 0x514f5b1bL
58
#define GXEMUL_KEY_F3 0x524f5b1bL
58
#define GXEMUL_KEY_F3 0x524f5b1bL
59
#define GXEMUL_KEY_F4 0x534f5b1bL
59
#define GXEMUL_KEY_F4 0x534f5b1bL
60
#define GXEMUL_KEY_F5 0x35315b1bL
60
#define GXEMUL_KEY_F5 0x35315b1bL
61
#define GXEMUL_KEY_F6 0x37315b1bL
61
#define GXEMUL_KEY_F6 0x37315b1bL
62
#define GXEMUL_KEY_F7 0x38315b1bL
62
#define GXEMUL_KEY_F7 0x38315b1bL
63
#define GXEMUL_KEY_F8 0x39315b1bL
63
#define GXEMUL_KEY_F8 0x39315b1bL
64
#define GXEMUL_KEY_F9 0x38325b1bL
64
#define GXEMUL_KEY_F9 0x38325b1bL
65
#define GXEMUL_KEY_F10 0x39325b1bL
65
#define GXEMUL_KEY_F10 0x39325b1bL
66
#define GXEMUL_KEY_F11 0x33325b1bL
66
#define GXEMUL_KEY_F11 0x33325b1bL
67
#define GXEMUL_KEY_F12 0x34325b1bL
67
#define GXEMUL_KEY_F12 0x34325b1bL
68
 
68
 
69
 
69
 
70
#define FUNCTION_KEYS 0x100
70
#define FUNCTION_KEYS 0x100
71
 
71
 
72
 
72
 
73
irq_cmd_t msim_cmds[1] = {
73
irq_cmd_t msim_cmds[1] = {
74
    { CMD_MEM_READ_1, (void *)0xB0000000, 0, 2 }
74
    { CMD_MEM_READ_1, (void *)0xB0000000, 0, 2 }
75
};
75
};
76
 
76
 
77
irq_code_t msim_kbd = {
77
irq_code_t msim_kbd = {
78
    1,
78
    1,
79
    msim_cmds
79
    msim_cmds
80
};
80
};
81
 
81
 
82
static int msim,gxemul;
82
static int msim,gxemul;
-
 
83
static int fb_fb;
-
 
84
 
83
 
85
 
84
int kbd_arch_init(void)
86
int kbd_arch_init(void)
85
{
87
{
-
 
88
    fb_fb=sysinfo_value("fb.kind")==1;
86
    ipc_register_irq(2, &msim_kbd);
89
    ipc_register_irq(2, &msim_kbd);
87
    msim=sysinfo_value("machine.msim");
-
 
88
    gxemul=sysinfo_value("machine.lgxemul");
-
 
89
    return 0;
90
    return 0;
90
}
91
}
91
 
92
 
92
 
93
 
93
//*
94
/*
94
//*
95
//*
95
//* Please preserve this code (it can be used to determine scancodes)
96
//* Please preserve this code (it can be used to determine scancodes)
96
//*
97
//*
97
int to_hex(int v)
98
int to_hex(int v)
98
{
99
{
99
        return "0123456789ABCDEF"[v];
100
        return "0123456789ABCDEF"[v];
100
}
101
}
101
//*/
102
*/
102
 
103
 
103
static int kbd_arch_process_msim(keybuffer_t *keybuffer, int scan_code)
104
static int kbd_arch_process_no_fb(keybuffer_t *keybuffer, int scan_code)
104
{
105
{
105
 
106
 
106
    static unsigned long buf=0;
107
    static unsigned long buf=0;
107
    static int count=0;
108
    static int count=0;
108
 
109
 
109
 
110
 
110
    //* Please preserve this code (it can be used to determine scancodes)
111
    /* Please preserve this code (it can be used to determine scancodes)
111
    //*
-
 
112
    //keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf));
-
 
113
    //keybuffer_push(keybuffer, to_hex(scan_code&0xf));
-
 
114
    //keybuffer_push(keybuffer, ' ');
-
 
115
    //keybuffer_push(keybuffer, ' ');
-
 
116
    //*/
-
 
117
    //return 1;
-
 
118
   
112
   
-
 
113
    keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf));
-
 
114
    keybuffer_push(keybuffer, to_hex(scan_code&0xf));
-
 
115
    keybuffer_push(keybuffer, ' ');
-
 
116
    keybuffer_push(keybuffer, ' ');
-
 
117
   
-
 
118
    return 1;
-
 
119
    */
119
   
120
   
120
    if(scan_code==0x7e)
121
    if(scan_code==0x7e)
121
    {
122
    {
122
        switch (buf){
123
        switch (buf){
123
            case MSIM_KEY_F5:
124
            case MSIM_KEY_F5:
124
                keybuffer_push(keybuffer,FUNCTION_KEYS | 5 );
125
                keybuffer_push(keybuffer,FUNCTION_KEYS | 5 );
125
                buf=count=0;
126
                buf=count=0;
126
                return 1;
127
                return 1;
127
            case MSIM_KEY_F6:
128
            case MSIM_KEY_F6:
128
                keybuffer_push(keybuffer,FUNCTION_KEYS | 6 );
129
                keybuffer_push(keybuffer,FUNCTION_KEYS | 6 );
129
                buf=count=0;
130
                buf=count=0;
130
                return 1;
131
                return 1;
131
            case MSIM_KEY_F7:
132
            case MSIM_KEY_F7:
132
                keybuffer_push(keybuffer,FUNCTION_KEYS | 7 );
133
                keybuffer_push(keybuffer,FUNCTION_KEYS | 7 );
133
                buf=count=0;
134
                buf=count=0;
134
                return 1;
135
                return 1;
135
            case MSIM_KEY_F8:
136
            case MSIM_KEY_F8:
136
                keybuffer_push(keybuffer,FUNCTION_KEYS | 8 );
137
                keybuffer_push(keybuffer,FUNCTION_KEYS | 8 );
137
                buf=count=0;
138
                buf=count=0;
138
                return 1;
139
                return 1;
139
 
140
 
140
            case MSIM_KEY_F9:
141
            case MSIM_KEY_F9:
141
                keybuffer_push(keybuffer,FUNCTION_KEYS | 9 );
142
                keybuffer_push(keybuffer,FUNCTION_KEYS | 9 );
142
                buf=count=0;
143
                buf=count=0;
143
                return 1;
144
                return 1;
144
            case MSIM_KEY_F10:
145
            case MSIM_KEY_F10:
145
                keybuffer_push(keybuffer,FUNCTION_KEYS | 10 );
146
                keybuffer_push(keybuffer,FUNCTION_KEYS | 10 );
146
                buf=count=0;
147
                buf=count=0;
147
                return 1;
148
                return 1;
148
 
149
 
149
            case MSIM_KEY_F11:
150
            case MSIM_KEY_F11:
150
                keybuffer_push(keybuffer,FUNCTION_KEYS | 11 );
151
                keybuffer_push(keybuffer,FUNCTION_KEYS | 11 );
151
                buf=count=0;
152
                buf=count=0;
152
                return 1;
153
                return 1;
153
            case MSIM_KEY_F12:
154
            case MSIM_KEY_F12:
154
                keybuffer_push(keybuffer,FUNCTION_KEYS | 12 );
155
                keybuffer_push(keybuffer,FUNCTION_KEYS | 12 );
155
                buf=count=0;
156
                buf=count=0;
156
                return 1;
157
                return 1;
157
            default:
158
            default:
158
                keybuffer_push(keybuffer, buf & 0xff );
159
                keybuffer_push(keybuffer, buf & 0xff );
159
                keybuffer_push(keybuffer, (buf >> 8) &0xff );
160
                keybuffer_push(keybuffer, (buf >> 8) &0xff );
160
                keybuffer_push(keybuffer, (buf >> 16) &0xff );
161
                keybuffer_push(keybuffer, (buf >> 16) &0xff );
161
                keybuffer_push(keybuffer, (buf >> 24) &0xff );
162
                keybuffer_push(keybuffer, (buf >> 24) &0xff );
162
                keybuffer_push(keybuffer, scan_code );
163
                keybuffer_push(keybuffer, scan_code );
163
                buf=count=0;
164
                buf=count=0;
164
                return 1;
165
                return 1;
165
   
166
   
166
        }
167
        }
167
    }
168
    }
168
 
169
 
169
    buf|=((unsigned long) scan_code)<<(8*(count++));
170
    buf|=((unsigned long) scan_code)<<(8*(count++));
170
   
171
   
171
   
172
   
172
    if((buf & 0xff)!= (MSIM_KEY_F1 & 0xff)) {
173
    if((buf & 0xff)!= (MSIM_KEY_F1 & 0xff)) {
173
 
174
 
174
        keybuffer_push(keybuffer,buf );
175
        keybuffer_push(keybuffer,buf );
175
        buf=count=0;
176
        buf=count=0;
176
        return 1;
177
        return 1;
177
    }
178
    }
178
 
179
 
179
    if ( count <= 1 )
180
    if ( count <= 1 )
180
        return 1;
181
        return 1;
181
 
182
 
182
    if(    (buf & 0xffff) != (MSIM_KEY_F1 & 0xffff)
183
    if(    (buf & 0xffff) != (MSIM_KEY_F1 & 0xffff)
183
        && (buf & 0xffff) != (MSIM_KEY_F5 & 0xffff) ) {
184
        && (buf & 0xffff) != (MSIM_KEY_F5 & 0xffff) ) {
184
 
185
 
185
        keybuffer_push(keybuffer, buf & 0xff );
186
        keybuffer_push(keybuffer, buf & 0xff );
186
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
187
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
187
        buf=count=0;
188
        buf=count=0;
188
        return 1;
189
        return 1;
189
    }
190
    }
190
 
191
 
191
    if ( count <= 2)
192
    if ( count <= 2)
192
        return 1;
193
        return 1;
193
 
194
 
194
    switch (buf){
195
    switch (buf){
195
        case MSIM_KEY_F1:
196
        case MSIM_KEY_F1:
196
            keybuffer_push(keybuffer,FUNCTION_KEYS | 1 );
197
            keybuffer_push(keybuffer,FUNCTION_KEYS | 1 );
197
            buf=count=0;
198
            buf=count=0;
198
            return 1;
199
            return 1;
199
        case MSIM_KEY_F2:
200
        case MSIM_KEY_F2:
200
            keybuffer_push(keybuffer,FUNCTION_KEYS | 2 );
201
            keybuffer_push(keybuffer,FUNCTION_KEYS | 2 );
201
            buf=count=0;
202
            buf=count=0;
202
            return 1;
203
            return 1;
203
        case MSIM_KEY_F3:
204
        case MSIM_KEY_F3:
204
            keybuffer_push(keybuffer,FUNCTION_KEYS | 3 );
205
            keybuffer_push(keybuffer,FUNCTION_KEYS | 3 );
205
            buf=count=0;
206
            buf=count=0;
206
            return 1;
207
            return 1;
207
        case MSIM_KEY_F4:
208
        case MSIM_KEY_F4:
208
            keybuffer_push(keybuffer,FUNCTION_KEYS | 4 );
209
            keybuffer_push(keybuffer,FUNCTION_KEYS | 4 );
209
            buf=count=0;
210
            buf=count=0;
210
            return 1;
211
            return 1;
211
    }
212
    }
212
 
213
 
213
 
214
 
214
    if(    (buf & 0xffffff) != (MSIM_KEY_F5 & 0xffffff)
215
    if(    (buf & 0xffffff) != (MSIM_KEY_F5 & 0xffffff)
215
        && (buf & 0xffffff) != (MSIM_KEY_F9 & 0xffffff) ) {
216
        && (buf & 0xffffff) != (MSIM_KEY_F9 & 0xffffff) ) {
216
 
217
 
217
        keybuffer_push(keybuffer, buf & 0xff );
218
        keybuffer_push(keybuffer, buf & 0xff );
218
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
219
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
219
        keybuffer_push(keybuffer, (buf >> 16) &0xff );
220
        keybuffer_push(keybuffer, (buf >> 16) &0xff );
220
        buf=count=0;
221
        buf=count=0;
221
        return 1;
222
        return 1;
222
    }
223
    }
223
 
224
 
224
    if ( count <= 3 )
225
    if ( count <= 3 )
225
        return 1;
226
        return 1;
226
   
227
   
227
 
228
 
228
   
229
   
229
   
230
   
230
    switch (buf){
231
    switch (buf){
231
        case MSIM_KEY_F5:
232
        case MSIM_KEY_F5:
232
        case MSIM_KEY_F6:
233
        case MSIM_KEY_F6:
233
        case MSIM_KEY_F7:
234
        case MSIM_KEY_F7:
234
        case MSIM_KEY_F8:
235
        case MSIM_KEY_F8:
235
        case MSIM_KEY_F9:
236
        case MSIM_KEY_F9:
236
        case MSIM_KEY_F10:
237
        case MSIM_KEY_F10:
237
        case MSIM_KEY_F11:
238
        case MSIM_KEY_F11:
238
        case MSIM_KEY_F12:
239
        case MSIM_KEY_F12:
239
            return 1;
240
            return 1;
240
        default:
241
        default:
241
            keybuffer_push(keybuffer, buf & 0xff );
242
            keybuffer_push(keybuffer, buf & 0xff );
242
            keybuffer_push(keybuffer, (buf >> 8) &0xff );
243
            keybuffer_push(keybuffer, (buf >> 8) &0xff );
243
            keybuffer_push(keybuffer, (buf >> 16) &0xff );
244
            keybuffer_push(keybuffer, (buf >> 16) &0xff );
244
            keybuffer_push(keybuffer, (buf >> 24) &0xff );
245
            keybuffer_push(keybuffer, (buf >> 24) &0xff );
245
            buf=count=0;
246
            buf=count=0;
246
            return 1;
247
            return 1;
247
       
248
       
248
        }
249
        }
249
    return 1;
250
    return 1;
250
}
251
}
251
 
252
 
252
 
253
 
253
 
254
 
254
static int kbd_arch_process_gxemul(keybuffer_t *keybuffer, int scan_code)
255
static int kbd_arch_process_fb(keybuffer_t *keybuffer, int scan_code)
255
{
256
{
256
 
257
 
257
    static unsigned long buf=0;
258
    static unsigned long buf=0;
258
    static int count=0;
259
    static int count=0;
259
 
260
 
260
 
261
 
261
    //* Please preserve this code (it can be used to determine scancodes)
262
    /* Please preserve this code (it can be used to determine scancodes)
262
    //*
-
 
263
    //keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf));
-
 
264
    //keybuffer_push(keybuffer, to_hex(scan_code&0xf));
-
 
265
    //keybuffer_push(keybuffer, ' ');
-
 
266
    //keybuffer_push(keybuffer, ' ');
-
 
267
    //*/
-
 
268
    //return 1;
-
 
269
   
263
   
-
 
264
    keybuffer_push(keybuffer, to_hex((scan_code>>4)&0xf));
-
 
265
    keybuffer_push(keybuffer, to_hex(scan_code&0xf));
-
 
266
    keybuffer_push(keybuffer, ' ');
-
 
267
    keybuffer_push(keybuffer, ' ');
-
 
268
   
-
 
269
    return 1;
-
 
270
    */
270
   
271
   
271
    if ( scan_code == '\r' )
272
    if ( scan_code == '\r' )
272
        scan_code = '\n' ;
273
        scan_code = '\n' ;
273
   
274
   
274
    buf|=((unsigned long) scan_code)<<(8*(count++));
275
    buf|=((unsigned long) scan_code)<<(8*(count++));
275
   
276
   
276
   
277
   
277
    if((buf & 0xff)!= (GXEMUL_KEY_F1 & 0xff)) {
278
    if((buf & 0xff)!= (GXEMUL_KEY_F1 & 0xff)) {
278
 
279
 
279
        keybuffer_push(keybuffer,buf );
280
        keybuffer_push(keybuffer,buf );
280
        buf=count=0;
281
        buf=count=0;
281
        return 1;
282
        return 1;
282
    }
283
    }
283
 
284
 
284
    if ( count <= 1 )
285
    if ( count <= 1 )
285
        return 1;
286
        return 1;
286
 
287
 
287
    if(    (buf & 0xffff) != (GXEMUL_KEY_F1 & 0xffff)  ) {
288
    if(    (buf & 0xffff) != (GXEMUL_KEY_F1 & 0xffff)  ) {
288
 
289
 
289
        keybuffer_push(keybuffer, buf & 0xff );
290
        keybuffer_push(keybuffer, buf & 0xff );
290
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
291
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
291
        buf=count=0;
292
        buf=count=0;
292
        return 1;
293
        return 1;
293
    }
294
    }
294
 
295
 
295
    if ( count <= 2)
296
    if ( count <= 2)
296
        return 1;
297
        return 1;
297
 
298
 
298
 
299
 
299
    if(    (buf & 0xffffff) != (GXEMUL_KEY_F1 & 0xffffff)
300
    if(    (buf & 0xffffff) != (GXEMUL_KEY_F1 & 0xffffff)
300
        && (buf & 0xffffff) != (GXEMUL_KEY_F5 & 0xffffff)
301
        && (buf & 0xffffff) != (GXEMUL_KEY_F5 & 0xffffff)
301
        && (buf & 0xffffff) != (GXEMUL_KEY_F9 & 0xffffff) ) {
302
        && (buf & 0xffffff) != (GXEMUL_KEY_F9 & 0xffffff) ) {
302
 
303
 
303
        keybuffer_push(keybuffer, buf & 0xff );
304
        keybuffer_push(keybuffer, buf & 0xff );
304
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
305
        keybuffer_push(keybuffer, (buf >> 8) &0xff );
305
        keybuffer_push(keybuffer, (buf >> 16) &0xff );
306
        keybuffer_push(keybuffer, (buf >> 16) &0xff );
306
        buf=count=0;
307
        buf=count=0;
307
        return 1;
308
        return 1;
308
    }
309
    }
309
 
310
 
310
    if ( count <= 3 )
311
    if ( count <= 3 )
311
        return 1;
312
        return 1;
312
   
313
   
313
 
314
 
314
    switch (buf){
315
    switch (buf){
315
 
316
 
316
        case GXEMUL_KEY_F1:
317
        case GXEMUL_KEY_F1:
317
            keybuffer_push(keybuffer,FUNCTION_KEYS | 1 );
318
            keybuffer_push(keybuffer,FUNCTION_KEYS | 1 );
318
            buf=count=0;
319
            buf=count=0;
319
            return 1;
320
            return 1;
320
        case GXEMUL_KEY_F2:
321
        case GXEMUL_KEY_F2:
321
            keybuffer_push(keybuffer,FUNCTION_KEYS | 2 );
322
            keybuffer_push(keybuffer,FUNCTION_KEYS | 2 );
322
            buf=count=0;
323
            buf=count=0;
323
            return 1;
324
            return 1;
324
        case GXEMUL_KEY_F3:
325
        case GXEMUL_KEY_F3:
325
            keybuffer_push(keybuffer,FUNCTION_KEYS | 3 );
326
            keybuffer_push(keybuffer,FUNCTION_KEYS | 3 );
326
            buf=count=0;
327
            buf=count=0;
327
            return 1;
328
            return 1;
328
        case GXEMUL_KEY_F4:
329
        case GXEMUL_KEY_F4:
329
            keybuffer_push(keybuffer,FUNCTION_KEYS | 4 );
330
            keybuffer_push(keybuffer,FUNCTION_KEYS | 4 );
330
            buf=count=0;
331
            buf=count=0;
331
            return 1;
332
            return 1;
332
        case GXEMUL_KEY_F5:
333
        case GXEMUL_KEY_F5:
333
            keybuffer_push(keybuffer,FUNCTION_KEYS | 5 );
334
            keybuffer_push(keybuffer,FUNCTION_KEYS | 5 );
334
            buf=count=0;
335
            buf=count=0;
335
            return 1;
336
            return 1;
336
        case GXEMUL_KEY_F6:
337
        case GXEMUL_KEY_F6:
337
            keybuffer_push(keybuffer,FUNCTION_KEYS | 6 );
338
            keybuffer_push(keybuffer,FUNCTION_KEYS | 6 );
338
            buf=count=0;
339
            buf=count=0;
339
            return 1;
340
            return 1;
340
        case GXEMUL_KEY_F7:
341
        case GXEMUL_KEY_F7:
341
            keybuffer_push(keybuffer,FUNCTION_KEYS | 7 );
342
            keybuffer_push(keybuffer,FUNCTION_KEYS | 7 );
342
            buf=count=0;
343
            buf=count=0;
343
            return 1;
344
            return 1;
344
        case GXEMUL_KEY_F8:
345
        case GXEMUL_KEY_F8:
345
            keybuffer_push(keybuffer,FUNCTION_KEYS | 8 );
346
            keybuffer_push(keybuffer,FUNCTION_KEYS | 8 );
346
            buf=count=0;
347
            buf=count=0;
347
            return 1;
348
            return 1;
348
        case GXEMUL_KEY_F9:
349
        case GXEMUL_KEY_F9:
349
            keybuffer_push(keybuffer,FUNCTION_KEYS | 9 );
350
            keybuffer_push(keybuffer,FUNCTION_KEYS | 9 );
350
            buf=count=0;
351
            buf=count=0;
351
            return 1;
352
            return 1;
352
        case GXEMUL_KEY_F10:
353
        case GXEMUL_KEY_F10:
353
            keybuffer_push(keybuffer,FUNCTION_KEYS | 10 );
354
            keybuffer_push(keybuffer,FUNCTION_KEYS | 10 );
354
            buf=count=0;
355
            buf=count=0;
355
            return 1;
356
            return 1;
356
        case GXEMUL_KEY_F11:
357
        case GXEMUL_KEY_F11:
357
            keybuffer_push(keybuffer,FUNCTION_KEYS | 11 );
358
            keybuffer_push(keybuffer,FUNCTION_KEYS | 11 );
358
            buf=count=0;
359
            buf=count=0;
359
            return 1;
360
            return 1;
360
        case GXEMUL_KEY_F12:
361
        case GXEMUL_KEY_F12:
361
            keybuffer_push(keybuffer,FUNCTION_KEYS | 12 );
362
            keybuffer_push(keybuffer,FUNCTION_KEYS | 12 );
362
            buf=count=0;
363
            buf=count=0;
363
            return 1;
364
            return 1;
364
 
365
 
365
        default:
366
        default:
366
            keybuffer_push(keybuffer, buf & 0xff );
367
            keybuffer_push(keybuffer, buf & 0xff );
367
            keybuffer_push(keybuffer, (buf >> 8) &0xff );
368
            keybuffer_push(keybuffer, (buf >> 8) &0xff );
368
            keybuffer_push(keybuffer, (buf >> 16) &0xff );
369
            keybuffer_push(keybuffer, (buf >> 16) &0xff );
369
            keybuffer_push(keybuffer, (buf >> 24) &0xff );
370
            keybuffer_push(keybuffer, (buf >> 24) &0xff );
370
            buf=count=0;
371
            buf=count=0;
371
            return 1;
372
            return 1;
372
       
373
       
373
        }
374
        }
374
    return 1;
375
    return 1;
375
}
376
}
376
 
377
 
377
int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call)
378
int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call)
378
{
379
{
379
    int scan_code = IPC_GET_ARG2(*call);
380
    int scan_code = IPC_GET_ARG2(*call);
380
    static int esc_count=0;
381
    static int esc_count=0;
381
 
382
 
382
   
383
   
383
    if ( scan_code == 0x1b ) {
384
    if ( scan_code == 0x1b ) {
384
        esc_count++;
385
        esc_count++;
385
        if ( esc_count == 3 ) {
386
        if ( esc_count == 3 ) {
386
            __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE);
387
            __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE);
387
        }  
388
        }  
388
    } else {
389
    } else {
389
        esc_count=0;
390
        esc_count=0;
390
    }
391
    }
391
 
392
 
392
    if(msim) return kbd_arch_process_msim(keybuffer, scan_code);
393
    if(fb_fb) return kbd_arch_process_fb(keybuffer, scan_code);
393
    if(gxemul) return kbd_arch_process_gxemul(keybuffer, scan_code);
394
    return kbd_arch_process_no_fb(keybuffer, scan_code);
394
 
395
 
395
    return 0;
396
    return 0;
396
}
397
}
397
 
-
 
398
/**
-
 
399
 * @}
398
/** @}
400
 */
399
*/
401
 
400