Skip to content

File wlan_core.h

FileList > doppler > wlan > wlan_core.h

Go to the source code of this file

IEEE 802.11 non-HT OFDM (Clause 17) builders: a PSDU in, the constellation points and the layout the OFDM modulator takes out. More...

  • #include "doppler/clib_common.h"
  • #include "doppler/conv/conv_core.h"
  • #include "doppler/dp_crc.h"
  • #include "doppler/ofdm/ofdm_core.h"
  • #include <stddef.h>
  • #include <stdint.h>
  • #include "doppler/mpsk/mpsk_core.h"
  • #include "doppler/fft/fft_core.h"
  • #include "doppler/pn/pn_core.h"

Classes

Type Name
struct dp_wlan_rate_t
A non-HT rate, by the two columns of Table 17-4 that do not change with the clocking: a constellation and a code rate.
struct dp_wlan_signal_rate_t
A row of dp_wlan_tables_t : Table 17-6 as printed, the data rate and the SIGNAL RATE bits of one pair.
struct dp_wlan_state_t
A non-HT rate, held with what follows from it.
struct dp_wlan_tables_t
What the standard supplies: the Clause 17 literals.

Public Types

Type Name
enum dp_wlan_code_t
The code rate of the BCC, with puncturing (Figure 17-9).
enum dp_wlan_mac_t
What the caller supplies, and what the PSDU is (section 3).
typedef size_t(* dp_wlan_perm2_fn
The second interleaver permutation: input index i to output.

Public Functions

Type Name
int dp_wlan_bcc (dp_wlan_code_t code, conv_code_t * c)
The BCC at a code rate: K = 7, generators 133 and 171 octal, with the puncture pattern of the rate.
dp_wlan_state_t * dp_wlan_create (int constellation, int code_rate, uint32_t mbps, uint32_t window, uint32_t oversample)
Create a rate holder, by the index of the constellation and of the code rate or by the data rate in Mb/s, with the window and the oversampling its PPDUs use.
dp_wlan_state_t * dp_wlan_create_why (int constellation, int code_rate, uint32_t mbps, uint32_t window, uint32_t oversample, const char ** why)
dp_wlan_create() , and the reason when it refuses. The binding calls this one.
size_t dp_wlan_data_bits (const dp_wlan_rate_t * r, const uint8_t * psdu, size_t len, uint8_t state, uint8_t * out, size_t cap)
The Data field's bits: SERVICE (16 zeros), the PSDU (each octet least significant bit first), six tail bits and pad bits to a whole number of symbols, all scrambled except the tail, which is reset to zero after scrambling.
size_t dp_wlan_data_bits_max_out (const dp_wlan_state_t * state, size_t n_in)
The capacity dp_wlan_data_bits_why() needs:n_sym * n_dbps .
int64_t dp_wlan_data_bits_why (dp_wlan_state_t * state, const uint8_t * in, size_t n_in, uint32_t scrambler_state, uint8_t * out, size_t max_out, const char ** why)
The Data field's bits for a PSDU at this object's rate: dp_wlan_data_bits() with the refusal's reason.
void dp_wlan_destroy (dp_wlan_state_t * state)
Destroy a rate holder.
size_t dp_wlan_encode (dp_wlan_code_t code, const uint8_t * in, size_t n, uint8_t * out, size_t cap)
The BCC over a field's bits, punctured to the rate: the encoder starts at zero and runs the whole field.
size_t dp_wlan_interleave (const dp_wlan_tables_t * t, unsigned n_bpsc, const uint8_t * in, size_t n, uint8_t * out)
Interleave a coded field, one OFDM symbol of n_cbps at a time: the first permutation (N_CBPS/16 rows by 16 columns), then the tables' second permutation.
int dp_wlan_layout (dp_ofdm_state_t * o, const dp_wlan_tables_t * t, size_t n_sym, unsigned window, unsigned oversample)
Build a PPDU's layout into an OFDM modulator: four classes (L-STF, L-LTF, SIGNAL, Data), the pilots as fixed entries with the pilot polarity, and four runs.
size_t dp_wlan_map (const dp_wlan_tables_t * t, unsigned n_bpsc, const uint8_t * bits, size_t n, float _Complex * out)
Map interleaved bits to constellation points: groups of n_bpsc bits, through the library's maps (or the tables' relabeling).
size_t dp_wlan_map_max_out (const dp_wlan_state_t * state, size_t n_in)
The capacity dp_wlan_map_why() needs:n_in / n_bpsc points.
int64_t dp_wlan_map_why (dp_wlan_state_t * state, const uint8_t * in, size_t n_in, float _Complex * out, size_t max_out, const char ** why)
Map interleaved bits to this rate's constellation points: dp_wlan_map() over the standard tables, with the refusal's reason.
int dp_wlan_mbps (const dp_wlan_tables_t * t, const dp_wlan_rate_t * r, unsigned * mbps)
The data rate of a pair at 20 MHz, in Mb/s: the table's printed column.
size_t dp_wlan_mpdu (dp_wlan_mac_t mode, const uint8_t * header, size_t header_len, const uint8_t * body, size_t body_len, uint8_t * out, size_t out_cap)
Wrap the caller's octets as one MPDU.
size_t dp_wlan_mpdu_len (dp_wlan_mac_t mode, size_t header_len, size_t body_len)
The PSDU length a MAC wrap produces.
size_t dp_wlan_mpdu_max_out (const dp_wlan_state_t * state, size_t n_in)
The capacity dp_wlan_mpdu_why() needs: WLAN_PSDU_MAX, the longest PSDU.
int64_t dp_wlan_mpdu_why (dp_wlan_state_t * state, const uint8_t * in, size_t n_in, const uint8_t * header, size_t header_len, uint8_t * out, size_t max_out, const char ** why)
A data frame's PSDU from its body and, optionally, its MAC header: dp_wlan_mpdu() in WLAN_MAC_DATA mode, or in WLAN_MAC_FCS mode whenheader_len is 0, with the refusal's reason.
unsigned dp_wlan_n_bpsc (int constellation)
Bits per subcarrier of a constellation index: the one map from the index dp_wlan_create() takes to then_bpsc of a rate pair.
unsigned dp_wlan_n_cbps (const dp_wlan_rate_t * r)
Coded bits per OFDM symbol, 48 * n_bpsc .
unsigned dp_wlan_n_dbps (const dp_wlan_rate_t * r)
Data bits per OFDM symbol, N_CBPS * code rate .
size_t dp_wlan_n_sym (const dp_wlan_state_t * state, size_t psdu_len)
The Data OFDM symbols a PSDU needs at the rate this object holds: ceil((16 + 8 * psdu_len + 6) / n_dbps) .
const char * dp_wlan_params_why (int constellation, int code_rate, uint32_t mbps, uint32_t window, uint32_t oversample)
Why dp_wlan_create() would refuse these arguments, or NULL if it would not: the first argument that fails, by name.
size_t dp_wlan_points (const dp_wlan_tables_t * t, const dp_wlan_rate_t * r, const uint8_t * psdu, size_t len, uint8_t state, float _Complex * out, size_t cap)
The constellation points a PPDU's layout takes, in layout order: the SIGNAL field's 48, then the Data field's 48 * n_sym .
size_t dp_wlan_points_max_out (const dp_wlan_state_t * state, size_t n_in)
The capacity dp_wlan_points_why() needs:48 + 48 * n_sym .
int64_t dp_wlan_points_why (dp_wlan_state_t * state, const uint8_t * in, size_t n_in, uint32_t scrambler_state, float _Complex * out, size_t max_out, const char ** why)
The constellation points a PSDU's layout takes, at this object's rate: dp_wlan_points() with the refusal's reason.
size_t dp_wlan_ppdu (const dp_wlan_tables_t * t, const dp_wlan_rate_t * r, const uint8_t * psdu, size_t len, uint8_t state, unsigned window, unsigned oversample, float _Complex * out, size_t cap)
Render a PPDU to samples.
size_t dp_wlan_ppdu_len (size_t n_sym, unsigned window, unsigned oversample)
The samples a PPDU of n_sym Data symbols occupies:M * (160 + 160 + 80 + 80 * n_sym) , plus thewindow samples of the last symbol's window tail, withM the oversampling factor.
size_t dp_wlan_ppdu_max_out (const dp_wlan_state_t * state, size_t n_in)
The samples a PPDU of n_in PSDU octets occupies at this object's rate, window and oversampling: the capacitydp_wlan_ppdu_why() needs, exactly.
int64_t dp_wlan_ppdu_why (dp_wlan_state_t * state, const uint8_t * in, size_t n_in, uint32_t scrambler_state, float _Complex * out, size_t max_out, const char ** why)
Render a PSDU to a whole PPDU: L-STF, L-LTF, SIGNAL and Data, at the rate, window and oversampling this object holds.
int dp_wlan_rate_from_mbps (const dp_wlan_tables_t * t, unsigned mbps, dp_wlan_rate_t * r)
The pair of a data rate at 20 MHz, from Table 17-6: the inverse of dp_wlan_mbps() .
size_t dp_wlan_rate_n_sym (const dp_wlan_rate_t * r, size_t psdu_len)
The Data OFDM symbols a PSDU needs: ceil((16 + 8 * psdu_len + 6) / N_DBPS) .
int dp_wlan_rate_ok (const dp_wlan_rate_t * r)
Whether r is a rate this component builds:n_bpsc in {1, 2, 4, 6} and a code rate of the four. The data bits per OFDM symbol are whole for every such pair (the test shows it).
const char * dp_wlan_rate_resolve (const dp_wlan_tables_t * t, int * constellation, int * code_rate, unsigned mbps)
The constellation and code rate a caller means: the one place a rate given as a pair, as Mb/s, or not at all, becomes a pair.
void dp_wlan_reset (dp_wlan_state_t * state)
Reset a rate holder: nothing to reset, the rate is configuration.
size_t dp_wlan_scrambler_sequence (uint8_t state, size_t n, uint8_t * out)
The scrambling sequence from a register state.
uint8_t dp_wlan_scrambler_state_from_sequence (uint8_t seq7)
The register state that produces a scrambling sequence whose first seven bits, read as an integer with the first bit most significant, are seq7 (Annex I writes the example's start this way: 54).
size_t dp_wlan_signal_bits (const dp_wlan_tables_t * t, const dp_wlan_rate_t * r, size_t length, uint8_t * out)
The SIGNAL field's 24 bits: RATE, a reserved 0, LENGTH least significant bit first, an even-parity bit over the first 17, and six zero tail bits (Figure 17-5, 17.3.4.1).
size_t dp_wlan_signal_bits_max_out (const dp_wlan_state_t * state)
The capacity dp_wlan_signal_bits_why() needs: WLAN_SIG_BITS.
int64_t dp_wlan_signal_bits_why (dp_wlan_state_t * state, size_t psdu_len, uint8_t * out, size_t max_out, const char ** why)
The SIGNAL field's 24 bits for a PSDU of psdu_len octets at this object's rate (Figure 17-5):dp_wlan_signal_bits() over the standard tables, with the refusal's reason.
const dp_wlan_tables_t * dp_wlan_tables_empty (void)
The tables with nothing in them.
const dp_wlan_tables_t * dp_wlan_tables_standard (void)
The tables of IEEE Std 802.11-2024 Clause 17, transcribed from the text: the RATE bits (Table 17-6), the L-STF and L-LTF sequences (Eq. 17-6, 17-8), one scale for every field, the constellation bit encodings (Figure 17-10, Tables 17-14 to 17-18, as relabels of the library's maps) and the second interleaver permutation (Eq. 17-16, 17-17).
uint32_t dp_wlan_window_resolve (uint32_t window, uint32_t oversample)
The window, in samples at the output rate, that a caller's window argument means at this oversampling.

Public Static Functions

Type Name
dp_wlan_mac_t dp_wlan_mac_resolve (int mac)
The MAC mode a caller means: WLAN_MAC_AUTO is_WLAN_MAC_FCS (the preset appends the FCS), and any other value is returned as given._
uint32_t dp_wlan_window_standard (uint32_t oversample)
The 100 ns default window's length at an oversampling: 2 * M samples. Of 17.3.2.5, only the transition time, T_TR, is checked, and not the window's shape or position.

Macros

Type Name
define WLAN_CODE_AUTO 4
The code-rate argument that means "not given"; see WLAN_CONSTELLATION_AUTO . The index after 5/6's.
define WLAN_CONSTELLATION_AUTO 4
The constellation argument that means "not given": with WLAN_CODE_AUTO and no rate in Mb/s,dp_wlan_rate_resolve() turns the pair intoWLAN_MBPS_DEFAULT 's. It is the index after 64-QAM's and names no constellation: an index is a position in the listbpsk, qpsk, qam16, qam64, auto , not a modulation order.
define WLAN_GI 16u
Guard interval, in samples (0.8 us at 20 MHz).
define WLAN_LTF_LEN 160u
The L-LTF, in samples (8 us at 20 MHz).
define WLAN_MBPS_DEFAULT 36u
The data rate a caller who gives none gets, in Mb/s at 20 MHz: Table 17-6's 16-QAM at 3/4, the rate of Annex I's example. The pair is looked up in the table, never written beside this.
define WLAN_N_FFT 64u
Transform length at 20 MHz (Table 17-5).
define WLAN_N_SD 48u
Data subcarriers per OFDM symbol (Table 17-5).
define WLAN_N_SP 4u
Pilot subcarriers per OFDM symbol (Table 17-5).
define WLAN_N_SYM_MAX 1366u
The most Data OFDM symbols a PPDU can have: the largest PSDU at the slowest rate (BPSK 1/2, 24 data bits per symbol), ceil ((16 + 8 * 4095 + 6) / 24) .
define WLAN_OVERSAMPLE_MAX 128u
The largest oversampling factor: a 20 MHz PPDU in a generator running at 2.56 GS/s, so a transform of at most 8192 points.
define WLAN_PILOT_K { -21, -7, 7, 21 }
The pilot subcarrier indices (17.3.5.9).
define WLAN_PILOT_V { 1.0, 1.0, 1.0, -1.0 }
The pilot values before the polarity element (17.3.5.10).
define WLAN_POLARITY_LEN 127u
Length of the pilot polarity sequence.
define WLAN_PSDU_MAX 4095u
The largest PSDU, in octets (LENGTH is 12 bits; 17.3.4.3).
define WLAN_SERVICE_BITS 16u
Bits in the SERVICE field.
define WLAN_SIG_BITS 24u
Bits in the SIGNAL field (24: RATE, reserved, LENGTH, parity, tail).
define WLAN_STF_LEN 160u
The L-STF, in samples (8 us at 20 MHz).
define WLAN_SYM_LEN 80u
An OFDM symbol with its guard interval, in samples.
define WLAN_TAIL_BITS 6u
Tail bits that return the BCC encoder to zero.
define WLAN_WINDOW_STANDARD UINT32\_MAX
The window argument that means "the 100 ns default": dp_wlan_window_resolve() turns it into2 * M samples. A spelling ofdp_wlan_create() only; every function below it takes a count of samples at the output rate, and refuses this value as out of range (it is above80 * M ).0 is the explicit rectangular choice.

Detailed Description

wlan is a table of PPDU formats and a builder from a format and a PSDU to a layout and the constellation points the layout takes (docs/design/wlan.md section 3). It calls the library's own blocks: the parametric CRC for the FCS, conv with puncturing for the BCC, the block interleaver's first permutation, the M-PSK and QAM maps, and the OFDM modulator (ofdm_core.h) for the layout. What it adds is the 802.11 rules about field contents, written once.

What this header claims, and what it does not

Every number the design page marks checked against the standard's text is a constant here, or a member of dp_wlan_tables_t, which dp_wlan_tables_standard() returns filled with the Clause 17 literals transcribed from the text. What the test holds against a printed form is the RATE bits, both training sequences, the constellation encodings and the 2/3 and 3/4 puncture masks (Figure 17-9's sent bits). The second interleaver permutation is held by its worked 16-QAM example and by a re-derivation of Eq. (17-16), (17-17) written in the test for every index of all four Clause 17 pairs: that is the equation as posted on #3109, not a printed table. The pilot polarity is held against the 127 values that ETSI TS 101 475 V1.3.1 (5.6) prints, which is not IEEE's text; that SIGNAL takes the first of them is not checked. The 5/6 mask (Clause 19) is not held against a printed form. dp_wlan_tables_empty() is the same struct with nothing in it: a builder that needs an empty entry refuses (returns 0 or -1) and changes nothing, and the machinery tests run on SYNTHETIC tables that claim no conformance. The tables are:

  • the SIGNAL field's RATE bits for each (constellation, code rate);
  • the L-STF and L-LTF subcarrier values (17.3.3) and each field's normalization;
  • the constellation bit-to-level labels, where they differ from the library's maps (Tables 17-15 to 17-18);
  • the second permutation of the interleaver (17.3.5.7).

A PPDU

L-STF (160 samples at 20 MHz), L-LTF (160), SIGNAL (one OFDM symbol of 80), then n_sym Data OFDM symbols of 80. Durations scale with the clocking (20, 10, 5 MHz) and the sample counts do not: this component counts samples at one per 1/bandwidth.

dp_wlan_rate_t r = { 4u, WLAN_CODE_3_4 };      // 16-QAM, rate 3/4
size_t n_sym = dp_wlan_rate_n_sym (&r, 100u);  // 100-octet PSDU

Public Types Documentation

enum dp_wlan_code_t

The code rate of the BCC, with puncturing (Figure 17-9).

enum dp_wlan_code_t {
    WLAN_CODE_1_2 = 0,
    WLAN_CODE_2_3 = 1,
    WLAN_CODE_3_4 = 2,
    WLAN_CODE_5_6 = 3
};

WLAN_CODE_5_6 is Clause 19's and is unchecked against the text; Clause 17 has no RATE bits for it.


enum dp_wlan_mac_t

What the caller supplies, and what the PSDU is (section 3).

enum dp_wlan_mac_t {
    WLAN_MAC_NONE = 0,
    WLAN_MAC_FCS = 1,
    WLAN_MAC_DATA = 2,
    WLAN_MAC_AUTO = 3
};


typedef dp_wlan_perm2_fn

The second interleaver permutation: input index i to output.

typedef size_t(* dp_wlan_perm2_fn) (size_t i, size_t n_cbps, size_t n_bpsc);


Public Functions Documentation

function dp_wlan_bcc

The BCC at a code rate: K = 7, generators 133 and 171 octal, with the puncture pattern of the rate.

int dp_wlan_bcc (
    dp_wlan_code_t code,
    conv_code_t * c
) 

Parameters:

  • code The rate.
  • c The code. Must be non-NULL.

Returns:

1 on success, 0 for an unknown rate.


function dp_wlan_create

Create a rate holder, by the index of the constellation and of the code rate or by the data rate in Mb/s, with the window and the oversampling its PPDUs use.

dp_wlan_state_t * dp_wlan_create (
    int constellation,
    int code_rate,
    uint32_t mbps,
    uint32_t window,
    uint32_t oversample
) 

The rate is resolved first, by dp_wlan_rate_resolve(): the pair as given, the pair mbps names, or, with neither, WLAN_MBPS_DEFAULT's pair.

Parameters:

  • constellation 0 BPSK, 1 QPSK, 2 16-QAM, 3 64-QAM, or WLAN_CONSTELLATION_AUTO.
  • code_rate 0 for 1/2, 1 for 2/3, 2 for 3/4, 3 for 5/6, or WLAN_CODE_AUTO.
  • mbps 0, or the data rate at 20 MHz in Mb/s (6, 9, 12, 18, 24, 36, 48 or 54) with the pair left at auto. The object holds no clocking: the same PPDU played at 10 or 5 MHz carries mbps / 2 or / 4.
  • window Window length in samples at the output rate, or WLAN_WINDOW_STANDARD for the 100 ns default (2 * M samples, see dp_wlan_window_resolve()); 0 is no window. A count is 0 to 80 * oversample: the modulator takes no run whose window is longer than an OFDM symbol of its class, and the shortest is the SIGNAL and Data symbol of 80 * M samples. Above the 16 * M guard interval the cross-fade reaches into the symbol body; the default is 2 * M.
  • oversample M, 1 to WLAN_OVERSAMPLE_MAX: the output rate over the 20 MHz clock (see dp_wlan_layout()).

Returns:

Heap-allocated state, or NULL if the rate does not resolve, or an index, window or oversample is outside its range (every pair of the four constellations and four code rates is built).

Note:

Caller must call dp_wlan_destroy() when done.


function dp_wlan_create_why

dp_wlan_create() , and the reason when it refuses. The binding calls this one.

dp_wlan_state_t * dp_wlan_create_why (
    int constellation,
    int code_rate,
    uint32_t mbps,
    uint32_t window,
    uint32_t oversample,
    const char ** why
) 

Parameters:

  • constellation 0 BPSK, 1 QPSK, 2 16-QAM, 3 64-QAM, or WLAN_CONSTELLATION_AUTO.
  • code_rate 0 for 1/2, 1 for 2/3, 2 for 3/4, 3 for 5/6, or WLAN_CODE_AUTO.
  • mbps 0, or the data rate at 20 MHz in Mb/s.
  • window Window length in samples at the output rate.
  • oversample M.
  • why On a refusal only, dp_wlan_params_why()'s sentence; left as the caller set it on success. May be NULL.

Returns:

The state, or NULL with why set.

Note:

Caller must call dp_wlan_destroy() when done.

>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qam16", code_rate="r34")  # 36 Mb/s at 20 MHz
>>> w.n_bpsc, w.n_cbps, w.n_dbps
(4, 192, 144)
>>> Wlan(constellation="qam256")
Traceback (most recent call last):
    ...
ValueError: constellation must be one of "bpsk", "qpsk", "qam16", "qam64", "auto", got 'qam256'

function dp_wlan_data_bits

The Data field's bits: SERVICE (16 zeros), the PSDU (each octet least significant bit first), six tail bits and pad bits to a whole number of symbols, all scrambled except the tail, which is reset to zero after scrambling.

size_t dp_wlan_data_bits (
    const dp_wlan_rate_t * r,
    const uint8_t * psdu,
    size_t len,
    uint8_t state,
    uint8_t * out,
    size_t cap
) 

Parameters:

  • r The rate.
  • psdu PSDU octets.
  • len Their count, 1 to WLAN_PSDU_MAX.
  • state The scrambler register state, 1..127.
  • out n_sym * N_DBPS unpacked bits.
  • cap Capacity of out.

Returns:

Bits written, or 0 for an invalid rate, length or state, or a capacity that is too small.


function dp_wlan_data_bits_max_out

The capacity dp_wlan_data_bits_why() needs:n_sym * n_dbps .

size_t dp_wlan_data_bits_max_out (
    const dp_wlan_state_t * state,
    size_t n_in
) 

Parameters:

Returns:

Bits, or 0 for a length outside 1 to WLAN_PSDU_MAX.


function dp_wlan_data_bits_why

The Data field's bits for a PSDU at this object's rate: dp_wlan_data_bits() with the refusal's reason.

int64_t dp_wlan_data_bits_why (
    dp_wlan_state_t * state,
    const uint8_t * in,
    size_t n_in,
    uint32_t scrambler_state,
    uint8_t * out,
    size_t max_out,
    const char ** why
) 

Parameters:

  • state A rate holder from dp_wlan_create().
  • in The PSDU octets.
  • n_in Their count, 1 to WLAN_PSDU_MAX.
  • scrambler_state The scrambler register's initial state, 1 to 127.
  • out Receives dp_wlan_data_bits_max_out() bits.
  • max_out Capacity of out.
  • why On a refusal only, a static sentence saying why. May be NULL.

Returns:

The bits written, or -1 if the length or the state is out of range or max_out is short.

>>> import numpy as np
>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qam16", code_rate="r34")
>>> psdu = np.arange(100, dtype=np.uint8)
>>> w.data_bits(psdu, 93).shape  # n_sym 6 times n_dbps 144
(864,)
>>> w.data_bits(psdu, 128)
Traceback (most recent call last):
    ...
ValueError: the scrambler state is 1 to 127

function dp_wlan_destroy

Destroy a rate holder.

void dp_wlan_destroy (
    dp_wlan_state_t * state
) 

Parameters:

  • state May be NULL.

function dp_wlan_encode

The BCC over a field's bits, punctured to the rate: the encoder starts at zero and runs the whole field.

size_t dp_wlan_encode (
    dp_wlan_code_t code,
    const uint8_t * in,
    size_t n,
    uint8_t * out,
    size_t cap
) 

Parameters:

  • code The rate.
  • in Unpacked bits.
  • n Their count.
  • out The coded, punctured bits.
  • cap Capacity of out.

Returns:

Bits written, or 0 if code is unknown or cap is too small.


function dp_wlan_interleave

Interleave a coded field, one OFDM symbol of n_cbps at a time: the first permutation (N_CBPS/16 rows by 16 columns), then the tables' second permutation.

size_t dp_wlan_interleave (
    const dp_wlan_tables_t * t,
    unsigned n_bpsc,
    const uint8_t * in,
    size_t n,
    uint8_t * out
) 

Parameters:

  • t The tables (second permutation).
  • n_bpsc Bits per subcarrier.
  • in Coded bits, a whole number of symbols.
  • n Their count.
  • out n interleaved bits.

Returns:

n, or 0 if the tables hold no second permutation, n is not a whole number of symbols, or n_bpsc is invalid.


function dp_wlan_layout

Build a PPDU's layout into an OFDM modulator: four classes (L-STF, L-LTF, SIGNAL, Data), the pilots as fixed entries with the pilot polarity, and four runs.

int dp_wlan_layout (
    dp_ofdm_state_t * o,
    const dp_wlan_tables_t * t,
    size_t n_sym,
    unsigned window,
    unsigned oversample
) 

Parameters:

  • o A fresh modulator from dp_ofdm_create().
  • t The tables (L-STF and L-LTF values and the scales).
  • n_sym Data OFDM symbols, 1 to WLAN_N_SYM_MAX.
  • window Window length in samples at each symbol boundary, at the output rate, 0 for none.
  • oversample M, 1 to WLAN_OVERSAMPLE_MAX. The transform is 64 M long, the subcarriers are the same, and every length (the L-STF, the L-LTF, the guard interval, the body) is M times its 20 MHz value: zero-padding the grid before the inverse transform, not a resampler. The transform is unnormalized and the scale is not changed, so x_M[M n] = x_1[n] and the unit-power convention holds at every M. M = 1 is the 20 MHz layout.

Returns:

0 and a checked layout, or -1 if a table is empty, n_sym is 0 or above WLAN_N_SYM_MAX, oversample is outside 1..WLAN_OVERSAMPLE_MAX, window is above 80 * oversample, or the modulator refuses a call.

Note:

A refusal by the arguments (t NULL or a table empty, n_sym, oversample or window out of range) leaves o untouched. A refusal by the modulator may leave classes in it, and then it is not to be used again, only destroyed. dp_wlan_ppdu() builds into its own modulator and destroys it, so it is unaffected.


function dp_wlan_map

Map interleaved bits to constellation points: groups of n_bpsc bits, through the library's maps (or the tables' relabeling).

size_t dp_wlan_map (
    const dp_wlan_tables_t * t,
    unsigned n_bpsc,
    const uint8_t * bits,
    size_t n,
    float _Complex * out
) 

Parameters:

  • t The tables (relabeling).
  • n_bpsc 1, 2, 4 or 6.
  • bits Unpacked bits, a whole number of groups.
  • n Their count.
  • out n / n_bpsc unit-average-power points.

Returns:

Points written, or 0 for an invalid n_bpsc or a partial group.


function dp_wlan_map_max_out

The capacity dp_wlan_map_why() needs:n_in / n_bpsc points.

size_t dp_wlan_map_max_out (
    const dp_wlan_state_t * state,
    size_t n_in
) 

Parameters:

Returns:

Points.


function dp_wlan_map_why

Map interleaved bits to this rate's constellation points: dp_wlan_map() over the standard tables, with the refusal's reason.

int64_t dp_wlan_map_why (
    dp_wlan_state_t * state,
    const uint8_t * in,
    size_t n_in,
    float _Complex * out,
    size_t max_out,
    const char ** why
) 

Parameters:

  • state A rate holder from dp_wlan_create().
  • in Unpacked bits.
  • n_in Their count: a whole number of groups of n_bpsc, not 0.
  • out Receives dp_wlan_map_max_out() points.
  • max_out Capacity of out, in points.
  • why On a refusal only, a static sentence saying why. May be NULL.

