3c2ebbeb78fd5f48cb1d5d63933c481d8e8fc13b
[super-star-trek.git] / src / sstlinux.c
1 #include "config.h"
2 #include "sstlinux.h"
3
4 #ifdef HAVE_LINUX_KD_H
5
6 #include <sys/types.h>
7 #include <fcntl.h>
8 #include <sys/ioctl.h>
9 #include <linux/kd.h>
10
11 static int fd = 0;
12 #endif
13
14 void sound(unsigned int freq)
15 {
16 #ifdef HAVE_LINUX_KD_H
17     if(fd==0) fd=open("/dev/console", O_RDONLY);
18     if(fd>0) ioctl(fd, KDMKTONE, 1193180/freq + (0xFFFF<<16));
19 #endif
20 }
21
22 void nosound(void)
23 {
24 #ifdef HAVE_LINUX_KD_H
25     if(fd>0) ioctl(fd, KDMKTONE, 0);
26 #endif
27 }