checkin
authorRonny Strutz <ronny.strutz@multimedia-labs.de>
Fri, 2 Sep 2005 23:38:17 +0000 (23:38 +0000)
committerRonny Strutz <ronny.strutz@multimedia-labs.de>
Fri, 2 Sep 2005 23:38:17 +0000 (23:38 +0000)
lib/driver/rfmod.cpp [new file with mode: 0644]

diff --git a/lib/driver/rfmod.cpp b/lib/driver/rfmod.cpp
new file mode 100644 (file)
index 0000000..5814def
--- /dev/null
@@ -0,0 +1,72 @@
+#include <lib/driver/rfmod.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include <lib/base/init.h>
+#include <lib/base/init_num.h>
+#include <lib/base/econfig.h>
+#include <lib/base/eerror.h>
+
+#define IOCTL_SET_CHANNEL                                              0
+#define IOCTL_SET_TESTMODE                                     1
+#define IOCTL_SET_SOUNDENABLE                          2
+#define IOCTL_SET_SOUNDSUBCARRIER              3
+#define IOCTL_SET_FINETUNE                                     4
+#define IOCTL_SET_STANDBY                                              5
+
+eRFmod *eRFmod::instance = 0;
+
+eRFmod::eRFmod()
+{
+       ASSERT(!instance);
+       instance = this;
+       
+       fd = open("/dev/rfmod0", O_RDWR);
+}
+
+eRFmod::~eRFmod()
+{
+       if(fd > 0)
+               close(fd);
+}
+
+eRFmod *eRFmod::getInstance()
+{
+       return instance;
+}
+
+void eRFmod::setFunction(int val)              //0=Enable 1=Disable
+{
+       int myval = !val;
+
+       ioctl(fd, IOCTL_SET_STANDBY, &val);
+}
+
+void eRFmod::setTestmode(int val)              //0=Enable 1=Disable
+{
+       ioctl(fd, IOCTL_SET_TESTMODE, &val);
+}
+
+void eRFmod::setSoundFunction(int val)         //0=Enable 1=Disable
+{
+       ioctl(fd, IOCTL_SET_SOUNDENABLE, &val);
+}
+
+void eRFmod::setSoundCarrier(int val)
+{
+       ioctl(fd, IOCTL_SET_SOUNDSUBCARRIER, &val);
+}
+
+void eRFmod::setChannel(int val)
+{
+       ioctl(fd, IOCTL_SET_CHANNEL, &val);
+}
+
+void eRFmod::setFinetune(int val)
+{
+}
+
+//FIXME: correct "run/startlevel"
+eAutoInitP0<eRFmod> init_rfmod(eAutoInitNumbers::rc, "UHF Modulator");