Returns:

The points written, or -1 for a partial group, no bits or a short max_out.

>>> import numpy as np
>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qam16", code_rate="r34")
>>> pts = w.map(np.array([0, 0, 0, 0, 1, 1, 1, 1], dtype=np.uint8))
>>> bool(np.allclose(pts, [-0.9487 - 0.9487j, 0.3162 + 0.3162j], atol=1e-3))
True
>>> w.map(np.zeros(7, dtype=np.uint8))
Traceback (most recent call last):
    ...
ValueError: the bits are a whole number of groups of n_bpsc

function dp_wlan_mbps

The data rate of a pair at 20 MHz, in Mb/s: the table's printed column.

int dp_wlan_mbps (
    const dp_wlan_tables_t * t,
    const dp_wlan_rate_t * r,
    unsigned * mbps
) 

Table 17-6 lists eight of the sixteen pairs; the rate is read from its first column, and the unit test holds that column against N_DBPS / 4 for every row.

Parameters:

  • t The tables.
  • r The pair.
  • mbps The rate; written only on success.

Returns:

1 on success, 0 if the table does not list r (or gives no rates, as dp_wlan_tables_empty() does). mbps is then unchanged.


function dp_wlan_mpdu

Wrap the caller's octets as one MPDU.

size_t dp_wlan_mpdu (
    dp_wlan_mac_t mode,
    const uint8_t * header,
    size_t header_len,
    const uint8_t * body,
    size_t body_len,
    uint8_t * out,
    size_t out_cap
) 

