diff options
-rw-r--r-- | dvb-spec/dvbapi/examples.tex | 115 | ||||
-rw-r--r-- | dvb-spec/dvbapi/intro.tex | 9 | ||||
-rw-r--r-- | dvb-spec/dvbapi/title.tex | 4 |
3 files changed, 64 insertions, 64 deletions
diff --git a/dvb-spec/dvbapi/examples.tex b/dvb-spec/dvbapi/examples.tex index d2786a6f6..114579b80 100644 --- a/dvb-spec/dvbapi/examples.tex +++ b/dvb-spec/dvbapi/examples.tex @@ -23,30 +23,32 @@ tuners, but can easily be adjusted for QAM. #include <sys/poll.h> #define DMX "/dev/ost/demux" -#define QPSK "/dev/ost/qpskfe" +#define FRONT "/dev/ost/frontend" #define SEC "/dev/ost/sec" -/* routine for checking if we have a signal */ -int has_signal(int front) +/* routine for checking if we have a signal and other status information*/ +int FEReadStatus(int fd, FrontendStatus *stat) { - feStatus stat; - - if ( front < 0 ){ - if((front = open(QPSK,O_RDWR)) < 0){ - perror("FRONTEND DEVICE: "); - return -1; - } - } + int ans; - FEReadStatus(front, &stat); - if (stat & FE_HAS_SIGNAL) - return 0; - else { - printf("Tuning failed\n"); + if ( (ans = ioctl(fd,FE_READ_STATUS,stat) < 0)){ + perror("FE READ STATUS: "); return -1; } + + if (*stat & FE_HAS_POWER) + printf("FE HAS POWER\n"); + + if (*stat & FE_HAS_SIGNAL) + printf("FE HAS SIGNAL\n"); + + if (*stat & FE_SPECTRUM_INV) + printf("SPEKTRUM INV\n"); + + return 0; } + /* tune qpsk */ /* freq: frequency of transponder */ /* vpid, apid, tpid: PIDs of video, audio and teletext TS packets */ @@ -65,14 +67,15 @@ int set_qpsk_channel(int freq, int vpid, int apid, int tpid, struct secCommand scmd; struct secCmdSequence scmds; struct dmxPesFilterParams pesFilterParams; - struct qpskParameters qpsk; + FrontendParameters frp; struct pollfd pfd[1]; - struct qpskEvent event; - int front, sec, demux1, demux2, demux3; + FrontendEvent event; + int demux1, dmeux2, demux3, front, - /* Open all the necessary the devices */ + frequency = (uint32_t) freq; + symbolrate = (uint32_t) srate; - if((front = open(QPSK,O_RDWR)) < 0){ + if((front = open(FRONT,O_RDWR)) < 0){ perror("FRONTEND DEVICE: "); return -1; } @@ -82,40 +85,41 @@ int set_qpsk_channel(int freq, int vpid, int apid, int tpid, return -1; } - if ((demux1 = open(DMX, O_RDWR|O_NONBLOCK)) < 0){ - perror("DEMUX DEVICE: "); - return -1; + if (demux1 < 0){ + if ((demux1=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } } - if ((demux2 = open(DMX, O_RDWR|O_NONBLOCK)) < 0){ - perror("DEMUX DEVICE: "); - return -1; + if (demux2 < 0){ + if ((demux2=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } } - if ((demux3 = open(DMX, O_RDWR|O_NONBLOCK)) < 0){ - perror("DEMUX DEVICE: "); - return -1; + if (demux3 < 0){ + if ((demux3=open(DMX, O_RDWR|O_NONBLOCK)) + < 0){ + perror("DEMUX DEVICE: "); + return -1; + } } - /* Set the frequency of the transponder, taking into account the - local frequencies of the LNB */ - if (freq < lnb_slof) { - qpsk.iFrequency = (freq - lnb_lof1); + frp.Frequency = (freq - lnb_lof1); scmds.continuousTone = SEC_TONE_OFF; } else { - qpsk.iFrequency = (freq - lnb_lof2); + frp.Frequency = (freq - lnb_lof2); scmds.continuousTone = SEC_TONE_ON; } - - /* Set the polarity of the transponder by setting the correct - voltage on the universal LNB */ - + frp.Inversion = INVERSION_AUTO; if (pol) scmds.voltage = SEC_VOLTAGE_18; else scmds.voltage = SEC_VOLTAGE_13; - - /* In case we have a DiSEqC, set it to the correct address */ - + scmd.type=0; scmd.u.diseqc.addr=0x10; scmd.u.diseqc.cmd=0x38; @@ -127,32 +131,31 @@ int set_qpsk_channel(int freq, int vpid, int apid, int tpid, scmds.miniCommand=SEC_MINI_NONE; scmds.numCommands=1; scmds.commands=&scmd; - - /* Send the data to the SEC device to prepare the LNB for tuning */ if (ioctl(sec, SEC_SEND_SEQUENCE, &scmds) < 0){ perror("SEC SEND: "); return -1; } - /* Set symbol rate and FEC */ + if (ioctl(sec, SEC_SEND_SEQUENCE, &scmds) < 0){ + perror("SEC SEND: "); + return -1; + } - qpsk.SymbolRate = srate; - qpsk.FEC_inner = fec; + frp.u.qpsk.SymbolRate = srate; + frp.u.qpsk.FEC_inner = fec; - /* Now send it all to the frontend device */ - if (ioctl(front, QPSK_TUNE, &qpsk) < 0){ + if (ioctl(front, FE_SET_FRONTEND, &frp) < 0){ perror("QPSK TUNE: "); return -1; } - /* poll for QPSK event to check if tuning worked */ pfd[0].fd = front; pfd[0].events = POLLIN; if (poll(pfd,1,3000)){ if (pfd[0].revents & POLLIN){ printf("Getting QPSK event\n"); - if ( ioctl(front, QPSK_GET_EVENT, &event) + if ( ioctl(front, FE_GET_EVENT, &event) == -EBUFFEROVERFLOW){ perror("qpsk get event"); @@ -166,15 +169,14 @@ int set_qpsk_channel(int freq, int vpid, int apid, int tpid, case FE_FAILURE_EV: printf("failure event\n"); return -1; - case FE_COMPLETION_EV: + + case FE_COMPLETION_EV: printf("completion event\n"); } } } - /* Set the filters for video, audio and teletext demuxing */ - pesFilterParams.pid = vpid; pesFilterParams.input = DMX_IN_FRONTEND; pesFilterParams.output = DMX_OUT_DECODER; @@ -205,8 +207,7 @@ int set_qpsk_channel(int freq, int vpid, int apid, int tpid, return -1; } - /* check if we have a signal */ - return has_signal(front); + return has_signal(fds); } \end{verbatim} @@ -262,7 +263,7 @@ int switch_to_record(int demux1, int demux2, uint16_t vpid, uint16_t apid) } if (demux2 < 0){ - if ((demux2=open(DMXdemuxs, O_RDWR|O_NONBLOCK)) + if ((demux2=open(DMX, O_RDWR|O_NONBLOCK)) < 0){ perror("DEMUX DEVICE: "); return -1; diff --git a/dvb-spec/dvbapi/intro.tex b/dvb-spec/dvbapi/intro.tex index acb6b4b85..e026a86e1 100644 --- a/dvb-spec/dvbapi/intro.tex +++ b/dvb-spec/dvbapi/intro.tex @@ -110,8 +110,7 @@ The individual devices are called \begin{itemize} \item \texttt{/dev/ost/audio}, \item \texttt{/dev/ost/video}, -\item \texttt{/dev/ost/qpskfe}, -\item \texttt{/dev/ost/qamfe}, +\item \texttt{/dev/ost/frontend}, \item \texttt{/dev/ost/sec}, \item \texttt{/dev/ost/demux}, \item \texttt{/dev/ost/ca}, @@ -151,7 +150,7 @@ with multiple DVB cards with more than one frontend or demultiplexer. Consider, e.g., two DVB cards, one with two frontends and one demultiplexer, the other with one frontend and two demultiplexers. If we just assign them consecutive numbers, there would be a demultiplexer -and a frontend which do notbelong to the same card but have +and a frontend which do not belong to the same card but have the same number. With \textsl{devfs} we propose a different scheme for the device names. @@ -169,14 +168,14 @@ two demultiplexers and an MPEG2 audio/video decoder is added, the complete \texttt{/dev/dvb} tree will look like this: \begin{verbatim} -/dev/dvb/card0/qam0 +/dev/dvb/card0/frontend0 demux0 /dev/dvb/card1/video0 audio0 demux0 demux1 - qpskfe0 + frontend0 sec0 \end{verbatim} diff --git a/dvb-spec/dvbapi/title.tex b/dvb-spec/dvbapi/title.tex index ce8b584c1..574464d23 100644 --- a/dvb-spec/dvbapi/title.tex +++ b/dvb-spec/dvbapi/title.tex @@ -12,7 +12,7 @@ % Rosenthalerstr. 51\\ % 10178 Berlin\\Germany } -\date{09/15/2001\\V 0.9.4} +\date{02/14/2002\\V 0.9.4} \maketitle \newpage @@ -21,4 +21,4 @@ % Local Variables: % mode: latex % TeX-master: "dvbapi" -% End:
\ No newline at end of file +% End: |