34 lines
906 B
C
34 lines
906 B
C
static inline void outb(const uint16_t port, const uint8_t val) {
|
|
asm volatile("outb %0, %1" : : "a" (val), "Nd" (port));
|
|
}
|
|
|
|
static inline void outw(const uint16_t port, const uint16_t val) {
|
|
asm volatile("outw %0, %1" : : "a" (val), "Nd" (port));
|
|
}
|
|
|
|
static inline void outl(const uint16_t port, const uint32_t val) {
|
|
asm volatile("outl %0, %1" : : "a" (val), "Nd" (port));
|
|
}
|
|
|
|
static inline uint8_t inb(const uint16_t port) {
|
|
volatile uint8_t ret;
|
|
asm volatile("inb %1, %0" : "=a" (ret) : "Nd" (port));
|
|
return ret;
|
|
}
|
|
|
|
static inline uint16_t inw(const uint16_t port) {
|
|
volatile uint16_t ret;
|
|
asm volatile("inw %1, %0" : "=a" (ret) : "Nd" (port));
|
|
return ret;
|
|
}
|
|
|
|
static inline uint32_t inl(const uint16_t port) {
|
|
volatile uint32_t ret;
|
|
asm volatile("inl %1, %0" : "=a" (ret) : "Nd" (port));
|
|
return ret;
|
|
}
|
|
|
|
static inline void io_wait() {
|
|
outb(0x80, 0);
|
|
}
|
|
|