The FCS is CRC-32/ISO-HDLC over every octet before it, appended least significant octet first. The check value of that CRC (CBF43926 over the nine ASCII digits) is pinned by the test, independent of 802.11.

Parameters:

  • mode The wrap.
  • header Header octets (DATA mode; may be NULL otherwise).
  • header_len Their count.
  • body The caller's octets.
  • body_len Their count.
  • out Receives dp_wlan_mpdu_len() octets.
  • out_cap Capacity of out.

Returns:

Octets written, or 0 (and out untouched) if the length is 0 or too large or out_cap is too small.


function dp_wlan_mpdu_len

The PSDU length a MAC wrap produces.

size_t dp_wlan_mpdu_len (
    dp_wlan_mac_t mode,
    size_t header_len,
    size_t body_len
) 

Parameters:

  • mode How the caller's octets are wrapped.
  • header_len Header octets (WLAN_MAC_DATA only).
  • body_len The caller's octets: the body in DATA mode, the whole PSDU or MPDU otherwise.

Returns:

Octets, or 0 if the result is 0 or above WLAN_PSDU_MAX.


function dp_wlan_mpdu_max_out

The capacity dp_wlan_mpdu_why() needs: WLAN_PSDU_MAX, the longest PSDU.

size_t dp_wlan_mpdu_max_out (
    const dp_wlan_state_t * state,
    size_t n_in
) 

