6225ca1ccd70708b1677481d7f02c2e40753810e
[h316.git] / pc-tools / ldc / tape.c
1 #include <stdio.h>
2 #include <termios.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <signal.h>
7
8 #include "tape.h"
9
10 static struct termios orgstate;
11 static struct termios workstate;
12
13 static int fd;
14
15 void tapeclose ()
16 {
17 tcsetattr (fd, TCSANOW, &orgstate);
18 close (fd);
19 }
20
21 void tapestart ()
22 {
23 char a = 0x11; //xon;
24 write (fd, &a, 1);
25 }
26
27 void tapestop ()
28 {
29 char a = 0x13; //xoff;
30 write (fd, &a, 1);
31 }
32
33 void tapeinit (int tapefd)
34 {
35 fd = tapefd;
36 tcgetattr (tapefd, &orgstate);
37 tcgetattr (tapefd, &workstate);
38 workstate.c_iflag = 0;
39 workstate.c_oflag = 0;
40 workstate.c_cflag = CS8 | CREAD | CLOCAL | CRTSCTS | CSTOPB;
41 workstate.c_lflag = 0;
42 cfsetspeed (&workstate, B4800);
43 tcsetattr (tapefd, TCSANOW, &workstate);
44 }
45
46 // Ende.