summaryrefslogtreecommitdiff
path: root/include/nrvn.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/nrvn.h')
-rw-r--r--include/nrvn.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/nrvn.h b/include/nrvn.h
new file mode 100644
index 0000000..abb03b4
--- /dev/null
+++ b/include/nrvn.h
@@ -0,0 +1,22 @@
+#ifndef _NRVN_H_
+#define _NRVN_H_
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+static inline void outb(uint16_t port, uint8_t val) {
+ asm volatile ("outb %0, %1" : : "a"(val), "Nd"(port) : "memory");
+}
+
+static inline uint8_t inb(uint16_t port) {
+ uint8_t ret;
+ asm volatile ("inb %1, %0" : "=a"(ret) : "Nd"(port) : "memory");
+ return ret;
+}
+
+static inline void io_wait(void) {
+ outb(0x80, 0);
+}
+
+#endif