OOStuBS - Technische Informatik II (TI-II)
2.4
Hauptseite
Zusätzliche Informationen
Klassen
Dateien
Auflistung der Dateien
Datei-Elemente
include
machine
io_port.h
gehe zur Dokumentation dieser Datei
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2
* Technische Informatik II *
3
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4
* *
5
* I O _ P O R T *
6
* *
7
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8
9
#ifndef __io_port_include__
10
#define __io_port_include__
11
19
class
IO_Port
{
20
private
:
22
unsigned
short
address
;
23
public
:
25
IO_Port
(
unsigned
short
a) :
address
(a) {};
26
31
void
outb
(
unsigned
char
val)
const
{
32
asm
(
"outb %1, %0"
33
:
34
:
"d"
(
address
),
"a"
(val)
35
);
36
};
37
42
void
outw
(
unsigned
short
val)
const
{
43
asm
(
"out %1, %0"
44
:
45
:
"d"
(
address
),
"a"
(val)
46
);
47
};
48
53
unsigned
char
inb
()
const
{
54
volatile
char
val=0;
55
asm
(
56
"in %0, %%al\t\n"
57
"mov %%al, (%1)"
58
:
59
:
"d"
(
address
),
"r"
(&val)
60
:
"%al"
61
);
62
return
val;
63
};
64
69
unsigned
short
inw
()
const
{
70
volatile
short
val=0;
71
asm
(
72
"in %0, %%ax\t\n"
73
"mov %%ax, (%1)"
74
:
75
:
"d"
(
address
),
"r"
(&val)
76
:
"%ax"
77
);
78
return
val;
79
};
80
};
81
82
#endif
Erzeugt am Mon Jun 30 2014 07:13:28 für OOStuBS - Technische Informatik II (TI-II) von
1.8.1.2