OOStuBS - Technische Informatik II (TI-II)
2.4
Hauptseite
Zusätzliche Informationen
Klassen
Dateien
Auflistung der Dateien
Datei-Elemente
include
machine
serial.h
gehe zur Dokumentation dieser Datei
1
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2
* Technische Informatik II *
3
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
4
* *
5
* S E R I A L *
6
* *
7
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
8
9
#ifndef __serial_include__
10
#define __serial_include__
11
12
/* INCLUDES */
13
14
#include <
machine/io_port.h
>
15
16
/* CLASSES */
17
18
class
Serial
{
19
private
:
20
static
const
unsigned
short
address
= 0x3F8;
21
static
const
unsigned
int
maxBaudRate
= 115200;
22
23
struct
ControlByte
{
24
enum
WordSize
{
25
_5Bits
= 0,
26
_6Bits
= 1,
27
_7Bits
= 2,
28
_8Bits
= 3
29
}
size
: 2;
30
enum
StopBits
{
31
One
= 0,
32
Two
= 1
33
}
stopBits
: 1;
34
enum
Parity
{
35
none
= 0,
36
odd
= 1,
37
even
= 2,
38
mark
= 3,
39
space
= 4
40
}
parity
: 3;
41
bool
breakEnable
: 1;
42
bool
divisorAccess
: 1;
43
};
44
45
struct
StatusByte
{
46
bool
dataReady
: 1;
47
bool
overrunError
: 1;
48
bool
parityError
: 1;
49
bool
framingError
: 1;
50
bool
breakInterrupt
: 1;
51
bool
transmitBufferEmpty
: 1;
52
bool
dataEmpty
: 1;
53
bool
FIFOError
: 1;
54
};
55
56
IO_Port
transmitPort
;
57
IO_Port
divisorLowPort
;
58
IO_Port
divisorHighPort
;
59
IO_Port
controlPort
;
60
IO_Port
statusPort
;
61
62
StatusByte
status
();
63
void
control
(
ControlByte
controlByte);
64
ControlByte
control
();
65
unsigned
int
baudRate
(
unsigned
int
divisor);
66
unsigned
int
baudRate
();
67
void
transmit
(
char
c);
68
69
public
:
73
Serial
();
74
78
~Serial
();
79
100
void
print
(
const
char
*
string
,
unsigned
int
n);
101
};
102
103
#endif
Erzeugt am Mon Jun 30 2014 07:13:28 für OOStuBS - Technische Informatik II (TI-II) von
1.8.1.2