Subversion Repositories HelenOS

Rev

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

Rev 1944 Rev 1945
Line 40... Line 40...
40
#include <arch/types.h>
40
#include <arch/types.h>
41
#include <typedefs.h>
41
#include <typedefs.h>
42
#include <ddi/device.h>
42
#include <ddi/device.h>
43
#include <ddi/irq.h>
43
#include <ddi/irq.h>
44
#include <ipc/irq.h>
44
#include <ipc/irq.h>
-
 
45
#include <proc/thread.h>
45
#include <synch/spinlock.h>
46
#include <synch/spinlock.h>
46
#include <arch/asm.h>
47
#include <arch/asm.h>
47
 
48
 
48
#define SKI_KBD_INR 0
49
#define SKI_KBD_INR 0
49
 
50
 
Line 121... Line 122...
121
        ch = '\n';
122
        ch = '\n';
122
    return (char) ch;
123
    return (char) ch;
123
}
124
}
124
 
125
 
125
/** Ask keyboard if a key was pressed. */
126
/** Ask keyboard if a key was pressed. */
126
void poll_keyboard(void)
127
static void poll_keyboard(void)
127
{
128
{
128
    char ch;
129
    char ch;
129
    static char last;
130
    static char last;
130
    ipl_t ipl;
131
    ipl_t ipl;
131
 
132
 
Line 222... Line 223...
222
    ski_kbd_irq.inr = SKI_KBD_INR;
223
    ski_kbd_irq.inr = SKI_KBD_INR;
223
    ski_kbd_irq.devno = ski_kbd_devno;
224
    ski_kbd_irq.devno = ski_kbd_devno;
224
    ski_kbd_irq.claim = ski_kbd_claim;
225
    ski_kbd_irq.claim = ski_kbd_claim;
225
    irq_register(&ski_kbd_irq);
226
    irq_register(&ski_kbd_irq);
226
 
227
 
227
}
-
 
228
 
-
 
229
/** Setup console sysinfo (i.e. Keyboard IRQ)
-
 
230
 *
-
 
231
 * Because sysinfo neads memory allocation/dealocation
-
 
232
 * this functions should be called separetely from init.
-
 
233
 *
-
 
234
 */
-
 
235
void ski_set_console_sysinfo(void)
-
 
236
{
-
 
237
    sysinfo_set_item_val("kbd", NULL, true);
228
    sysinfo_set_item_val("kbd", NULL, true);
238
    sysinfo_set_item_val("kbd.inr", NULL, SKI_KBD_INR);
229
    sysinfo_set_item_val("kbd.inr", NULL, SKI_KBD_INR);
239
    sysinfo_set_item_val("kbd.devno", NULL, ski_kbd_devno);
230
    sysinfo_set_item_val("kbd.devno", NULL, ski_kbd_devno);
240
}
231
}
241
 
232
 
Line 256... Line 247...
256
        ski_kbd_irq.notif_cfg.notify = true;
247
        ski_kbd_irq.notif_cfg.notify = true;
257
    spinlock_unlock(&ski_kbd_irq.lock);
248
    spinlock_unlock(&ski_kbd_irq.lock);
258
    interrupts_restore(ipl);
249
    interrupts_restore(ipl);
259
}
250
}
260
 
251
 
-
 
252
 
-
 
253
#define POLL_INTERVAL       50000       /* 50 ms */
-
 
254
 
-
 
255
/** Kernel thread for polling keyboard. */
-
 
256
void kkbdpoll(void *arg)
-
 
257
{
-
 
258
    while (1) {
-
 
259
        poll_keyboard();
-
 
260
        thread_usleep(POLL_INTERVAL);
-
 
261
    }
-
 
262
}
-
 
263
 
261
/** @}
264
/** @}
262
 */
265
 */