Ejemplo n.º 1
0
static void test_sequencer(void* param)
{
  t_satip_config* sc=(t_satip_config*)param;

  cseq++;
  
  switch (cseq)
    {
    case 1:
      satip_set_freq(sc,118360);
      satip_set_modsys(sc, SATIPCFG_MS_DVB_S);
      satip_set_pilots(sc, SATIPCFG_P_OFF);
      satip_set_fecinner(sc, SATIPCFG_F_34);
      satip_set_polarization(sc, SATIPCFG_P_HORIZONTAL);
      satip_set_rolloff(sc, SATIPCFG_R_0_35);
      satip_set_symbol_rate(sc,27500);
      satip_set_modtype(sc, SATIPCFG_MT_QPSK);
      satip_set_position(sc, 1);
      satip_add_pid(sc, 18);
      break;

    case 200:
      //satip_add_pid(sc, 19);
      break;

    case 400:
      break;

    default: 
      break;
      
    }
}
Ejemplo n.º 2
0
t_satip_vtuner* satip_vtuner_new(char* devname,t_satip_config* satip_cfg)
{
    int fd;
    t_satip_vtuner* vt;
    char typestr[8];
    struct dvb_frontend_info *fe_info;

    fd  = open(devname, O_RDWR);
    if ( fd < 0)
    {
        ERROR(MSG_MAIN,"Couldn't open %s\n",devname);
        return NULL;
    }

    fe_info = malloc(sizeof(struct dvb_frontend_info));
    if (!fe_info)
    {
        close(fd);
        return NULL;
    }

    switch(satip_cfg->fe_type)
    {
    case SATIP_FE_TYPE_SAT:
        strncpy(fe_info->name, "SAT>IP DVB-S2 NIM", sizeof(fe_info->name));
        strncpy((char*)&typestr, "DVB-S2", sizeof(typestr));
        fe_info->type = FE_QPSK;
        fe_info->frequency_min=925000;
        fe_info->frequency_max=2175000;
        fe_info->frequency_stepsize=125000;
        fe_info->frequency_tolerance=0;
        fe_info->symbol_rate_min=1000000;
        fe_info->symbol_rate_max=45000000;
        fe_info->symbol_rate_tolerance=0;
        fe_info->notifier_delay=0;
        fe_info->caps=FE_CAN_INVERSION_AUTO |
                      FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | FE_CAN_FEC_4_5 |
                      FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_8_9 |
                      FE_CAN_QPSK | FE_CAN_RECOVER | FE_CAN_2G_MODULATION | FE_HAS_EXTENDED_CAPS;
        break;
    case SATIP_FE_TYPE_CAB:
        strncpy(fe_info->name, "SAT>IP DVB-C NIM", sizeof(fe_info->name));
        strncpy(typestr, "DVB-C", sizeof(typestr));
        fe_info->type = FE_QAM;
        fe_info->frequency_min=51000000;
        fe_info->frequency_max=858000000;
        fe_info->frequency_stepsize=62500;
        fe_info->frequency_tolerance=0;
        fe_info->symbol_rate_min=(57840000/2)/64;     /* SACLK/64 == (XIN/2)/64 */
        fe_info->symbol_rate_max=(57840000/2)/4;      /* SACLK/4 */
        fe_info->symbol_rate_tolerance=0;
        fe_info->notifier_delay=0;
        fe_info->caps=FE_CAN_INVERSION_AUTO |
                      FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 | FE_CAN_QAM_128 |
                      FE_CAN_QAM_256 | FE_CAN_RECOVER | FE_CAN_FEC_AUTO;
        break;
    case SATIP_FE_TYPE_TER:
        strncpy(fe_info->name, "SAT>IP DVB-T NIM", sizeof(fe_info->name));
        strncpy(typestr, "DVB-T", sizeof(typestr));
        fe_info->type = FE_OFDM;
        fe_info->frequency_min=0;
        fe_info->frequency_max=863250000;
        fe_info->frequency_stepsize=62500;
        fe_info->frequency_tolerance=0;
        fe_info->notifier_delay=0;
        fe_info->caps=FE_CAN_INVERSION_AUTO |
                      FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
                      FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
                      FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QPSK |
                      FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO |
                      FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER;
        break;
    default:
        ERROR(MSG_MAIN,"Unknown frontend type: %d\n",satip_cfg->fe_type);
        close(fd);
        free(fe_info);
        return NULL;
    }

    INFO(MSG_MAIN,"Frontend type: %s, name: %s\n", typestr, &fe_info->name);

    if ( ioctl(fd, VTUNER_SET_NAME, &fe_info->name) )
        perror("ioctl(VTUNER_SET_NAME)");

    if ( ioctl(fd, VTUNER_SET_TYPE, typestr)  )
    {
        perror("ioctl(VTUNER_SET_TYPE)");
    }
    if ( ioctl(fd, VTUNER_SET_FE_INFO, fe_info) )
    {
        perror("ioctl(VTUNER_SET_FE_INFO)");
    }

#ifdef VTUNER_TYPE_VUPLUS
    if ( ioctl(fd, VTUNER_SET_HAS_OUTPUTS, "no") )
    {
        perror("ioctl(VTUNER_SET_HAS_OUTPUTS)");
    }
#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 5
    {
        struct dtv_property p[1];
        u32 ncaps = 0;
        p[0].cmd = DTV_ENUM_DELSYS; /* Not used, but kept for reference. */

        switch(satip_cfg->fe_type)
        {
        case SATIP_FE_TYPE_SAT:
            p[0].u.buffer.data[ncaps++] = SYS_DVBS;
            if (fe_info->caps & FE_CAN_2G_MODULATION)
                p[0].u.buffer.data[ncaps++] = SYS_DVBS2;
            break;
        case SATIP_FE_TYPE_CAB:
            p[0].u.buffer.data[ncaps++] = SYS_DVBC_ANNEX_A;
            break;
        case SATIP_FE_TYPE_TER:
            p[0].u.buffer.data[ncaps++] = SYS_DVBT;
            if (fe_info->caps & FE_CAN_2G_MODULATION)
                p[0].u.buffer.data[ncaps++] = SYS_DVBT2;
            break;
        default:
            ERROR(MSG_MAIN,"Unknown delivery system: %d\n",satip_cfg->fe_type);
            break;
        }
        p[0].u.buffer.len = ncaps;
        ioctl(fd, VTUNER_SET_DELSYS, p[0].u.buffer.data);
    }
#endif

#endif

    free(fe_info);

    vt=(t_satip_vtuner*)malloc(sizeof(t_satip_vtuner));

    vt->fd=fd;
    vt->satip_cfg=satip_cfg;

    /* set default position A, if appl. does not configure */
    satip_set_position(satip_cfg,1);

    vt->tone_set=0;

    return vt;
}