示例#1
0
void ath9k_wiphy_chan_work(struct work_struct *work)
{
	struct ath_softc *sc = container_of(work, struct ath_softc, chan_work);
	struct ath_wiphy *aphy = sc->next_wiphy;

	if (aphy == NULL)
		return;

	/*
	 * All pending interfaces paused; ready to change
	 * channels.
	 */

	/* Change channels */
	mutex_lock(&sc->mutex);
	/* XXX: remove me eventually */
	ath9k_update_ichannel(sc, aphy->hw,
			      &sc->sc_ah->channels[sc->chan_idx]);
	ath_update_chainmask(sc, sc->chan_is_ht);
	if (ath_set_channel(sc, aphy->hw,
			    &sc->sc_ah->channels[sc->chan_idx]) < 0) {
		printk(KERN_DEBUG "ath9k: Failed to set channel for new "
		       "virtual wiphy\n");
		mutex_unlock(&sc->mutex);
		return;
	}
	mutex_unlock(&sc->mutex);

	ath9k_wiphy_unpause_channel(sc);
}
示例#2
0
int spectral_exit_raw_capture_mode(ath_dev_t dev)
{
    struct ath_softc *sc = ATH_DEV_TO_SC(dev);
    int error = 0;

    if (sc->sc_raw_adc_capture_enabled) {
        DPRINTF(sc, ATH_DEBUG_ANY, "%s[%d]: restore chan=%d flags=0x%x imask=0x%x\n", __func__, __LINE__, 
                sc->sc_save_current_chan.channel, sc->sc_save_current_chan.channel_flags, sc->sc_imask);
        sc->sc_opmode = sc->sc_save_current_opmode;
        if (!sc->sc_invalid) {
            ath_hal_disable_test_addac_mode(sc->sc_ah);
            ath_set_rx_chainmask(dev,sc->sc_save_rx_chainmask);
            sc->sc_full_reset = 1; /* ensure we do a full reset */
            ath_set_channel(dev, &sc->sc_save_current_chan, 0, 0, 0);
        }
        sc->sc_raw_adc_capture_enabled = 0;
    }    
    return error;
}
示例#3
0
int spectral_enter_raw_capture_mode(ath_dev_t dev, void *indata)
{
    struct ath_softc *sc = ATH_DEV_TO_SC(dev);
    SPECTRAL_ADC_CAPTURE_PARAMS *params = (SPECTRAL_ADC_CAPTURE_PARAMS*)indata;
    HAL_CHANNEL hchan;
    int error = 0;

    if (ath_hal_getcapability(sc->sc_ah, HAL_CAP_RAW_ADC_CAPTURE, 0, NULL) != HAL_OK) {
        DPRINTF(sc, ATH_DEBUG_ANY, "%s[%d]: called but raw capture mode not supported!\n", __func__, __LINE__);
        return -ENOTSUP;
    }

    /* sanity check input version */
    if (params->version != SPECTRAL_ADC_API_VERSION) {
        DPRINTF(sc, ATH_DEBUG_ANY, "%s[%d]: version mismatch: expect %d got %d\n", 
                __func__, __LINE__, params->version, SPECTRAL_ADC_API_VERSION);
        return -EINVAL; 
    }

    if (sc->sc_invalid) {
        DPRINTF(sc, ATH_DEBUG_ANY, "%s[%d]: called but device is invalid or removed!\n", __func__, __LINE__);
        return -ENXIO;
    }

    if (sc->sc_raw_adc_capture_enabled) {
        DPRINTF(sc, ATH_DEBUG_ANY, "%s[%d]: already raw capture mode - calling spectral_exit_raw_capture_mode() first\n", __func__, __LINE__);
        spectral_exit_raw_capture_mode(dev);
    }

    /* save current channel and chain mask so we can restore later */
    sc->sc_save_rx_chainmask = sc->sc_rx_chainmask;
    sc->sc_save_current_chan = sc->sc_curchan;
    sc->sc_save_current_opmode = sc->sc_opmode;
    /* ensure chain mask is valid */
    params->chain_info.chain_mask &= sc->sc_rx_chainmask;
    /* store requested capture params */
    sc->sc_adc_chain_mask = params->chain_info.chain_mask;
    sc->sc_adc_num_chains = sc->sc_mask2chains[params->chain_info.chain_mask];
    sc->sc_adc_capture_flags = params->capture_flags;
    /* set new chain mask */
    ath_set_rx_chainmask(dev, params->chain_info.chain_mask);
    /* change channel to that requested */
    OS_MEMZERO(&hchan, sizeof(hchan));
    hchan.channel = params->freq;
    if (hchan.channel > 5000)
        hchan.channel_flags = CHANNEL_A_HT20;
    else
        hchan.channel_flags = CHANNEL_G_HT20;
    sc->sc_full_reset = 1; /* ensure we do a full reset */
    ath_set_channel(dev, &hchan, 0, 0, 0); 
    /* save channel info to return with capture data later */
    sc->sc_adc_chan_flags = sc->sc_curchan.channel_flags;
    sc->sc_adc_freq = sc->sc_curchan.channel;
    sc->sc_adc_ieee = ath_hal_mhz2ieee(sc->sc_ah, sc->sc_adc_freq, sc->sc_adc_chan_flags);
    /* did the channel change succeed ?*/
    if (sc->sc_curchan.channel != hchan.channel ||
        sc->sc_curchan.channel_flags != hchan.channel_flags) {
        DPRINTF(sc, ATH_DEBUG_ANY, "%s[%d]: set chan to %dMhz[%x] FAILED! current chan=%dMhz[0x%x]\n", 
                __func__, __LINE__, hchan.channel, hchan.channel_flags, 
                sc->sc_curchan.channel, sc->sc_curchan.channel_flags);
        error = -EINVAL; 
    } else {
        /* ok, all set up - enter raw capture mode */
        DPRINTF(sc, ATH_DEBUG_ANY, "%s[%d]: chan is now %dMhz flags=0x%x mask=0x%x\n", __func__, __LINE__, 
                sc->sc_curchan.channel, sc->sc_curchan.channel_flags, params->chain_info.chain_mask);
        sc->sc_raw_adc_capture_enabled = 1;
        sc->sc_opmode = HAL_M_RAW_ADC_CAPTURE;
        ath_hal_enable_test_addac_mode(sc->sc_ah);
    }

    return error;
}