Subversion Repositories HelenOS

Rev

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

Rev 1921 Rev 1923
Line 38... Line 38...
38
#include <genarch/kbd/key.h>
38
#include <genarch/kbd/key.h>
39
#include <genarch/kbd/scanc.h>
39
#include <genarch/kbd/scanc.h>
40
#include <genarch/kbd/scanc_sun.h>
40
#include <genarch/kbd/scanc_sun.h>
41
#include <arch/drivers/z8530.h>
41
#include <arch/drivers/z8530.h>
42
#include <ddi/irq.h>
42
#include <ddi/irq.h>
-
 
43
#include <ipc/irq.h>
43
#include <arch/interrupt.h>
44
#include <arch/interrupt.h>
44
#include <arch/drivers/kbd.h>
45
#include <arch/drivers/kbd.h>
45
#include <arch/drivers/fhc.h>
46
#include <arch/drivers/fhc.h>
46
#include <cpu.h>
47
#include <cpu.h>
47
#include <arch/asm.h>
48
#include <arch/asm.h>
Line 56... Line 57...
56
/*
57
/*
57
 * These codes read from z8530 data register are silently ignored.
58
 * These codes read from z8530 data register are silently ignored.
58
 */
59
 */
59
#define IGNORE_CODE 0x7f        /* all keys up */
60
#define IGNORE_CODE 0x7f        /* all keys up */
60
 
61
 
61
bool z8530_belongs_to_kernel = true;
-
 
62
 
-
 
63
static z8530_t z8530;       /**< z8530 device structure. */
62
static z8530_t z8530;       /**< z8530 device structure. */
64
static irq_t z8530_irq;     /**< z8530's IRQ. */
63
static irq_t z8530_irq;     /**< z8530's IRQ. */
65
 
64
 
66
static void z8530_suspend(chardev_t *);
65
static void z8530_suspend(chardev_t *);
67
static void z8530_resume(chardev_t *);
66
static void z8530_resume(chardev_t *);
Line 70... Line 69...
70
    .suspend = z8530_suspend,
69
    .suspend = z8530_suspend,
71
    .resume = z8530_resume,
70
    .resume = z8530_resume,
72
    .read = z8530_key_read
71
    .read = z8530_key_read
73
};
72
};
74
 
73
 
75
void z8530_wait(void);
-
 
76
 
-
 
77
/** Initialize keyboard and service interrupts using kernel routine */
74
/** Initialize keyboard and service interrupts using kernel routine. */
78
void z8530_grab(void)
75
void z8530_grab(void)
79
{
76
{
80
    z8530_belongs_to_kernel = true;
-
 
81
}
77
}
82
 
78
 
83
/** Resume the former interrupt vector */
79
/** Resume the former IPC notification behavior. */
84
void z8530_release(void)
80
void z8530_release(void)
85
{
81
{
86
    z8530_belongs_to_kernel = false;
-
 
87
}
82
}
88
 
83
 
89
/** Initialize z8530. */
84
/** Initialize z8530. */
90
void z8530_init(devno_t devno, inr_t inr, uintptr_t vaddr)
85
void z8530_init(devno_t devno, inr_t inr, uintptr_t vaddr)
91
{
86
{
Line 131... Line 126...
131
void z8530_interrupt(void)
126
void z8530_interrupt(void)
132
{
127
{
133
    z8530_poll();
128
    z8530_poll();
134
}
129
}
135
 
130
 
136
/** Wait until the controller reads its data. */
-
 
137
void z8530_wait(void) {
-
 
138
}
-
 
139
 
-
 
140
/* Called from getc(). */
131
/* Called from getc(). */
141
void z8530_resume(chardev_t *d)
132
void z8530_resume(chardev_t *d)
142
{
133
{
143
}
134
}
144
 
135
 
Line 192... Line 183...
192
 
183
 
193
void z8530_irq_handler(irq_t *irq, void *arg, ...)
184
void z8530_irq_handler(irq_t *irq, void *arg, ...)
194
{
185
{
195
    /*
186
    /*
196
     * So far, we know we got this interrupt through the FHC.
187
     * So far, we know we got this interrupt through the FHC.
197
     * Since we don't have enough information about the FHC and
188
     * Since we don't have enough documentation about the FHC
198
     * because the interrupt looks like level sensitive,
189
     * and because the interrupt looks like level sensitive,
199
     * we cannot handle it by scheduling one of the level
190
     * we cannot handle it by scheduling one of the level
200
     * interrupt traps. Process the interrupt directly.
191
     * interrupt traps. Process the interrupt directly.
201
     */
192
     */
202
    if (z8530_belongs_to_kernel)
193
    if (irq->notif_cfg.answerbox)
203
        z8530_interrupt();
194
        ipc_irq_send_notif(irq);
204
    else
195
    else
205
        ipc_irq_send_notif(0);
196
        z8530_interrupt();
206
    fhc_clear_interrupt(central_fhc, irq->inr);
197
    fhc_clear_interrupt(central_fhc, irq->inr);
207
}
198
}
208
 
199
 
209
/** @}
200
/** @}
210
 */
201
 */