blob: 460f2309dc1cbce63144bff4884980b5edcef1cc (
plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#ifndef _SYS_IO_H
#define _SYS_IO_H
#include <inttypes.h>
static inline uint8_t inb(uint16_t p)
{
uint8_t v;
asm volatile("inb %1,%0" : "=a" (v) : "Nd" (p));
return v;
}
static inline uint16_t inw(uint16_t p)
{
uint16_t v;
asm volatile("inw %1,%0" : "=a" (v) : "Nd" (p));
return v;
}
static inline uint32_t inl(uint16_t p)
{
uint32_t v;
asm volatile("inl %1,%0" : "=a" (v) : "Nd" (p));
return v;
}
static inline void outb(uint8_t v, uint16_t p)
{
asm volatile("outb %0,%1" : : "a" (v), "Nd" (p));
}
static inline void outw(uint16_t v, uint16_t p)
{
asm volatile("outw %0,%1" : : "a" (v), "Nd" (p));
}
static inline void outl(uint32_t v, uint16_t p)
{
asm volatile("outl %0,%1" : : "a" (v), "Nd" (p));
}
#endif /* _SYS_IO_H */
|