Subversion Repositories HelenOS-historic

Rev

Rev 1632 | Rev 1645 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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