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 3, 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.
22 #ifndef INCLUDED_GMAC_H
23 #define INCLUDED_GMAC_H
25 #include <mb_mblock.h>
29 class gmac : public mb_mblock
32 // The state is used to determine how to handle incoming messages and of
33 // course, the state of the MAC protocol.
45 // Ports used for applications to connect to this block
46 mb_port_sptr d_tx, d_rx, d_cs;
48 // Ports to connect to usrp_server (us)
49 mb_port_sptr d_us_tx, d_us_rx, d_us_cs;
51 // The channel numbers assigned for use
52 pmt_t d_us_rx_chan, d_us_tx_chan;
66 gmac(mb_runtime *rt, const std::string &instance_name, pmt_t user_arg);
68 void handle_message(mb_message_sptr msg);
72 void initialize_usrp();
73 void initialize_gmac();
74 void set_carrier_sense(bool toggle, long threshold, long deadline, pmt_t invocation);
75 void allocate_channels();
76 void enter_receiving();
78 void close_channels();
81 void handle_cmd_tx_pkt(pmt_t data);
82 void handle_response_xmit_raw_frame(pmt_t data);
83 bool carrier_sense_pkt(pmt_t pkt_properties);
84 void handle_cmd_carrier_sense_enable(pmt_t data);
85 void handle_cmd_carrier_sense_threshold(pmt_t data);
86 void handle_cmd_carrier_sense_disable(pmt_t data);
87 void handle_cmd_carrier_sense_deadline(pmt_t data);
91 #endif // INCLUDED_GMAC_H