Пример #1
0
void si4700_dbg_info(struct si4700_dbg_info *nfo)
{
    memset(nfo->regs, 0, sizeof (nfo->regs));

    if (tuner_powered())
    {
        si4700_read(16);
        memcpy(nfo->regs, cache, sizeof (nfo->regs));
    }
}
Пример #2
0
/* tuner abstraction layer: read something from the tuner */
int si4700_get(int setting)
{
    int val = -1; /* default for unsupported query */

    if(!tuner_powered() && setting != RADIO_PRESENT)
        return -1;

    mutex_lock(&fmr_mutex);

    switch(setting)
    {
        case RADIO_PRESENT:
            val = tuner_present;
            break;

        case RADIO_TUNED:
            val = si4700_tuned();
            break;

        case RADIO_STEREO:
            val = si4700_st();
            break;
    
        case RADIO_RSSI:
            val = STATUSRSSI_RSSIr(si4700_read_reg(STATUSRSSI));
            break;

        case RADIO_RSSI_MIN:
            val = RSSI_MIN;
            break;

        case RADIO_RSSI_MAX:
            val = RSSI_MAX;
            break;
            
#ifdef HAVE_RDS_CAP
        case RADIO_EVENT:
        {
        #ifdef RDS_ISR_PROCESSING
            int oldlevel = disable_irq_save();
        #endif
            val = rds_event;
            rds_event = 0;
        #ifdef RDS_ISR_PROCESSING
            restore_irq(oldlevel);
        #endif
            break;
            }
#endif
    }

    mutex_unlock(&fmr_mutex);

    return val;
}
Пример #3
0
/* tuner abstraction layer: set something to the tuner */
int si4700_set(int setting, int value)
{
    int val = 1;

    if(!tuner_powered() && setting != RADIO_SLEEP)
        return -1;

    mutex_lock(&fmr_mutex);

    switch(setting)
    {
        case RADIO_SLEEP:
            if (value != 2)
                si4700_sleep(value);
            /* else actually it's 'pause' */
            break;

        case RADIO_FREQUENCY:
#ifdef HAVE_RDS_CAP
            rds_reset();
#endif
            si4700_set_frequency(value);
            break;

        case RADIO_SCAN_FREQUENCY:
#ifdef HAVE_RDS_CAP
            rds_reset();
#endif
            si4700_set_frequency(value);
            val = si4700_tuned();
            break;

        case RADIO_MUTE:
            si4700_write_masked(POWERCFG, value ? 0 : POWERCFG_DMUTE,
                                POWERCFG_DMUTE);
            break;

        case RADIO_REGION:
            si4700_set_region(value);
            break;

        case RADIO_FORCE_MONO:
            si4700_write_masked(POWERCFG, value ? POWERCFG_MONO : 0,
                                POWERCFG_MONO);
            break;
            
        default:
            val = -1;
            break;
    }

    mutex_unlock(&fmr_mutex);

    return val;
}
Пример #4
0
/* Read raw RDS info for processing */
bool si4700_rds_read_raw(uint16_t data[4])
{
    bool retval = false;

    mutex_lock(&fmr_mutex);

    if (tuner_powered())
    {
        si4700_read_reg(RDSD);
        memcpy(data, &cache[RDSA], 4 * sizeof (uint16_t));
        retval = true;
    }

    mutex_unlock(&fmr_mutex);

    return retval;   
}