Path: blob/main/sys/contrib/dev/athk/spectral_common.h
48254 views
/*1* Copyright (c) 2013 Qualcomm Atheros, Inc.2*3* Permission to use, copy, modify, and/or distribute this software for any4* purpose with or without fee is hereby granted, provided that the above5* copyright notice and this permission notice appear in all copies.6*7* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES8* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF9* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR10* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES11* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN12* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF13* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.14*/1516#ifndef SPECTRAL_COMMON_H17#define SPECTRAL_COMMON_H1819#define SPECTRAL_HT20_NUM_BINS 5620#define SPECTRAL_HT20_40_NUM_BINS 1282122/* TODO: could possibly be 512, but no samples this large23* could be acquired so far.24*/25#define SPECTRAL_ATH10K_MAX_NUM_BINS 2562627/* FFT sample format given to userspace via debugfs.28*29* Please keep the type/length at the front position and change30* other fields after adding another sample type31*32* TODO: this might need rework when switching to nl80211-based33* interface.34*/35enum ath_fft_sample_type {36ATH_FFT_SAMPLE_HT20 = 1,37ATH_FFT_SAMPLE_HT20_40,38ATH_FFT_SAMPLE_ATH10K,39ATH_FFT_SAMPLE_ATH11K40};4142struct fft_sample_tlv {43u8 type; /* see ath_fft_sample */44__be16 length;45/* type dependent data follows */46} __packed;4748struct fft_sample_ht20 {49struct fft_sample_tlv tlv;5051u8 max_exp;5253__be16 freq;54s8 rssi;55s8 noise;5657__be16 max_magnitude;58u8 max_index;59u8 bitmap_weight;6061__be64 tsf;6263u8 data[SPECTRAL_HT20_NUM_BINS];64} __packed;6566struct fft_sample_ht20_40 {67struct fft_sample_tlv tlv;6869u8 channel_type;70__be16 freq;7172s8 lower_rssi;73s8 upper_rssi;7475__be64 tsf;7677s8 lower_noise;78s8 upper_noise;7980__be16 lower_max_magnitude;81__be16 upper_max_magnitude;8283u8 lower_max_index;84u8 upper_max_index;8586u8 lower_bitmap_weight;87u8 upper_bitmap_weight;8889u8 max_exp;9091u8 data[SPECTRAL_HT20_40_NUM_BINS];92} __packed;9394struct fft_sample_ath10k {95struct fft_sample_tlv tlv;96u8 chan_width_mhz;97__be16 freq1;98__be16 freq2;99__be16 noise;100__be16 max_magnitude;101__be16 total_gain_db;102__be16 base_pwr_db;103__be64 tsf;104s8 max_index;105u8 rssi;106u8 relpwr_db;107u8 avgpwr_db;108u8 max_exp;109110u8 data[];111} __packed;112113struct fft_sample_ath11k {114struct fft_sample_tlv tlv;115u8 chan_width_mhz;116s8 max_index;117u8 max_exp;118__be16 freq1;119__be16 freq2;120__be16 max_magnitude;121__be16 rssi;122__be32 tsf;123__be32 noise;124125u8 data[];126} __packed;127128#endif /* SPECTRAL_COMMON_H */129130131