コード例 #1
0
void frontend_unregister_tuner(struct dibFrontend *fe)
{
    if (fe->tuner_is_shared)
        fe->tuner_is_shared--;
    else
        tuner_release(fe);
    fe->tuner_info = NULL; fe->tuner_priv = NULL;
}
コード例 #2
0
/* example of creating all the demod-structure and tuner-structures and tuning them in diversity and start monitoring after that */
int main(int argc, char *argv[])
{
    struct dibI2CAdapter *main_i2c = open_spp_i2c();
    struct dibI2CAdapter *tuner_i2c[2];
    struct dibDemod *demod[2];
    struct dibTuner *tuner[2];

    struct dibDemodMonitor mon[2];

    struct dibDVBChannel ch;

    DibZeroMemory(mon, sizeof(mon));

    if (main_i2c == NULL)
        return 1;

    /* attach 2 demods, do i2c-enumeration */
    if (dib7000p_attach(main_i2c, 2, DEFAULT_DIB7000P_I2C_ADDRESS, 1, dib7000p_example_board_config, demod) != 0) {
        DibDbgPrint("-E-  dib7000 attaching and i2c enumeration failed.\n");
        exit(1);
    }

    /* first tuner */
    tuner_i2c[0] = dib7000p_get_i2c_master(demod[0], DIBX000_I2C_INTERFACE_TUNER, 1);
    if ((tuner[0] = env57h12d5_attach(tuner_i2c[0], &tuner_0_config)) == NULL) {
        DibDbgPrint("-E-  env57h12d5 -0- attaching failed.\n");
        exit(1);
    }

    /* second tuner */
    tuner_i2c[1] = dib7000p_get_i2c_master(demod[1], DIBX000_I2C_INTERFACE_TUNER, 1);
    if ((tuner[1] = env57h12d5_attach(tuner_i2c[1], &tuner_1_config)) == NULL) {
        DibDbgPrint("-E-  env57h12d5 -1- attaching failed.\n");
        exit(1);
    }

    INIT_DVB_CHANNEL(&ch);
    ch.RF_kHz = 474000;
    ch.Bw     = INDEX_BW_8_0_MHZ;

    /* tune the 2 demods and tuner to the channel "ch" */
    tune_diversity_tuner_and_demod(tuner,demod,2,&ch);

    DibDbgPrint("-I-  Tuning done <enter>\n");
    getchar();

    while (1) {
        /* get monitoring information for the first demod */
        demod_get_monitoring(demod[0], &mon[0]);
        /* get monitoring information for the second demod */
        demod_get_monitoring(demod[1], &mon[1]);
        /* display information for 2 demods */
        dib7000_print_monitor(mon, NULL, 0, 2);
        usleep(100000);
    }

    DibDbgPrint("-I-  Cleaning up\n");

    /* release the 2 tuners */
    tuner_release(tuner[1]);
    tuner_release(tuner[0]);

    /* release the 2 demods */
    demod_release(demod[1]);
    demod_release(demod[0]);

    close_spp_i2c();

    return 0;
}
コード例 #3
0
/* example of creating all the demod-structure and tuner-structures and tuning them in diversity and start monitoring after that */
int main(int argc, char *argv[])
{
    struct dibI2CAdapter *main_i2c = open_spp_i2c();
    struct dibI2CAdapter *tuner_i2c[2];
    struct dibDemod *demod[2];
    struct dibTuner *tuner[2];

    struct dibDemodMonitor mon[2];

    struct dibDVBChannel ch;

    DibZeroMemory(mon, sizeof(mon));

    if (main_i2c == NULL)
        return 1;

    if (dib7000m_attach(main_i2c, 2, DEFAULT_DIB7000M_I2C_ADDRESS, 1, dib7000m_demod_config, demod) != 0) {
        DibDbgPrint("-E-  dib7000 attaching and i2c enumeration failed.\n");
        exit(1);
    }

    tuner_i2c[0] = dib7000m_get_i2c_master(demod[0], DIBX000_I2C_INTERFACE_TUNER, 1);
    if ((tuner[0] = env57h12d5_attach(tuner_i2c[0], &tuner_0_config)) == NULL) {
        DibDbgPrint("-E-  env57h12d5 -0- attaching failed.\n");
        exit(1);
    }

    tuner_i2c[1] = dib7000m_get_i2c_master(demod[1], DIBX000_I2C_INTERFACE_TUNER, 1);
    if ((tuner[1] = env57h12d5_attach(tuner_i2c[1], &tuner_1_config)) == NULL) {
        DibDbgPrint("-E-  env57h12d5 -1- attaching failed.\n");
        exit(1);
    }

    INIT_DVB_CHANNEL(&ch);
    ch.RF_kHz = 474000;
    ch.Bw     = INDEX_BW_8_0_MHZ;

    tune_diversity_tuner_and_demod(tuner,demod,2,&ch);

    DibDbgPrint("-I-  Tuning done <enter>\n");
    getchar();

    while (1) {
        demod_get_monitoring(demod[0], &mon[0]);
        demod_get_monitoring(demod[1], &mon[1]);
        dib7000_print_monitor(mon, NULL, 0, 2);
        usleep(100000);
    }

    DibDbgPrint("-I-  Cleaning up\n");

    tuner_release(tuner[1]);
    tuner_release(tuner[0]);

    demod_release(demod[1]);
    demod_release(demod[0]);

    close_spp_i2c();

    return 0;
}