mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2023-10-10 13:37:43 +02:00
new tuning for dvbc
This commit is contained in:
parent
95d23821b7
commit
9af63d41f7
121
apps/modtest.c
121
apps/modtest.c
@ -1003,7 +1003,8 @@ int mci_set_stream( int fd, uint8_t stream, uint8_t channel, uint8_t standard,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_dvbt_mods(int adapt, int chans, uint32_t start_freq, write_data *wd)
|
void set_dvb_mods(int adapt, int chans, uint32_t start_freq,
|
||||||
|
enum fe_delivery_system delsys, write_data *wd)
|
||||||
{
|
{
|
||||||
if ((mci_set_output_simple(adapt, chans) < 0)||
|
if ((mci_set_output_simple(adapt, chans) < 0)||
|
||||||
(mci_set_channels_simple(adapt, start_freq, chans)< 0))
|
(mci_set_channels_simple(adapt, start_freq, chans)< 0))
|
||||||
@ -1019,6 +1020,8 @@ void set_dvbt_mods(int adapt, int chans, uint32_t start_freq, write_data *wd)
|
|||||||
char *device;
|
char *device;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
switch(delsys){
|
||||||
|
case SYS_DVBT:
|
||||||
wd->tp[i].tpid = 1; // all the same transport stream id
|
wd->tp[i].tpid = 1; // all the same transport stream id
|
||||||
wd->tp[i].delsys = SYS_DVBT;
|
wd->tp[i].delsys = SYS_DVBT;
|
||||||
wd->tp[i].freq = start_freq+8000000*i;
|
wd->tp[i].freq = start_freq+8000000*i;
|
||||||
@ -1028,6 +1031,20 @@ void set_dvbt_mods(int adapt, int chans, uint32_t start_freq, write_data *wd)
|
|||||||
wd->tp[i].guard = 0;
|
wd->tp[i].guard = 0;
|
||||||
wd->tp[i].code_rate = 4;
|
wd->tp[i].code_rate = 4;
|
||||||
wd->tp[i].trans_mode = MOD_STANDARD_DVBT_8;
|
wd->tp[i].trans_mode = MOD_STANDARD_DVBT_8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SYS_DVBC_ANNEX_A:
|
||||||
|
wd->tp[i].tpid = i;
|
||||||
|
wd->tp[i].delsys = SYS_DVBC_ANNEX_A;
|
||||||
|
wd->tp[i].freq = start_freq+8000000*i;
|
||||||
|
wd->tp[i].qam = QAM_256;
|
||||||
|
wd->tp[i].symbolrate = 6900000;
|
||||||
|
wd->tp[i].bandwidth = 0;
|
||||||
|
wd->tp[i].guard = 0;
|
||||||
|
wd->tp[i].code_rate = 0;
|
||||||
|
wd->tp[i].trans_mode = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
device = malloc(sizeof(char)*40);
|
device = malloc(sizeof(char)*40);
|
||||||
snprintf(device,35,"/dev/dvb/adapter%d/mod%d",adapt,i);
|
snprintf(device,35,"/dev/dvb/adapter%d/mod%d",adapt,i);
|
||||||
@ -1045,104 +1062,6 @@ void set_dvbt_mods(int adapt, int chans, uint32_t start_freq, write_data *wd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
//++++++++++++++++++++++++++++++++DVBC MOD++++++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
static int set_property(int fd, uint32_t cmd, uint32_t data)
|
|
||||||
{
|
|
||||||
struct dtv_property p;
|
|
||||||
struct dtv_properties c;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
p.cmd = cmd;
|
|
||||||
c.num = 1;
|
|
||||||
c.props = &p;
|
|
||||||
p.u.data = data;
|
|
||||||
ret = ioctl(fd, FE_SET_PROPERTY, &c);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "FE_SET_PROPERTY returned %d\n", errno);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int set_input_bitrate(int fd, uint64_t data)
|
|
||||||
{
|
|
||||||
struct dtv_property p;
|
|
||||||
struct dtv_properties c;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
p.cmd = MODULATOR_INPUT_BITRATE;
|
|
||||||
c.num = 1;
|
|
||||||
c.props = &p;
|
|
||||||
p.u.data64 = data;
|
|
||||||
ret = ioctl(fd, FE_SET_PROPERTY, &c);
|
|
||||||
if (ret < 0) {
|
|
||||||
fprintf(stderr, "FE_SET_PROPERTY returned %d\n", errno);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_dvbc_mods(int adapt, int chans, uint32_t start_freq, write_data *wd)
|
|
||||||
{
|
|
||||||
uint32_t freq = start_freq;
|
|
||||||
uint8_t qam = QAM_256;
|
|
||||||
uint32_t sym = 6900000;
|
|
||||||
|
|
||||||
wd->chans = chans;
|
|
||||||
wd->fd_out = (int *)malloc(chans*sizeof(int));
|
|
||||||
memset(wd->fd_out,0,chans*sizeof(int));
|
|
||||||
|
|
||||||
for (int i = 0; i < chans; i++){
|
|
||||||
char *device;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
wd->tp[i].tpid = i;
|
|
||||||
wd->tp[i].delsys = SYS_DVBC_ANNEX_A;
|
|
||||||
wd->tp[i].freq = freq;
|
|
||||||
wd->tp[i].qam = qam;
|
|
||||||
wd->tp[i].symbolrate = sym;
|
|
||||||
wd->tp[i].bandwidth = 0;
|
|
||||||
wd->tp[i].guard = 0;
|
|
||||||
wd->tp[i].code_rate = 0;
|
|
||||||
wd->tp[i].trans_mode = 0;
|
|
||||||
|
|
||||||
device = malloc(sizeof(char)*40);
|
|
||||||
snprintf(device,35,"/dev/dvb/adapter%d/mod%d",adapt,i);
|
|
||||||
fd = open(device, O_RDWR);
|
|
||||||
if( fd < 0 )
|
|
||||||
{
|
|
||||||
fprintf(stderr,"Error opening %s : %s\n",device,strerror(errno));
|
|
||||||
free(device);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (set_property(fd, MODULATOR_FREQUENCY, freq) < 0){
|
|
||||||
fprintf(stderr,"setting freq %d failed\n",freq);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (set_property(fd, MODULATOR_MODULATION, qam) < 0){
|
|
||||||
fprintf(stderr,"setting qam %d failed\n",qam);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (set_property(fd, MODULATOR_SYMBOL_RATE, sym) < 0){
|
|
||||||
fprintf(stderr,"setting sym %d failed\n",sym);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (set_input_bitrate(fd, (DEFAULT_BIT_RATE_C << 32)) < 0){
|
|
||||||
fprintf(stderr,"setting bitrate %d failed\n",
|
|
||||||
(int)DEFAULT_BIT_RATE_C);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
freq += 8000000;
|
|
||||||
close(fd);
|
|
||||||
free(device);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//+++++++++++++++++++++++++++++CLI++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++CLI++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@ -1296,9 +1215,9 @@ int main(int argc, char **argv)
|
|||||||
chans = ddevices.ndevs[adapt];
|
chans = ddevices.ndevs[adapt];
|
||||||
|
|
||||||
if (dvbt){
|
if (dvbt){
|
||||||
set_dvbt_mods(adapt, chans, start_freq, &wd);
|
set_dvb_mods(adapt, chans, start_freq, SYS_DVBT, &wd);
|
||||||
} else {
|
} else {
|
||||||
set_dvbc_mods(adapt, chans, start_freq, &wd);
|
set_dvb_mods(adapt, chans, start_freq, SYS_DVBC_ANNEX_A, &wd);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,"Reading from %s\n", filename);
|
fprintf(stderr,"Reading from %s\n", filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user