Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2013 Qualcomm Atheros, Inc.
0003  *
0004  * Permission to use, copy, modify, and/or distribute this software for any
0005  * purpose with or without fee is hereby granted, provided that the above
0006  * copyright notice and this permission notice appear in all copies.
0007  *
0008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
0009  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
0010  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
0011  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
0012  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
0013  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
0014  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0015  */
0016 
0017 #ifndef SPECTRAL_COMMON_H
0018 #define SPECTRAL_COMMON_H
0019 
0020 #define SPECTRAL_HT20_NUM_BINS      56
0021 #define SPECTRAL_HT20_40_NUM_BINS       128
0022 
0023 /* TODO: could possibly be 512, but no samples this large
0024  * could be acquired so far.
0025  */
0026 #define SPECTRAL_ATH10K_MAX_NUM_BINS        256
0027 
0028 /* FFT sample format given to userspace via debugfs.
0029  *
0030  * Please keep the type/length at the front position and change
0031  * other fields after adding another sample type
0032  *
0033  * TODO: this might need rework when switching to nl80211-based
0034  * interface.
0035  */
0036 enum ath_fft_sample_type {
0037     ATH_FFT_SAMPLE_HT20 = 1,
0038     ATH_FFT_SAMPLE_HT20_40,
0039     ATH_FFT_SAMPLE_ATH10K,
0040     ATH_FFT_SAMPLE_ATH11K
0041 };
0042 
0043 struct fft_sample_tlv {
0044     u8 type;    /* see ath_fft_sample */
0045     __be16 length;
0046     /* type dependent data follows */
0047 } __packed;
0048 
0049 struct fft_sample_ht20 {
0050     struct fft_sample_tlv tlv;
0051 
0052     u8 max_exp;
0053 
0054     __be16 freq;
0055     s8 rssi;
0056     s8 noise;
0057 
0058     __be16 max_magnitude;
0059     u8 max_index;
0060     u8 bitmap_weight;
0061 
0062     __be64 tsf;
0063 
0064     u8 data[SPECTRAL_HT20_NUM_BINS];
0065 } __packed;
0066 
0067 struct fft_sample_ht20_40 {
0068     struct fft_sample_tlv tlv;
0069 
0070     u8 channel_type;
0071     __be16 freq;
0072 
0073     s8 lower_rssi;
0074     s8 upper_rssi;
0075 
0076     __be64 tsf;
0077 
0078     s8 lower_noise;
0079     s8 upper_noise;
0080 
0081     __be16 lower_max_magnitude;
0082     __be16 upper_max_magnitude;
0083 
0084     u8 lower_max_index;
0085     u8 upper_max_index;
0086 
0087     u8 lower_bitmap_weight;
0088     u8 upper_bitmap_weight;
0089 
0090     u8 max_exp;
0091 
0092     u8 data[SPECTRAL_HT20_40_NUM_BINS];
0093 } __packed;
0094 
0095 struct fft_sample_ath10k {
0096     struct fft_sample_tlv tlv;
0097     u8 chan_width_mhz;
0098     __be16 freq1;
0099     __be16 freq2;
0100     __be16 noise;
0101     __be16 max_magnitude;
0102     __be16 total_gain_db;
0103     __be16 base_pwr_db;
0104     __be64 tsf;
0105     s8 max_index;
0106     u8 rssi;
0107     u8 relpwr_db;
0108     u8 avgpwr_db;
0109     u8 max_exp;
0110 
0111     u8 data[];
0112 } __packed;
0113 
0114 struct fft_sample_ath11k {
0115     struct fft_sample_tlv tlv;
0116     u8 chan_width_mhz;
0117     s8 max_index;
0118     u8 max_exp;
0119     __be16 freq1;
0120     __be16 freq2;
0121     __be16 max_magnitude;
0122     __be16 rssi;
0123     __be32 tsf;
0124     __be32 noise;
0125 
0126     u8 data[];
0127 } __packed;
0128 
0129 #endif /* SPECTRAL_COMMON_H */