From 8958b87f6517da9dd70b2c8177a91c74df0d1f84 Mon Sep 17 00:00:00 2001 From: starnakin Date: Tue, 10 Sep 2024 16:37:01 +0200 Subject: [PATCH] lib: add: inw, outw --- libbozo/headers/sys/io.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libbozo/headers/sys/io.h b/libbozo/headers/sys/io.h index c072f04..01fc098 100644 --- a/libbozo/headers/sys/io.h +++ b/libbozo/headers/sys/io.h @@ -13,3 +13,15 @@ static inline uint8_t inb(uint16_t port) __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port) : "memory"); return ret; } + +static inline void outw(uint16_t port, uint16_t val) +{ + __asm__ volatile("outb %b0, %w1" : : "a"(val), "Nd"(port) : "memory"); +} + +static inline uint16_t inw(uint16_t port) +{ + uint8_t ret; + __asm__ volatile("inb %w1, %b0" : "=a"(ret) : "Nd"(port) : "memory"); + return ret; +}