From 47fc6fe8bef017d120e6a88f75628003b72b9fe7 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 15 Sep 2019 00:05:48 +0200 Subject: Added basic IO receiver/sender --- src/io/io.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/io/io.c (limited to 'src/io/io.c') diff --git a/src/io/io.c b/src/io/io.c new file mode 100644 index 0000000..d617cf2 --- /dev/null +++ b/src/io/io.c @@ -0,0 +1,9 @@ +unsigned char receive(unsigned short port) { + unsigned char value; + __asm__ __volatile__ ("inb %1, %0" : "=a" (value) : "dN" (port)); + return value; +} + +void send(unsigned short _port, unsigned char _data) { + __asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data)); +} -- cgit v1.2.3