pts: as the decoding demux isn't stored in the dvbchannel (it could be shared, and...
[enigma2.git] / lib / driver / rfmod.cpp
1 #include <lib/driver/rfmod.h>
2
3 #include <unistd.h>
4 #include <fcntl.h>
5 #include <sys/ioctl.h>
6
7 #include <lib/base/init.h>
8 #include <lib/base/init_num.h>
9 #include <lib/base/econfig.h>
10 #include <lib/base/eerror.h>
11
12 #define IOCTL_SET_CHANNEL                                               0
13 #define IOCTL_SET_TESTMODE                                      1
14 #define IOCTL_SET_SOUNDENABLE                           2
15 #define IOCTL_SET_SOUNDSUBCARRIER               3
16 #define IOCTL_SET_FINETUNE                                      4
17 #define IOCTL_SET_STANDBY                                               5
18
19 eRFmod *eRFmod::instance = 0;
20
21 eRFmod::eRFmod()
22 {
23         ASSERT(!instance);
24         instance = this;
25         
26         fd = open("/dev/rfmod0", O_RDWR);
27 }
28
29 eRFmod::~eRFmod()
30 {
31         if(fd > 0)
32                 close(fd);
33 }
34
35 eRFmod *eRFmod::getInstance()
36 {
37         return instance;
38 }
39
40 void eRFmod::setFunction(int val)               //0=Enable 1=Disable
41 {
42         int myval = !val;
43
44         ioctl(fd, IOCTL_SET_STANDBY, &val);
45 }
46
47 void eRFmod::setTestmode(int val)               //0=Enable 1=Disable
48 {
49         ioctl(fd, IOCTL_SET_TESTMODE, &val);
50 }
51
52 void eRFmod::setSoundFunction(int val)          //0=Enable 1=Disable
53 {
54         ioctl(fd, IOCTL_SET_SOUNDENABLE, &val);
55 }
56
57 void eRFmod::setSoundCarrier(int val)
58 {
59         ioctl(fd, IOCTL_SET_SOUNDSUBCARRIER, &val);
60 }
61
62 void eRFmod::setChannel(int val)
63 {
64         ioctl(fd, IOCTL_SET_CHANNEL, &val);
65 }
66
67 void eRFmod::setFinetune(int val)
68 {
69         ioctl(fd, IOCTL_SET_FINETUNE, &val);
70 }
71
72 //FIXME: correct "run/startlevel"
73 eAutoInitP0<eRFmod> init_rfmod(eAutoInitNumbers::rc, "UHF Modulator");