Parameters:

Returns:

WLAN_PSDU_MAX.


function dp_wlan_mpdu_why

A data frame's PSDU from its body and, optionally, its MAC header: dp_wlan_mpdu() in WLAN_MAC_DATA mode, or in WLAN_MAC_FCS mode whenheader_len is 0, with the refusal's reason.

int64_t dp_wlan_mpdu_why (
    dp_wlan_state_t * state,
    const uint8_t * in,
    size_t n_in,
    const uint8_t * header,
    size_t header_len,
    uint8_t * out,
    size_t max_out,
    const char ** why
) 

With no header the body is taken as an MPDU that lacks its FCS and the result is the body and its FCS, which is also what an empty header gives in data mode, so "no header" and "an empty header" are one result. There is no way to ask for the body unchanged: WLAN_MAC_NONE is the body itself. The MPDU does not depend on the rate; it is on the object so a caller builds a frame and renders it with one handle.

Parameters:

  • state A rate holder from dp_wlan_create().
  • in The body octets (the whole MPDU without its FCS when there is no header).
  • n_in Their count.
  • header Header octets, or NULL.
  • header_len Their count; 0 for none.
  • out Receives the header, the body and the FCS.
  • max_out Capacity of out.
  • why On a refusal only, a static sentence saying why. May be NULL.

Returns:

The octets written, or -1 if the MPDU is 0 or above WLAN_PSDU_MAX octets or max_out is short.

>>> import numpy as np
>>> from doppler.wlan import Wlan
>>> w = Wlan()
>>> header = np.arange(24, dtype=np.uint8)
>>> body = np.arange(10, dtype=np.uint8)
>>> psdu = w.mpdu(body, header)  # 24 + 10 + the 4-octet FCS
>>> psdu.shape
(38,)
>>> bytes(psdu[-4:]).hex()  # CRC-32/ISO-HDLC, least significant first
'c0958e66'
>>> w.mpdu(body).shape  # no header: the body and its FCS
(14,)

function dp_wlan_n_bpsc

Bits per subcarrier of a constellation index: the one map from the index dp_wlan_create() takes to then_bpsc of a rate pair.

unsigned dp_wlan_n_bpsc (
    int constellation
) 

Parameters:

  • constellation 0 BPSK, 1 QPSK, 2 16-QAM, 3 64-QAM.

Returns:

1, 2, 4 or 6, or 0 for an index outside 0 to 3.

unsigned n = dp_wlan_n_bpsc (2);   // 16-QAM: 4 bits per subcarrier

function dp_wlan_n_cbps

Coded bits per OFDM symbol, 48 * n_bpsc .

unsigned dp_wlan_n_cbps (
    const dp_wlan_rate_t * r
) 

Parameters:

  • r A valid rate.

Returns:

N_CBPS, or 0 for an invalid rate.


function dp_wlan_n_dbps

Data bits per OFDM symbol, N_CBPS * code rate .

unsigned dp_wlan_n_dbps (
    const dp_wlan_rate_t * r
) 

Parameters:

  • r A valid rate.

Returns:

N_DBPS, or 0 for an invalid rate.


function dp_wlan_n_sym

The Data OFDM symbols a PSDU needs at the rate this object holds: ceil((16 + 8 * psdu_len + 6) / n_dbps) .

size_t dp_wlan_n_sym (
    const dp_wlan_state_t * state,
    size_t psdu_len
) 

Parameters:

  • state A rate holder from dp_wlan_create().
  • psdu_len Octets, 1 to WLAN_PSDU_MAX.

Returns:

The symbol count, or 0 for a length of 0 or above WLAN_PSDU_MAX.

>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qam16", code_rate="r34")
>>> w.n_sym(100)
6
>>> w.n_sym(0)
0

