195752b75SSven Eckelmann /* 295752b75SSven Eckelmann * Copyright (c) 2013 Qualcomm Atheros, Inc. 395752b75SSven Eckelmann * 495752b75SSven Eckelmann * Permission to use, copy, modify, and/or distribute this software for any 595752b75SSven Eckelmann * purpose with or without fee is hereby granted, provided that the above 695752b75SSven Eckelmann * copyright notice and this permission notice appear in all copies. 795752b75SSven Eckelmann * 895752b75SSven Eckelmann * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 995752b75SSven Eckelmann * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1095752b75SSven Eckelmann * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 1195752b75SSven Eckelmann * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1295752b75SSven Eckelmann * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1395752b75SSven Eckelmann * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1495752b75SSven Eckelmann * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1595752b75SSven Eckelmann */ 1695752b75SSven Eckelmann 1795752b75SSven Eckelmann #ifndef SPECTRAL_COMMON_H 1895752b75SSven Eckelmann #define SPECTRAL_COMMON_H 1995752b75SSven Eckelmann 2095752b75SSven Eckelmann #define SPECTRAL_HT20_NUM_BINS 56 2195752b75SSven Eckelmann #define SPECTRAL_HT20_40_NUM_BINS 128 2295752b75SSven Eckelmann 2395752b75SSven Eckelmann /* FFT sample format given to userspace via debugfs. 2495752b75SSven Eckelmann * 2595752b75SSven Eckelmann * Please keep the type/length at the front position and change 2695752b75SSven Eckelmann * other fields after adding another sample type 2795752b75SSven Eckelmann * 2895752b75SSven Eckelmann * TODO: this might need rework when switching to nl80211-based 2995752b75SSven Eckelmann * interface. 3095752b75SSven Eckelmann */ 3195752b75SSven Eckelmann enum ath_fft_sample_type { 3295752b75SSven Eckelmann ATH_FFT_SAMPLE_HT20 = 1, 3395752b75SSven Eckelmann ATH_FFT_SAMPLE_HT20_40, 3495752b75SSven Eckelmann }; 3595752b75SSven Eckelmann 3695752b75SSven Eckelmann struct fft_sample_tlv { 3795752b75SSven Eckelmann u8 type; /* see ath_fft_sample */ 3895752b75SSven Eckelmann __be16 length; 3995752b75SSven Eckelmann /* type dependent data follows */ 4095752b75SSven Eckelmann } __packed; 4195752b75SSven Eckelmann 4295752b75SSven Eckelmann struct fft_sample_ht20 { 4395752b75SSven Eckelmann struct fft_sample_tlv tlv; 4495752b75SSven Eckelmann 4595752b75SSven Eckelmann u8 max_exp; 4695752b75SSven Eckelmann 4795752b75SSven Eckelmann __be16 freq; 4895752b75SSven Eckelmann s8 rssi; 4995752b75SSven Eckelmann s8 noise; 5095752b75SSven Eckelmann 5195752b75SSven Eckelmann __be16 max_magnitude; 5295752b75SSven Eckelmann u8 max_index; 5395752b75SSven Eckelmann u8 bitmap_weight; 5495752b75SSven Eckelmann 5595752b75SSven Eckelmann __be64 tsf; 5695752b75SSven Eckelmann 5795752b75SSven Eckelmann u8 data[SPECTRAL_HT20_NUM_BINS]; 5895752b75SSven Eckelmann } __packed; 5995752b75SSven Eckelmann 6095752b75SSven Eckelmann struct fft_sample_ht20_40 { 6195752b75SSven Eckelmann struct fft_sample_tlv tlv; 6295752b75SSven Eckelmann 6395752b75SSven Eckelmann u8 channel_type; 6495752b75SSven Eckelmann __be16 freq; 6595752b75SSven Eckelmann 6695752b75SSven Eckelmann s8 lower_rssi; 6795752b75SSven Eckelmann s8 upper_rssi; 6895752b75SSven Eckelmann 6995752b75SSven Eckelmann __be64 tsf; 7095752b75SSven Eckelmann 7195752b75SSven Eckelmann s8 lower_noise; 7295752b75SSven Eckelmann s8 upper_noise; 7395752b75SSven Eckelmann 7495752b75SSven Eckelmann __be16 lower_max_magnitude; 7595752b75SSven Eckelmann __be16 upper_max_magnitude; 7695752b75SSven Eckelmann 7795752b75SSven Eckelmann u8 lower_max_index; 7895752b75SSven Eckelmann u8 upper_max_index; 7995752b75SSven Eckelmann 8095752b75SSven Eckelmann u8 lower_bitmap_weight; 8195752b75SSven Eckelmann u8 upper_bitmap_weight; 8295752b75SSven Eckelmann 8395752b75SSven Eckelmann u8 max_exp; 8495752b75SSven Eckelmann 8595752b75SSven Eckelmann u8 data[SPECTRAL_HT20_40_NUM_BINS]; 8695752b75SSven Eckelmann } __packed; 8795752b75SSven Eckelmann 8895752b75SSven Eckelmann #endif /* SPECTRAL_COMMON_H */ 89