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 <stdio.h>
#include <string.h>
@ -30,7 +30,8 @@ int main(int argc, char **argv)
struct dddvb_fe *fe;
struct dddvb_params p;
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;
enum fe_code_rate fec = FEC_AUTO;
enum fe_delivery_system delsys = ~0;
@ -51,16 +52,18 @@ int main(int argc, char **argv)
{"source", required_argument, 0, 'l'},
{"delsys", required_argument, 0, 'd'},
{"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'},
{"num", required_argument, 0, 'n'},
{"mtype", required_argument, 0, 'm'},
{"verbosity", required_argument, 0, 'v'},
{"open_dvr", no_argument, 0, 'o'},
{"help", no_argument , 0, 'h'},
{0, 0, 0, 0}
};
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);
if (c==-1)
break;
@ -90,10 +93,10 @@ int main(int argc, char **argv)
verbosity = strtoul(optarg, NULL, 0);
break;
case 'g':
pls = strtoul(optarg, NULL, 0);
ssi = strtoul(optarg, NULL, 0);
break;
case 'r':
pls = root2gold(strtoul(optarg, NULL, 0));
ssi = root2gold(strtoul(optarg, NULL, 0));
break;
case 'i':
id = strtoul(optarg, NULL, 0);
@ -101,17 +104,41 @@ int main(int argc, char **argv)
case 'n':
num = strtoul(optarg, NULL, 0);
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':
if (!strcmp(optarg, "C"))
delsys = SYS_DVBC_ANNEX_A;
if (!strcmp(optarg, "DVBC"))
delsys = SYS_DVBC_ANNEX_A;
if (!strcmp(optarg, "S"))
delsys = SYS_DVBS;
if (!strcmp(optarg, "DVBS"))
delsys = SYS_DVBS;
if (!strcmp(optarg, "S2"))
delsys = SYS_DVBS2;
if (!strcmp(optarg, "DVBS2"))
delsys = SYS_DVBS2;
if (!strcmp(optarg, "T"))
delsys = SYS_DVBT;
if (!strcmp(optarg, "DVBT"))
delsys = SYS_DVBT;
if (!strcmp(optarg, "T2"))
delsys = SYS_DVBT2;
if (!strcmp(optarg, "DVBT2"))
delsys = SYS_DVBT2;
if (!strcmp(optarg, "J83B"))
delsys = SYS_DVBC_ANNEX_B;
if (!strcmp(optarg, "ISDBC"))
@ -133,7 +160,6 @@ int main(int argc, char **argv)
"\n"
" delivery_system = C,S,S2,T,T2,J83B,ISDBC,ISDBT\n"
" polarity = h,v\n"
" polarity = h,v\n"
"\n");
exit(-1);
default:
@ -172,6 +198,7 @@ int main(int argc, char **argv)
exit(-1);
}
dddvb_param_init(&p);
dddvb_set_mtype(&p, mtype);
dddvb_set_frequency(&p, frequency);
dddvb_set_src(&p, source);
dddvb_set_bandwidth(&p, bandwidth);
@ -179,27 +206,29 @@ int main(int argc, char **argv)
dddvb_set_polarization(&p, pol);
dddvb_set_delsys(&p, delsys);
dddvb_set_id(&p, id);
dddvb_set_pls(&p, pls);
dddvb_set_ssi(&p, ssi);
dddvb_dvb_tune(fe, &p);
#if 0
{
uint8_t ts[188];
dddvb_ca_write(dd, 0, ts, 188);
}
#endif
if (!odvr){
while (1) {
fe_status_t stat;
int64_t str, cnr;
while (1) {
fe_status_t stat;
int64_t str, cnr;
stat = dddvb_get_stat(fe);
str = dddvb_get_strength(fe);
cnr = dddvb_get_cnr(fe);
stat = dddvb_get_stat(fe);
str = dddvb_get_strength(fe);
cnr = dddvb_get_cnr(fe);
printf("stat=%02x, str=%lld.%03llddB, snr=%lld.%03llddB \n",
stat, str/1000, abs(str%1000), cnr/1000, abs(cnr%1000));
printf("stat=%02x, str=%lld.%03llddB, snr=%lld.%03llddB \n",
stat, str/1000, abs(str%1000), cnr/1000, abs(cnr%1000));
sleep(1);
}
}
} else {
#define BUFFSIZE (1024*188)
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);
if (fe->param.param[PARAM_ISI] != DDDVB_UNDEF)
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,
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);
return 0;
}
@ -280,9 +282,9 @@ static int tune_sat(struct dddvb_fe *fe)
freq -= lofs;
else
freq = lofs - freq;
} else
}
#endif
{
if (freq > 2100000) {
if (lofs)
hi = (freq > lofs) ? 1 : 0;
if (hi)
@ -491,7 +493,7 @@ static int tune(struct dddvb_fe *fe)
int ret;
printf("tune()\n");
switch (fe->n_param.param[PARAM_MSYS]) {
switch (fe->param.param[PARAM_MSYS]) {
case SYS_DVBS:
case SYS_DVBS2:
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");
pthread_mutex_lock(&fe->mutex);
memcpy(fe->n_param.param, p->param, sizeof(fe->n_param.param));
fe->n_tune = 1;
memcpy(p->param, fe->n_param.param, sizeof(fe->n_param.param));
pthread_mutex_unlock(&fe->mutex);
return ret;
}
@ -916,3 +917,4 @@ int dddvb_dvb_exit(struct dddvb *dd)
}

View File

@ -7,8 +7,8 @@
#include <pthread.h>
#include <sys/ioctl.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/frontend.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/video.h>
#include <linux/dvb/net.h>
@ -34,7 +34,7 @@
#define PARAM_GI 15
#define PARAM_PLP 16
#define PARAM_ISI 16
#define PARAM_PLS 17
#define PARAM_SSI 17
#define PARAM_T2ID 17
#define PARAM_SM 18
#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;
};
static inline void dddvb_set_pls(struct dddvb_params *p, uint32_t pls) {
p->param[PARAM_PLS] = pls;
static inline void dddvb_set_ssi(struct dddvb_params *p, uint32_t val) {
p->param[PARAM_SSI] = val;
};
static inline void dddvb_set_id(struct dddvb_params *p, uint32_t 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) {
return fe->stat;
};