From cc7a33b0cf6d60015d8fcab6ada20c1cbfbc39fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Quei=C3=9Fner?= Date: Wed, 4 May 2016 16:30:33 +0200 Subject: [PATCH] Adds io.hpp --- prototypes/base/include/io.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 prototypes/base/include/io.hpp diff --git a/prototypes/base/include/io.hpp b/prototypes/base/include/io.hpp new file mode 100644 index 0000000..4b0443e --- /dev/null +++ b/prototypes/base/include/io.hpp @@ -0,0 +1,13 @@ +#pragma once + +static inline void outb(uint16_t port, uint8_t data) +{ + __asm__ volatile ("outb %0, %1" : : "a" (data), "Nd" (port)); +} + +static inline uint8_t inb(uint16_t port) +{ + uint8_t data; + __asm__ volatile ("inb %1, %0" : "=a" (data) : "d" (port)); + return data; +} \ No newline at end of file