Add PNP functions

This commit is contained in:
Jeremy Soller 2019-11-22 14:30:30 -07:00
parent da60fc9080
commit 75e0a0b3f9
No known key found for this signature in database
GPG Key ID: E988B49EE78A7FB1
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#ifndef _BOARD_PNP_H
#define _BOARD_PNP_H
void pnp_enable(void);
#endif // _BOARD_PNP_H

View File

@ -0,0 +1,43 @@
#include <stdint.h>
#include <common/debug.h>
volatile uint8_t __xdata __at(0x1200) IHIOA;
volatile uint8_t __xdata __at(0x1201) IHD;
volatile uint8_t __xdata __at(0x1204) IBMAE;
volatile uint8_t __xdata __at(0x1205) IBCTL;
void e2ci_write(uint8_t port, uint8_t data) {
while (IBCTL & ((1 << 2) | (1 << 1))) {}
IHIOA = port;
IHD = data;
IBMAE = 1;
IBCTL = 1;
while (IBCTL & (1 << 2)) {}
IBMAE = 0;
IBCTL = 0;
}
void pnp_write(uint8_t reg, uint8_t data) {
e2ci_write(0x2E, reg);
e2ci_write(0x2F, data);
}
void pnp_enable() {
DEBUG("Enable PNP devices\n");
// Enable PMC
pnp_write(0x07, 0x11);
pnp_write(0x30, 0x01);
// Enable KBC keyboard
pnp_write(0x07, 0x06);
pnp_write(0x30, 0x01);
// Enable KBC mouse
pnp_write(0x07, 0x05);
pnp_write(0x30, 0x01);
// Enable SWUC
pnp_write(0x07, 0x04);
pnp_write(0x30, 0x01);
}