Merge branch 'integration' into release
This commit is contained in:
+1
-1
@@ -80,7 +80,7 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
|
||||
########################################################################
|
||||
# Find gnuradio build dependencies
|
||||
########################################################################
|
||||
set(GR_REQUIRED_COMPONENTS RUNTIME FILTER FFT PMT)
|
||||
set(GR_REQUIRED_COMPONENTS RUNTIME FILTER FFT PMT DIGITAL)
|
||||
find_package(Gnuradio)
|
||||
find_package(CppUnit)
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILE="/tmp/ofdm.pcap"
|
||||
FLOWGRAPH="ofdm_transceiver.py"
|
||||
FLOWGRAPH="wifi_transceiver.py"
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
### create fifo
|
||||
|
||||
+57
-57
@@ -1,6 +1,6 @@
|
||||
<?xml version='1.0' encoding='ASCII'?>
|
||||
<flow_graph>
|
||||
<timestamp>Thu Dec 5 14:05:11 2013</timestamp>
|
||||
<timestamp>Sat Feb 1 18:56:56 2014</timestamp>
|
||||
<block>
|
||||
<key>options</key>
|
||||
<param>
|
||||
@@ -60,29 +60,6 @@
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>sync_length</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>320</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(601, 15)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable</key>
|
||||
<param>
|
||||
@@ -107,50 +84,22 @@
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>ieee802_11_ofdm_sync_short</key>
|
||||
<key>variable</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ieee802_11_ofdm_sync_short_0</value>
|
||||
<value>sync_length</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>log</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>debug</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>threshold</key>
|
||||
<value>0.8</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>max_samples</key>
|
||||
<value>80 * 160</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>min_plateau</key>
|
||||
<value>2</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
<key>value</key>
|
||||
<value>320</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(212, 501)</value>
|
||||
<value>(601, 15)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
@@ -1966,6 +1915,57 @@
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>ieee802_11_ofdm_sync_short</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ieee802_11_ofdm_sync_short_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>log</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>debug</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>threshold</key>
|
||||
<value>0.85</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>max_samples</key>
|
||||
<value>80 * 160</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>min_plateau</key>
|
||||
<value>2</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(212, 501)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<connection>
|
||||
<source_block_id>blocks_stream_to_vector_0</source_block_id>
|
||||
<sink_block_id>fft_vxx_0</sink_block_id>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
||||
<?xml version='1.0' encoding='ASCII'?>
|
||||
<flow_graph>
|
||||
<timestamp>Thu Dec 5 14:06:08 2013</timestamp>
|
||||
<timestamp>Mon Dec 30 11:05:22 2013</timestamp>
|
||||
<block>
|
||||
<key>options</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ofdm_rx</value>
|
||||
<value>wifi_rx</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
@@ -618,52 +618,6 @@
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_ctrlport_monitor</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_ctrlport_monitor_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>en</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(828, 166)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_ctrlport_monitor_performance</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_ctrlport_monitor_performance_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>en</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(972, 169)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_delay</key>
|
||||
<param>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
||||
<?xml version='1.0' encoding='ASCII'?>
|
||||
<flow_graph>
|
||||
<timestamp>Fri Dec 6 18:16:38 2013</timestamp>
|
||||
<timestamp>Sat Feb 1 19:26:11 2014</timestamp>
|
||||
<block>
|
||||
<key>options</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ofdm_tx</value>
|
||||
<value>wifi_tx</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
@@ -115,263 +115,6 @@
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_ctrlport_monitor_performance</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_ctrlport_monitor_performance_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>en</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(982, 299)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_null_source</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_null_source_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>vlen</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(692, 334)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>180</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable_chooser</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>lo_offset</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>label</key>
|
||||
<value>LO Offset</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>choices</key>
|
||||
<value>[0, 6e9, 11e9]</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>labels</key>
|
||||
<value>['0 MHz', '6 MHz', '11 MHz']</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>drop_down</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.RA_HORIZONTAL</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(697, 165)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable_slider</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>mult</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>label</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>0.35</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>min</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>max</key>
|
||||
<value>2</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>num_steps</key>
|
||||
<value>100</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.SL_HORIZONTAL</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>converver</key>
|
||||
<value>float_converter</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(979, 10)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_ctrlport_monitor</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_ctrlport_monitor_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>en</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(980, 366)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>ofdm_phy_hier</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ofdm_phy_hier_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>encoding</key>
|
||||
<value>encoding</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(449, 300)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>180</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>ieee802_11_ofdm_mac</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ieee802_11_ofdm_mac_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(465, 191)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable_chooser</key>
|
||||
<param>
|
||||
@@ -424,61 +167,10 @@
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable_chooser</key>
|
||||
<key>blocks_socket_pdu</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>label</key>
|
||||
<value>Sample Rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>20e6</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>choices</key>
|
||||
<value>[10e6, 20e6]</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>labels</key>
|
||||
<value>["10 Mhz", "20 Mhz"]</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>radio_buttons</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.RA_HORIZONTAL</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(629, 14)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_multiply_const_vxx</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_multiply_const_vxx_1</value>
|
||||
<value>blocks_socket_pdu_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
@@ -486,15 +178,19 @@
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
<value>"UDP_SERVER"</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>const</key>
|
||||
<value>mult</value>
|
||||
<key>host</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>vlen</key>
|
||||
<value>1</value>
|
||||
<key>port</key>
|
||||
<value>52001</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>mtu</key>
|
||||
<value>10000</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
@@ -510,11 +206,50 @@
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(162, 330)</value>
|
||||
<value>(200, 210)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>180</value>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_message_strobe</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_message_strobe_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>msg</key>
|
||||
<value>pmt.intern(" Hello World")</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>period</key>
|
||||
<value>300</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(113, 154)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
@@ -533,7 +268,7 @@
|
||||
</param>
|
||||
<param>
|
||||
<key>otw</key>
|
||||
<value>sc16</value>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>stream_args</key>
|
||||
@@ -1181,7 +916,7 @@
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(307, 420)</value>
|
||||
<value>(279, 428)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
@@ -1189,22 +924,22 @@
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>blocks_message_strobe</key>
|
||||
<key>blocks_null_source</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>blocks_message_strobe_0</value>
|
||||
<value>blocks_null_source_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>msg</key>
|
||||
<value>pmt.intern("Hello World")</value>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>period</key>
|
||||
<value>100</value>
|
||||
<key>vlen</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
@@ -1220,42 +955,34 @@
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(113, 179)</value>
|
||||
<value>(678, 333)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
<value>180</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>foo_packet_pad</key>
|
||||
<key>blocks_multiply_const_vxx</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>foo_packet_pad_0</value>
|
||||
<value>blocks_multiply_const_vxx_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>debug</key>
|
||||
<value>False</value>
|
||||
<key>type</key>
|
||||
<value>complex</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>delay</key>
|
||||
<value>True</value>
|
||||
<key>const</key>
|
||||
<value>mult</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>delay_sec</key>
|
||||
<value>0.001</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>pad_front</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>pad_tail</key>
|
||||
<value>0</value>
|
||||
<key>vlen</key>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
@@ -1271,7 +998,89 @@
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(93, 420)</value>
|
||||
<value>(232, 329)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>180</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>ieee802_11_ofdm_mac</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>ieee802_11_ofdm_mac_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(465, 191)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable_chooser</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>lo_offset</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>label</key>
|
||||
<value>LO Offset</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>6e9</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>choices</key>
|
||||
<value>[0, 6e9, 11e9]</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>labels</key>
|
||||
<value>['0 MHz', '6 MHz', '11 MHz']</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>drop_down</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.RA_HORIZONTAL</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(697, 165)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
@@ -1294,7 +1103,7 @@
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>5.22e9</value>
|
||||
<value>5.89e9</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>choices</key>
|
||||
@@ -1329,30 +1138,198 @@
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<connection>
|
||||
<source_block_id>blocks_multiply_const_vxx_1</source_block_id>
|
||||
<sink_block_id>foo_packet_pad_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ofdm_phy_hier_0</source_block_id>
|
||||
<sink_block_id>blocks_multiply_const_vxx_1</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>foo_packet_pad_0</source_block_id>
|
||||
<sink_block_id>uhd_usrp_sink_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>blocks_null_source_0</source_block_id>
|
||||
<sink_block_id>ofdm_phy_hier_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<block>
|
||||
<key>variable_slider</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>mult</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>label</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>.38</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>min</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>max</key>
|
||||
<value>2</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>num_steps</key>
|
||||
<value>100</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.SL_HORIZONTAL</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>converver</key>
|
||||
<value>float_converter</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(979, 10)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable_chooser</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>samp_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>label</key>
|
||||
<value>Sample Rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>10e6</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>choices</key>
|
||||
<value>[10e6, 20e6]</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>labels</key>
|
||||
<value>["10 Mhz", "20 Mhz"]</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>type</key>
|
||||
<value>radio_buttons</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.RA_HORIZONTAL</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(629, 14)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>wifi_phy_hier</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>wifi_phy_hier_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>encoding</key>
|
||||
<value>encoding</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(461, 299)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>180</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>foo_packet_pad2</key>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>foo_packet_pad2_0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>debug</key>
|
||||
<value>False</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>delay</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>delay_sec</key>
|
||||
<value>0.001</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>pad_front</key>
|
||||
<value>10000</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>pad_tail</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>minoutbuf</key>
|
||||
<value>100000</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>maxoutbuf</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(86, 420)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
</block>
|
||||
<connection>
|
||||
<source_block_id>blocks_message_strobe_0</source_block_id>
|
||||
<sink_block_id>ieee802_11_ofdm_mac_0</sink_block_id>
|
||||
@@ -1360,15 +1337,45 @@
|
||||
<sink_key>app in</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ofdm_phy_hier_0</source_block_id>
|
||||
<source_block_id>blocks_socket_pdu_0</source_block_id>
|
||||
<sink_block_id>ieee802_11_ofdm_mac_0</sink_block_id>
|
||||
<source_key>pdus</source_key>
|
||||
<sink_key>app in</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>foo_packet_pad2_0</source_block_id>
|
||||
<sink_block_id>uhd_usrp_sink_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>wifi_phy_hier_0</source_block_id>
|
||||
<sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>blocks_null_source_0</source_block_id>
|
||||
<sink_block_id>wifi_phy_hier_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>blocks_multiply_const_vxx_0</source_block_id>
|
||||
<sink_block_id>foo_packet_pad2_0</sink_block_id>
|
||||
<source_key>0</source_key>
|
||||
<sink_key>0</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ieee802_11_ofdm_mac_0</source_block_id>
|
||||
<sink_block_id>wifi_phy_hier_0</sink_block_id>
|
||||
<source_key>phy out</source_key>
|
||||
<sink_key>mac_in</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>wifi_phy_hier_0</source_block_id>
|
||||
<sink_block_id>ieee802_11_ofdm_mac_0</sink_block_id>
|
||||
<source_key>mac_out</source_key>
|
||||
<sink_key>phy in</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>ieee802_11_ofdm_mac_0</source_block_id>
|
||||
<sink_block_id>ofdm_phy_hier_0</sink_block_id>
|
||||
<source_key>phy out</source_key>
|
||||
<sink_key>mac_in</sink_key>
|
||||
</connection>
|
||||
</flow_graph>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<block>
|
||||
<name>Chunks to Symbols</name>
|
||||
<key>ieee802_11_chunks_to_symbols_xx</key>
|
||||
<category>IEEE802.11</category>
|
||||
<import>import ieee802_11</import>
|
||||
<make>ieee802_11.chunks_to_symbols()</make>
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>byte</type>
|
||||
<nports>1</nports>
|
||||
</sink>
|
||||
<source>
|
||||
<name>out</name>
|
||||
<type>complex</type>
|
||||
<nports>1</nports>
|
||||
</source>
|
||||
</block>
|
||||
@@ -40,8 +40,7 @@
|
||||
|
||||
<source>
|
||||
<name>out</name>
|
||||
<type>complex</type>
|
||||
<vlen>48</vlen>
|
||||
<type>byte</type>
|
||||
<nports>1</nports>
|
||||
</source>
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<block>
|
||||
<name>OFDM Pilot</name>
|
||||
<key>ieee802_11_ofdm_pilot</key>
|
||||
<category>IEEE802.11</category>
|
||||
<import>import ieee802_11</import>
|
||||
<make>ieee802_11.ofdm_pilot($debug)</make>
|
||||
|
||||
<param>
|
||||
<name>Debug</name>
|
||||
<key>debug</key>
|
||||
<value>False</value>
|
||||
<type>bool</type>
|
||||
|
||||
<option>
|
||||
<name>Enable</name>
|
||||
<key>True</key>
|
||||
</option>
|
||||
<option>
|
||||
<name>Disable</name>
|
||||
<key>False</key>
|
||||
</option>
|
||||
</param>
|
||||
|
||||
<sink>
|
||||
<name>in</name>
|
||||
<type>complex</type>
|
||||
<vlen>48</vlen>
|
||||
<nports>1</nports>
|
||||
</sink>
|
||||
|
||||
<source>
|
||||
<name>out</name>
|
||||
<type>complex</type>
|
||||
<vlen>64</vlen>
|
||||
<nports>1</nports>
|
||||
</source>
|
||||
|
||||
</block>
|
||||
@@ -69,6 +69,7 @@ add_custom_target(ieee802_11_generated_includes DEPENDS
|
||||
list(APPEND include_sources
|
||||
${generated_includes}
|
||||
api.h
|
||||
chunks_to_symbols.h
|
||||
ether_encap.h
|
||||
ofdm_decode_mac.h
|
||||
ofdm_decode_signal.h
|
||||
@@ -77,10 +78,10 @@ list(APPEND include_sources
|
||||
ofdm_mac.h
|
||||
ofdm_mapper.h
|
||||
ofdm_parse_mac.h
|
||||
ofdm_pilot.h
|
||||
ofdm_preamble.h
|
||||
ofdm_sync_long.h
|
||||
ofdm_sync_short.h
|
||||
wifi_signal_field.h
|
||||
)
|
||||
|
||||
install(
|
||||
|
||||
@@ -14,25 +14,23 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef INCLUDED_IEEE802_11_PILOT_H
|
||||
#define INCLUDED_IEEE802_11_PILOT_H
|
||||
#ifndef INCLUDED_IEEE802_11_CHUNKS_TO_SYMBOLS_H
|
||||
#define INCLUDED_IEEE802_11_CHUNKS_TO_SYMBOLS_H
|
||||
|
||||
#include <ieee802-11/api.h>
|
||||
#include <gnuradio/sync_block.h>
|
||||
#include <gnuradio/tagged_stream_block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
class IEEE802_11_API ofdm_pilot : virtual public sync_block
|
||||
class IEEE802_11_API chunks_to_symbols : virtual public tagged_stream_block
|
||||
{
|
||||
public:
|
||||
|
||||
typedef boost::shared_ptr<ofdm_pilot> sptr;
|
||||
static sptr make(bool debug = false);
|
||||
|
||||
typedef boost::shared_ptr<chunks_to_symbols> sptr;
|
||||
static sptr make();
|
||||
};
|
||||
|
||||
} // namespace ieee802_11
|
||||
} // namespace gr
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_PILOT_H */
|
||||
#endif /* INCLUDED_IEEE802_11_CHUNKS_TO_SYMBOLS_H */
|
||||
@@ -18,12 +18,12 @@
|
||||
#define INCLUDED_IEEE802_11_OFDM_PREAMBLE_H
|
||||
|
||||
#include <ieee802-11/api.h>
|
||||
#include <gnuradio/block.h>
|
||||
#include <gnuradio/tagged_stream_block.h>
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
class IEEE802_11_API ofdm_preamble : virtual public block
|
||||
class IEEE802_11_API ofdm_preamble : virtual public tagged_stream_block
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_IEEE802_11_WIFI_SIGNAL_FIELD_H
|
||||
#define INCLUDED_IEEE802_11_WIFI_SIGNAL_FIELD_H
|
||||
|
||||
#include <ieee802-11/api.h>
|
||||
#include <gnuradio/digital/packet_header_default.h>
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
class IEEE802_11_API wifi_signal_field : virtual public digital::packet_header_default
|
||||
{
|
||||
public:
|
||||
typedef boost::shared_ptr<wifi_signal_field> sptr;
|
||||
static sptr make();
|
||||
|
||||
protected:
|
||||
wifi_signal_field();
|
||||
};
|
||||
|
||||
} // namespace ieee802_11
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_WIFI_SIGNAL_FIELD_H */
|
||||
|
||||
+3
-1
@@ -101,6 +101,7 @@ include_directories(
|
||||
########################################################################
|
||||
list(APPEND gr_ieee802_11_sources
|
||||
${generated_sources}
|
||||
chunks_to_symbols_impl.cc
|
||||
ether_encap_impl.cc
|
||||
ofdm_decode_mac.cc
|
||||
ofdm_decode_signal.cc
|
||||
@@ -109,11 +110,11 @@ list(APPEND gr_ieee802_11_sources
|
||||
ofdm_mac.cc
|
||||
ofdm_mapper.cc
|
||||
ofdm_parse_mac.cc
|
||||
ofdm_pilot.cc
|
||||
ofdm_preamble.cc
|
||||
ofdm_sync_long.cc
|
||||
ofdm_sync_short.cc
|
||||
utils.cc
|
||||
wifi_signal_field_impl.cc
|
||||
)
|
||||
|
||||
list(APPEND gr_ieee802_11_libs
|
||||
@@ -122,6 +123,7 @@ list(APPEND gr_ieee802_11_libs
|
||||
${GNURADIO_FFT_LIBRARIES}
|
||||
${GNURADIO_PMT_LIBRARIES}
|
||||
${GNURADIO_FILTER_LIBRARIES}
|
||||
${GNURADIO_DIGITAL_LIBRARIES}
|
||||
)
|
||||
|
||||
add_library(gnuradio-ieee802_11 SHARED ${gr_ieee802_11_sources})
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "chunks_to_symbols_impl.h"
|
||||
#include "utils.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <gnuradio/tag_checker.h>
|
||||
#include <assert.h>
|
||||
|
||||
using namespace gr::ieee802_11;
|
||||
|
||||
chunks_to_symbols::sptr
|
||||
chunks_to_symbols::make()
|
||||
{
|
||||
return gnuradio::get_initial_sptr(new chunks_to_symbols_impl());
|
||||
}
|
||||
|
||||
chunks_to_symbols_impl::chunks_to_symbols_impl()
|
||||
: tagged_stream_block("wifi_chunks_to_symbols",
|
||||
io_signature::make(1, 1, sizeof(char)),
|
||||
io_signature::make(1, 1, sizeof(gr_complex)), "packet_len") {
|
||||
}
|
||||
|
||||
chunks_to_symbols_impl::~chunks_to_symbols_impl() { }
|
||||
|
||||
|
||||
int
|
||||
chunks_to_symbols_impl::work(int noutput_items,
|
||||
gr_vector_int &ninput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items) {
|
||||
|
||||
const unsigned char *in = (unsigned char*)input_items[0];
|
||||
gr_complex *out = (gr_complex*)output_items[0];
|
||||
|
||||
std::vector<tag_t> tags;
|
||||
get_tags_in_range(tags, 0, nitems_read(0),
|
||||
nitems_read(0) + ninput_items[0],
|
||||
pmt::mp("encoding"));
|
||||
if(tags.size() != 1) {
|
||||
throw std::runtime_error("no encoding in input stream");
|
||||
}
|
||||
|
||||
Encoding encoding = (Encoding)pmt::to_long(tags[0].value);
|
||||
|
||||
const gr_complex *mapping;
|
||||
|
||||
switch (encoding) {
|
||||
case BPSK_1_2:
|
||||
case BPSK_3_4:
|
||||
mapping = BPSK;
|
||||
break;
|
||||
|
||||
case QPSK_1_2:
|
||||
case QPSK_3_4:
|
||||
mapping = QPSK;
|
||||
break;
|
||||
|
||||
case QAM16_1_2:
|
||||
case QAM16_3_4:
|
||||
mapping = QAM16;
|
||||
break;
|
||||
|
||||
case QAM64_2_3:
|
||||
case QAM64_3_4:
|
||||
mapping = QAM64;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw std::invalid_argument("wrong encoding");
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i = 0; i < ninput_items[0]; i++) {
|
||||
out[i] = mapping[in[i]];
|
||||
}
|
||||
|
||||
return ninput_items[0];
|
||||
}
|
||||
|
||||
const gr_complex chunks_to_symbols_impl::BPSK[2] = {
|
||||
gr_complex(-1.0, 0.0), gr_complex(1.0, 0.0)};
|
||||
|
||||
const gr_complex chunks_to_symbols_impl::QPSK[4] = {
|
||||
gr_complex(-0.7071, -0.7071), gr_complex(-0.7071, 0.7071),
|
||||
gr_complex(+0.7071, -0.7071), gr_complex(+0.7071, 0.7071)};
|
||||
|
||||
const gr_complex chunks_to_symbols_impl::QAM16[16] = {
|
||||
gr_complex(-0.9487, -0.9487), gr_complex(-0.9487, -0.3162),
|
||||
gr_complex(-0.9487, 0.9487), gr_complex(-0.9487, 0.3162),
|
||||
gr_complex(-0.3162, -0.9487), gr_complex(-0.3162, -0.3162),
|
||||
gr_complex(-0.3162, 0.9487), gr_complex(-0.3162, 0.3162),
|
||||
gr_complex(0.9487, -0.9487), gr_complex(0.9487, -0.3162),
|
||||
gr_complex(0.9487, 0.9487), gr_complex(0.9487, 0.3162),
|
||||
gr_complex(0.3162, -0.9487), gr_complex(0.3162, -0.3162),
|
||||
gr_complex(0.3162, 0.9487), gr_complex(0.3162, 0.3162)};
|
||||
|
||||
const gr_complex chunks_to_symbols_impl::QAM64[64] = {
|
||||
gr_complex(-1.0801, -1.0801), gr_complex(-1.0801, -0.7715),
|
||||
gr_complex(-1.0801, -0.1543), gr_complex(-1.0801, -0.4629),
|
||||
gr_complex(-1.0801, 1.0801), gr_complex(-1.0801, 0.7715),
|
||||
gr_complex(-1.0801, 0.1543), gr_complex(-1.0801, 0.4629),
|
||||
gr_complex(-0.7715, -1.0801), gr_complex(-0.7715, -0.7715),
|
||||
gr_complex(-0.7715, -0.1543), gr_complex(-0.7715, -0.4629),
|
||||
gr_complex(-0.7715, 1.0801), gr_complex(-0.7715, 0.7715),
|
||||
gr_complex(-0.7715, 0.1543), gr_complex(-0.7715, 0.4629),
|
||||
gr_complex(-0.1543, -1.0801), gr_complex(-0.1543, -0.7715),
|
||||
gr_complex(-0.1543, -0.1543), gr_complex(-0.1543, -0.4629),
|
||||
gr_complex(-0.1543, 1.0801), gr_complex(-0.1543, 0.7715),
|
||||
gr_complex(-0.1543, 0.1543), gr_complex(-0.1543, 0.4629),
|
||||
gr_complex(-0.4629, -1.0801), gr_complex(-0.4629, -0.7715),
|
||||
gr_complex(-0.4629, -0.1543), gr_complex(-0.4629, -0.4629),
|
||||
gr_complex(-0.4629, 1.0801), gr_complex(-0.4629, 0.7715),
|
||||
gr_complex(-0.4629, 0.1543), gr_complex(-0.4629, 0.4629),
|
||||
gr_complex(1.0801, -1.0801), gr_complex(1.0801, -0.7715),
|
||||
gr_complex(1.0801, -0.1543), gr_complex(1.0801, -0.4629),
|
||||
gr_complex(1.0801, 1.0801), gr_complex(1.0801, 0.7715),
|
||||
gr_complex(1.0801, 0.1543), gr_complex(1.0801, 0.4629),
|
||||
gr_complex(0.7715, -1.0801), gr_complex(0.7715, -0.7715),
|
||||
gr_complex(0.7715, -0.1543), gr_complex(0.7715, -0.4629),
|
||||
gr_complex(0.7715, 1.0801), gr_complex(0.7715, 0.7715),
|
||||
gr_complex(0.7715, 0.1543), gr_complex(0.7715, 0.4629),
|
||||
gr_complex(0.1543, -1.0801), gr_complex(0.1543, -0.7715),
|
||||
gr_complex(0.1543, -0.1543), gr_complex(0.1543, -0.4629),
|
||||
gr_complex(0.1543, 1.0801), gr_complex(0.1543, 0.7715),
|
||||
gr_complex(0.1543, 0.1543), gr_complex(0.1543, 0.4629),
|
||||
gr_complex(0.4629, -1.0801), gr_complex(0.4629, -0.7715),
|
||||
gr_complex(0.4629, -0.1543), gr_complex(0.4629, -0.4629),
|
||||
gr_complex(0.4629, 1.0801), gr_complex(0.4629, 0.7715),
|
||||
gr_complex(0.4629, 0.1543), gr_complex(0.4629, 0.4629)};
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef INCLUDED_IEEE802_11_CHUNKS_TO_SYMBOLS_IMPL_H
|
||||
#define INCLUDED_IEEE802_11_CHUNKS_TO_SYMBOLS_IMPL_H
|
||||
|
||||
#include <ieee802-11/chunks_to_symbols.h>
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
class chunks_to_symbols_impl : public chunks_to_symbols
|
||||
{
|
||||
public:
|
||||
chunks_to_symbols_impl();
|
||||
~chunks_to_symbols_impl();
|
||||
|
||||
int work(int noutput_items,
|
||||
gr_vector_int &ninput_itmes,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
protected:
|
||||
static const gr_complex BPSK[2];
|
||||
static const gr_complex QPSK[4];
|
||||
static const gr_complex QAM16[16];
|
||||
static const gr_complex QAM64[64];
|
||||
};
|
||||
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_CHUNKS_TO_SYMBOLS_IMPL_H */
|
||||
+32
-82
@@ -29,7 +29,7 @@ static const int DATA_CARRIERS = 48;
|
||||
ofdm_mapper_impl(Encoding e, bool debug) :
|
||||
block ("ofdm_mapper",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(1, 1, DATA_CARRIERS * sizeof(gr_complex))),
|
||||
gr::io_signature::make(1, 1, sizeof(char))),
|
||||
d_symbols_offset(0),
|
||||
d_symbols(NULL),
|
||||
d_debug(debug),
|
||||
@@ -45,6 +45,7 @@ ofdm_mapper_impl(Encoding e, bool debug) :
|
||||
|
||||
void print_message(const char *msg, size_t len) {
|
||||
|
||||
|
||||
dout << std::hex << "OFDM MAPPER input symbols" << std::endl
|
||||
<< "===========================" << std::endl;
|
||||
|
||||
@@ -55,25 +56,12 @@ void print_message(const char *msg, size_t len) {
|
||||
dout << std::dec << std::endl;
|
||||
}
|
||||
|
||||
void map_to_symbols(const char *bits, size_t len) {
|
||||
|
||||
dout << "OFDM MAPPER complex symbols" << std::endl
|
||||
<< "===========================" << std::endl;
|
||||
|
||||
for(int i = 0; i < len; i++) {
|
||||
|
||||
// the signal field is bpsk encoded
|
||||
d_symbols[i] = (i < 48) ? BPSK[bits[i]] : mapping[bits[i]];
|
||||
dout << d_symbols[i] << " ";
|
||||
}
|
||||
dout << std::endl;
|
||||
}
|
||||
|
||||
int general_work(int noutput, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items ) {
|
||||
|
||||
gr_complex *out = (gr_complex*)output_items[0];
|
||||
unsigned char *out = (unsigned char*)output_items[0];
|
||||
dout << "OFDM MAPPER called offset: " << d_symbols_offset <<
|
||||
" length: " << d_symbols_len << std::endl;
|
||||
|
||||
@@ -92,11 +80,12 @@ int general_work(int noutput, gr_vector_int& ninput_items,
|
||||
int psdu_length = pmt::blob_length(pmt::cdr(msg));
|
||||
const char *psdu = static_cast<const char*>(pmt::blob_data(pmt::cdr(msg)));
|
||||
|
||||
|
||||
// ############ INSERT MAC STUFF
|
||||
tx_param tx(d_ofdm, psdu_length);
|
||||
//tx.print_out();
|
||||
//ofdm.print_out();
|
||||
if(tx.n_sym > 120) {
|
||||
std::cout << "packet too large" <<std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//alloc memory for modulation steps
|
||||
char *data_bits = (char*)calloc(tx.n_data, sizeof(char));
|
||||
@@ -104,7 +93,7 @@ int general_work(int noutput, gr_vector_int& ninput_items,
|
||||
char *encoded_data = (char*)calloc(tx.n_data * 2, sizeof(char));
|
||||
char *punctured_data = (char*)calloc(tx.n_encoded_bits, sizeof(char));
|
||||
char *interleaved_data = (char*)calloc(tx.n_encoded_bits, sizeof(char));
|
||||
char *symbols = (char*)calloc((tx.n_encoded_bits / d_ofdm.n_bpsc) + 48, sizeof(char));
|
||||
char *symbols = (char*)calloc((tx.n_encoded_bits / d_ofdm.n_bpsc), sizeof(char));
|
||||
|
||||
//generate the OFDM data field, adding service field and pad bits
|
||||
generate_bits(psdu, data_bits, tx);
|
||||
@@ -126,30 +115,28 @@ int general_work(int noutput, gr_vector_int& ninput_items,
|
||||
interleave(punctured_data, interleaved_data, tx, d_ofdm);
|
||||
//std::cout << "interleaved" << std::endl;
|
||||
|
||||
split_symbols(interleaved_data, symbols + 48, tx, d_ofdm);
|
||||
//std::cout << "split" << std::endl;
|
||||
generate_signal_field(symbols, tx, d_ofdm);
|
||||
//std::cout << "signal" << std::endl;
|
||||
// one byte per symbol
|
||||
split_symbols(interleaved_data, symbols, tx, d_ofdm);
|
||||
|
||||
d_symbols_len = (tx.n_sym + 1) * 48;
|
||||
assert(d_symbols_len % 48 == 0);
|
||||
d_symbols_len = tx.n_sym * 48;
|
||||
|
||||
d_symbols = (char*)calloc(d_symbols_len, 1);
|
||||
std::memcpy(d_symbols, symbols, d_symbols_len);
|
||||
|
||||
|
||||
// ############ INSERT MAC STUFF
|
||||
// add tags
|
||||
pmt::pmt_t key = pmt::string_to_symbol("packet_len");
|
||||
pmt::pmt_t value = pmt::from_long(d_symbols_len);
|
||||
pmt::pmt_t srcid = pmt::string_to_symbol(alias());
|
||||
add_item_tag(0, nitems_written(0), key, value, srcid);
|
||||
|
||||
d_symbols = static_cast<gr_complex*>(std::malloc(d_symbols_len * sizeof(gr_complex)));
|
||||
pmt::pmt_t psdu_bytes = pmt::from_long(psdu_length);
|
||||
add_item_tag(0, nitems_written(0), pmt::mp("psdu_len"),
|
||||
psdu_bytes, srcid);
|
||||
|
||||
|
||||
print_message(static_cast<const char*>(symbols), d_symbols_len);
|
||||
map_to_symbols(static_cast<const char*>(symbols), d_symbols_len);
|
||||
|
||||
|
||||
|
||||
// add tag to indicate start of odfm frame
|
||||
const pmt::pmt_t key = pmt::string_to_symbol("ofdm_start");
|
||||
const pmt::pmt_t value = pmt::from_uint64((d_symbols_len / DATA_CARRIERS));
|
||||
const pmt::pmt_t srcid = pmt::string_to_symbol(this->name());
|
||||
add_item_tag(0, this->nitems_written(0), key, value, srcid);
|
||||
pmt::pmt_t encoding = pmt::from_long(d_ofdm.encoding);
|
||||
add_item_tag(0, nitems_written(0), pmt::mp("encoding"),
|
||||
encoding, srcid);
|
||||
|
||||
|
||||
free(data_bits);
|
||||
@@ -163,24 +150,15 @@ int general_work(int noutput, gr_vector_int& ninput_items,
|
||||
}
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
while(i < noutput) {
|
||||
int i = std::min(noutput, d_symbols_len - d_symbols_offset);
|
||||
std::memcpy(out, d_symbols + d_symbols_offset, i);
|
||||
d_symbols_offset += i;
|
||||
|
||||
memcpy(out, d_symbols + d_symbols_offset, DATA_CARRIERS * sizeof(gr_complex));
|
||||
|
||||
i++;
|
||||
d_symbols_offset += DATA_CARRIERS;
|
||||
out += DATA_CARRIERS;
|
||||
|
||||
if(d_symbols_offset == d_symbols_len) {
|
||||
d_symbols_offset = 0;
|
||||
free(d_symbols);
|
||||
break;
|
||||
}
|
||||
if(d_symbols_offset == d_symbols_len) {
|
||||
d_symbols_offset = 0;
|
||||
free(d_symbols);
|
||||
}
|
||||
|
||||
dout << "OFDM MAPPER: output size: " << noutput <<
|
||||
" produced items: " << i << std::endl;
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -190,43 +168,15 @@ void set_encoding(Encoding encoding) {
|
||||
gr::thread::scoped_lock lock(d_mutex);
|
||||
|
||||
d_ofdm = ofdm_param(encoding);
|
||||
|
||||
switch (encoding) {
|
||||
case BPSK_1_2:
|
||||
case BPSK_3_4:
|
||||
mapping = BPSK;
|
||||
break;
|
||||
|
||||
case QPSK_1_2:
|
||||
case QPSK_3_4:
|
||||
mapping = QPSK;
|
||||
break;
|
||||
|
||||
case QAM16_1_2:
|
||||
case QAM16_3_4:
|
||||
mapping = QAM16;
|
||||
break;
|
||||
|
||||
case QAM64_2_3:
|
||||
case QAM64_3_4:
|
||||
mapping = QAM64;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw std::invalid_argument("wrong encoding");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
bool d_debug;
|
||||
gr_complex* d_symbols;
|
||||
char* d_symbols;
|
||||
int d_symbols_offset;
|
||||
int d_symbols_len;
|
||||
ofdm_param d_ofdm;
|
||||
gr::thread::mutex d_mutex;
|
||||
|
||||
const gr_complex *mapping;
|
||||
};
|
||||
|
||||
ofdm_mapper::sptr
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <ieee802-11/ofdm_pilot.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
|
||||
using namespace gr::ieee802_11;
|
||||
|
||||
|
||||
class ofdm_pilot_impl : public ofdm_pilot {
|
||||
|
||||
static const int TONES = 48;
|
||||
static const int FFT_SIZE = 64;
|
||||
|
||||
public:
|
||||
|
||||
ofdm_pilot_impl(bool debug) :
|
||||
sync_block ("ofdm_pilot",
|
||||
gr::io_signature::make(1, 1, TONES * sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, FFT_SIZE * sizeof(gr_complex))),
|
||||
d_offset(0),
|
||||
d_debug(debug) {
|
||||
|
||||
}
|
||||
|
||||
~ofdm_pilot_impl() {
|
||||
|
||||
}
|
||||
|
||||
int work (int noutput_items, gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items) {
|
||||
|
||||
const gr_complex *in = (const gr_complex*)input_items[0];
|
||||
gr_complex *out = (gr_complex*)output_items[0];
|
||||
|
||||
int i = 0;
|
||||
int count = 0;
|
||||
const uint64_t nread = nitems_read(0);
|
||||
std::vector<gr::tag_t> tags;
|
||||
|
||||
while (count < noutput_items) {
|
||||
|
||||
get_tags_in_range(tags, 0, nread + count, nread + count + 1, pmt::string_to_symbol("ofdm_start"));
|
||||
|
||||
if(tags.size()) {
|
||||
d_offset = 0;
|
||||
dout << "OFDM PILOT: start of OFDM frame" << std::endl;
|
||||
}
|
||||
|
||||
// guard band
|
||||
memset(out, 0, 6 * sizeof(gr_complex));
|
||||
|
||||
// subcarriers -26 to -22
|
||||
memcpy(out + 6, in, 5 * sizeof(gr_complex));
|
||||
|
||||
// pilot 1
|
||||
out[11] = POLARITY[d_offset];
|
||||
|
||||
// subcarriers -20 to -8
|
||||
memcpy(out + 12, in + 5, 13 * sizeof(gr_complex));
|
||||
|
||||
// pilot 2
|
||||
out[25] = POLARITY[d_offset];
|
||||
|
||||
// subcarriers -6 to -1
|
||||
memcpy(out + 26, in + 18, 6 * sizeof(gr_complex));
|
||||
|
||||
// DC
|
||||
out[32] = 0;
|
||||
|
||||
// subcarriers 1 to 6
|
||||
memcpy(out + 33, in + 24, 6 * sizeof(gr_complex));
|
||||
|
||||
// pilot 3
|
||||
out[39] = POLARITY[d_offset];
|
||||
|
||||
// pubcarriers 8 to 20
|
||||
memcpy(out + 40, in + 30, 13 * sizeof(gr_complex));
|
||||
|
||||
// pilot 4
|
||||
out[53] = -POLARITY[d_offset];
|
||||
|
||||
// subcarriers 22 to 26
|
||||
memcpy(out + 54, in + 43, 5 * sizeof(gr_complex));
|
||||
|
||||
// guard band
|
||||
memset(out + 59, 0, 5 * sizeof(gr_complex));
|
||||
|
||||
|
||||
count++;
|
||||
out += FFT_SIZE;
|
||||
in += TONES;
|
||||
d_offset = (d_offset + 1) % 127;
|
||||
}
|
||||
|
||||
dout << "OFDM PILOT: produced items: " << noutput_items << std::endl;
|
||||
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
private:
|
||||
bool d_debug;
|
||||
int d_offset;
|
||||
static const gr_complex POLARITY[127];
|
||||
};
|
||||
|
||||
const gr_complex ofdm_pilot_impl::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,-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,-1,-1,-1,-1,-1 };
|
||||
|
||||
ofdm_pilot::sptr
|
||||
ofdm_pilot::make(bool debug) {
|
||||
return gnuradio::get_initial_sptr(new ofdm_pilot_impl(debug));
|
||||
}
|
||||
|
||||
+17
-126
@@ -24,133 +24,41 @@ using namespace gr::ieee802_11;
|
||||
|
||||
class ofdm_preamble_impl : public ofdm_preamble {
|
||||
|
||||
static const int SYMBOL_LENGTH = 80;
|
||||
|
||||
public:
|
||||
ofdm_preamble_impl(bool debug) : block("ofdm_preamble",
|
||||
ofdm_preamble_impl(bool debug) : tagged_stream_block("ofdm_preamble",
|
||||
gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(gr_complex))),
|
||||
d_debug(debug),
|
||||
d_state(IDLE) {
|
||||
|
||||
set_relative_rate(1);
|
||||
set_output_multiple(SYMBOL_LENGTH);
|
||||
gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
"packet_len"),
|
||||
d_debug(debug) {
|
||||
set_tag_propagation_policy(block::TPP_DONT);
|
||||
}
|
||||
|
||||
~ofdm_preamble_impl(){
|
||||
}
|
||||
|
||||
int general_work (int noutput_items, gr_vector_int& ninput_items,
|
||||
int calculate_output_stream_length(const gr_vector_int &ninput_items) {
|
||||
return ninput_items[0] + 320;
|
||||
}
|
||||
|
||||
int work (int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items) {
|
||||
|
||||
int ninput = ninput_items[0] / SYMBOL_LENGTH;
|
||||
//assert(ninput_items[0] % SYMBOL_LENGTH == 0);
|
||||
int noutput = noutput_items / SYMBOL_LENGTH;
|
||||
|
||||
const gr_complex *in = (const gr_complex*)input_items[0];
|
||||
gr_complex *out = (gr_complex*)output_items[0];
|
||||
|
||||
int written = 0;
|
||||
int consumed = 0;
|
||||
std::memcpy(out, PREAMBLE, 320 * sizeof(gr_complex));
|
||||
std::memcpy(out + 320, in, ninput_items[0] * sizeof(gr_complex));
|
||||
|
||||
const uint64_t nread = this->nitems_read(0);
|
||||
std::vector<gr::tag_t> tags;
|
||||
pmt::pmt_t key = pmt::string_to_symbol("tx_sob");
|
||||
pmt::pmt_t srcid = pmt::string_to_symbol(this->name());
|
||||
|
||||
dout << "OFDM PREAMBLE: input size: " << ninput_items[0] << " output size: "
|
||||
<< noutput_items << std::endl;
|
||||
int produced = ninput_items[0] + 320;
|
||||
const pmt::pmt_t value = pmt::PMT_T;
|
||||
const pmt::pmt_t src = pmt::string_to_symbol(alias());
|
||||
|
||||
while(written < noutput) {
|
||||
add_item_tag(0, nitems_written(0), pmt::mp("tx_sob"), value, src);
|
||||
add_item_tag(0, nitems_written(0) + produced - 1, pmt::mp("tx_eob"), value, src);
|
||||
|
||||
// debug
|
||||
dout << "OFDM PREAMBLE: iteration - consumed: " << consumed <<
|
||||
" written:" << written << std::endl;
|
||||
//assert((consumed + 1) * SYMBOL_LENGTH <= ninput_items[0]);
|
||||
|
||||
switch(d_state) {
|
||||
|
||||
case IDLE:
|
||||
|
||||
if(consumed >= ninput) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
dout << "OFDM PREAMBLE: start of new frame" << std::endl;
|
||||
|
||||
get_tags_in_range(tags, 0, nread + consumed * SYMBOL_LENGTH,
|
||||
nread + (consumed + 1) * SYMBOL_LENGTH - 1,
|
||||
pmt::string_to_symbol("ofdm_start"));
|
||||
|
||||
// looks like we changed to modulation scheme during the frame
|
||||
if(tags.size() != 1) {
|
||||
std::cout << "PREAMBLE: frame is longer than expected" << std::endl;
|
||||
throw std::runtime_error("PREAMBLE: frame is too long");
|
||||
break;
|
||||
}
|
||||
d_frame_left = pmt::to_uint64(tags[0].value);
|
||||
d_preamble_left = 4;
|
||||
d_state = PRE;
|
||||
|
||||
// add tag to indicate start of odfm frame
|
||||
add_item_tag(0, this->nitems_written(0) + written * SYMBOL_LENGTH, key, pmt::PMT_T, srcid);
|
||||
|
||||
// FALL THROUGH !!!!!
|
||||
|
||||
case PRE:
|
||||
|
||||
dout << "OFDM PREAMBLE: copy preamble" << std::endl;
|
||||
|
||||
memcpy(out, PREAMBLE + (4 - d_preamble_left) * SYMBOL_LENGTH,
|
||||
SYMBOL_LENGTH * sizeof(gr_complex));
|
||||
|
||||
out += SYMBOL_LENGTH;
|
||||
written++;
|
||||
d_preamble_left--;
|
||||
|
||||
if(!d_preamble_left) {
|
||||
d_state = FRAME;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FRAME:
|
||||
if(consumed >= ninput) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
dout << "OFDM PREAMBLE: copy frame" << std::endl;
|
||||
|
||||
memcpy(out, in, SYMBOL_LENGTH * sizeof(gr_complex));
|
||||
|
||||
consumed++;
|
||||
in += SYMBOL_LENGTH;
|
||||
out += SYMBOL_LENGTH;
|
||||
written++;
|
||||
d_frame_left--;
|
||||
|
||||
if(!d_frame_left) {
|
||||
d_state = IDLE;
|
||||
insert_eob(nitems_written(0) + written * SYMBOL_LENGTH -1);
|
||||
goto out;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
dout << "PREAMBLE: consumed " << consumed * SYMBOL_LENGTH;
|
||||
dout << " written " << written * SYMBOL_LENGTH << std::endl;
|
||||
consume(0, consumed * SYMBOL_LENGTH);
|
||||
return written * SYMBOL_LENGTH;
|
||||
return produced;
|
||||
}
|
||||
|
||||
void insert_eob(uint64_t item) {
|
||||
@@ -159,27 +67,10 @@ void insert_eob(uint64_t item) {
|
||||
const pmt::pmt_t eob_key = pmt::string_to_symbol("tx_eob");
|
||||
const pmt::pmt_t value = pmt::PMT_T;
|
||||
const pmt::pmt_t srcid = pmt::string_to_symbol(this->name());
|
||||
add_item_tag(0, item, eob_key, value, srcid);
|
||||
}
|
||||
|
||||
void
|
||||
forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||
{
|
||||
if(d_state == PRE) {
|
||||
ninput_items_required[0] = 0;
|
||||
} else {
|
||||
ninput_items_required[0] = noutput_items;
|
||||
}
|
||||
|
||||
dout << "forecast noutput_items: " << noutput_items << " required: " << ninput_items_required[0] << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
bool d_debug;
|
||||
size_t d_preamble_left;
|
||||
size_t d_frame_left;
|
||||
enum {IDLE, PRE, FRAME} d_state;
|
||||
|
||||
static gr_complex PREAMBLE[320];
|
||||
};
|
||||
|
||||
|
||||
+19
-22
@@ -245,25 +245,22 @@ ofdm_sync_long::make(unsigned int sync_length, bool log, bool debug) {
|
||||
}
|
||||
|
||||
const std::vector<gr_complex> ofdm_sync_long_impl::LONG = {
|
||||
gr_complex( -0.04097-0.9626011), gr_complex( 0.3179976-0.8892635), gr_complex( 0.7746551+0.6623833),
|
||||
gr_complex( 0.1688942+0.2230874), gr_complex( 0.4785908-0.7016541), gr_complex( -0.9210497-0.441444),
|
||||
gr_complex( -0.3065277-0.8493673), gr_complex( 0.7803301-0.2071068), gr_complex( 0.4267019+0.0326106),
|
||||
gr_complex( 0.0079118-0.9200371), gr_complex( -1.094439-0.379038), gr_complex( 0.1958068-0.4682544),
|
||||
gr_complex( 0.4693501-0.119512), gr_complex( -0.179866+1.285259), gr_complex( 0.9539127-0.0327648),
|
||||
gr_complex( 0.5-0.5), gr_complex( 0.2953435+0.7867532), gr_complex( -0.4576508+0.3143887),
|
||||
gr_complex( -1.050101+0.521818), gr_complex( 0.6577466+0.7388524), gr_complex( 0.5564548+0.1129757),
|
||||
gr_complex( -0.4824808+0.650289), gr_complex( -0.451641-0.1744314), gr_complex( -0.28033-1.207107),
|
||||
gr_complex( -0.9750961-0.1325297), gr_complex( -1.018595-0.164011), gr_complex( 0.6005896-0.5923234),
|
||||
gr_complex( -0.0224476+0.4301941), gr_complex( -0.7351004+0.9210297), gr_complex( 0.7337324+0.8469733),
|
||||
gr_complex( 0.0982767+0.7807964), gr_complex( -1.25+0), gr_complex( 0.0982767-0.7807964),
|
||||
gr_complex( 0.7337324-0.8469733), gr_complex( -0.7351004-0.9210297), gr_complex( -0.0224476-0.4301941),
|
||||
gr_complex( 0.6005896+0.5923234), gr_complex( -1.018595+0.164011), gr_complex( -0.9750961+0.1325297),
|
||||
gr_complex( -0.28033+1.207107), gr_complex( -0.451641+0.1744314), gr_complex( -0.4824808-0.650289),
|
||||
gr_complex( 0.5564548-0.1129757), gr_complex( 0.6577466-0.7388524), gr_complex( -1.050101-0.521818),
|
||||
gr_complex( -0.4576508-0.3143887), gr_complex( 0.2953435-0.7867532), gr_complex( 0.5+0.5),
|
||||
gr_complex( 0.9539127+0.0327648), gr_complex( -0.179866-1.285259), gr_complex( 0.4693501+0.119512),
|
||||
gr_complex( 0.1958068+0.4682544), gr_complex( -1.094439+0.379038), gr_complex( 0.0079118+0.9200371),
|
||||
gr_complex( 0.4267019-0.0326106), gr_complex( 0.7803301+0.2071068), gr_complex( -0.3065277+0.8493673),
|
||||
gr_complex( -0.9210497+0.441444), gr_complex( 0.4785908+0.7016541), gr_complex( 0.1688942-0.2230874),
|
||||
gr_complex( 0.7746551-0.6623833), gr_complex( 0.3179976+0.8892635), gr_complex( -0.04097+0.9626011),
|
||||
gr_complex( 1.25+0)};
|
||||
|
||||
gr_complex( 1.3868, 0.0000), gr_complex(-0.0455, -1.0679), gr_complex( 0.3528, -0.9865), gr_complex( 0.8594, 0.7348),
|
||||
gr_complex( 0.1874, 0.2475), gr_complex( 0.5309, -0.7784), gr_complex(-1.0218, -0.4897), gr_complex(-0.3401, -0.9423),
|
||||
gr_complex( 0.8657, -0.2298), gr_complex( 0.4734, 0.0362), gr_complex( 0.0088, -1.0207), gr_complex(-1.2142, -0.4205),
|
||||
gr_complex( 0.2172, -0.5195), gr_complex( 0.5207, -0.1326), gr_complex(-0.1995, 1.4259), gr_complex( 1.0583, -0.0363),
|
||||
gr_complex( 0.5547, -0.5547), gr_complex( 0.3277, 0.8728), gr_complex(-0.5077, 0.3488), gr_complex(-1.1650, 0.5789),
|
||||
gr_complex( 0.7297, 0.8197), gr_complex( 0.6173, 0.1253), gr_complex(-0.5353, 0.7214), gr_complex(-0.5011, -0.1935),
|
||||
gr_complex(-0.3110, -1.3392), gr_complex(-1.0818, -0.1470), gr_complex(-1.1300, -0.1820), gr_complex( 0.6663, -0.6571),
|
||||
gr_complex(-0.0249, 0.4773), gr_complex(-0.8155, 1.0218), gr_complex( 0.8140, 0.9396), gr_complex( 0.1090, 0.8662),
|
||||
gr_complex(-1.3868, 0.0000), gr_complex( 0.1090, -0.8662), gr_complex( 0.8140, -0.9396), gr_complex(-0.8155, -1.0218),
|
||||
gr_complex(-0.0249, -0.4773), gr_complex( 0.6663, 0.6571), gr_complex(-1.1300, 0.1820), gr_complex(-1.0818, 0.1470),
|
||||
gr_complex(-0.3110, 1.3392), gr_complex(-0.5011, 0.1935), gr_complex(-0.5353, -0.7214), gr_complex( 0.6173, -0.1253),
|
||||
gr_complex( 0.7297, -0.8197), gr_complex(-1.1650, -0.5789), gr_complex(-0.5077, -0.3488), gr_complex( 0.3277, -0.8728),
|
||||
gr_complex( 0.5547, 0.5547), gr_complex( 1.0583, 0.0363), gr_complex(-0.1995, -1.4259), gr_complex( 0.5207, 0.1326),
|
||||
gr_complex( 0.2172, 0.5195), gr_complex(-1.2142, 0.4205), gr_complex( 0.0088, 1.0207), gr_complex( 0.4734, -0.0362),
|
||||
gr_complex( 0.8657, 0.2298), gr_complex(-0.3401, 0.9423), gr_complex(-1.0218, 0.4897), gr_complex( 0.5309, 0.7784),
|
||||
gr_complex( 0.1874, -0.2475), gr_complex( 0.8594, -0.7348), gr_complex( 0.3528, 0.9865), gr_complex(-0.0455, 1.0679)
|
||||
|
||||
};
|
||||
|
||||
+10
-117
@@ -21,32 +21,15 @@
|
||||
#include <math.h>
|
||||
|
||||
// constellations for different modulations (normalized to avg power 1)
|
||||
const std::complex<float> BPSK[2] = {
|
||||
std::complex<float>(-1.0, 0.0), std::complex<float>(1.0, 0.0)};
|
||||
|
||||
const std::complex<double> BPSK_D[2] = {
|
||||
std::complex<double>(-1.0, 0.0), std::complex<double>(1.0, 0.0)};
|
||||
|
||||
|
||||
const std::complex<float> QPSK[4] = {
|
||||
std::complex<float>(-0.7071, -0.7071), std::complex<float>(-0.7071, 0.7071),
|
||||
std::complex<float>(+0.7071, -0.7071), std::complex<float>(+0.7071, 0.7071)};
|
||||
|
||||
const std::complex<double> QPSK_D[4] = {
|
||||
std::complex<double>(-0.7071, -0.7071), std::complex<double>(-0.7071, 0.7071),
|
||||
std::complex<double>(+0.7071, -0.7071), std::complex<double>(+0.7071, 0.7071)};
|
||||
|
||||
|
||||
const std::complex<float> QAM16[16] = {
|
||||
std::complex<float>(-0.9487, -0.9487), std::complex<float>(-0.9487, -0.3162),
|
||||
std::complex<float>(-0.9487, 0.9487), std::complex<float>(-0.9487, 0.3162),
|
||||
std::complex<float>(-0.3162, -0.9487), std::complex<float>(-0.3162, -0.3162),
|
||||
std::complex<float>(-0.3162, 0.9487), std::complex<float>(-0.3162, 0.3162),
|
||||
std::complex<float>(0.9487, -0.9487), std::complex<float>(0.9487, -0.3162),
|
||||
std::complex<float>(0.9487, 0.9487), std::complex<float>(0.9487, 0.3162),
|
||||
std::complex<float>(0.3162, -0.9487), std::complex<float>(0.3162, -0.3162),
|
||||
std::complex<float>(0.3162, 0.9487), std::complex<float>(0.3162, 0.3162)};
|
||||
|
||||
const std::complex<double> QAM16_D[16] = {
|
||||
std::complex<double>(-0.9487, -0.9487), std::complex<double>(-0.9487, -0.3162),
|
||||
std::complex<double>(-0.9487, 0.9487), std::complex<double>(-0.9487, 0.3162),
|
||||
@@ -58,40 +41,6 @@ const std::complex<double> QAM16_D[16] = {
|
||||
std::complex<double>(0.3162, 0.9487), std::complex<double>(0.3162, 0.3162)};
|
||||
|
||||
|
||||
const std::complex<float> QAM64[64] = {
|
||||
std::complex<float>(-1.0801, -1.0801), std::complex<float>(-1.0801, -0.7715),
|
||||
std::complex<float>(-1.0801, -0.1543), std::complex<float>(-1.0801, -0.4629),
|
||||
std::complex<float>(-1.0801, 1.0801), std::complex<float>(-1.0801, 0.7715),
|
||||
std::complex<float>(-1.0801, 0.1543), std::complex<float>(-1.0801, 0.4629),
|
||||
std::complex<float>(-0.7715, -1.0801), std::complex<float>(-0.7715, -0.7715),
|
||||
std::complex<float>(-0.7715, -0.1543), std::complex<float>(-0.7715, -0.4629),
|
||||
std::complex<float>(-0.7715, 1.0801), std::complex<float>(-0.7715, 0.7715),
|
||||
std::complex<float>(-0.7715, 0.1543), std::complex<float>(-0.7715, 0.4629),
|
||||
std::complex<float>(-0.1543, -1.0801), std::complex<float>(-0.1543, -0.7715),
|
||||
std::complex<float>(-0.1543, -0.1543), std::complex<float>(-0.1543, -0.4629),
|
||||
std::complex<float>(-0.1543, 1.0801), std::complex<float>(-0.1543, 0.7715),
|
||||
std::complex<float>(-0.1543, 0.1543), std::complex<float>(-0.1543, 0.4629),
|
||||
std::complex<float>(-0.4629, -1.0801), std::complex<float>(-0.4629, -0.7715),
|
||||
std::complex<float>(-0.4629, -0.1543), std::complex<float>(-0.4629, -0.4629),
|
||||
std::complex<float>(-0.4629, 1.0801), std::complex<float>(-0.4629, 0.7715),
|
||||
std::complex<float>(-0.4629, 0.1543), std::complex<float>(-0.4629, 0.4629),
|
||||
std::complex<float>(1.0801, -1.0801), std::complex<float>(1.0801, -0.7715),
|
||||
std::complex<float>(1.0801, -0.1543), std::complex<float>(1.0801, -0.4629),
|
||||
std::complex<float>(1.0801, 1.0801), std::complex<float>(1.0801, 0.7715),
|
||||
std::complex<float>(1.0801, 0.1543), std::complex<float>(1.0801, 0.4629),
|
||||
std::complex<float>(0.7715, -1.0801), std::complex<float>(0.7715, -0.7715),
|
||||
std::complex<float>(0.7715, -0.1543), std::complex<float>(0.7715, -0.4629),
|
||||
std::complex<float>(0.7715, 1.0801), std::complex<float>(0.7715, 0.7715),
|
||||
std::complex<float>(0.7715, 0.1543), std::complex<float>(0.7715, 0.4629),
|
||||
std::complex<float>(0.1543, -1.0801), std::complex<float>(0.1543, -0.7715),
|
||||
std::complex<float>(0.1543, -0.1543), std::complex<float>(0.1543, -0.4629),
|
||||
std::complex<float>(0.1543, 1.0801), std::complex<float>(0.1543, 0.7715),
|
||||
std::complex<float>(0.1543, 0.1543), std::complex<float>(0.1543, 0.4629),
|
||||
std::complex<float>(0.4629, -1.0801), std::complex<float>(0.4629, -0.7715),
|
||||
std::complex<float>(0.4629, -0.1543), std::complex<float>(0.4629, -0.4629),
|
||||
std::complex<float>(0.4629, 1.0801), std::complex<float>(0.4629, 0.7715),
|
||||
std::complex<float>(0.4629, 0.1543), std::complex<float>(0.4629, 0.4629)};
|
||||
|
||||
const std::complex<double> QAM64_D[64] = {
|
||||
std::complex<double>(-1.0801, -1.0801), std::complex<double>(-1.0801, -0.7715),
|
||||
std::complex<double>(-1.0801, -0.1543), std::complex<double>(-1.0801, -0.4629),
|
||||
@@ -192,6 +141,7 @@ ofdm_param::ofdm_param(Encoding e) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ofdm_param::print() {
|
||||
std::cout << "OFDM Parameters:" << std::endl;
|
||||
@@ -202,6 +152,7 @@ ofdm_param::print() {
|
||||
std::cout << "n_dbps :" << n_dbps << std::endl;
|
||||
}
|
||||
|
||||
|
||||
tx_param::tx_param(ofdm_param &ofdm, int psdu_length) {
|
||||
|
||||
psdu_size = psdu_length;
|
||||
@@ -226,9 +177,6 @@ tx_param::print() {
|
||||
std::cout << "n_pad: " << n_pad << std::endl;
|
||||
}
|
||||
|
||||
int get_bit(int b, int i) {
|
||||
return (b & (1 << i) ? 1 : 0);
|
||||
}
|
||||
|
||||
void scramble(const char *in, char *out, tx_param &tx, char initial_state) {
|
||||
|
||||
@@ -243,10 +191,12 @@ void scramble(const char *in, char *out, tx_param &tx, char initial_state) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reset_tail_bits(char *scrambled_data, tx_param &tx) {
|
||||
memset(scrambled_data + tx.n_data - tx.n_pad - 6, 0, 6 * sizeof(char));
|
||||
}
|
||||
|
||||
|
||||
int ones(int n) {
|
||||
int sum = 0;
|
||||
for(int i = 0; i < 8; i++) {
|
||||
@@ -257,6 +207,7 @@ int ones(int n) {
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
void convolutional_encoding(const char *in, char *out, tx_param &tx) {
|
||||
|
||||
int state = 0;
|
||||
@@ -269,6 +220,7 @@ void convolutional_encoding(const char *in, char *out, tx_param &tx) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void puncturing(const char *in, char *out, tx_param &tx, ofdm_param &ofdm) {
|
||||
|
||||
int mod;
|
||||
@@ -306,6 +258,7 @@ void puncturing(const char *in, char *out, tx_param &tx, ofdm_param &ofdm) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void interleave(const char *in, char *out, tx_param &tx, ofdm_param &ofdm, bool reverse) {
|
||||
|
||||
int n_cbps = ofdm.n_cbps;
|
||||
@@ -332,6 +285,7 @@ void interleave(const char *in, char *out, tx_param &tx, ofdm_param &ofdm, bool
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void interleave(const double *in, double *out, tx_param &tx, ofdm_param &ofdm, bool reverse) {
|
||||
|
||||
int n_cbps = ofdm.n_cbps;
|
||||
@@ -357,6 +311,8 @@ void interleave(const double *in, double *out, tx_param &tx, ofdm_param &ofdm, b
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void split_symbols(const char *in, char *out, tx_param &tx, ofdm_param &ofdm) {
|
||||
|
||||
int symbols = tx.n_sym * 48;
|
||||
@@ -372,69 +328,6 @@ void split_symbols(const char *in, char *out, tx_param &tx, ofdm_param &ofdm) {
|
||||
}
|
||||
|
||||
|
||||
void generate_signal_field(char *out, tx_param &tx, ofdm_param &ofdm) {
|
||||
|
||||
//data bits of the signal header
|
||||
char *signal_header = (char *) malloc(sizeof(char) * 24);
|
||||
|
||||
//signal header after...
|
||||
//convolutional encoding
|
||||
char *encoded_signal_header = (char *) malloc(sizeof(char) * 48);
|
||||
//interleaving
|
||||
char *interleaved_signal_header = (char *) malloc(sizeof(char) * 48);
|
||||
|
||||
int length = tx.psdu_size;
|
||||
|
||||
// first 4 bits represent the modulation and coding scheme
|
||||
signal_header[ 0] = get_bit(ofdm.rate_field, 3);
|
||||
signal_header[ 1] = get_bit(ofdm.rate_field, 2);
|
||||
signal_header[ 2] = get_bit(ofdm.rate_field, 1);
|
||||
signal_header[ 3] = get_bit(ofdm.rate_field, 0);
|
||||
// 5th bit is reserved and must be set to 0
|
||||
signal_header[ 4] = 0;
|
||||
// then 12 bits represent the length
|
||||
signal_header[ 5] = get_bit(length, 0);
|
||||
signal_header[ 6] = get_bit(length, 1);
|
||||
signal_header[ 7] = get_bit(length, 2);
|
||||
signal_header[ 8] = get_bit(length, 3);
|
||||
signal_header[ 9] = get_bit(length, 4);
|
||||
signal_header[10] = get_bit(length, 5);
|
||||
signal_header[11] = get_bit(length, 6);
|
||||
signal_header[12] = get_bit(length, 7);
|
||||
signal_header[13] = get_bit(length, 8);
|
||||
signal_header[14] = get_bit(length, 9);
|
||||
signal_header[15] = get_bit(length, 10);
|
||||
signal_header[16] = get_bit(length, 11);
|
||||
//18-th bit is the parity bit for the first 17 bits
|
||||
int sum = 0;
|
||||
for(int i = 0; i < 17; i++) {
|
||||
if(signal_header[i]) {
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
signal_header[17] = sum % 2;
|
||||
|
||||
// last 6 bits must be set to 0
|
||||
for (int i = 0; i < 6; i++) {
|
||||
signal_header[18 + i] = 0;
|
||||
}
|
||||
|
||||
ofdm_param signal_ofdm(BPSK_1_2);
|
||||
tx_param signal_tx(signal_ofdm, 3);
|
||||
signal_tx.n_data = 24;
|
||||
signal_tx.n_sym = 1;
|
||||
|
||||
// convolutional encoding (scrambling is not needed)
|
||||
convolutional_encoding(signal_header, encoded_signal_header, signal_tx);
|
||||
// interleaving
|
||||
//interleave(encoded_signal_header, interleaved_signal_header, signal_tx, signal_ofdm);
|
||||
interleave(encoded_signal_header, out, signal_tx, signal_ofdm);
|
||||
|
||||
free(signal_header);
|
||||
free(encoded_signal_header);
|
||||
free(interleaved_signal_header);
|
||||
}
|
||||
|
||||
void generate_bits(const char *psdu, char *data_bits, tx_param &tx) {
|
||||
|
||||
// first 16 bits are zero (SERVICE/DATA field)
|
||||
|
||||
@@ -31,11 +31,6 @@
|
||||
#define mylog(msg) do { d_log && std::cout << msg << std::endl; } while(0);
|
||||
#endif
|
||||
|
||||
extern const std::complex<float> BPSK[2];
|
||||
extern const std::complex<float> QPSK[4];
|
||||
extern const std::complex<float> QAM16[16];
|
||||
extern const std::complex<float> QAM64[64];
|
||||
|
||||
// same mappings in double (itpp sucks)
|
||||
extern const std::complex<double> BPSK_D[2];
|
||||
extern const std::complex<double> QPSK_D[4];
|
||||
@@ -120,8 +115,6 @@ void interleave(const double *input, double *out, tx_param &tx, ofdm_param &ofdm
|
||||
|
||||
void split_symbols(const char *input, char *out, tx_param &tx, ofdm_param &ofdm);
|
||||
|
||||
void generate_signal_field(char *out, tx_param &tx, ofdm_param &ofdm);
|
||||
|
||||
void generate_bits(const char *psdu, char *data_bits, tx_param &tx);
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_OFDM_UTILS_H */
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "wifi_signal_field_impl.h"
|
||||
#include "utils.h"
|
||||
#include <gnuradio/digital/lfsr.h>
|
||||
|
||||
using namespace gr::ieee802_11;
|
||||
|
||||
wifi_signal_field::sptr
|
||||
wifi_signal_field::make() {
|
||||
return wifi_signal_field::sptr(new wifi_signal_field_impl());
|
||||
}
|
||||
|
||||
wifi_signal_field::wifi_signal_field() : packet_header_default(48, "packet_len") {};
|
||||
|
||||
|
||||
wifi_signal_field_impl::wifi_signal_field_impl() : packet_header_default(48, "packet_len") {}
|
||||
|
||||
|
||||
wifi_signal_field_impl::~wifi_signal_field_impl() {}
|
||||
|
||||
|
||||
int wifi_signal_field_impl::get_bit(int b, int i) {
|
||||
return (b & (1 << i) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
void wifi_signal_field_impl::generate_signal_field(char *out, tx_param &tx, ofdm_param &ofdm) {
|
||||
|
||||
//data bits of the signal header
|
||||
char *signal_header = (char *) malloc(sizeof(char) * 24);
|
||||
|
||||
//signal header after...
|
||||
//convolutional encoding
|
||||
char *encoded_signal_header = (char *) malloc(sizeof(char) * 48);
|
||||
//interleaving
|
||||
char *interleaved_signal_header = (char *) malloc(sizeof(char) * 48);
|
||||
|
||||
int length = tx.psdu_size;
|
||||
|
||||
// first 4 bits represent the modulation and coding scheme
|
||||
signal_header[ 0] = get_bit(ofdm.rate_field, 3);
|
||||
signal_header[ 1] = get_bit(ofdm.rate_field, 2);
|
||||
signal_header[ 2] = get_bit(ofdm.rate_field, 1);
|
||||
signal_header[ 3] = get_bit(ofdm.rate_field, 0);
|
||||
// 5th bit is reserved and must be set to 0
|
||||
signal_header[ 4] = 0;
|
||||
// then 12 bits represent the length
|
||||
signal_header[ 5] = get_bit(length, 0);
|
||||
signal_header[ 6] = get_bit(length, 1);
|
||||
signal_header[ 7] = get_bit(length, 2);
|
||||
signal_header[ 8] = get_bit(length, 3);
|
||||
signal_header[ 9] = get_bit(length, 4);
|
||||
signal_header[10] = get_bit(length, 5);
|
||||
signal_header[11] = get_bit(length, 6);
|
||||
signal_header[12] = get_bit(length, 7);
|
||||
signal_header[13] = get_bit(length, 8);
|
||||
signal_header[14] = get_bit(length, 9);
|
||||
signal_header[15] = get_bit(length, 10);
|
||||
signal_header[16] = get_bit(length, 11);
|
||||
//18-th bit is the parity bit for the first 17 bits
|
||||
int sum = 0;
|
||||
for(int i = 0; i < 17; i++) {
|
||||
if(signal_header[i]) {
|
||||
sum++;
|
||||
}
|
||||
}
|
||||
signal_header[17] = sum % 2;
|
||||
|
||||
// last 6 bits must be set to 0
|
||||
for (int i = 0; i < 6; i++) {
|
||||
signal_header[18 + i] = 0;
|
||||
}
|
||||
|
||||
ofdm_param signal_ofdm(BPSK_1_2);
|
||||
tx_param signal_tx(signal_ofdm, 3);
|
||||
signal_tx.n_data = 24;
|
||||
signal_tx.n_sym = 1;
|
||||
|
||||
// convolutional encoding (scrambling is not needed)
|
||||
convolutional_encoding(signal_header, encoded_signal_header, signal_tx);
|
||||
// interleaving
|
||||
//interleave(encoded_signal_header, interleaved_signal_header, signal_tx, signal_ofdm);
|
||||
interleave(encoded_signal_header, out, signal_tx, signal_ofdm);
|
||||
|
||||
free(signal_header);
|
||||
free(encoded_signal_header);
|
||||
free(interleaved_signal_header);
|
||||
}
|
||||
|
||||
bool wifi_signal_field_impl::header_formatter(long packet_len, unsigned char *out, const std::vector<tag_t> &tags)
|
||||
{
|
||||
|
||||
bool encoding_found = false;
|
||||
bool len_found = false;
|
||||
int encoding = 0;
|
||||
int len = 0;
|
||||
|
||||
// read tags
|
||||
for(int i = 0; i < tags.size(); i++) {
|
||||
if(pmt::eq(tags[i].key, pmt::mp("encoding"))) {
|
||||
encoding_found = true;
|
||||
encoding = pmt::to_long(tags[i].value);
|
||||
} else if(pmt::eq(tags[i].key, pmt::mp("psdu_len"))) {
|
||||
len_found = true;
|
||||
len = pmt::to_long(tags[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
// check if all tags are present
|
||||
if( (!encoding_found) || (!len_found)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ofdm_param ofdm((Encoding)encoding);
|
||||
tx_param tx(ofdm, len);
|
||||
|
||||
generate_signal_field((char*)out, tx, ofdm);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wifi_signal_field_impl::header_parser(
|
||||
const unsigned char *in, std::vector<tag_t> &tags) {
|
||||
|
||||
throw std::runtime_error("not implemented yet");
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Bastian Bloessl <bloessl@ccs-labs.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_IEEE802_11_WIFI_SIGNAL_FIELD_IMPL_H
|
||||
#define INCLUDED_IEEE802_11_WIFI_SIGNAL_FIELD_IMPL_H
|
||||
|
||||
#include <ieee802-11/wifi_signal_field.h>
|
||||
#include "utils.h"
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
|
||||
class wifi_signal_field_impl : public wifi_signal_field
|
||||
{
|
||||
public:
|
||||
wifi_signal_field_impl();
|
||||
~wifi_signal_field_impl();
|
||||
|
||||
bool header_formatter(long packet_len, unsigned char *out,
|
||||
const std::vector<tag_t> &tags);
|
||||
|
||||
bool header_parser(const unsigned char *header,
|
||||
std::vector<tag_t> &tags);
|
||||
private:
|
||||
int get_bit(int b, int i);
|
||||
void generate_signal_field(char *out, tx_param &tx, ofdm_param &ofdm);
|
||||
};
|
||||
|
||||
} // namespace ieee802_11
|
||||
} // namespace gr
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_WIFI_SIGNAL_FIELD_IMPL_H */
|
||||
|
||||
+15
-3
@@ -15,12 +15,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#define IEEE802_11_API
|
||||
#define DIGITAL_API
|
||||
|
||||
%include "gnuradio.i"
|
||||
|
||||
%include "ieee802_11_swig_doc.i"
|
||||
|
||||
%{
|
||||
#include "gnuradio/digital/packet_header_default.h"
|
||||
|
||||
#include "ieee802-11/chunks_to_symbols.h"
|
||||
#include "ieee802-11/ether_encap.h"
|
||||
#include "ieee802-11/moving_average_cc.h"
|
||||
#include "ieee802-11/moving_average_ff.h"
|
||||
@@ -31,12 +35,15 @@
|
||||
#include "ieee802-11/ofdm_mac.h"
|
||||
#include "ieee802-11/ofdm_mapper.h"
|
||||
#include "ieee802-11/ofdm_parse_mac.h"
|
||||
#include "ieee802-11/ofdm_pilot.h"
|
||||
#include "ieee802-11/ofdm_preamble.h"
|
||||
#include "ieee802-11/ofdm_sync_long.h"
|
||||
#include "ieee802-11/ofdm_sync_short.h"
|
||||
#include "ieee802-11/wifi_signal_field.h"
|
||||
%}
|
||||
|
||||
%include "gnuradio/digital/packet_header_default.h"
|
||||
|
||||
%include "ieee802-11/chunks_to_symbols.h"
|
||||
%include "ieee802-11/ether_encap.h"
|
||||
%include "ieee802-11/moving_average_cc.h"
|
||||
%include "ieee802-11/moving_average_ff.h"
|
||||
@@ -47,11 +54,12 @@
|
||||
%include "ieee802-11/ofdm_mac.h"
|
||||
%include "ieee802-11/ofdm_mapper.h"
|
||||
%include "ieee802-11/ofdm_parse_mac.h"
|
||||
%include "ieee802-11/ofdm_pilot.h"
|
||||
%include "ieee802-11/ofdm_preamble.h"
|
||||
%include "ieee802-11/ofdm_sync_long.h"
|
||||
%include "ieee802-11/ofdm_sync_short.h"
|
||||
%include "ieee802-11/wifi_signal_field.h"
|
||||
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, chunks_to_symbols);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ether_encap);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, moving_average_cc);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, moving_average_ff);
|
||||
@@ -62,8 +70,12 @@ GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_freq_est);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_mac);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_mapper);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_parse_mac);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_pilot);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_preamble);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_long);
|
||||
GR_SWIG_BLOCK_MAGIC2(ieee802_11, ofdm_sync_short);
|
||||
|
||||
%template(wifi_signal_field_sptr) boost::shared_ptr<gr::ieee802_11::wifi_signal_field>;
|
||||
%pythoncode %{
|
||||
wifi_signal_field_sptr.__repr__ = lambda self: "<wifi_signal_field>"
|
||||
wifi_signal_field = wifi_signal_field .make;
|
||||
%}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
fft.shift <- function(sym) {
|
||||
|
||||
sym <- matrix(sym, ncol=64)
|
||||
|
||||
# the explicit dimensions are required
|
||||
# if sym contains only one row
|
||||
m1 <- matrix(sym[,33:64], ncol=32)
|
||||
m2 <- matrix(sym[, 1:32], ncol=32)
|
||||
|
||||
return(cbind(m1, m2))
|
||||
}
|
||||
|
||||
### symbols as defined in the standard
|
||||
sym <- c(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)
|
||||
freq <- c(rep(0, 6), sym, rep(0, 5))
|
||||
|
||||
pre <- fft(fft.shift(freq), inverse=T) / sqrt(52)
|
||||
|
||||
|
||||
for(i in seq(1, 64, 4)) {
|
||||
cat("\t\tgr_complex(", sprintf("% .4f", Re(pre[ i])), ", ", sprintf("% .4f", Im(pre[ i])), "), ", sep="")
|
||||
cat( "gr_complex(", sprintf("% .4f", Re(pre[i+1])), ", ", sprintf("% .4f", Im(pre[i+1])), "), ", sep="")
|
||||
cat( "gr_complex(", sprintf("% .4f", Re(pre[i+2])), ", ", sprintf("% .4f", Im(pre[i+2])), "), ", sep="")
|
||||
cat( "gr_complex(", sprintf("% .4f", Re(pre[i+3])), ", ", sprintf("% .4f", Im(pre[i+3])), "),\n", sep="")
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
polarity = [
|
||||
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,-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,-1,-1,-1,-1,-1]
|
||||
|
||||
|
||||
print "polarity"
|
||||
print tuple((x, x, x, -x) for x in polarity)
|
||||
|
||||
|
||||
print "pattern"
|
||||
print tuple((-21, -7, 7, 21) for x in range(127))
|
||||
@@ -0,0 +1,13 @@
|
||||
library(TTR)
|
||||
library(ggplot2)
|
||||
|
||||
### test file
|
||||
in.file <- file('/tmp/ofdm.bin', 'rb')
|
||||
|
||||
sig <- readBin(in.file, double(), n=10000, size=4, endian='little')
|
||||
|
||||
sig <- sig[seq(1, length(sig), 2)] + 1i * sig[seq(2, length(sig), 2)]
|
||||
|
||||
pow <- abs(sig)^2
|
||||
|
||||
plot(SMA(pow, 1600), type='l')
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
|
||||
short = tuple([(52**.5/24**.5) * x for x in [0, 0, 0, 0, 0, 0, 0, 0, 1+1j, 0, 0, 0, -1-1j, 0, 0, 0, 1+1j, 0, 0, 0, -1-1j, 0, 0, 0, -1-1j, 0, 0, 0, 1+1j, 0, 0, 0, 0, 0, 0, 0, -1-1j, 0, 0, 0, -1-1j, 0, 0, 0, 1+1j, 0, 0, 0, 1+1j, 0, 0, 0, 1+1j, 0, 0, 0, 1+1j, 0, 0, 0, 0, 0, 0, 0]])
|
||||
|
||||
long_norm = tuple([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])
|
||||
|
||||
|
||||
mul = tuple([1, -1j, -1, 1j] * 16)
|
||||
long_rot = tuple([x * y for x, y in zip(long_norm, mul)])
|
||||
|
||||
|
||||
sync = tuple([short, short, long_rot, long_norm])
|
||||
|
||||
|
||||
assert(len(short) == 64)
|
||||
assert(len(long_norm) == 64)
|
||||
assert(len(long_rot) == 64)
|
||||
assert(len(sync) == 4)
|
||||
|
||||
print "power short: " + str(sum([abs(x)**2 for x in short]))
|
||||
print "power long: " + str(sum([abs(x)**2 for x in long_norm]))
|
||||
|
||||
print "sync sequence"
|
||||
print sync
|
||||
print "len sync: " + str(len(sync))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user