Große Umstellung. Viel hinzugefügt.
[h316.git] / pc-tools / ldc / tape.c
diff --git a/pc-tools/ldc/tape.c b/pc-tools/ldc/tape.c
new file mode 100644 (file)
index 0000000..6225ca1
--- /dev/null
@@ -0,0 +1,46 @@
+#include <stdio.h>
+#include <termios.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include "tape.h"
+
+static struct termios orgstate;
+static struct termios workstate;
+
+static int fd;
+
+void tapeclose ()
+{
+    tcsetattr (fd, TCSANOW, &orgstate);
+    close (fd);
+}
+
+void tapestart ()
+{
+    char a = 0x11;             //xon;
+    write (fd, &a, 1);
+}
+
+void tapestop ()
+{
+    char a = 0x13;             //xoff;
+    write (fd, &a, 1);
+}
+
+void tapeinit (int tapefd)
+{
+    fd = tapefd;
+    tcgetattr (tapefd, &orgstate);
+    tcgetattr (tapefd, &workstate);
+    workstate.c_iflag = 0;
+    workstate.c_oflag = 0;
+    workstate.c_cflag = CS8 | CREAD | CLOCAL | CRTSCTS | CSTOPB;
+    workstate.c_lflag = 0;
+    cfsetspeed (&workstate, B4800);
+    tcsetattr (tapefd, TCSANOW, &workstate);
+}
+
+// Ende.