OpenCores
URL https://opencores.org/ocsvn/ao486/ao486/trunk

Subversion Repositories ao486

[/] [ao486/] [trunk/] [syn/] [components/] [ps2/] [software/] [exe/] [main.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
#include <stdio.h>
2
#include <unistd.h>
3
 
4
#include <system.h>
5
#include <io.h>
6
 
7
int main() {
8
 
9
        IOWR_8DIRECT(PS2_0_BASE, 4, 0x60);
10
        IOWR_8DIRECT(PS2_0_BASE, 0, 0x03);
11
 
12
        usleep(100000);
13
 
14
        IOWR_8DIRECT(PS2_0_BASE, 4, 0xD4);
15
        IOWR_8DIRECT(PS2_0_BASE, 0, 0xF4);
16
 
17
        while(1) {
18
 
19
                int impl   = IORD(PIO_0_BASE, 0);
20
                int status = IORD_8DIRECT(PS2_0_BASE, 4);
21
 
22
                if(impl & 0x02) { //mouse
23
                        int scancode = IORD_8DIRECT(PS2_0_BASE, 0);
24
                        printf("mouse: %02x, status: %02x\n", scancode, status);
25
                }
26
                if(impl & 0x01) { //keyboard
27
                        int scancode = IORD_8DIRECT(PS2_0_BASE, 0);
28
                        printf("keyboard: %02x, status: %02x\n", scancode, status);
29
                }
30
        }
31
 
32
        return 0;
33
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.