| plan 9 kernel history: overview | file list | diff list |
1991/0803/pc/kbd.c (diff list | history)
| 1991/0801/sys/src/9/pc/kbd.c:240,268 – 1991/0803/sys/src/9/pc/kbd.c:240,296 (short | long | prev | next) | ||
| 1991/0703 | return 0; } | |
| 1991/0731 |
| |
| 1991/0803 | /* * wait for output no longer busy */ static int outready(void) | |
| 1991/0731 | { | |
| 1991/0803 | int tries; for(tries = 0; (inb(Status) & Outbusy); tries++) if(tries > 1000) return -1; return 0; } /* * wait for input */ static int inready(void) { int tries; for(tries = 0; !(inb(Status) & Inready); tries++) if(tries > 1000) return -1; return 0; } /* * send a command to the mouse */ static int mousecmd(int cmd) { | |
| 1991/0731 | unsigned int c; | |
| 1991/0803 | int tries; | |
| 1991/0731 |
| |
| 1991/0803 | for(tries=0; tries < 10; tries++){ if(outready() < 0) return -1; | |
| 1991/0731 | outb(Cmd, 0xD4); | |
| 1991/0803 | if(outready() < 0) return -1; | |
| 1991/0731 | outb(Data, cmd); | |
| 1991/0803 | if(inready() < 0) return -1; | |
| 1991/0731 | c = inb(Data); } while(c == 0xFE); if(c != 0xFA) | |
| 1991/0803 | return -1; return 0; | |
| 1991/0731 | } | |
| 1991/0703 | void | |
| 1991/0801/sys/src/9/pc/kbd.c:269,274 – 1991/0803/sys/src/9/pc/kbd.c:297,303 | ||
| 1991/0703 | kbdinit(void) { | |
| 1991/0731 | int c, s; | |
| 1991/0803 | int tries; | |
| 1991/0730 | ||
| 1991/0703 | initq(&kbdq); | |
| 1991/0716 | setvec(Kbdvec, kbdintr); | |
| 1991/0801/sys/src/9/pc/kbd.c:282,300 – 1991/0803/sys/src/9/pc/kbd.c:311,327 | ||
| 1991/0730 | ||
| 1991/0731 | /* enable kbd/mouse xfers and interrupts */ | |
| 1991/0730 | outb(Cmd, 0x60); | |
| 1991/0803 | if(outready() < 0) print("kbd init failed\n"); | |
| 1991/0731 | outb(Data, 0x47); | |
| 1991/0803 | if(outready() < 0) print("kbd init failed\n"); | |
| 1991/0731 | outb(Cmd, 0xA8); | |
| 1991/0801 |
| |
| 1991/0803 | /* make mouse streaming, enabled */ if(mousecmd(0xEA) < 0 || mousecmd(0xF4) < 0) print("can't initialize mouse\n"); | |
| 1991/0731 | } | |
| 1991/0730 | ||
| 1991/0731 | /* | |