diff options
author | Marvin Borner | 2019-09-15 00:05:48 +0200 |
---|---|---|
committer | Marvin Borner | 2019-09-15 00:05:48 +0200 |
commit | 47fc6fe8bef017d120e6a88f75628003b72b9fe7 (patch) | |
tree | 7b5ced69c6a6aa1986fe721996ccd2d3736b1645 /src | |
parent | 71167b959595616e6573eb6af56335bb145eaa8e (diff) |
Added basic IO receiver/sender
Diffstat (limited to 'src')
-rw-r--r-- | src/io/io.c | 9 | ||||
-rw-r--r-- | src/io/io.h | 10 |
2 files changed, 19 insertions, 0 deletions
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)); +} diff --git a/src/io/io.h b/src/io/io.h new file mode 100644 index 0000000..8d3beda --- /dev/null +++ b/src/io/io.h @@ -0,0 +1,10 @@ +#ifndef MELVIX_IO_H +#define MELVIX_IO_H + +#include <stdint.h> + +unsigned char receive(unsigned short port); + +void send(unsigned short _port, unsigned char _data); + +#endif |