mips32-nemu: add ioe

This commit is contained in:
Zihao Yu 2019-01-14 01:54:43 +08:00
parent 16f8226f12
commit cd55cf1f20
2 changed files with 4 additions and 4 deletions

View File

@ -2,14 +2,14 @@
#include <mips32.h>
#include <amdev.h>
#define KBD_DATA_PORT 0x60
#define KBD_DATA_MMIO 0x4060
#define KEYDOWN_MASK 0x8000
size_t input_read(uintptr_t reg, void *buf, size_t size) {
switch (reg) {
case _DEVREG_INPUT_KBD: {
_KbdReg *kbd = (_KbdReg *)buf;
int k = inl(KBD_DATA_PORT);
int k = inl(KBD_DATA_MMIO);
kbd->keydown = (k & KEYDOWN_MASK ? 1 : 0);
kbd->keycode = k & ~KEYDOWN_MASK;
return sizeof(_KbdReg);

View File

@ -3,7 +3,7 @@
#include <amdev.h>
#include <klib.h>
#define SCREEN_PORT 0x100
#define SCREEN_MMIO 0x4100
static int W, H;
static uint32_t* const fb = (uint32_t *)0x40000;
@ -46,7 +46,7 @@ size_t video_write(uintptr_t reg, void *buf, size_t size) {
}
void vga_init() {
uint32_t data = inl(SCREEN_PORT);
uint32_t data = inl(SCREEN_MMIO);
W = data >> 16;
H = data & 0xffff;
}