function dp_wlan_params_why

Why dp_wlan_create() would refuse these arguments, or NULL if it would not: the first argument that fails, by name.

const char * dp_wlan_params_why (
    int constellation,
    int code_rate,
    uint32_t mbps,
    uint32_t window,
    uint32_t oversample
) 

The rate is resolved first (dp_wlan_rate_resolve(), whose sentence is returned when it refuses). The oversampling is checked before the window, because the window's limit depends on it.

Parameters:

  • constellation 0 BPSK, 1 QPSK, 2 16-QAM, 3 64-QAM, or WLAN_CONSTELLATION_AUTO.
  • code_rate 0 for 1/2, 1 for 2/3, 2 for 3/4, 3 for 5/6, or WLAN_CODE_AUTO.
  • mbps 0, or the data rate at 20 MHz in Mb/s.
  • window Window length in samples at the output rate.
  • oversample M.

Returns:

A static sentence naming the argument and its range, or NULL.


function dp_wlan_points

The constellation points a PPDU's layout takes, in layout order: the SIGNAL field's 48, then the Data field's 48 * n_sym .

size_t dp_wlan_points (
    const dp_wlan_tables_t * t,
    const dp_wlan_rate_t * r,
    const uint8_t * psdu,
    size_t len,
    uint8_t state,
    float _Complex * out,
    size_t cap
) 

The SIGNAL field is BPSK at rate 1/2, not scrambled; the Data field runs dp_wlan_data_bits(), dp_wlan_encode(), dp_wlan_interleave() and dp_wlan_map().

Parameters:

  • t The tables.
  • r The rate.
  • psdu PSDU octets.
  • len Their count.
  • state The scrambler register state, 1..127.
  • out Receives 48 + 48 * n_sym points.
  • cap Capacity of out, in points.

Returns:

Points written, or 0 if any stage refuses.


function dp_wlan_points_max_out

The capacity dp_wlan_points_why() needs:48 + 48 * n_sym .

size_t dp_wlan_points_max_out (
    const dp_wlan_state_t * state,
    size_t n_in
) 

Parameters:

Returns:

Points, or 0 for a length outside 1 to WLAN_PSDU_MAX.


function dp_wlan_points_why

The constellation points a PSDU's layout takes, at this object's rate: dp_wlan_points() with the refusal's reason.

int64_t dp_wlan_points_why (
    dp_wlan_state_t * state,
    const uint8_t * in,
    size_t n_in,
    uint32_t scrambler_state,
    float _Complex * out,
    size_t max_out,
    const char ** why
) 

Parameters:

  • state A rate holder from dp_wlan_create().
  • in The PSDU octets.
  • n_in Their count, 1 to WLAN_PSDU_MAX.
  • scrambler_state The scrambler register's initial state, 1 to 127.
  • out Receives dp_wlan_points_max_out() points.
  • max_out Capacity of out, in points.
  • why On a refusal only, a static sentence saying why. May be NULL.

Returns:

The points written, or -1 if the rate has no SIGNAL RATE bits, the length or the state is out of range or max_out is short.

>>> import numpy as np
>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qam16", code_rate="r34")
>>> psdu = np.arange(100, dtype=np.uint8)
>>> w.points(psdu, 93).shape  # 48 SIGNAL + 48 * 6 Data
(336,)
>>> w.points_max_out(100)
336
>>> w.points(psdu, 0)
Traceback (most recent call last):
    ...
ValueError: the scrambler state is 1 to 127

function dp_wlan_ppdu

Render a PPDU to samples.

size_t dp_wlan_ppdu (
    const dp_wlan_tables_t * t,
    const dp_wlan_rate_t * r,
    const uint8_t * psdu,
    size_t len,
    uint8_t state,
    unsigned window,
    unsigned oversample,
    float _Complex * out,
    size_t cap
) 

Parameters:

  • t The tables.
  • r The rate.
  • psdu PSDU octets.
  • len Their count.
  • state The scrambler register state, 1..127.
  • window Window length in samples at the output rate, 0 for none.
  • oversample M, 1 to WLAN_OVERSAMPLE_MAX (see dp_wlan_layout()).
  • out Receives dp_wlan_ppdu_len() samples.
  • cap Capacity of out, in samples.

Returns:

Samples written, or 0 if any stage refuses (changing nothing).


function dp_wlan_ppdu_len

The samples a PPDU of n_sym Data symbols occupies:M * (160 + 160 + 80 + 80 * n_sym) , plus thewindow samples of the last symbol's window tail, withM the oversampling factor.

size_t dp_wlan_ppdu_len (
    size_t n_sym,
    unsigned window,
    unsigned oversample
) 

Parameters:

  • n_sym Data OFDM symbols, 1 to WLAN_N_SYM_MAX.
  • window Window length in samples at the output rate, 0 for none. A count: WLAN_WINDOW_STANDARD is resolved by the caller (dp_wlan_window_resolve()), not here.
  • oversample M: the output rate over the 20 MHz clock, 1 to WLAN_OVERSAMPLE_MAX (128).

Returns:

Samples, or 0 if n_sym or oversample is outside its range (the ranges dp_wlan_layout() accepts).


function dp_wlan_ppdu_max_out

The samples a PPDU of n_in PSDU octets occupies at this object's rate, window and oversampling: the capacitydp_wlan_ppdu_why() needs, exactly.

size_t dp_wlan_ppdu_max_out (
    const dp_wlan_state_t * state,
    size_t n_in
) 

Parameters:

  • state A rate holder from dp_wlan_create().
  • n_in PSDU octets, 1 to WLAN_PSDU_MAX.

Returns:

Samples, or 0 for a length outside that range or for a rate with no SIGNAL RATE bits (Table 17-6 lists eight of the sixteen pairs; the others cannot be sent, and rate_mbps is 0 for them).


function dp_wlan_ppdu_why

Render a PSDU to a whole PPDU: L-STF, L-LTF, SIGNAL and Data, at the rate, window and oversampling this object holds.

int64_t dp_wlan_ppdu_why (
    dp_wlan_state_t * state,
    const uint8_t * in,
    size_t n_in,
    uint32_t scrambler_state,
    float _Complex * out,
    size_t max_out,
    const char ** why
) 

The standard's tables are the library's (dp_wlan_tables_standard()); the PSDU is the caller's octets as given, FCS included. The result is the dp_wlan_ppdu() output for the same arguments, with the refusal's reason.

Parameters:

  • state A rate holder from dp_wlan_create().
  • in The PSDU octets.
  • n_in Their count, 1 to WLAN_PSDU_MAX.
  • scrambler_state The scrambler register's initial state, 1 to 127.
  • out Receives dp_wlan_ppdu_max_out() samples.
  • max_out Capacity of out, in samples.
  • why On a refusal only, a static sentence saying why; left as the caller set it on success. May be NULL.

Returns:

The samples written, or -1 if the rate has no SIGNAL RATE bits, the PSDU length or the scrambler state is out of range, or max_out is short; out is then untouched. On the Python face a short out= is refused before the other arguments are, by the binding.

