Subversion Repositories HelenOS

Rev

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

Rev 1932 Rev 1944
Line 78... Line 78...
78
void ns16550_interrupt(void);
78
void ns16550_interrupt(void);
79
 
79
 
80
/** Initialize keyboard and service interrupts using kernel routine */
80
/** Initialize keyboard and service interrupts using kernel routine */
81
void ns16550_grab(void)
81
void ns16550_grab(void)
82
{
82
{
-
 
83
    ipl_t ipl = interrupts_disable();
-
 
84
 
83
    ns16550_ier_write(&ns16550, IER_ERBFI);     /* enable receiver interrupt */
85
    ns16550_ier_write(&ns16550, IER_ERBFI);     /* enable receiver interrupt */
84
   
86
   
85
    while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY)
87
    while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY)
86
        (void) ns16550_rbr_read(&ns16550);
88
        (void) ns16550_rbr_read(&ns16550);
87
 
89
 
-
 
90
    spinlock_lock(&ns16550_irq.lock);
88
    ns16550_irq.notif_cfg.notify = false;
91
    ns16550_irq.notif_cfg.notify = false;
-
 
92
    spinlock_unlock(&ns16550_irq.lock);
-
 
93
    interrupts_restore(ipl);
89
}
94
}
90
 
95
 
91
/** Resume the former interrupt vector */
96
/** Resume the former interrupt vector */
92
void ns16550_release(void)
97
void ns16550_release(void)
93
{
98
{
-
 
99
    ipl_t ipl = interrupts_disable();
-
 
100
    spinlock_lock(&ns16550_irq.lock);
94
    if (ns16550_irq.notif_cfg.answerbox)
101
    if (ns16550_irq.notif_cfg.answerbox)
95
        ns16550_irq.notif_cfg.notify = true;
102
        ns16550_irq.notif_cfg.notify = true;
-
 
103
    spinlock_unlock(&ns16550_irq.lock);
-
 
104
    interrupts_restore(ipl);
96
}
105
}
97
 
106
 
98
/** Initialize ns16550.
107
/** Initialize ns16550.
99
 *
108
 *
100
 * @param devno Device number.
109
 * @param devno Device number.