ldc: Small fixes (includes, less warnings etc.)
[h316.git] / pc-tools / ldc / tape.c
CommitLineData
437b3ba8 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>
d34afc1e 7#include <unistd.h>
437b3ba8 8
9#include "tape.h"
10
11static struct termios orgstate;
12static struct termios workstate;
13
14static int fd;
15
16void tapeclose ()
17{
18 tcsetattr (fd, TCSANOW, &orgstate);
19 close (fd);
20}
21
22void tapestart ()
23{
24 char a = 0x11; //xon;
25 write (fd, &a, 1);
26}
27
28void tapestop ()
29{
30 char a = 0x13; //xoff;
31 write (fd, &a, 1);
32}
33
34void tapeinit (int tapefd)
35{
36 fd = tapefd;
37 tcgetattr (tapefd, &orgstate);
38 tcgetattr (tapefd, &workstate);
39 workstate.c_iflag = 0;
40 workstate.c_oflag = 0;
41 workstate.c_cflag = CS8 | CREAD | CLOCAL | CRTSCTS | CSTOPB;
42 workstate.c_lflag = 0;
43 cfsetspeed (&workstate, B4800);
44 tcsetattr (tapefd, TCSANOW, &workstate);
45}
46
47// Ende.