k-chow/k/io.h
Julien CLEMENT 3e881a6f33 fix: coding style
Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
2021-07-12 17:55:13 +02:00

35 lines
579 B
C

#ifndef IO_H_
#define IO_H_
#include <k/types.h>
static inline void outb(u16 port, u8 val)
{
asm volatile ("outb %0, %1" : /* No output */ : "a"(val), "d"(port));
}
static inline u8 inb(u16 port)
{
u8 res;
asm volatile ("inb %1, %0" : "=&a"(res) : "d"(port));
return res;
}
static inline void outw(u16 port, u16 val)
{
asm volatile ("outw %0, %1" : /* No output */ : "a"(val), "d"(port));
}
static inline u16 inw(u16 port)
{
u16 res;
asm volatile ("inw %1, %0" : "=&a"(res) : "d"(port));
return res;
}
#endif /* !IO_H_ */