SENF Extensible Network Framework
Home
Overview
Examples
HowTos
Glossary
Ext
NetEmu
PPI
Packets
Scheduler
Socket
Utils
Console
Daemon
Logger
Termlib
WLAN
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
*/
52
enum
ath_fft_sample_type
{
53
ATH_FFT_SAMPLE_HT20
= 1,
54
ATH_FFT_SAMPLE_HT20_40
,
55
ATH_FFT_SAMPLE_ATH10K
,
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
63
struct
fft_sample_tlv
{
64
u8
type
;
/* see ath_fft_sample */
65
__be16
length
;
66
/* type dependent data follows */
67
}
__attribute__
((packed));
68
69
struct
fft_sample_ht20
{
70
struct
fft_sample_tlv
tlv
;
71
72
u8
max_exp
;
73
74
__be16
freq
;
75
s8
rssi
;
76
s8
noise
;
77
78
__be16
max_magnitude
;
79
u8
max_index
;
80
u8
bitmap_weight
;
81
82
__be64
tsf
;
83
84
u8
data
[
SPECTRAL_HT20_NUM_BINS
];
85
}
__attribute__
((packed));
86
87
struct
fft_sample_ht20_40
{
88
struct
fft_sample_tlv
tlv
;
89
90
u8
channel_type
;
91
__be16
freq
;
92
93
s8
lower_rssi
;
94
s8
upper_rssi
;
95
96
__be64
tsf
;
97
98
s8
lower_noise
;
99
s8
upper_noise
;
100
101
__be16
lower_max_magnitude
;
102
__be16
upper_max_magnitude
;
103
104
u8
lower_max_index
;
105
u8
upper_max_index
;
106
107
u8
lower_bitmap_weight
;
108
u8
upper_bitmap_weight
;
109
110
u8
max_exp
;
111
112
u8
data
[
SPECTRAL_HT20_40_NUM_BINS
];
113
}
__attribute__
((packed));
114
115
struct
fft_sample_ath10k
{
116
struct
fft_sample_tlv
tlv
;
117
u8
chan_width_mhz
;
118
__be16
freq1
;
119
__be16
freq2
;
120
__be16
noise
;
121
__be16
max_magnitude
;
122
__be16
total_gain_db
;
123
__be16
base_pwr_db
;
124
__be64
tsf
;
125
s8
max_index
;
126
u8
rssi
;
127
u8
relpwr_db
;
128
u8
avgpwr_db
;
129
u8
max_exp
;
130
131
u8
data
[0];
132
}
__attribute__
((packed));
133
134
#endif
/* SPECTRAL_COMMON_H */
ATH_FFT_SAMPLE_HT20
Definition:
spectral_common.h:53
SPECTRAL_HT20_40_NUM_BINS
#define SPECTRAL_HT20_40_NUM_BINS
Definition:
spectral_common.h:37
fft_sample_ht20_40
Definition:
spectral_common.h:87
fft_sample_ht20_40::tsf
__be64 tsf
Definition:
spectral_common.h:96
fft_sample_ht20::max_index
u8 max_index
Definition:
spectral_common.h:79
fft_sample_ht20_40::upper_max_index
u8 upper_max_index
Definition:
spectral_common.h:105
fft_sample_ht20_40::upper_rssi
s8 upper_rssi
Definition:
spectral_common.h:94
fft_sample_ath10k::total_gain_db
__be16 total_gain_db
Definition:
spectral_common.h:122
fft_sample_ath10k::tsf
__be64 tsf
Definition:
spectral_common.h:124
data
u8 data[SPECTRAL_HT20_NUM_BINS]
Definition:
spectral_common.h:75
fft_sample_tlv::type
u8 type
Definition:
spectral_common.h:64
fft_sample_ath10k::max_exp
u8 max_exp
Definition:
spectral_common.h:129
tlv
struct fft_sample_tlv tlv
Definition:
spectral_common.h:61
ath_fft_sample_type
ath_fft_sample_type
Definition:
spectral_common.h:52
ATH_FFT_SAMPLE_HT20_40
Definition:
spectral_common.h:54
fft_sample_ath10k::max_magnitude
__be16 max_magnitude
Definition:
spectral_common.h:121
fft_sample_tlv
Definition:
spectral_common.h:63
fft_sample_ht20_40::upper_max_magnitude
__be16 upper_max_magnitude
Definition:
spectral_common.h:102
fft_sample_ht20_40::lower_rssi
s8 lower_rssi
Definition:
spectral_common.h:93
fft_sample_ath10k::avgpwr_db
u8 avgpwr_db
Definition:
spectral_common.h:128
fft_sample_ht20_40::channel_type
u8 channel_type
Definition:
spectral_common.h:90
fft_sample_tlv::length
__be16 length
Definition:
spectral_common.h:65
fft_sample_ht20_40::lower_max_index
u8 lower_max_index
Definition:
spectral_common.h:104
ATH_FFT_SAMPLE_ATH10K
Definition:
spectral_common.h:55
fft_sample_ath10k::noise
__be16 noise
Definition:
spectral_common.h:120
fft_sample_ht20_40::freq
__be16 freq
Definition:
spectral_common.h:91
__attribute__
struct fft_sample_tlv __attribute__((packed))
fft_sample_ath10k::max_index
s8 max_index
Definition:
spectral_common.h:125
__be16
std::uint16_t __be16
Definition:
spectral_common.h:60
fft_sample_ath10k::freq1
__be16 freq1
Definition:
spectral_common.h:118
fft_sample_ht20_40::max_exp
u8 max_exp
Definition:
spectral_common.h:110
fft_sample_ath10k::chan_width_mhz
u8 chan_width_mhz
Definition:
spectral_common.h:117
u8
std::uint8_t u8
Definition:
spectral_common.h:58
max_exp
u8 max_exp
Definition:
spectral_common.h:63
fft_sample_ht20_40::lower_max_magnitude
__be16 lower_max_magnitude
Definition:
spectral_common.h:101
rssi
s8 rssi
Definition:
spectral_common.h:66
fft_sample_ht20::tsf
__be64 tsf
Definition:
spectral_common.h:82
fft_sample_ht20_40::lower_noise
s8 lower_noise
Definition:
spectral_common.h:98
fft_sample_ht20_40::upper_bitmap_weight
u8 upper_bitmap_weight
Definition:
spectral_common.h:108
fft_sample_ath10k::relpwr_db
u8 relpwr_db
Definition:
spectral_common.h:127
fft_sample_ht20_40::lower_bitmap_weight
u8 lower_bitmap_weight
Definition:
spectral_common.h:107
SPECTRAL_HT20_NUM_BINS
#define SPECTRAL_HT20_NUM_BINS
Definition:
spectral_common.h:36
fft_sample_ath10k::freq2
__be16 freq2
Definition:
spectral_common.h:119
fft_sample_ath10k::base_pwr_db
__be16 base_pwr_db
Definition:
spectral_common.h:123
fft_sample_ht20
Definition:
spectral_common.h:69
fft_sample_ath10k::rssi
u8 rssi
Definition:
spectral_common.h:126
fft_sample_ht20::noise
s8 noise
Definition:
spectral_common.h:76
fft_sample_ht20_40::upper_noise
s8 upper_noise
Definition:
spectral_common.h:99
s8
std::int8_t s8
Definition:
spectral_common.h:59
freq
__be16 freq
Definition:
spectral_common.h:65
max_magnitude
__be16 max_magnitude
Definition:
spectral_common.h:69
bitmap_weight
u8 bitmap_weight
Definition:
spectral_common.h:71
fft_sample_ath10k
Definition:
spectral_common.h:115