Imported Upstream version 3.0
[debian/gnuradio] / usrp / firmware / src / usrp2 / fpga_rev2.h
1 /* 
2  * USRP - Universal Software Radio Peripheral
3  *
4  * Copyright (C) 2003,2004 Free Software Foundation, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
19  */
20
21 #ifndef INCLUDED_FPGA_REV1_H
22 #define INCLUDED_FPGA_REV1_H
23
24 void fpga_set_reset (unsigned char v);
25 void fpga_set_tx_enable (unsigned char v);
26 void fpga_set_rx_enable (unsigned char v);
27 void fpga_set_tx_reset (unsigned char v);
28 void fpga_set_rx_reset (unsigned char v);
29
30 unsigned char fpga_has_room_for_packet (void);
31 unsigned char fpga_has_packet_avail (void);
32
33 #if (UC_BOARD_HAS_FPGA)
34 /*
35  * return TRUE iff FPGA internal fifo has room for 512 bytes.
36  */
37 #define fpga_has_room_for_packet()      (GPIFREADYSTAT & bmFPGA_HAS_SPACE)
38
39 /*
40  * return TRUE iff FPGA internal fifo has at least 512 bytes available.
41  */
42 #define fpga_has_packet_avail()         (GPIFREADYSTAT & bmFPGA_PKT_AVAIL)
43
44 #else   /* no FPGA on board.  fake it. */
45
46 #define fpga_has_room_for_packet()      TRUE
47 #define fpga_has_packet_avail()         TRUE
48
49 #endif
50
51 #define fpga_clear_flags()                              \
52         do {                                            \
53           USRP_PE |= bmPE_FPGA_CLR_STATUS;              \
54           USRP_PE &= ~bmPE_FPGA_CLR_STATUS;             \
55         } while (0)
56
57
58 #endif /* INCLUDED_FPGA_REV1_H */