コード例 #1
0
ファイル: satip_main.c プロジェクト: BackupGGCode/satip
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;
      
    }
}
コード例 #2
0
ファイル: satip_vtuner.c プロジェクト: eriksl/satip-client
static void set_frontend(struct satip_vtuner* vt, struct vtuner_message* msg)
{
    if (vt->satip_cfg->fe_type == SATIP_FE_TYPE_SAT)
    {
        int fec_inner=msg->body.fe_params.u.qpsk.fec_inner;
        int frequency = msg->body.fe_params.frequency/100;

        if ( !vt->tone_set )
        {
            DEBUG(MSG_MAIN,"cannot tune: no band selected\n");
            return;
        }

        /* revert frequency shift */
        if ( vt->tone == SEC_TONE_ON ) /* high band */
            frequency += 106000;
        else /* low band */
            if ( frequency-97500 < 0 )
                frequency+=97500;
            else
                frequency-=97500;

        satip_set_freq(vt->satip_cfg, frequency);
        satip_set_symbol_rate(vt->satip_cfg, msg->body.fe_params.u.qpsk.symbol_rate/1000 );

        if ( ( fec_inner & 31 ) < SATIPCFG_F_NONE )
            satip_set_fecinner(vt->satip_cfg, fec_map[fec_inner & 31]);
        else
            ERROR(MSG_MAIN,"invalid FEC configured\n");

#ifdef VTUNER_TYPE_ORIGINAL
        /* modulation system and modulation piggybacked in FEC DVB-S(2) for old DVB API version 3*/
        if ( fec_inner & 32 )
        {
            int inversion=msg->body.fe_params.inversion;

            satip_set_modsys(vt->satip_cfg, SATIPCFG_MS_DVB_S2);

            /* DVB-S2: modulation */
            if ( fec_inner & 64 )
                satip_set_modtype(vt->satip_cfg, SATIPCFG_MT_8PSK);
            else
                satip_set_modtype(vt->satip_cfg, SATIPCFG_MT_QPSK);

            /* DVB-S2: rolloff and pilots encoded in inversion */
            if ( inversion & 0x04 )
                satip_set_rolloff(vt->satip_cfg,SATIPCFG_R_0_25);
            else if (inversion & 0x08)
                satip_set_rolloff(vt->satip_cfg,SATIPCFG_R_0_20);
            else
                satip_set_rolloff(vt->satip_cfg,SATIPCFG_R_0_35);

            if ( inversion & 0x10 )
                satip_set_pilots(vt->satip_cfg,SATIPCFG_P_ON);
            else if ( inversion & 0x20 )
                satip_set_pilots(vt->satip_cfg,SATIPCFG_P_ON);
            else
                satip_set_pilots(vt->satip_cfg,SATIPCFG_P_OFF);
        }
        else
            satip_set_modsys(vt->satip_cfg, SATIPCFG_MS_DVB_S);
#else
        /*VU+
          Do not set modulation system (aka delivery system)!
          This is done using FE_SET_PROPERTY(DTV_DELIVERY_SYSTEM)!
        */
#endif

        DEBUG(MSG_MAIN,"MSG_SET_FRONTEND freq: %d symrate: %d \n",
              frequency,
              msg->body.fe_params.u.qpsk.symbol_rate );
    }
    else if (vt->satip_cfg->fe_type == SATIP_FE_TYPE_CAB)
    {
        int fec_inner = msg->body.fe_params.u.qam.fec_inner;
        int inversion=msg->body.fe_params.inversion;
        int frequency = msg->body.fe_params.frequency;

        satip_set_freq(vt->satip_cfg, frequency);
        satip_set_inversion(vt->satip_cfg, i_map[inversion]);
        satip_set_symbol_rate(vt->satip_cfg, msg->body.fe_params.u.qam.symbol_rate/1000 );

        if ( ( fec_inner & 31 ) < SATIPCFG_F_NONE )
            satip_set_fecinner(vt->satip_cfg, fec_map[fec_inner & 31]);
        else
            ERROR(MSG_MAIN,"invalid FEC configured\n");

#ifdef VTUNER_TYPE_ORIGINAL
        int modulation = msg->body.fe_params.u.qam.modulation;

        satip_set_modtype(vt->satip_cfg, mt_map[modulation]);
        satip_set_modsys(vt->satip_cfg, SATIPCFG_MS_DVB_C);
#else
        /*VU+
          Do not set modulation system (aka delivery system)!
          This is done using FE_SET_PROPERTY(DTV_DELIVERY_SYSTEM)!
        */
		/*
		 * Above may be required for non-VU+ receivers, though
		 */
#endif

        DEBUG(MSG_MAIN,"MSG_SET_FRONTEND freq: %d symrate: %d \n",
              frequency,
              msg->body.fe_params.u.qam.symbol_rate );
    }
    else if (vt->satip_cfg->fe_type == SATIP_FE_TYPE_TER)
    {
        int coderate_hp = msg->body.fe_params.u.ofdm.code_rate_HP;
        int coderate_lp = msg->body.fe_params.u.ofdm.code_rate_LP;
        int bandwidth = msg->body.fe_params.u.ofdm.bandwidth;
        int transmode = msg->body.fe_params.u.ofdm.transmission_mode;
        int guardint = msg->body.fe_params.u.ofdm.guard_interval;
        int frequency = msg->body.fe_params.frequency;

        /*
          TODO: do not know how to handle this as the SAT>IP spec does not
                differentiate between coderate_hp and coderate_lp!
                Use coderate_hp for now.
        */
        if ( coderate_hp != coderate_lp)
            WARN(MSG_MAIN,"coderate_hp and coderate_lp are not equal! Using coderate_hp for FEC!\n");

        int fec_inner = coderate_hp;

        if ( ( fec_inner & 31 ) < SATIPCFG_F_NONE )
            satip_set_fecinner(vt->satip_cfg, fec_map[fec_inner & 31]);
        else
            ERROR(MSG_MAIN,"invalid FEC configured\n");

        satip_set_freq(vt->satip_cfg, frequency);
        satip_set_bandwidth(vt->satip_cfg, bw_map[bandwidth]);
        satip_set_transmode(vt->satip_cfg, tm_map[transmode]);
        satip_set_guardinterval(vt->satip_cfg, gi_map[guardint]);

#ifdef VTUNER_TYPE_ORIGINAL
        int constellation = msg->body.fe_params.u.ofdm.constellation;

        satip_set_modtype(vt->satip_cfg, mt_map[constellation]);
        satip_set_modsys(vt->satip_cfg, SATIPCFG_MS_DVB_T);
#else
        /*VU+
          Do not set modulation system (aka delivery system)!
          This is done using FE_SET_PROPERTY(DTV_DELIVERY_SYSTEM)!
        */
#endif

        DEBUG(MSG_MAIN,"MSG_SET_FRONTEND freq: %d \n",
              frequency);
    }

}