>>> import numpy as np
>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qam16", code_rate="r34")  # 36 Mb/s
>>> psdu = np.arange(100, dtype=np.uint8)
>>> x = w.ppdu(psdu, 93)
>>> x.dtype, x.shape  # 160 + 160 + 80 + 80 * 6, plus the 2-sample window
(dtype('complex64'), (882,))
>>> w2 = Wlan(constellation="qam16", code_rate="r34", oversample=2)
>>> w2.ppdu(psdu, 93).shape  # twice as fine, and a 4-sample window
(1764,)
>>> w.ppdu(psdu, 0)
Traceback (most recent call last):
    ...
ValueError: the scrambler state is 1 to 127

function dp_wlan_rate_from_mbps

The pair of a data rate at 20 MHz, from Table 17-6: the inverse of dp_wlan_mbps() .

int dp_wlan_rate_from_mbps (
    const dp_wlan_tables_t * t,
    unsigned mbps,
    dp_wlan_rate_t * r
) 

Parameters:

  • t The tables.
  • mbps The rate: 6, 9, 12, 18, 24, 36, 48 or 54 in the standard's table.
  • r The pair; written only on success.

Returns:

1 on success, 0 if the table lists no such rate. r is then unchanged.


function dp_wlan_rate_n_sym

The Data OFDM symbols a PSDU needs: ceil((16 + 8 * psdu_len + 6) / N_DBPS) .

size_t dp_wlan_rate_n_sym (
    const dp_wlan_rate_t * r,
    size_t psdu_len
) 

Parameters:

  • r A valid rate.
  • psdu_len Octets, 1 to WLAN_PSDU_MAX.

Returns:

The symbol count, or 0 for an invalid rate or length.


function dp_wlan_rate_ok

Whether r is a rate this component builds:n_bpsc in {1, 2, 4, 6} and a code rate of the four. The data bits per OFDM symbol are whole for every such pair (the test shows it).

int dp_wlan_rate_ok (
    const dp_wlan_rate_t * r
) 

Parameters:

  • r The rate.

Returns:

1 if it is, 0 if not.


function dp_wlan_rate_resolve

The constellation and code rate a caller means: the one place a rate given as a pair, as Mb/s, or not at all, becomes a pair.

const char * dp_wlan_rate_resolve (
    const dp_wlan_tables_t * t,
    int * constellation,
    int * code_rate,
    unsigned mbps
) 

A rate is a pair (docs/design/wlan.md, section 10), so it is given whole:

constellation, code_rate mbps resolves to
both auto 0 WLAN_MBPS_DEFAULT's pair
both auto N Table 17-6's pair for N
both given 0 the pair, unchanged
one auto, one given any refused: half a pair
either given N refused: two spellings of one rate

Each pair is read from t, never written here. A given pair is returned unchanged and not range-checked: dp_wlan_params_why() does that. Both faces call this, so they refuse in the same words: Wlan through dp_wlan_create(), and the wfmgen ofdm source, whose wlan field is mbps.

Parameters:

  • t The tables.
  • constellation An index or WLAN_CONSTELLATION_AUTO; the resolved index on success, unchanged on a refusal.
  • code_rate An index or WLAN_CODE_AUTO; as above.
  • mbps 0, or a data rate at 20 MHz in Mb/s.

Returns:

NULL on success, or a static sentence saying why not.

>>> from doppler.wlan import Wlan
>>> Wlan().rate_mbps            # neither given: the default pair
36
>>> Wlan(mbps=54).rate_mbps
54
>>> Wlan(constellation="qam16")
Traceback (most recent call last):
    ...
ValueError: constellation and code_rate are one rate: give both, or neither

function dp_wlan_reset

Reset a rate holder: nothing to reset, the rate is configuration.

void dp_wlan_reset (
    dp_wlan_state_t * state
) 

Parameters:

  • state Must be non-NULL.
>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qpsk", code_rate="r34")
>>> w.reset()                      # nothing runs, so nothing changes
>>> w.n_dbps
72

function dp_wlan_scrambler_sequence

The scrambling sequence from a register state.

size_t dp_wlan_scrambler_sequence (
    uint8_t state,
    size_t n,
    uint8_t * out
) 

Parameters:

  • state The register state, 1..127 (x1 the most significant bit).
  • n Bits wanted.
  • out n unpacked bits.

Returns:

n, or 0 for a state of 0 or above 127.


function dp_wlan_scrambler_state_from_sequence

