Not that I'm specifically getting into this in any deep way right now, but..

On 27 November 2012 11:01, Simon Wunderlich
<simon.wunderl...@s2003.tu-chemnitz.de> wrote:

[snip] - this should apply to AR9380 and later I think.

> +void ar9002_hw_spectral_scan(struct ath_hw *ah)
> +{
> +       struct ath_common *common = ath9k_hw_common(ah);
> +
> +       REG_SET_BIT(ah, AR_PHY_RADAR_0, AR_PHY_RADAR_0_FFT_ENA);
> +
> +       /* NOTE: this will generate a few samples ... lacking documentation,
> +        * I'm not really sure what these parameters mean.
> +        */
> +       REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN, AR_PHY_SPECTRAL_SCAN_ENABLE);
> +       REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
> +                   AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT);
> +       REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
> +                     AR_PHY_SPECTRAL_SCAN_COUNT, 8);
> +       REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
> +                     AR_PHY_SPECTRAL_SCAN_PERIOD, 0xF);
> +       REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
> +                     AR_PHY_SPECTRAL_SCAN_FFT_PERIOD, 0xFF);
> +
> +       /* Activate spectral scan */
> +       REG_SET_BIT(ah, AR_PHY_SPECTRAL_SCAN,
> +                   AR_PHY_SPECTRAL_SCAN_ACTIVE);
> +
> +       /* Poll for spectral scan complete */
> +       if (!ath9k_hw_wait(ah, AR_PHY_SPECTRAL_SCAN,
> +                          AR_PHY_SPECTRAL_SCAN_ACTIVE,
> +                          0, AH_WAIT_TIMEOUT)) {
> +               ath_err(common, "spectral scan wait failed\n");
> +               return;
> +       }
> +
> +       /* Disable spectral scan */
> +       REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
> +                   AR_PHY_SPECTRAL_SCAN_ENABLE);
> +}
> +

You shouldn't have to do this. There's two spectral scan modes (well, three) -

* when you're not decoding things, and you meet these parameters,
please send me some events (I think the patent mentions this);
* trigger _now_ and send me "X" events; then clear the spectral scan bit;
* trigger _now_ and just send me infinite events - on earlier chips
(AR9280 I think) the magic value may be 0; on the later values it may
be 255. Someone should experiment.

I suggest you separate out "configure/enable/disable" and "trigger" as options.

Grr, mumble mumble open source developers mumble mumble.. :-)

I suggest experimenting around with those particular parameters. You
should be able to coax out specific numbers of spectral scan events
when you set the COUNT parameter to something other than 8. But
polling that bit isn't needed. It should be asynchronous.

Good luck,



Adrian



Adrian
_______________________________________________
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel

Reply via email to