42 lines
1.5 KiB
Mathematica
42 lines
1.5 KiB
Mathematica
![]() |
function [y, bits] = newLSIG(cfgFormat,frameNo)
|
||
|
|
||
|
R = wlan.internal.nonHTRateSignalBits(cfgFormat.MCS);
|
||
|
length = cfgFormat.PSDULength;
|
||
|
|
||
|
|
||
|
% Construct the SIGNAL field. Length parameter with LSB first, which is 12 bits
|
||
|
lengthBits = de2bi(length,12,'right-msb').';
|
||
|
|
||
|
% Even parity bit
|
||
|
parityBit = mod(sum([R;lengthBits],1),2);
|
||
|
|
||
|
% 自建:插入帧号
|
||
|
frameNoBits = de2bi(frameNo,6,'right-msb').';
|
||
|
|
||
|
% The SIGNAL field (IEEE Std 802.11-2016, Section 17.3.4.2)
|
||
|
% bits = [R; 0; lengthBits; parityBit; zeros(6,1,'int8')];
|
||
|
bits = [R; 0; lengthBits; parityBit; frameNoBits];
|
||
|
|
||
|
% Process L-SIG bits
|
||
|
encodedBits = wlanBCCEncode(bits,'1/2');
|
||
|
interleavedBits = wlanBCCInterleave(encodedBits,'Non-HT',48);
|
||
|
modData = wlanConstellationMap(interleavedBits,1);
|
||
|
|
||
|
% Add pilot symbols, from IEEE Std 802.11-2016, Equation 19-14
|
||
|
Nsym = 1; % One symbol
|
||
|
z = 0; % No offset as first symbol is with pilots
|
||
|
modPilots = wlan.internal.nonHTPilots(Nsym,z);
|
||
|
|
||
|
% Map subcarriers and replicate over bandwidth
|
||
|
cfgOFDM = wlan.internal.wlanGetOFDMConfig(cfgFormat.ChannelBandwidth,'Long','Legacy');
|
||
|
sym = complex(zeros(cfgOFDM.FFTLength,1));
|
||
|
sym(cfgOFDM.DataIndices,1) = repmat(modData,cfgOFDM.NumSubchannels,1);
|
||
|
sym(cfgOFDM.PilotIndices,1) = repmat(modPilots,cfgOFDM.NumSubchannels,1);
|
||
|
|
||
|
% Apply gamma rotation, replicate over antennas and apply cyclic shifts
|
||
|
[lsig,scalingFactor] = wlan.internal.legacyFieldMap(sym,cfgOFDM.NumTones,cfgFormat);
|
||
|
|
||
|
% OFDM modulate
|
||
|
y = wlan.internal.wlanOFDMModulate(lsig,cfgOFDM.CyclicPrefixLength)*scalingFactor;
|
||
|
|
||
|
end
|