Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1931 → Rev 1932

/trunk/kernel/genarch/src/kbd/ns16550.c
61,8 → 61,6
/** Structure for ns16550's IRQ. */
static irq_t ns16550_irq;
 
static ipc_notif_cfg_t saved_notif_cfg;
 
/*
* These codes read from ns16550 data register are silently ignored.
*/
87,20 → 85,14
while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY)
(void) ns16550_rbr_read(&ns16550);
 
if (ns16550_irq.notif_cfg.answerbox) {
saved_notif_cfg = ns16550_irq.notif_cfg;
ns16550_irq.notif_cfg.answerbox = NULL;
ns16550_irq.notif_cfg.code = NULL;
ns16550_irq.notif_cfg.method = 0;
ns16550_irq.notif_cfg.counter = 0;
}
ns16550_irq.notif_cfg.notify = false;
}
 
/** Resume the former interrupt vector */
void ns16550_release(void)
{
if (saved_notif_cfg.answerbox)
ns16550_irq.notif_cfg = saved_notif_cfg;
if (ns16550_irq.notif_cfg.answerbox)
ns16550_irq.notif_cfg.notify = true;
}
 
/** Initialize ns16550.
183,7 → 175,7
spinlock_lock(&ns16550_irq.lock);
 
if (ns16550_lsr_read(&ns16550) & LSR_DATA_READY) {
if (ns16550_irq.notif_cfg.answerbox) {
if (ns16550_irq.notif_cfg.notify && ns16550_irq.notif_cfg.answerbox) {
/*
* Send IPC notification.
*/
/trunk/kernel/genarch/src/kbd/z8530.c
62,8 → 62,6
static z8530_t z8530; /**< z8530 device structure. */
static irq_t z8530_irq; /**< z8530's IRQ. */
 
static ipc_notif_cfg_t saved_notif_cfg;
 
static void z8530_suspend(chardev_t *);
static void z8530_resume(chardev_t *);
 
91,20 → 89,14
z8530_write_a(&z8530, WR9, WR9_MIE); /* Master Interrupt Enable. */
if (z8530_irq.notif_cfg.answerbox) {
saved_notif_cfg = z8530_irq.notif_cfg;
z8530_irq.notif_cfg.answerbox = NULL;
z8530_irq.notif_cfg.code = NULL;
z8530_irq.notif_cfg.method = 0;
z8530_irq.notif_cfg.counter = 0;
}
z8530_irq.notif_cfg.notify = false;
}
 
/** Resume the former IPC notification behavior. */
void z8530_release(void)
{
if (saved_notif_cfg.answerbox)
z8530_irq.notif_cfg = saved_notif_cfg;
if (z8530_irq.notif_cfg.answerbox)
z8530_irq.notif_cfg.notify = true;
}
 
/** Initialize z8530. */
204,7 → 196,7
* we cannot handle it by scheduling one of the level
* interrupt traps. Process the interrupt directly.
*/
if (irq->notif_cfg.answerbox)
if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
ipc_irq_send_notif(irq);
else
z8530_interrupt();
/trunk/kernel/generic/include/ipc/irq.h
78,6 → 78,7
* It is protected by irq_t::lock.
*/
struct ipc_notif_cfg {
bool notify; /**< When false, notifications are not sent. */
answerbox_t *answerbox; /**< Answerbox for notifications. */
unative_t method; /**< Method to be used for the notification. */
irq_code_t *code; /**< Top-half pseudocode. */
/trunk/kernel/generic/src/ipc/irq.c
176,11 → 176,12
irq = irq_find_and_lock(inr, devno);
if (irq) {
if (irq->notif_cfg.answerbox == box) {
code_free(irq->notif_cfg.code);
irq->notif_cfg.notify = false;
irq->notif_cfg.answerbox = NULL;
irq->notif_cfg.code = NULL;
irq->notif_cfg.answerbox = NULL;
irq->notif_cfg.method = 0;
irq->notif_cfg.counter = 0;
code_free(irq->notif_cfg.code);
spinlock_unlock(&irq->lock);
}
}
226,6 → 227,7
return EEXISTS;
}
irq->notif_cfg.notify = true;
irq->notif_cfg.answerbox = box;
irq->notif_cfg.method = method;
irq->notif_cfg.code = code;
/trunk/kernel/arch/ppc32/src/drivers/cuda.c
64,9 → 64,6
static volatile uint8_t *cuda = NULL;
static irq_t cuda_irq; /**< Cuda's IRQ. */
 
static ipc_notif_cfg_t saved_notif_cfg;
 
 
static char lchars[0x80] = {
'a',
's',
254,7 → 251,7
 
static void cuda_irq_handler(irq_t *irq, void *arg, ...)
{
if (irq->notif_cfg.answerbox)
if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
ipc_irq_send_notif(irq);
else {
int scan_code = cuda_get_scancode();
276,13 → 273,7
/** Initialize keyboard and service interrupts using kernel routine */
void cuda_grab(void)
{
if (cuda_irq.notif_cfg.answerbox) {
saved_notif_cfg = cuda_irq.notif_cfg;
cuda_irq.notif_cfg.answerbox = NULL;
cuda_irq.notif_cfg.code = NULL;
cuda_irq.notif_cfg.method = 0;
cuda_irq.notif_cfg.counter = 0;
}
cuda_irq.notif_cfg.notify = false;
}
 
 
289,8 → 280,8
/** Resume the former interrupt vector */
void cuda_release(void)
{
if (saved_notif_cfg.answerbox)
cuda_irq.notif_cfg = saved_notif_cfg;
if (cuda_irq.notif_cfg.answerbox)
cuda_irq.notif_cfg.notify = true;
}