diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2015-02-05 20:57:30 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2015-02-05 20:57:30 -0500 |
| commit | 48e33bd3ee5f62f1b27d8a7aa6cfb697b497e03f (patch) | |
| tree | 94bd01d24866cb5692b0b12a1f876bb2bccde3d0 | |
| parent | e8ff5b7323176f9e1f61e15516a41ce1cd3edb92 (diff) | |
| download | kappa-48e33bd3ee5f62f1b27d8a7aa6cfb697b497e03f.zip kappa-48e33bd3ee5f62f1b27d8a7aa6cfb697b497e03f.tar.gz kappa-48e33bd3ee5f62f1b27d8a7aa6cfb697b497e03f.tar.bz2 kappa-48e33bd3ee5f62f1b27d8a7aa6cfb697b497e03f.tar.xz | |
add outw function
| -rw-r--r-- | kernel/include/io.h | 1 | ||||
| -rw-r--r-- | kernel/io.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/kernel/include/io.h b/kernel/include/io.h index c3c735b..d1177ac 100644 --- a/kernel/include/io.h +++ b/kernel/include/io.h @@ -1,4 +1,5 @@ #include <stdint.h> void outb(uint16_t port, uint8_t val); +void outw(uint16_t port, uint16_t val); uint8_t inb(uint16_t port); uint16_t inw(uint16_t port); diff --git a/kernel/io.c b/kernel/io.c index 9b56b5d..33b7f7c 100644 --- a/kernel/io.c +++ b/kernel/io.c @@ -5,12 +5,19 @@ void outb(uint16_t port, uint8_t val) { asm volatile ("outb %1, %0": :"dN" (port), "a" (val)); } + +void outw(uint16_t port, uint16_t val) +{ + asm volatile ("outw %1, %0": :"dN" (port), "a"(val)); +} + uint8_t inb(uint16_t port) { uint8_t ret; asm volatile ("inb %1, %0" : "=a" (ret) : "dN" (port)); return ret; } + uint16_t inw(uint16_t port) { uint16_t ret; |