Subversion Repositories HelenOS

Rev

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

Rev 4223 Rev 4251
Line 48... Line 48...
48
    .poll = NULL
48
    .poll = NULL
49
};
49
};
50
 
50
 
51
#define i8042_SET_COMMAND  0x60
51
#define i8042_SET_COMMAND  0x60
52
#define i8042_COMMAND      0x69
52
#define i8042_COMMAND      0x69
-
 
53
#define i8042_CPU_RESET    0xfe
53
 
54
 
54
#define i8042_BUFFER_FULL_MASK  0x01
55
#define i8042_BUFFER_FULL_MASK  0x01
55
#define i8042_WAIT_MASK         0x02
56
#define i8042_WAIT_MASK         0x02
56
 
57
 
57
static irq_ownership_t i8042_claim(irq_t *irq)
58
static irq_ownership_t i8042_claim(irq_t *irq)
Line 95... Line 96...
95
    instance->irq.claim = i8042_claim;
96
    instance->irq.claim = i8042_claim;
96
    instance->irq.handler = i8042_irq_handler;
97
    instance->irq.handler = i8042_irq_handler;
97
    instance->irq.instance = instance;
98
    instance->irq.instance = instance;
98
    irq_register(&instance->irq);
99
    irq_register(&instance->irq);
99
   
100
   
100
    /*
-
 
101
     * Clear input buffer.
101
    /* Clear input buffer */
102
     */
-
 
103
    while (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK)
102
    while (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK)
104
        (void) pio_read_8(&dev->data);
103
        (void) pio_read_8(&dev->data);
105
   
104
   
106
    return &instance->kbrdin;
105
    return &instance->kbrdin;
107
}
106
}
108
 
107
 
-
 
108
/* Reset CPU by pulsing pin 0 */
-
 
109
void i8042_cpu_reset(i8042_t *dev)
-
 
110
{
-
 
111
    interrupts_disable();
-
 
112
   
-
 
113
    /* Clear input buffer */
-
 
114
    while (pio_read_8(&dev->status) & i8042_BUFFER_FULL_MASK)
-
 
115
        (void) pio_read_8(&dev->data);
-
 
116
   
-
 
117
    /* Reset CPU */
-
 
118
    pio_write_8(&dev->status, i8042_CPU_RESET);
-
 
119
}
-
 
120
 
109
/** @}
121
/** @}
110
 */
122
 */