blob: a12d2fa45f781633fc4570605ade0a51a8fc0d09 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// MIT License, Copyright (c) 2021 Marvin Borner
#include <cpu.h>
/**
* CPU IO
*/
u8 inb(u16 port)
{
u8 value;
__asm__ volatile("inb %1, %0" : "=a"(value) : "Nd"(port));
return value;
}
u16 inw(u16 port)
{
u16 value;
__asm__ volatile("inw %1, %0" : "=a"(value) : "Nd"(port));
return value;
}
void outb(u16 port, u8 data)
{
__asm__ volatile("outb %0, %1" ::"a"(data), "Nd"(port));
}
|