All old versions moved to 'historic' directoery.
[super-star-trek.git] / historic / c-version / src / sstlinux.c
diff --git a/historic/c-version/src/sstlinux.c b/historic/c-version/src/sstlinux.c
new file mode 100644 (file)
index 0000000..422c305
--- /dev/null
@@ -0,0 +1,30 @@
+#include "config.h"
+#include "sstlinux.h"
+
+#ifdef HAVE_LINUX_KD_H
+
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/kd.h>
+
+static int fd = 0;
+#endif
+
+void sound(unsigned int freq)
+{
+#ifdef HAVE_LINUX_KD_H
+    if (fd==0)
+       fd=open("/dev/console", O_RDONLY);
+    if (fd>0)
+       ioctl(fd, KDMKTONE, 1193180/freq + (0xFFFF<<16));
+#endif
+}
+
+void nosound(void)
+{
+#ifdef HAVE_LINUX_KD_H
+    if(fd>0)
+       ioctl(fd, KDMKTONE, 0);
+#endif
+}