Subversion Repositories HelenOS

Rev

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

Rev 3854 Rev 3880
Line 44... Line 44...
44
#include <proc/thread.h>
44
#include <proc/thread.h>
45
#include <synch/spinlock.h>
45
#include <synch/spinlock.h>
46
#include <arch/asm.h>
46
#include <arch/asm.h>
47
#include <arch/drivers/kbd.h>
47
#include <arch/drivers/kbd.h>
48
 
48
 
49
#define SKI_KBD_INR 0
49
#define SKI_KBD_INR  0
50
 
50
 
51
static irq_t ski_kbd_irq;
51
static irq_t ski_kbd_irq;
52
static devno_t ski_kbd_devno;
52
static devno_t ski_kbd_devno;
53
 
53
 
54
chardev_t ski_console;
54
chardev_t ski_console;
Line 112... Line 112...
112
 * To be used when the kernel crashes.
112
 * To be used when the kernel crashes.
113
 */
113
 */
114
static char ski_getchar_blocking(chardev_t *d)
114
static char ski_getchar_blocking(chardev_t *d)
115
{
115
{
116
    int ch;
116
    int ch;
117
 
117
   
118
    while(!(ch = ski_getchar()))
118
    while(!(ch = ski_getchar()));
119
        ;
119
   
120
    if (ch == '\r')
120
    if (ch == '\r')
121
        ch = '\n';
121
        ch = '\n';
122
    return (char) ch;
122
    return (char) ch;
123
}
123
}
124
 
124
 
Line 126... Line 126...
126
static void poll_keyboard(void)
126
static void poll_keyboard(void)
127
{
127
{
128
    char ch;
128
    char ch;
129
    static char last;
129
    static char last;
130
    ipl_t ipl;
130
    ipl_t ipl;
131
 
131
   
132
    ipl = interrupts_disable();
132
    ipl = interrupts_disable();
133
 
133
   
134
    if (kbd_disabled) {
134
    if (kbd_disabled) {
135
        interrupts_restore(ipl);
135
        interrupts_restore(ipl);
136
        return;
136
        return;
137
    }
137
    }
138
       
138
   
139
    spinlock_lock(&ski_kbd_irq.lock);
139
    spinlock_lock(&ski_kbd_irq.lock);
140
 
140
   
141
    ch = ski_getchar();
141
    ch = ski_getchar();
142
    if(ch == '\r')
142
    if(ch == '\r')
143
        ch = '\n';
143
        ch = '\n';
144
    if (ch) {
144
    if (ch) {
145
        if (ski_kbd_irq.notif_cfg.notify &&
145
        if (ski_kbd_irq.notif_cfg.notify &&
Line 175... Line 175...
175
}
175
}
176
 
176
 
177
/* Called from getc(). */
177
/* Called from getc(). */
178
static void ski_kbd_disable(chardev_t *d)
178
static void ski_kbd_disable(chardev_t *d)
179
{
179
{
180
    kbd_disabled = true;   
180
    kbd_disabled = true;
181
}
181
}
182
 
182
 
183
/** Decline to service hardware IRQ.
183
/** Decline to service hardware IRQ.
184
 *
184
 *
185
 * This is only a virtual IRQ, so always decline.
185
 * This is only a virtual IRQ, so always decline.