From b2e2cdb19bd14a54b2d18a490a156b34f0b52d1d Mon Sep 17 00:00:00 2001 From: Xnoe Date: Mon, 6 Sep 2021 17:34:48 +0100 Subject: [PATCH] Add inw and outw commands in preparation for ATA-PIO support --- io.c | 9 +++++++++ io.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/io.c b/io.c index bcd6885..ae78e65 100644 --- a/io.c +++ b/io.c @@ -7,4 +7,13 @@ uint8_t inb(uint16_t portnumber) { uint8_t result; asm volatile("inb %1, %0" : "=a" (result) : "Nd" (portnumber)); return result; +} + +void outw(uint16_t portnumber, uint16_t data) { + asm volatile("outw %0, %1" : : "a" (data), "Nd" (portnumber)); +} +uint16_t inw(uint16_t portnumber) { + uint16_t result; + asm volatile("inw %1, %0" : "=a" (result) : "Nd" (portnumber)); + return result; } \ No newline at end of file diff --git a/io.h b/io.h index a558cf3..8df8ec6 100644 --- a/io.h +++ b/io.h @@ -6,4 +6,7 @@ void outb(uint16_t portnumber, uint8_t data); uint8_t inb(uint16_t portnumber); +void outw(uint16_t portnumber, uint16_t data); +uint16_t inw(uint16_t portnumber); + #endif \ No newline at end of file