The register state that produces a scrambling sequence whose first seven bits, read as an integer with the first bit most significant, are seq7 (Annex I writes the example's start this way: 54).

uint8_t dp_wlan_scrambler_state_from_sequence (
    uint8_t seq7
) 

The sequence is the library's pn (a Galois register, polynomial 0x48, seven bits) and obeys s[n] = s[n-7] xor s[n-4], so it is its own history: the register x1..x7 is s[0], s[-1], ..., s[-6] (an integer with x1 most significant) and the first output is x7 xor x4. The state that produces given first seven bits is the recurrence run backward seven steps, and the state 1011101 (93) produces the sequence 0110110 (54).

Parameters:

  • seq7 The first seven sequence bits, 1..127.

Returns:

The register state, 1..127; 0 for 0 or a value above 127.


function dp_wlan_signal_bits

The SIGNAL field's 24 bits: RATE, a reserved 0, LENGTH least significant bit first, an even-parity bit over the first 17, and six zero tail bits (Figure 17-5, 17.3.4.1).

size_t dp_wlan_signal_bits (
    const dp_wlan_tables_t * t,
    const dp_wlan_rate_t * r,
    size_t length,
    uint8_t * out
) 

Parameters:

  • t The tables (RATE bits).
  • r The rate.
  • length PSDU octets, 1 to WLAN_PSDU_MAX.
  • out WLAN_SIG_BITS unpacked bits.

Returns:

WLAN_SIG_BITS, or 0 if the rate has no RATE bits in the tables or the length is outside 1 to WLAN_PSDU_MAX.


function dp_wlan_signal_bits_max_out

The capacity dp_wlan_signal_bits_why() needs: WLAN_SIG_BITS.

size_t dp_wlan_signal_bits_max_out (
    const dp_wlan_state_t * state
) 

Parameters:

Returns:

WLAN_SIG_BITS.


function dp_wlan_signal_bits_why

The SIGNAL field's 24 bits for a PSDU of psdu_len octets at this object's rate (Figure 17-5):dp_wlan_signal_bits() over the standard tables, with the refusal's reason.

int64_t dp_wlan_signal_bits_why (
    dp_wlan_state_t * state,
    size_t psdu_len,
    uint8_t * out,
    size_t max_out,
    const char ** why
) 

Parameters:

  • state A rate holder from dp_wlan_create().
  • psdu_len PSDU octets, 1 to WLAN_PSDU_MAX.
  • out Receives WLAN_SIG_BITS unpacked bits.
  • max_out Capacity of out.
  • why On a refusal only, a static sentence saying why. May be NULL.

Returns:

The bits written, or -1 if the rate has no SIGNAL RATE bits, the length is out of range or max_out is short.

>>> from doppler.wlan import Wlan
>>> w = Wlan(constellation="qam16", code_rate="r34")  # 36 Mb/s
>>> w.signal_bits(100).tolist()  # RATE, 0, LENGTH lsb first, parity, tail
[1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
>>> w.signal_bits(0)
Traceback (most recent call last):
    ...
ValueError: the PSDU is 1 to 4095 octets

function dp_wlan_tables_empty

The tables with nothing in them.

const dp_wlan_tables_t * dp_wlan_tables_empty (
    void
) 

Returns:

A pointer to a static, all-empty dp_wlan_tables_t.


function dp_wlan_tables_standard

The tables of IEEE Std 802.11-2024 Clause 17, transcribed from the text: the RATE bits (Table 17-6), the L-STF and L-LTF sequences (Eq. 17-6, 17-8), one scale for every field, the constellation bit encodings (Figure 17-10, Tables 17-14 to 17-18, as relabels of the library's maps) and the second interleaver permutation (Eq. 17-16, 17-17).

const dp_wlan_tables_t * dp_wlan_tables_standard (
    void
) 

The 5/6 code rate has no entry: it is Clause 19's, not Clause 17's, and dp_wlan_signal_bits() refuses it.

Returns:

A pointer to a static, filled dp_wlan_tables_t.


function dp_wlan_window_resolve

The window, in samples at the output rate, that a caller's window argument means at this oversampling.

uint32_t dp_wlan_window_resolve (
    uint32_t window,
    uint32_t oversample
) 

WLAN_WINDOW_STANDARD gives 2 * oversample, the 100 ns default (T_TR checked, 17.3.2.5); any other value is returned unchanged, so 0 stays the explicit rectangular choice. The one place the default is defined: dp_wlan_create() and the wfmgen source call it, and a caller who wants the default for a call that takes a count (dp_wlan_layout(), dp_wlan_ppdu()) asks it too. It does not range-check: dp_wlan_params_why() does, on the resolved count.

Parameters:

  • window A count, or WLAN_WINDOW_STANDARD.
  • oversample M.

Returns:

The count.

>>> from doppler.wlan import Wlan
>>> Wlan(oversample=4).window   # the default: 100 ns at 80 MHz
8
>>> Wlan(window=0, oversample=4).window   # rectangular, by asking
0

Public Static Functions Documentation

function dp_wlan_mac_resolve

The MAC mode a caller means: WLAN_MAC_AUTO is_WLAN_MAC_FCS (the preset appends the FCS), and any other value is returned as given._

static inline dp_wlan_mac_t dp_wlan_mac_resolve (
    int mac
) 

static inline so that wfmgen's draw library, which links no DSP, calls it instead of keeping a copy, as it does dp_wlan_window_standard().

Parameters:

  • mac A dp_wlan_mac_t value, or WLAN_MAC_AUTO.

Returns:

The mode.


function dp_wlan_window_standard

The 100 ns default window's length at an oversampling: 2 * M samples. Of 17.3.2.5, only the transition time, T_TR, is checked, and not the window's shape or position.

static inline uint32_t dp_wlan_window_standard (
    uint32_t oversample
) 

The one definition of the rule. It is static inline so that wfmgen's draw library, which links no DSP, calls it instead of keeping a copy; dp_wlan_window_resolve() returns it for WLAN_WINDOW_STANDARD.

Parameters:

  • oversample M.

Returns:

The count.


Macro Definition Documentation

define WLAN_CODE_AUTO

The code-rate argument that means "not given"; see WLAN_CONSTELLATION_AUTO . The index after 5/6's.

#define WLAN_CODE_AUTO `4`


define WLAN_CONSTELLATION_AUTO

The constellation argument that means "not given": with WLAN_CODE_AUTO and no rate in Mb/s,dp_wlan_rate_resolve() turns the pair intoWLAN_MBPS_DEFAULT 's. It is the index after 64-QAM's and names no constellation: an index is a position in the listbpsk, qpsk, qam16, qam64, auto , not a modulation order.

#define WLAN_CONSTELLATION_AUTO `4`


define WLAN_GI

Guard interval, in samples (0.8 us at 20 MHz).

#define WLAN_GI `16u`


define WLAN_LTF_LEN

The L-LTF, in samples (8 us at 20 MHz).

#define WLAN_LTF_LEN `160u`


define WLAN_MBPS_DEFAULT

The data rate a caller who gives none gets, in Mb/s at 20 MHz: Table 17-6's 16-QAM at 3/4, the rate of Annex I's example. The pair is looked up in the table, never written beside this.

#define WLAN_MBPS_DEFAULT `36u`


define WLAN_N_FFT

Transform length at 20 MHz (Table 17-5).

#define WLAN_N_FFT `64u`


define WLAN_N_SD

Data subcarriers per OFDM symbol (Table 17-5).

#define WLAN_N_SD `48u`


define WLAN_N_SP

Pilot subcarriers per OFDM symbol (Table 17-5).

#define WLAN_N_SP `4u`


define WLAN_N_SYM_MAX

The most Data OFDM symbols a PPDU can have: the largest PSDU at the slowest rate (BPSK 1/2, 24 data bits per symbol), ceil ((16 + 8 * 4095 + 6) / 24) .

#define WLAN_N_SYM_MAX `1366u`


define WLAN_OVERSAMPLE_MAX

The largest oversampling factor: a 20 MHz PPDU in a generator running at 2.56 GS/s, so a transform of at most 8192 points.

#define WLAN_OVERSAMPLE_MAX `128u`


define WLAN_PILOT_K

The pilot subcarrier indices (17.3.5.9).

#define WLAN_PILOT_K `{ -21, -7, 7, 21 }`


define WLAN_PILOT_V

The pilot values before the polarity element (17.3.5.10).

#define WLAN_PILOT_V `{ 1.0, 1.0, 1.0, -1.0 }`


define WLAN_POLARITY_LEN

Length of the pilot polarity sequence.

#define WLAN_POLARITY_LEN `127u`


define WLAN_PSDU_MAX

The largest PSDU, in octets (LENGTH is 12 bits; 17.3.4.3).

#define WLAN_PSDU_MAX `4095u`


define WLAN_SERVICE_BITS

Bits in the SERVICE field.

#define WLAN_SERVICE_BITS `16u`


define WLAN_SIG_BITS

Bits in the SIGNAL field (24: RATE, reserved, LENGTH, parity, tail).

#define WLAN_SIG_BITS `24u`


define WLAN_STF_LEN

The L-STF, in samples (8 us at 20 MHz).

#define WLAN_STF_LEN `160u`


define WLAN_SYM_LEN

An OFDM symbol with its guard interval, in samples.

#define WLAN_SYM_LEN `80u`


define WLAN_TAIL_BITS

Tail bits that return the BCC encoder to zero.

#define WLAN_TAIL_BITS `6u`


define WLAN_WINDOW_STANDARD

The window argument that means "the 100 ns default": dp_wlan_window_resolve() turns it into2 * M samples. A spelling ofdp_wlan_create() only; every function below it takes a count of samples at the output rate, and refuses this value as out of range (it is above80 * M ).0 is the explicit rectangular choice.

#define WLAN_WINDOW_STANDARD `UINT32_MAX`



The documentation for this class was generated from the following file native/inc/doppler/wlan/wlan_core.h