blob: b9ab722747bd49c916101816c500519153f68369 [file] [log] [blame]
Sven Eckelmann95752b72014-08-02 09:12:53 +03001/*
2 * Copyright (c) 2013 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef SPECTRAL_COMMON_H
18#define SPECTRAL_COMMON_H
19
20#define SPECTRAL_HT20_NUM_BINS 56
21#define SPECTRAL_HT20_40_NUM_BINS 128
22
23/* FFT sample format given to userspace via debugfs.
24 *
25 * Please keep the type/length at the front position and change
26 * other fields after adding another sample type
27 *
28 * TODO: this might need rework when switching to nl80211-based
29 * interface.
30 */
31enum ath_fft_sample_type {
32 ATH_FFT_SAMPLE_HT20 = 1,
33 ATH_FFT_SAMPLE_HT20_40,
34};
35
36struct fft_sample_tlv {
37 u8 type; /* see ath_fft_sample */
38 __be16 length;
39 /* type dependent data follows */
40} __packed;
41
42struct fft_sample_ht20 {
43 struct fft_sample_tlv tlv;
44
45 u8 max_exp;
46
47 __be16 freq;
48 s8 rssi;
49 s8 noise;
50
51 __be16 max_magnitude;
52 u8 max_index;
53 u8 bitmap_weight;
54
55 __be64 tsf;
56
57 u8 data[SPECTRAL_HT20_NUM_BINS];
58} __packed;
59
60struct fft_sample_ht20_40 {
61 struct fft_sample_tlv tlv;
62
63 u8 channel_type;
64 __be16 freq;
65
66 s8 lower_rssi;
67 s8 upper_rssi;
68
69 __be64 tsf;
70
71 s8 lower_noise;
72 s8 upper_noise;
73
74 __be16 lower_max_magnitude;
75 __be16 upper_max_magnitude;
76
77 u8 lower_max_index;
78 u8 upper_max_index;
79
80 u8 lower_bitmap_weight;
81 u8 upper_bitmap_weight;
82
83 u8 max_exp;
84
85 u8 data[SPECTRAL_HT20_40_NUM_BINS];
86} __packed;
87
88#endif /* SPECTRAL_COMMON_H */