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_stop_rx_cmd {
56 struct op_config_tx_v2_cmd
63 struct op_config_mimo_cmd
70 struct op_burn_mac_addr_cmd
73 op_burn_mac_addr_t op;
77 struct op_dboard_info_cmd {
92 // words to write go here
93 // eop must be dynamically written here
108 struct op_gpio_set_sels_cmd {
110 op_gpio_set_sels_t op;
115 * Control mechanism to allow API calls to block waiting for reply packets
124 // d_mutex is used with d_cond and also protects d_complete
126 omni_condition d_cond;
131 * Construct a pending reply from the reply ID, response packet
132 * buffer, and buffer length.
134 pending_reply(unsigned int rid, void *buffer, size_t len);
137 * Destructor. Signals creating thread.
142 * Block, waiting for reply packet.
143 * Returns: 1 = ok, reply packet in buffer
146 int wait_for_completion(double secs);
149 * Allows creating thread to resume after copying reply into buffer
151 void notify_completion();
154 * Retrieve pending reply ID
156 unsigned int rid() const { return d_rid; }
159 * Retrieve destination buffer address
161 void *buffer() const { return d_buffer; }
164 * Retrieve destination buffer length
166 size_t len() const { return d_len; }
171 #endif /* INCLUDED_CONTROL_H */