Subversion Repositories HelenOS-historic

Rev

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