3 * Copyright 2008,2009 Free Software Foundation, Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef INCLUDED_CONTROL_H
20 #define INCLUDED_CONTROL_H
22 #include <gnuradio/omnithread.h>
23 #include <usrp2_eth_packet.h>
27 struct op_generic_cmd {
34 * OP_CONFIG_RX_V2 command packet
36 struct op_config_rx_v2_cmd
43 struct op_start_rx_streaming_cmd
46 op_start_rx_streaming_t op;
50 struct op_sync_and_start_rx_streaming_cmd
54 op_start_rx_streaming_t rx_op;
58 struct op_stop_rx_cmd {
64 struct op_config_tx_v2_cmd
71 struct op_config_mimo_cmd
78 struct op_burn_mac_addr_cmd
81 op_burn_mac_addr_t op;
85 struct op_dboard_info_cmd {
100 // words to write go here
101 // eop must be dynamically written here
116 struct op_gpio_set_sels_cmd {
118 op_gpio_set_sels_t op;
123 * Control mechanism to allow API calls to block waiting for reply packets
132 // d_mutex is used with d_cond and also protects d_complete
134 omni_condition d_cond;
139 * Construct a pending reply from the reply ID, response packet
140 * buffer, and buffer length.
142 pending_reply(unsigned int rid, void *buffer, size_t len);
145 * Destructor. Signals creating thread.
150 * Block, waiting for reply packet.
151 * Returns: 1 = ok, reply packet in buffer
154 int wait_for_completion(double secs);
157 * Allows creating thread to resume after copying reply into buffer
159 void notify_completion();
162 * Retrieve pending reply ID
164 unsigned int rid() const { return d_rid; }
167 * Retrieve destination buffer address
169 void *buffer() const { return d_buffer; }
172 * Retrieve destination buffer length
174 size_t len() const { return d_len; }
179 #endif /* INCLUDED_CONTROL_H */