mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-02 07:28:21 +00:00
ps2 fix keyboard initialisation
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include <arch/ps2.h>
|
#include <arch/ps2.h>
|
||||||
#include <printf.h>
|
#include <printf.h>
|
||||||
|
#include <arch/ps2kbd.h>
|
||||||
|
|
||||||
static bool reset_selftest(int port) {
|
static bool reset_selftest(int port) {
|
||||||
uint8_t r = RESEND;
|
uint8_t r = RESEND;
|
||||||
@@ -60,8 +61,15 @@ void arch_ps2_init() {
|
|||||||
else
|
else
|
||||||
write_command(CTLR_CMD_DISABLEP2); // disable second port again
|
write_command(CTLR_CMD_DISABLEP2); // disable second port again
|
||||||
|
|
||||||
|
// self test ports
|
||||||
int workingflag = 0;
|
int workingflag = 0;
|
||||||
|
|
||||||
|
write_command(CTLR_CMD_P1SELFTEST);
|
||||||
|
if (read_data() == 0)
|
||||||
|
workingflag |= 1;
|
||||||
|
else
|
||||||
|
printf("First PS/2 port self test failed!\n");
|
||||||
|
|
||||||
if (dualport) {
|
if (dualport) {
|
||||||
write_command(CTLR_CMD_P2SELFTEST);
|
write_command(CTLR_CMD_P2SELFTEST);
|
||||||
if (read_data() == 0)
|
if (read_data() == 0)
|
||||||
@@ -77,8 +85,9 @@ void arch_ps2_init() {
|
|||||||
|
|
||||||
printf("ps2: controller with %d ports\n", dualport ? 2 : 1);
|
printf("ps2: controller with %d ports\n", dualport ? 2 : 1);
|
||||||
|
|
||||||
write_command(CTLR_CMD_ENABLEP1);
|
// enable ports
|
||||||
|
|
||||||
|
write_command(CTLR_CMD_ENABLEP1);
|
||||||
if (dualport)
|
if (dualport)
|
||||||
write_command(CTLR_CMD_ENABLEP2);
|
write_command(CTLR_CMD_ENABLEP2);
|
||||||
|
|
||||||
@@ -101,4 +110,8 @@ void arch_ps2_init() {
|
|||||||
|
|
||||||
if (workingflag & 2 && reset_selftest(2))
|
if (workingflag & 2 && reset_selftest(2))
|
||||||
connectedflag |= 2;
|
connectedflag |= 2;
|
||||||
|
|
||||||
|
// XXX should id each one for proper identification
|
||||||
|
if (connectedflag & 1)
|
||||||
|
ps2kbd_init();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user