Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding IEEE802.11ah compatibility #412

Draft
wants to merge 12 commits into
base: maint-3.10
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions break.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cd build
sudo make uninstall
cd ..
sudo rm -rf build
7 changes: 7 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig
cd ..
2 changes: 1 addition & 1 deletion grc/ieee802_11_decode_mac.block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ parameters:
inputs:
- domain: stream
dtype: byte
vlen: 48
vlen: 24

outputs:
- domain: message
Expand Down
10 changes: 5 additions & 5 deletions grc/ieee802_11_frame_equalizer.block.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# auto-generated by grc.converter

id: ieee802_11_frame_equalizer
label: WiFi Frame Equalizer
label: HaLow Frame Equalizer
category: '[IEEE802.11]'

parameters:
Expand All @@ -12,11 +12,11 @@ parameters:
- id: freq
label: Frequency
dtype: real
default: 5.89e9
default: 920.5e6
- id: bw
label: Bandwidth
dtype: real
default: 10e6
default: 1e6
- id: log
label: Log
dtype: bool
Expand All @@ -33,13 +33,13 @@ parameters:
inputs:
- domain: stream
dtype: complex
vlen: 64
vlen: 32
multiplicity: '1'

outputs:
- domain: stream
dtype: byte
vlen: 48
vlen: 24
multiplicity: '1'
- domain: message
id: symbols
Expand Down
2 changes: 1 addition & 1 deletion grc/ieee802_11_sync_long.block.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# auto-generated by grc.converter

id: ieee802_11_sync_long
label: WiFi Sync Long
label: HaLow Sync Long
category: '[IEEE802.11]'

parameters:
Expand Down
2 changes: 1 addition & 1 deletion grc/ieee802_11_sync_short.block.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# auto-generated by grc.converter

id: ieee802_11_sync_short
label: WiFi Sync Short
label: HaLow Sync Short
category: '[IEEE802.11]'

parameters:
Expand Down
14 changes: 7 additions & 7 deletions lib/decode_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class decode_mac_impl : public decode_mac
public:
decode_mac_impl(bool log, bool debug)
: block("decode_mac",
gr::io_signature::make(1, 1, 48),
gr::io_signature::make(1, 1, CODED_BITS_PER_OFDM_SYMBOL),
gr::io_signature::make(0, 0, 0)),
d_log(log),
d_debug(debug),
Expand Down Expand Up @@ -102,20 +102,20 @@ class decode_mac_impl : public decode_mac
if (copied < d_frame.n_sym) {
dout << "copy one symbol, copied " << copied << " out of "
<< d_frame.n_sym << std::endl;
std::memcpy(d_rx_symbols + (copied * 48), in, 48);
std::memcpy(d_rx_symbols + (copied * CODED_BITS_PER_OFDM_SYMBOL), in, CODED_BITS_PER_OFDM_SYMBOL);
copied++;

if (copied == d_frame.n_sym) {
dout << "received complete frame - decoding" << std::endl;
decode();
in += 48;
in += CODED_BITS_PER_OFDM_SYMBOL;
i++;
d_frame_complete = true;
break;
}
}

in += 48;
in += CODED_BITS_PER_OFDM_SYMBOL;
i++;
}

