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

initial support for SDR IQ card

This commit is contained in:
Ralph Metzler 2018-10-07 18:07:14 +02:00
parent dc45a08c10
commit 448b07091d
4 changed files with 65 additions and 12 deletions

View File

@ -267,7 +267,11 @@ int main(int argc, char **argv)
break; break;
case 0x0220: case 0x0220:
fname="SDRModulatorV1A_DD01_0220.fpga"; fname="SDRModulatorV1A_DD01_0220.fpga";
printf("SDRModulator\n"); printf("SDRModulator ATV\n");
break;
case 0x0221:
fname="SDRModulatorV1A_DD01_0221_IQ.fpga";
printf("SDRModulator IQ\n");
break; break;
default: default:
printf("UNKNOWN\n"); printf("UNKNOWN\n");

View File

@ -517,10 +517,20 @@ static const struct ddb_info ddb_mod_fsm_4 = {
.lostlock_irq = 9, .lostlock_irq = 9,
}; };
static const struct ddb_info ddb_sdr = { static const struct ddb_info ddb_sdr_atv = {
.type = DDB_MOD, .type = DDB_MOD,
.name = "Digital Devices SDR", .name = "Digital Devices SDR ATV",
.version = 3, .version = 16,
.regmap = &octopus_sdr_map,
.port_num = 16,
.temp_num = 1,
.tempmon_irq = 8,
};
static const struct ddb_info ddb_sdr_iq = {
.type = DDB_MOD,
.name = "Digital Devices SDR IQ",
.version = 17,
.regmap = &octopus_sdr_map, .regmap = &octopus_sdr_map,
.port_num = 16, .port_num = 16,
.temp_num = 1, .temp_num = 1,
@ -777,7 +787,8 @@ static const struct ddb_device_id ddb_device_ids[] = {
DDB_DEVID(0x0210, 0x0001, ddb_mod_fsm_24), DDB_DEVID(0x0210, 0x0001, ddb_mod_fsm_24),
DDB_DEVID(0x0210, 0x0002, ddb_mod_fsm_16), DDB_DEVID(0x0210, 0x0002, ddb_mod_fsm_16),
DDB_DEVID(0x0210, 0x0003, ddb_mod_fsm_8), DDB_DEVID(0x0210, 0x0003, ddb_mod_fsm_8),
DDB_DEVID(0x0220, 0x0001, ddb_sdr), DDB_DEVID(0x0220, 0x0001, ddb_sdr_atv),
DDB_DEVID(0x0221, 0x0001, ddb_sdr_iq),
/* testing on OctopusNet Pro */ /* testing on OctopusNet Pro */
DDB_DEVID(0x0320, 0xffff, ddb_octopro_hdin), DDB_DEVID(0x0320, 0xffff, ddb_octopro_hdin),

View File

@ -424,6 +424,7 @@ static const struct pci_device_id ddb_id_table[] __devinitconst = {
DDB_DEVICE_ANY(0x0203), DDB_DEVICE_ANY(0x0203),
DDB_DEVICE_ANY(0x0210), DDB_DEVICE_ANY(0x0210),
DDB_DEVICE_ANY(0x0220), DDB_DEVICE_ANY(0x0220),
DDB_DEVICE_ANY(0x0221),
DDB_DEVICE_ANY(0x0320), DDB_DEVICE_ANY(0x0320),
DDB_DEVICE_ANY(0x0321), DDB_DEVICE_ANY(0x0321),
DDB_DEVICE_ANY(0x0322), DDB_DEVICE_ANY(0x0322),

View File

@ -292,7 +292,7 @@ int ddbridge_mod_output_start(struct ddb_output *output)
struct ddb_mod *mod = &dev->mod[output->nr]; struct ddb_mod *mod = &dev->mod[output->nr];
u32 Symbolrate = mod->symbolrate; u32 Symbolrate = mod->symbolrate;
if (dev->link[0].info->version < 3) if (dev->link[0].info->version < 16)
mod_calc_rateinc(mod); mod_calc_rateinc(mod);
mod->LastInPacketCount = 0; mod->LastInPacketCount = 0;
@ -311,7 +311,7 @@ int ddbridge_mod_output_start(struct ddb_output *output)
mod->State = CM_STARTUP; mod->State = CM_STARTUP;
mod->StateCounter = CM_STARTUP_DELAY; mod->StateCounter = CM_STARTUP_DELAY;
if (dev->link[0].info->version == 3) if (dev->link[0].info->version >= 16)
mod->Control = 0xfffffff0 & mod->Control = 0xfffffff0 &
ddbreadl(dev, CHANNEL_CONTROL(output->nr)); ddbreadl(dev, CHANNEL_CONTROL(output->nr));
else else
@ -363,11 +363,11 @@ int ddbridge_mod_output_start(struct ddb_output *output)
CHANNEL_SETTINGS(output->nr)); CHANNEL_SETTINGS(output->nr));
mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ | mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ |
CHANNEL_CONTROL_ENABLE_DVB); CHANNEL_CONTROL_ENABLE_DVB);
} else if (dev->link[0].info->version == 3) { } else if (dev->link[0].info->version >= 16) {
mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ | mod->Control |= (CHANNEL_CONTROL_ENABLE_IQ |
CHANNEL_CONTROL_ENABLE_DVB); CHANNEL_CONTROL_ENABLE_DVB);
} }
if (dev->link[0].info->version < 3) { if (dev->link[0].info->version < 16) {
mod_set_rateinc(dev, output->nr); mod_set_rateinc(dev, output->nr);
mod_set_incs(output); mod_set_incs(output);
} }
@ -1499,7 +1499,7 @@ static int mod3_prop_proc(struct ddb_mod *mod, struct dtv_property *tvp)
static int mod_prop_proc(struct ddb_mod *mod, struct dtv_property *tvp) static int mod_prop_proc(struct ddb_mod *mod, struct dtv_property *tvp)
{ {
if (mod->port->dev->link[0].info->version == 3) if (mod->port->dev->link[0].info->version >= 16)
return mod3_prop_proc(mod, tvp); return mod3_prop_proc(mod, tvp);
switch (tvp->cmd) { switch (tvp->cmd) {
case MODULATOR_SYMBOL_RATE: case MODULATOR_SYMBOL_RATE:
@ -1592,7 +1592,7 @@ int ddbridge_mod_do_ioctl(struct file *file, unsigned int cmd, void *parg)
(struct dtv_properties __user *) parg; (struct dtv_properties __user *) parg;
int i, ret = 0; int i, ret = 0;
if (dev->link[0].info->version == 3 && cmd != FE_SET_PROPERTY) if (dev->link[0].info->version >= 16 && cmd != FE_SET_PROPERTY)
return -EINVAL; return -EINVAL;
mutex_lock(&dev->ioctl_mutex); mutex_lock(&dev->ioctl_mutex);
switch (cmd) { switch (cmd) {
@ -1852,6 +1852,41 @@ static int mod_init_3(struct ddb *dev, u32 Frequency)
return ret; return ret;
} }
static int mod_init_sdr_iq(struct ddb *dev, u32 Frequency)
{
int streams = dev->link[0].info->port_num;
int i, ret = 0;
ret = mod_setup_max2871(dev, max2871_sdr);
if (ret)
dev_err(dev->dev, "PLL setup failed\n");
ret = rfdac_init(dev);
if (ret)
ret = rfdac_init(dev);
if (ret)
dev_err(dev->dev, "RFDAC setup failed\n");
ddbwritel(dev, 0x3000, 0x244);
ddbwritel(dev, 0x01, 0x240);
//mod3_set_base_frequency(dev, 602000000);
for (i = 0; i < streams; i++) {
struct ddb_mod *mod = &dev->mod[i];
ddbwritel(dev, 0x00, SDR_CHANNEL_CONTROL(i));
ddbwritel(dev, 0x306, SDR_CHANNEL_CONFIG(i));
ddbwritel(dev, 0x72492492, SDR_CHANNEL_ARICW(i));
//mod3_set_frequency(mod, Frequency + 8000000 * i);
ddbwritel(dev, 0x00011f80, SDR_CHANNEL_RGAIN(i));
}
ddbwritel(dev, -699050667, SDR_CHANNEL_CFCW(0));
ddbwritel(dev, 699050667, SDR_CHANNEL_CFCW(1));
mod_set_attenuator(dev, 0);
mod_set_vga(dev, 64);
return ret;
}
int ddbridge_mod_init(struct ddb *dev) int ddbridge_mod_init(struct ddb *dev)
{ {
switch (dev->link[0].info->version) { switch (dev->link[0].info->version) {
@ -1860,8 +1895,10 @@ int ddbridge_mod_init(struct ddb *dev)
return mod_init_1(dev, 722000000); return mod_init_1(dev, 722000000);
case 2: case 2:
return mod_init_2(dev, 114000000); return mod_init_2(dev, 114000000);
case 3: case 16:
return mod_init_3(dev, 503250000); return mod_init_3(dev, 503250000);
case 17:
return mod_init_sdr_iq(dev, 503250000);
default: default:
return -1; return -1;
} }