Skip to content
Snippets Groups Projects
Commit 04038803 authored by Glenn Bradford's avatar Glenn Bradford
Browse files

bug fixes

parent 49402c71
No related branches found
No related tags found
No related merge requests found
......@@ -23,13 +23,12 @@ $ cmake ..
$ make
$ sudo make install
```
You see a number of blocks installed in GRC under the \[cdc\] category.
You should see a number of blocks installed in GRC under the **\[cdc\]** category.
## Primary User Reference Code
GRC applications for running the Primary User Tx and Rx can be found in the
`./examples/` directory:
GRC applications for running the OFDM-based primary user Tx and Rx can be found
in the `./examples/` directory:
- `pu_tx_1_channel.grc`
- `pu_tx_4_channel.grc`
......@@ -46,19 +45,20 @@ the `./examples/` directory.
- `test_dsa_database.grc`
If you want to test out this code, ensure you have first started an instance
of the database running on the local machine.
If you want to test out this code, first ensure you start an instance of the
database on the local machine.
```
$ ./run_dsa_database.py
```
You should then be able to run the GRC application and see KPI statistics
printed to the terminal.
The key block that will need to be integrated into your secondary link is the
*DSA DB Connect*. This block should be used at both SU Tx and Rx. Request to the
DSA database can then be made by passing commands to the *DSA DB Connect* block
in the form of
The key block that you will need to integrate into your secondary link is
**DSA DB Connect**. This block should be used at both secondary user Tx and Rx.
Requests to the DSA database can then be made by passing commands to
*DSA DB Connect* block as
[GNU Radio Messages](https://wiki.gnuradio.org/index.php/Message_Passing).
Example message formation for various command is shown in the following.
```
......@@ -66,6 +66,7 @@ Example message formation for various command is shown in the following.
msg = pmt.cons(pmt.intern('get_pkt'), pmt.PMT_NIL)
# put packet
payload = pmt.init_u8vector(64, [ii for ii in range(64)])
msg = pmt.cons(pmt.intern('put_pkt), payload)
# get current KPI report
......@@ -74,4 +75,5 @@ msg = pmt.cons(pmt.intern('get_kpi'), pmt.PMT_NIL)
# get current PU mode (development only)
msg = pmt.cons(pmt.intern('get_mode'), pmt.PMT_NIL)
```
Responses from the server will be provided as messages on either the **info** or
**pkt** output message ports.
......@@ -56,6 +56,18 @@ blocks:
coordinate: [710, 12]
rotation: 0
state: enabled
- name: pdu_size
id: variable
parameters:
comment: ''
value: '64'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [781, 11]
rotation: 0
state: enabled
- name: rf_freq
id: variable_qtgui_range
parameters:
......@@ -127,6 +139,25 @@ blocks:
coordinate: [583, 307]
rotation: 0
state: true
- name: cdc_dsa_db_connect_0
id: cdc_dsa_db_connect
parameters:
affinity: ''
alias: ''
comment: ''
host: 127.0.0.1
maxoutbuf: '0'
minoutbuf: '0'
pktsize: pdu_size
port: '9000'
radiotype: dsa.RADIO_PU_RX
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [855, 283]
rotation: 0
state: disabled
- name: digital_ofdm_rx_0
id: digital_ofdm_rx
parameters:
......@@ -628,6 +659,7 @@ blocks:
state: true
connections:
- [blocks_tagged_stream_to_pdu_0, pdus, cdc_dsa_db_connect_0, cmd]
- [digital_ofdm_rx_0, '0', blocks_tagged_stream_to_pdu_0, '0']
- [uhd_usrp_source_0, '0', digital_ofdm_rx_0, '0']
- [uhd_usrp_source_0, '0', qtgui_freq_sink_x_0, '0']
......
......@@ -56,6 +56,18 @@ blocks:
coordinate: [656, 10]
rotation: 0
state: enabled
- name: pdu_size
id: variable
parameters:
comment: ''
value: '64'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [725, 10]
rotation: 0
state: enabled
- name: rf_freq
id: variable_qtgui_range
parameters:
......@@ -190,6 +202,25 @@ blocks:
coordinate: [867, 841]
rotation: 0
state: true
- name: cdc_dsa_db_connect_0
id: cdc_dsa_db_connect
parameters:
affinity: ''
alias: ''
comment: ''
host: 127.0.0.1
maxoutbuf: '0'
minoutbuf: '0'
pktsize: pdu_size
port: '9000'
radiotype: dsa.RADIO_PU_RX
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1194, 197]
rotation: 0
state: disabled
- name: digital_ofdm_rx_0
id: digital_ofdm_rx
parameters:
......@@ -504,7 +535,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [60, 389]
coordinate: [53, 326]
rotation: 180
state: true
- name: uhd_usrp_source_0
......@@ -875,11 +906,15 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [68, 238]
coordinate: [64, 172]
rotation: 0
state: true
connections:
- [blocks_tagged_stream_to_pdu_0, pdus, cdc_dsa_db_connect_0, cmd]
- [blocks_tagged_stream_to_pdu_0_0, pdus, cdc_dsa_db_connect_0, cmd]
- [blocks_tagged_stream_to_pdu_0_0_0, pdus, cdc_dsa_db_connect_0, cmd]
- [blocks_tagged_stream_to_pdu_0_0_0_0, pdus, cdc_dsa_db_connect_0, cmd]
- [digital_ofdm_rx_0, '0', blocks_tagged_stream_to_pdu_0, '0']
- [digital_ofdm_rx_0_0, '0', blocks_tagged_stream_to_pdu_0_0, '0']
- [digital_ofdm_rx_0_0_0, '0', blocks_tagged_stream_to_pdu_0_0_0, '0']
......
......@@ -145,25 +145,6 @@ blocks:
coordinate: [458, 186]
rotation: 0
state: enabled
- name: blocks_random_pdu_0
id: blocks_random_pdu
parameters:
affinity: ''
alias: ''
comment: ''
length_modulo: '2'
mask: '0xFF'
maxoutbuf: '0'
maxsize: '2000'
minoutbuf: '0'
minsize: '50'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1150, 299]
rotation: 0
state: true
- name: blocks_tagged_stream_to_pdu_0
id: blocks_tagged_stream_to_pdu
parameters:
......@@ -228,8 +209,8 @@ blocks:
maxoutbuf: '0'
minoutbuf: '0'
num_outputs: '1'
num_packets: '100'
num_queued: '5'
num_packets: '20'
num_queued: '20'
scenario: '-1'
seed: '1'
states:
......@@ -743,7 +724,7 @@ blocks:
bus_structure: null
coordinate: [666, 361]
rotation: 0
state: enabled
state: disabled
- name: virtual_sink_0
id: virtual_sink
parameters:
......
......@@ -153,7 +153,7 @@ blocks:
alias: ''
amp: '1'
comment: ''
freq: 1.25e6
freq: -3.75e6
maxoutbuf: '0'
minoutbuf: '0'
offset: '0'
......@@ -197,7 +197,7 @@ blocks:
alias: ''
amp: '1'
comment: ''
freq: 3.75e6
freq: 1.25e6
maxoutbuf: '0'
minoutbuf: '0'
offset: '0'
......@@ -219,7 +219,7 @@ blocks:
alias: ''
amp: '1'
comment: ''
freq: -3.75e6
freq: 3.75e6
maxoutbuf: '0'
minoutbuf: '0'
offset: '0'
......@@ -423,8 +423,8 @@ blocks:
maxoutbuf: '0'
minoutbuf: '0'
num_outputs: '4'
num_packets: '50'
num_queued: '50'
num_packets: '20'
num_queued: '20'
scenario: '-1'
seed: '1'
states:
......
......@@ -4,7 +4,7 @@ import cdc
host = '127.0.0.1'
port = 9000
shared_mode = True
share_mode = True
mtu = 1500
iface = cdc.dsa_database(host, port, share_mode, mtu)
......
......@@ -234,9 +234,9 @@ dsa_database::request_handler(std::shared_ptr<tcp::socket> sock,
}
else if (req == dsa::REQUEST_GET_MODE)
{
int mode = htonl(d_pu_mode);
memcpy(buf.data(), &mode, 4);
boost::asio::write(*sock, boost::asio::buffer(buf.data(), 4));
int mode = htonl(get_pu_mode());
memcpy(buf.data(), &mode, sizeof(int));
boost::asio::write(*sock, boost::asio::buffer(buf.data(), sizeof(int)));
}
else if (req == dsa::REQUEST_PUT_MODE)
{
......@@ -245,7 +245,7 @@ dsa_database::request_handler(std::shared_ptr<tcp::socket> sock,
int mode;
memcpy(&mode, buf.data(), sizeof(int));
d_pu_mode = ntohl(mode);
set_pu_mode(ntohl(mode));
}
else if (req == dsa::REQUEST_RESET_KPI)
{
......
......@@ -97,7 +97,8 @@ dsa_pu_scenario_impl::update_scenario(int n_chan)
if (d_random && d_pkt_cnt <= 0)
{
d_scenario = (*d_uniform)(d_engine);
//message_port_pub(pmt::mp("cmd"), pmt::cons(pmt::mp("put_mode"), pmt::mp(d_scenario)));
//message_port_pub(pmt::mp("cmd"),
// pmt::cons(pmt::mp("put_mode"), pmt::mp(d_scenario)));
d_pkt_cnt = d_num_packets;
}
......@@ -134,7 +135,7 @@ dsa_pu_scenario_impl::work(int noutput_items,
}
else // inactive channel
{
memset(out, 0x00, d_pkt_len * sizeof(gr_complex));
memset(out, 0, d_pkt_len * sizeof(gr_complex));
}
}
n_out = d_pkt_len;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment