1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

add support to select higher S2/X modulation types

This commit is contained in:
Ralph Metzler 2019-11-04 19:07:28 +01:00
parent 960ee48a10
commit 7925537b58
3 changed files with 65 additions and 30 deletions

View File

@ -1,4 +1,4 @@
#include <linux/dvb/frontend.h> #include "../include/linux/dvb/frontend.h"
#include "src/libdddvb.h" #include "src/libdddvb.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -30,7 +30,8 @@ int main(int argc, char **argv)
struct dddvb_fe *fe; struct dddvb_fe *fe;
struct dddvb_params p; struct dddvb_params p;
uint32_t bandwidth = 8000000, frequency = 0, symbol_rate = 0, pol = DDDVB_UNDEF; uint32_t bandwidth = 8000000, frequency = 0, symbol_rate = 0, pol = DDDVB_UNDEF;
uint32_t id = DDDVB_UNDEF, pls = DDDVB_UNDEF, num = DDDVB_UNDEF, source = 0; uint32_t id = DDDVB_UNDEF, ssi = DDDVB_UNDEF, num = DDDVB_UNDEF, source = 0;
uint32_t mtype= DDDVB_UNDEF;
uint32_t verbosity = 0; uint32_t verbosity = 0;
enum fe_code_rate fec = FEC_AUTO; enum fe_code_rate fec = FEC_AUTO;
enum fe_delivery_system delsys = ~0; enum fe_delivery_system delsys = ~0;
@ -51,16 +52,18 @@ int main(int argc, char **argv)
{"source", required_argument, 0, 'l'}, {"source", required_argument, 0, 'l'},
{"delsys", required_argument, 0, 'd'}, {"delsys", required_argument, 0, 'd'},
{"id", required_argument, 0, 'i'}, {"id", required_argument, 0, 'i'},
{"pls", required_argument, 0, 'g'}, {"ssi", required_argument, 0, 'g'},
{"gold", required_argument, 0, 'g'},
{"root", required_argument, 0, 'r'}, {"root", required_argument, 0, 'r'},
{"num", required_argument, 0, 'n'}, {"num", required_argument, 0, 'n'},
{"mtype", required_argument, 0, 'm'},
{"verbosity", required_argument, 0, 'v'}, {"verbosity", required_argument, 0, 'v'},
{"open_dvr", no_argument, 0, 'o'}, {"open_dvr", no_argument, 0, 'o'},
{"help", no_argument , 0, 'h'}, {"help", no_argument , 0, 'h'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
c = getopt_long(argc, argv, c = getopt_long(argc, argv,
"c:i:f:s:d:p:hg:r:n:b:l:v:o", "c:i:f:s:d:p:hg:r:n:b:l:v:m:o",
long_options, &option_index); long_options, &option_index);
if (c==-1) if (c==-1)
break; break;
@ -90,10 +93,10 @@ int main(int argc, char **argv)
verbosity = strtoul(optarg, NULL, 0); verbosity = strtoul(optarg, NULL, 0);
break; break;
case 'g': case 'g':
pls = strtoul(optarg, NULL, 0); ssi = strtoul(optarg, NULL, 0);
break; break;
case 'r': case 'r':
pls = root2gold(strtoul(optarg, NULL, 0)); ssi = root2gold(strtoul(optarg, NULL, 0));
break; break;
case 'i': case 'i':
id = strtoul(optarg, NULL, 0); id = strtoul(optarg, NULL, 0);
@ -101,17 +104,41 @@ int main(int argc, char **argv)
case 'n': case 'n':
num = strtoul(optarg, NULL, 0); num = strtoul(optarg, NULL, 0);
break; break;
case 'm':
if (!strcmp(optarg, "16APSK"))
mtype = APSK_16;
if (!strcmp(optarg, "32APSK"))
mtype = APSK_32;
if (!strcmp(optarg, "64APSK"))
mtype = APSK_64;
if (!strcmp(optarg, "128APSK"))
mtype = APSK_128;
if (!strcmp(optarg, "256APSK"))
mtype = APSK_256;
if (mtype == DDDVB_UNDEF)
printf("unknown mtype %s\n", optarg);
break;
case 'd': case 'd':
if (!strcmp(optarg, "C")) if (!strcmp(optarg, "C"))
delsys = SYS_DVBC_ANNEX_A; delsys = SYS_DVBC_ANNEX_A;
if (!strcmp(optarg, "DVBC"))
delsys = SYS_DVBC_ANNEX_A;
if (!strcmp(optarg, "S")) if (!strcmp(optarg, "S"))
delsys = SYS_DVBS; delsys = SYS_DVBS;
if (!strcmp(optarg, "DVBS"))
delsys = SYS_DVBS;
if (!strcmp(optarg, "S2")) if (!strcmp(optarg, "S2"))
delsys = SYS_DVBS2; delsys = SYS_DVBS2;
if (!strcmp(optarg, "DVBS2"))
delsys = SYS_DVBS2;
if (!strcmp(optarg, "T")) if (!strcmp(optarg, "T"))
delsys = SYS_DVBT; delsys = SYS_DVBT;
if (!strcmp(optarg, "DVBT"))
delsys = SYS_DVBT;
if (!strcmp(optarg, "T2")) if (!strcmp(optarg, "T2"))
delsys = SYS_DVBT2; delsys = SYS_DVBT2;
if (!strcmp(optarg, "DVBT2"))
delsys = SYS_DVBT2;
if (!strcmp(optarg, "J83B")) if (!strcmp(optarg, "J83B"))
delsys = SYS_DVBC_ANNEX_B; delsys = SYS_DVBC_ANNEX_B;
if (!strcmp(optarg, "ISDBC")) if (!strcmp(optarg, "ISDBC"))
@ -133,7 +160,6 @@ int main(int argc, char **argv)
"\n" "\n"
" delivery_system = C,S,S2,T,T2,J83B,ISDBC,ISDBT\n" " delivery_system = C,S,S2,T,T2,J83B,ISDBC,ISDBT\n"
" polarity = h,v\n" " polarity = h,v\n"
" polarity = h,v\n"
"\n"); "\n");
exit(-1); exit(-1);
default: default:
@ -172,6 +198,7 @@ int main(int argc, char **argv)
exit(-1); exit(-1);
} }
dddvb_param_init(&p); dddvb_param_init(&p);
dddvb_set_mtype(&p, mtype);
dddvb_set_frequency(&p, frequency); dddvb_set_frequency(&p, frequency);
dddvb_set_src(&p, source); dddvb_set_src(&p, source);
dddvb_set_bandwidth(&p, bandwidth); dddvb_set_bandwidth(&p, bandwidth);
@ -179,14 +206,16 @@ int main(int argc, char **argv)
dddvb_set_polarization(&p, pol); dddvb_set_polarization(&p, pol);
dddvb_set_delsys(&p, delsys); dddvb_set_delsys(&p, delsys);
dddvb_set_id(&p, id); dddvb_set_id(&p, id);
dddvb_set_pls(&p, pls); dddvb_set_ssi(&p, ssi);
dddvb_dvb_tune(fe, &p); dddvb_dvb_tune(fe, &p);
#if 0
{ {
uint8_t ts[188]; uint8_t ts[188];
dddvb_ca_write(dd, 0, ts, 188); dddvb_ca_write(dd, 0, ts, 188);
} }
#endif
if (!odvr){ if (!odvr){
while (1) { while (1) {
fe_status_t stat; fe_status_t stat;

View File

@ -130,9 +130,11 @@ static int set_fe_input(struct dddvb_fe *fe, uint32_t fr,
set_property(fd, DTV_INPUT, input); set_property(fd, DTV_INPUT, input);
if (fe->param.param[PARAM_ISI] != DDDVB_UNDEF) if (fe->param.param[PARAM_ISI] != DDDVB_UNDEF)
set_property(fd, DTV_STREAM_ID, fe->param.param[PARAM_ISI]); set_property(fd, DTV_STREAM_ID, fe->param.param[PARAM_ISI]);
if (fe->param.param[PARAM_PLS] != DDDVB_UNDEF) if (fe->param.param[PARAM_SSI] != DDDVB_UNDEF)
set_property(fd, DTV_SCRAMBLING_SEQUENCE_INDEX, set_property(fd, DTV_SCRAMBLING_SEQUENCE_INDEX,
fe->param.param[PARAM_PLS]); fe->param.param[PARAM_SSI]);
if (fe->param.param[PARAM_MTYPE] != DDDVB_UNDEF)
set_property(fd, DTV_MODULATION, fe->param.param[PARAM_MTYPE]);
set_property(fd, DTV_TUNE, 0); set_property(fd, DTV_TUNE, 0);
return 0; return 0;
} }
@ -280,9 +282,9 @@ static int tune_sat(struct dddvb_fe *fe)
freq -= lofs; freq -= lofs;
else else
freq = lofs - freq; freq = lofs - freq;
} else }
#endif #endif
{ if (freq > 2100000) {
if (lofs) if (lofs)
hi = (freq > lofs) ? 1 : 0; hi = (freq > lofs) ? 1 : 0;
if (hi) if (hi)
@ -491,7 +493,7 @@ static int tune(struct dddvb_fe *fe)
int ret; int ret;
printf("tune()\n"); printf("tune()\n");
switch (fe->n_param.param[PARAM_MSYS]) { switch (fe->param.param[PARAM_MSYS]) {
case SYS_DVBS: case SYS_DVBS:
case SYS_DVBS2: case SYS_DVBS2:
ret = tune_sat(fe); ret = tune_sat(fe);
@ -704,8 +706,7 @@ int dddvb_fe_get(struct dddvb_fe *fe, struct dddvb_params *p)
dbgprintf(DEBUG_DVB, "fe_get\n"); dbgprintf(DEBUG_DVB, "fe_get\n");
pthread_mutex_lock(&fe->mutex); pthread_mutex_lock(&fe->mutex);
memcpy(fe->n_param.param, p->param, sizeof(fe->n_param.param)); memcpy(p->param, fe->n_param.param, sizeof(fe->n_param.param));
fe->n_tune = 1;
pthread_mutex_unlock(&fe->mutex); pthread_mutex_unlock(&fe->mutex);
return ret; return ret;
} }
@ -916,3 +917,4 @@ int dddvb_dvb_exit(struct dddvb *dd)
} }

View File

@ -7,8 +7,8 @@
#include <pthread.h> #include <pthread.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/frontend.h> #include <linux/dvb/frontend.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/video.h> #include <linux/dvb/video.h>
#include <linux/dvb/net.h> #include <linux/dvb/net.h>
@ -34,7 +34,7 @@
#define PARAM_GI 15 #define PARAM_GI 15
#define PARAM_PLP 16 #define PARAM_PLP 16
#define PARAM_ISI 16 #define PARAM_ISI 16
#define PARAM_PLS 17 #define PARAM_SSI 17
#define PARAM_T2ID 17 #define PARAM_T2ID 17
#define PARAM_SM 18 #define PARAM_SM 18
#define PARAM_C2TFT 19 #define PARAM_C2TFT 19
@ -93,14 +93,18 @@ static inline void dddvb_set_fec(struct dddvb_params *p, enum fe_code_rate fec)
p->param[PARAM_FEC] = fec; p->param[PARAM_FEC] = fec;
}; };
static inline void dddvb_set_pls(struct dddvb_params *p, uint32_t pls) { static inline void dddvb_set_ssi(struct dddvb_params *p, uint32_t val) {
p->param[PARAM_PLS] = pls; p->param[PARAM_SSI] = val;
}; };
static inline void dddvb_set_id(struct dddvb_params *p, uint32_t id) { static inline void dddvb_set_id(struct dddvb_params *p, uint32_t id) {
p->param[PARAM_ISI] = id; p->param[PARAM_ISI] = id;
}; };
static inline void dddvb_set_mtype(struct dddvb_params *p, uint32_t val) {
p->param[PARAM_MTYPE] = val;
};
static inline uint32_t dddvb_get_stat(struct dddvb_fe *fe) { static inline uint32_t dddvb_get_stat(struct dddvb_fe *fe) {
return fe->stat; return fe->stat;
}; };