Expand All @@ -127,7 +127,7 @@ class decode_mac_impl : public decode_mac
void decode()
{

for (int i = 0; i < d_frame.n_sym * 48; i++) {
for (int i = 0; i < d_frame.n_sym * CODED_BITS_PER_OFDM_SYMBOL; i++) {
for (int k = 0; k < d_ofdm.n_bpsc; k++) {
d_rx_bits[i * d_ofdm.n_bpsc + k] = !!(d_rx_symbols[i] & (1 << k));
}
Expand All @@ -142,7 +142,7 @@ class decode_mac_impl : public decode_mac
boost::crc_32_type result;
result.process_bytes(out_bytes + 2, d_frame.psdu_size);
if (result.checksum() != 558161692) {
dout << "checksum wrong -- dropping" << std::endl;
dout << "checksum wrong -- dropping. expected 558161692 got: " << result.checksum() << std::endl;
return;
}

Expand Down Expand Up @@ -243,7 +243,7 @@ class decode_mac_impl : public decode_mac

viterbi_decoder d_decoder;

uint8_t d_rx_symbols[48 * MAX_SYM];
uint8_t d_rx_symbols[CODED_BITS_PER_OFDM_SYMBOL * MAX_SYM];
uint8_t d_rx_bits[MAX_ENCODED_BITS];
uint8_t d_deinterleaved_bits[MAX_ENCODED_BITS];
uint8_t out_bytes[MAX_PSDU_SIZE + 2]; // 2 for signal field
Expand Down
11 changes: 5 additions & 6 deletions lib/equalizer/base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@

using namespace gr::ieee802_11::equalizer;

const gr_complex base::LONG[] = { 0, 0, 0, 0, 0, 0, 1, 1, -1, -1, 1, 1, -1,
1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1,
1, -1, 1, 1, 1, 1, 0, 1, -1, -1, 1, 1, -1,
1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1,
-1, 1, -1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
const gr_complex base::LONG[] = { 0, 0, 0, 1, 1, -1, -1, 1, 1, -1,
1, -1, 1, 1, 1, 1, 0, 1, -1, -1, //make sure 0 is in center
1, -1, 1, 1, 1, 1, 1, 1, -1, -1,
0, 0};//maybe this is the first 48 (24 in the case of HaLow) values from the polarity field below, after the SIG

const gr_complex base::POLARITY[127] = {
1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1,
Expand All @@ -34,7 +33,7 @@ const gr_complex base::POLARITY[127] = {
1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1,
1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1,
1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1
};
}; //original from p.2826

std::vector<gr_complex> base::get_csi()
{
Expand Down
5 changes: 3 additions & 2 deletions lib/equalizer/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <gnuradio/digital/constellation.h>
#include <gnuradio/gr_complex.h>
#include "../utils.h"

namespace gr {
namespace ieee802_11 {
Expand All @@ -41,9 +42,9 @@ class base
std::vector<gr_complex> get_csi();

protected:
static const gr_complex LONG[64];
static const gr_complex LONG[SAMPLES_PER_OFDM_SYMBOL];

gr_complex d_H[64];
gr_complex d_H[SAMPLES_PER_OFDM_SYMBOL];
};

} // namespace equalizer
Expand Down
14 changes: 7 additions & 7 deletions lib/equalizer/ls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ void ls::equalize(gr_complex* in,
{

if (n == 0) {
std::memcpy(d_H, in, 64 * sizeof(gr_complex));
std::memcpy(d_H, in, SAMPLES_PER_OFDM_SYMBOL * sizeof(gr_complex));

} else if (n == 1) {
double signal = 0;
double noise = 0;
for (int i = 0; i < 64; i++) {
if ((i == 32) || (i < 6) || (i > 58)) {
for (int i = 0; i < SAMPLES_PER_OFDM_SYMBOL; i++) {
if ((i == 16) || (i < 3) || (i > 29)) { //dividing by two gets you the dead DC pilot subcarrier, the other indices correspond to dead lower and upper subcarriers. 3 dead lower ones, 2 dead upper ones
continue;
}
noise += std::pow(std::abs(d_H[i] - in[i]), 2);
Expand All @@ -49,10 +49,10 @@ void ls::equalize(gr_complex* in,
} else {

int c = 0;
for (int i = 0; i < 64; i++) {
if ((i == 11) || (i == 25) || (i == 32) || (i == 39) || (i == 53) ||
(i < 6) || (i > 58)) {
continue;
for (int i = 0; i < SAMPLES_PER_OFDM_SYMBOL; i++) {
if ((i == PILOT1_INDEX) || (i == 16) || (i == PILOT2_INDEX) ||
(i < 3) || (i > 29)) {
continue; //ignore all pilots and dead subcarriers
} else {
symbols[c] = in[i] / d_H[i];
bits[c] = mod->decision_maker(&symbols[c]);
Expand Down
Loading