Imported Upstream version 3.2.2
[debian/gnuradio] / usrp2 / firmware / apps / app_common_v2.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2007,2008 Free Software Foundation, Inc.
4  *
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.
9  *
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.
14  *
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/>.
17  */
18
19 #ifndef INCLUDED_APP_COMMON_H
20 #define INCLUDED_APP_COMMON_H
21
22 #include "bool.h"
23 #include "usrp2_eth_packet.h"
24 #include "dbsm.h"
25 #include "memory_map.h"
26 #include "hal_io.h"
27 #include <stddef.h>
28 #include <db.h>
29
30 #define CPU_TX_BUF      7       // cpu -> eth
31
32 #define _AL4 __attribute__((aligned (4)))
33
34 extern volatile bool link_is_up;        // eth handler sets this
35
36 // If there's a dbsm that sends to the ethernet, put it's address here
37 extern dbsm_t *ac_could_be_sending_to_eth;
38
39 extern int cpu_tx_buf_dest_port;
40
41 void set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt);
42
43 /*
44  * Called when an ethernet packet is received.
45  * Return true if we handled it here, otherwise
46  * it'll be passed on to the DSP Tx pipe
47  */
48 bool eth_pkt_inspector(dbsm_t *sm, int bufno);
49
50 void link_changed_callback(int speed);
51
52 void
53 print_tune_result(char *msg, bool tune_ok,
54                   u2_fxpt_freq_t target_freq, struct tune_result *r);
55
56
57 void start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p);
58 void stop_rx_cmd(void);
59 void restart_streaming(void);
60 bool is_streaming(void);
61
62 void handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len);
63
64 #endif /* INCLUDED_APP_COMMON_H */