Subversion Repositories HelenOS

Rev

Rev 3674 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3674 Rev 4342
Line 112... Line 112...
112
#define MCR_REG     4   /** Modem Control Register. */
112
#define MCR_REG     4   /** Modem Control Register. */
113
#define LSR_REG     5   /** Line Status Register. */
113
#define LSR_REG     5   /** Line Status Register. */
114
 
114
 
115
 
115
 
116
 
116
 
117
 
-
 
118
irq_cmd_t ski_cmds[1] = {
-
 
119
    { CMD_IA64_GETCHAR, 0, 0, 2 }
-
 
120
};
-
 
121
 
-
 
122
irq_code_t ski_kbd = {
-
 
123
    1,
-
 
124
    ski_cmds
-
 
125
};
-
 
126
 
-
 
127
 
-
 
128
 
-
 
129
irq_cmd_t ns16550_cmds[1] = {
117
irq_cmd_t ns16550_cmds[1] = {
130
    { CMD_PORT_READ_1, 0, 0, 2 },
118
    { CMD_PORT_READ_1, 0, 0, 2 },
131
};
119
};
132
 
120
 
133
irq_code_t ns16550_kbd = {
121
irq_code_t ns16550_kbd = {
Line 142... Line 130...
142
 
130
 
143
int kbd_arch_init(void)
131
int kbd_arch_init(void)
144
{
132
{
145
    if (sysinfo_value("kbd")) {
133
    if (sysinfo_value("kbd")) {
146
        kbd_type=sysinfo_value("kbd.type");
134
        kbd_type=sysinfo_value("kbd.type");
147
        if(kbd_type==KBD_SKI) ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &ski_kbd);
135
        if (kbd_type == KBD_LEGACY)
148
        if(kbd_type==KBD_LEGACY) return lkbd_arch_init();
136
            return lkbd_arch_init();
149
        if(kbd_type==KBD_NS16550) {
137
        if (kbd_type == KBD_NS16550) {
150
            ns16550_kbd.cmds[0].addr= (void *)  (sysinfo_value("kbd.port")+RBR_REG);
138
            ns16550_kbd.cmds[0].addr = (void *) (sysinfo_value("kbd.port") + RBR_REG);
151
            ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &ns16550_kbd);
139
            ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &ns16550_kbd);
152
            iospace_enable(task_get_id(),ns16550_port=sysinfo_value("kbd.port"),8);
140
            iospace_enable(task_get_id(), ns16550_port = sysinfo_value("kbd.port"), 8);
153
        }  
141
        }
154
        return 0;
142
        return 0;
155
    }  
143
    }
156
    return 1;
144
    return 1;
157
}
145
}
158
 
146
 
159
/*
147
/*
160
* Please preserve this code (it can be used to determine scancodes)
148
* Please preserve this code (it can be used to determine scancodes)
Line 168... Line 156...
168
 
156
 
169
int kbd_ns16550_process(keybuffer_t *keybuffer, ipc_call_t *call)
157
int kbd_ns16550_process(keybuffer_t *keybuffer, ipc_call_t *call)
170
{
158
{
171
    static unsigned long buf = 0;
159
    static unsigned long buf = 0;
172
    static int count = 0, esc_count=0; 
160
    static int count = 0, esc_count=0; 
173
 
161
   
174
    int scan_code = IPC_GET_ARG2(*call);
162
    int scan_code = IPC_GET_ARG2(*call);
175
 
163
   
176
    if (scan_code == 0x1b) {
164
    if (scan_code == 0x1b) {
177
        esc_count++;
165
        esc_count++;
178
        if (esc_count == 3) {
166
        if (esc_count == 3) {
179
            __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE);
167
            __SYSCALL0(SYS_DEBUG_ENABLE_CONSOLE);
180
        }  
168
        }  
181
    } else {
169
    } else {
182
        esc_count = 0;
170
        esc_count = 0;
183
    }
171
    }
184
 
172
   
185
    if(scan_code==0x0d) return 1;   //Delete CR
173
    if (scan_code == 0x0d)
-
 
174
        return 1;        /* Delete CR */
-
 
175
    if (scan_code == 0x7f)
186
    if(scan_code==0x7f) scan_code='\b'; //Convert backspace
176
        scan_code='\b';  /* Convert backspace */
187
 
177
   
188
    if(scan_code == 0x7e) {
178
    if(scan_code == 0x7e) {
189
        switch (buf) {
179
        switch (buf) {
190
        case NSKEY_F6:
180
        case NSKEY_F6:
191
            keybuffer_push(keybuffer,FUNCTION_KEYS | 6);
181
            keybuffer_push(keybuffer,FUNCTION_KEYS | 6);
192
            buf = count = 0;
182
            buf = count = 0;
Line 306... Line 296...
306
        return 1;
296
        return 1;
307
    }
297
    }
308
    return 1;
298
    return 1;
309
}
299
}
310
 
300
 
311
 
-
 
312
 
-
 
313
 
-
 
314
 
-
 
315
 
-
 
316
 
-
 
317
int kbd_ski_process(keybuffer_t *keybuffer, ipc_call_t *call)
301
int kbd_ski_process(keybuffer_t *keybuffer, ipc_call_t *call)
318
{
302
{
319
    static unsigned long long buf = 0;
303
    static unsigned long long buf = 0;
320
    static int count = 0;  
304
    static int count = 0;  
321
    static int esc_count = 0;
305
    static int esc_count = 0;
Line 391... Line 375...
391
}
375
}
392
 
376
 
393
int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call)
377
int kbd_arch_process(keybuffer_t *keybuffer, ipc_call_t *call)
394
{
378
{
395
    printf("KBD Key pressed: %x(%c)\n",IPC_GET_ARG2(*call),IPC_GET_ARG2(*call));
379
    printf("KBD Key pressed: %x(%c)\n",IPC_GET_ARG2(*call),IPC_GET_ARG2(*call));
-
 
380
    if (kbd_type == KBD_SKI)
396
    if(kbd_type==KBD_SKI) return kbd_ski_process(keybuffer,call);
381
        return kbd_ski_process(keybuffer, call);
-
 
382
    if (kbd_type == KBD_NS16550)
397
    if(kbd_type==KBD_NS16550) return kbd_ns16550_process(keybuffer,call);
383
        return kbd_ns16550_process(keybuffer,call);
-
 
384
    if (kbd_type == KBD_LEGACY)
398
    if(kbd_type==KBD_LEGACY) return lkbd_arch_process(keybuffer,call);
385
        return lkbd_arch_process(keybuffer,call);
399
 
-
 
400
   
-
 
401
}
386
}
402
 
387
 
403
 
388
 
404
 
389
 
405
/**
390
/**
406
 * @}
391
 * @}
407
 */
392
 */
408
 
393