3 * Copyright 2007 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef INCLUDED_USRP_SERVER_H
22 #define INCLUDED_USRP_SERVER_H
24 #include <mb_mblock.h>
28 * \brief Implements the lowest-level mblock interface to the USRP
30 class usrp_server : public mb_mblock
35 RQSTD_CAPACITY_UNAVAIL = 0,
46 static const int N_PORTS = 4;
47 std::vector<mb_port_sptr> d_tx, d_rx;
50 static const int D_USB_CAPACITY = 32 * 1024 * 1024;
51 static const int D_MAX_CHANNELS = 16;
56 long assigned_capacity; // the capacity currently assignedby the channel
57 pmt_t owner; // port ID of the owner of the channel
60 struct channel_info d_chaninfo_tx[D_MAX_CHANNELS];
61 struct channel_info d_chaninfo_rx[D_MAX_CHANNELS];
64 usrp_server(mb_runtime *rt, const std::string &instance_name, pmt_t user_arg);
67 void initial_transition();
68 void handle_message(mb_message_sptr msg);
71 static int max_capacity() { return D_USB_CAPACITY; }
74 void handle_cmd_allocate_channel(pmt_t port_id, pmt_t data);
75 void handle_cmd_deallocate_channel(pmt_t port_id, pmt_t data);
76 void handle_cmd_xmit_raw_frame(pmt_t data);
77 int rx_port_index(pmt_t port_id);
78 int tx_port_index(pmt_t port_id);
79 long current_capacity_allocation();
82 #endif /* INCLUDED_USRP_SERVER_H */