spectral_common.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /*
15  * Copyright (c) 2013 Qualcomm Atheros, Inc.
16  *
17  * Permission to use, copy, modify, and/or distribute this software for any
18  * purpose with or without fee is hereby granted, provided that the above
19  * copyright notice and this permission notice appear in all copies.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
22  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
23  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
24  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
25  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
26  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
27  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28  */
29 
30 #ifndef SPECTRAL_COMMON_H
31 #define SPECTRAL_COMMON_H
32 
33 #include <cstdint>
34 #include <linux/types.h>
35 
36 #define SPECTRAL_HT20_NUM_BINS 56
37 #define SPECTRAL_HT20_40_NUM_BINS 128
38 
39 /* TODO: could possibly be 512, but no samples this large
40  * could be acquired so far.
41  */
42 #define SPECTRAL_ATH10K_MAX_NUM_BINS 256
43 
44 /* FFT sample format given to userspace via debugfs.
45  *
46  * Please keep the type/length at the front position and change
47  * other fields after adding another sample type
48  *
49  * TODO: this might need rework when switching to nl80211-based
50  * interface.
51  */
56 };
57 
58 typedef std::uint8_t u8;
59 typedef std::int8_t s8;
60 typedef std::uint16_t __be16;
61 //typedef std::uint64_t __be64;
62 
64  u8 type; /* see ath_fft_sample */
66  /* type dependent data follows */
67 } __attribute__((packed));
68 
71 
73 
77 
81 
82  __be64 tsf;
83 
85 } __attribute__((packed));
86 
89 
92 
95 
96  __be64 tsf;
97 
100 
103 
106 
109 
111 
113 } __attribute__((packed));
114 
124  __be64 tsf;
130 
131  u8 data[0];
132 } __attribute__((packed));
133 
134 #endif /* SPECTRAL_COMMON_H */
#define SPECTRAL_HT20_40_NUM_BINS
u8 data[SPECTRAL_HT20_NUM_BINS]
struct fft_sample_tlv tlv
ath_fft_sample_type
struct fft_sample_tlv __attribute__((packed))
std::uint16_t __be16
std::uint8_t u8
u8 max_exp
s8 rssi
#define SPECTRAL_HT20_NUM_BINS
std::int8_t s8
__be16 freq
__be16 max_magnitude
u8 bitmap_weight