1#ifndef IO_H
 2#define IO_H
 3
 4// Read a byte from a port
 5static inline unsigned char inb(unsigned short port) {
 6	unsigned char result;
 7	__asm__ volatile("inb %1, %0" : "=a"(result) : "Nd"(port));
 8	return result;
 9}
10
11// Write a byte to a port
12static inline void outb(unsigned short port, unsigned char data) {
13	__asm__ volatile("outb %0, %1" : : "a"(data), "Nd"(port));
14}
15
16// Small delay for PIC operations
17static inline void io_wait(void) {
18	outb(0x80, 0);
19}
20
21#endif