[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7124 - in usrp2/trunk/firmware: . apps include lib
From: |
eb |
Subject: |
[Commit-gnuradio] r7124 - in usrp2/trunk/firmware: . apps include lib |
Date: |
Wed, 12 Dec 2007 01:33:34 -0700 (MST) |
Author: eb
Date: 2007-12-12 01:33:33 -0700 (Wed, 12 Dec 2007)
New Revision: 7124
Added:
usrp2/trunk/firmware/include/
usrp2/trunk/firmware/include/usrp2_cdefs.h
usrp2/trunk/firmware/include/usrp2_eth_packet.h
usrp2/trunk/firmware/include/usrp2_fpga_regs.h
usrp2/trunk/firmware/include/usrp2_i2c_addr.h
Removed:
usrp2/trunk/firmware/lib/u2_eth_packet.h
usrp2/trunk/firmware/lib/u2_fpga_regs.h
usrp2/trunk/firmware/lib/usrp2_i2c_addr.h
Modified:
usrp2/trunk/firmware/Makefile.common
usrp2/trunk/firmware/apps/gen_eth_packets.c
usrp2/trunk/firmware/apps/rcv_eth_packets.c
usrp2/trunk/firmware/apps/rx_only.c
usrp2/trunk/firmware/apps/test_serdes.c
Log:
Relocated .h files that are likely to be shared between the host + firmware
Modified: usrp2/trunk/firmware/Makefile.common
===================================================================
--- usrp2/trunk/firmware/Makefile.common 2007-12-12 07:26:41 UTC (rev
7123)
+++ usrp2/trunk/firmware/Makefile.common 2007-12-12 08:33:33 UTC (rev
7124)
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-STD_INCLUDES = -I$(top_srcdir)/lib
+STD_INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib
#HAL_IO = -DHAL_IO_USES_DBOARD_PINS
HAL_IO = -DHAL_IO_USES_UART
Modified: usrp2/trunk/firmware/apps/gen_eth_packets.c
===================================================================
--- usrp2/trunk/firmware/apps/gen_eth_packets.c 2007-12-12 07:26:41 UTC (rev
7123)
+++ usrp2/trunk/firmware/apps/gen_eth_packets.c 2007-12-12 08:33:33 UTC (rev
7124)
@@ -25,7 +25,7 @@
#include "eth_driver.h"
#include "eth_mac.h"
#include "nonstdio.h"
-#include "u2_eth_packet.h"
+#include "usrp2_eth_packet.h"
#include "memcpy_wa.h"
#include <stddef.h>
#include <stdlib.h>
Modified: usrp2/trunk/firmware/apps/rcv_eth_packets.c
===================================================================
--- usrp2/trunk/firmware/apps/rcv_eth_packets.c 2007-12-12 07:26:41 UTC (rev
7123)
+++ usrp2/trunk/firmware/apps/rcv_eth_packets.c 2007-12-12 08:33:33 UTC (rev
7124)
@@ -25,7 +25,7 @@
#include "eth_driver.h"
#include "eth_mac.h"
#include "nonstdio.h"
-#include "u2_eth_packet.h"
+#include "usrp2_eth_packet.h"
#include "memcpy_wa.h"
#include <stddef.h>
#include <stdlib.h>
Modified: usrp2/trunk/firmware/apps/rx_only.c
===================================================================
--- usrp2/trunk/firmware/apps/rx_only.c 2007-12-12 07:26:41 UTC (rev 7123)
+++ usrp2/trunk/firmware/apps/rx_only.c 2007-12-12 08:33:33 UTC (rev 7124)
@@ -25,7 +25,7 @@
#include "eth_driver.h"
#include "eth_mac.h"
#include "nonstdio.h"
-#include "u2_eth_packet.h"
+#include "usrp2_eth_packet.h"
#include "memcpy_wa.h"
#include <stddef.h>
#include <stdlib.h>
Modified: usrp2/trunk/firmware/apps/test_serdes.c
===================================================================
--- usrp2/trunk/firmware/apps/test_serdes.c 2007-12-12 07:26:41 UTC (rev
7123)
+++ usrp2/trunk/firmware/apps/test_serdes.c 2007-12-12 08:33:33 UTC (rev
7124)
@@ -25,7 +25,7 @@
#include "eth_driver.h"
#include "eth_mac.h"
#include "nonstdio.h"
-#include "u2_eth_packet.h"
+#include "usrp2_eth_packet.h"
#include "memcpy_wa.h"
#include <stddef.h>
#include <stdlib.h>
Added: usrp2/trunk/firmware/include/usrp2_cdefs.h
===================================================================
--- usrp2/trunk/firmware/include/usrp2_cdefs.h (rev 0)
+++ usrp2/trunk/firmware/include/usrp2_cdefs.h 2007-12-12 08:33:33 UTC (rev
7124)
@@ -0,0 +1,34 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_USRP2_CDEFS_H
+#define INCLUDED_USRP2_CDEFS_H
+
+/* C++ needs to know that types and declarations are C, not C++. */
+#ifdef __cplusplus
+# define __U2_BEGIN_DECLS extern "C" {
+# define __U2_END_DECLS }
+#else
+# define __U2_BEGIN_DECLS
+# define __U2_END_DECLS
+#endif
+
+#endif /* INCLUDED_USRP2_CDEFS_H */
Property changes on: usrp2/trunk/firmware/include/usrp2_cdefs.h
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: usrp2/trunk/firmware/include/usrp2_eth_packet.h (from rev 7123,
usrp2/trunk/firmware/lib/u2_eth_packet.h)
===================================================================
--- usrp2/trunk/firmware/include/usrp2_eth_packet.h
(rev 0)
+++ usrp2/trunk/firmware/include/usrp2_eth_packet.h 2007-12-12 08:33:33 UTC
(rev 7124)
@@ -0,0 +1,173 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INCLUDED_USRP2_ETH_PACKET_H
+#define INCLUDED_USRP2_ETH_PACKET_H
+
+#include "usrp2_cdefs.h"
+#include <stdint.h>
+
+__U2_BEGIN_DECLS
+
+#define U2_ETHERTYPE 0xBEEF // used in our frames
+#define MAC_CTRL_ETHERTYPE 0x8808 // used in PAUSE frames
+
+/*
+ * All these data structures are BIG-ENDIAN on the wire
+ */
+
+/* The classic 14-byte ethernet header */
+
+typedef struct {
+ uint8_t dst_addr[6];
+ uint8_t src_addr[6];
+ uint16_t ethertype;
+} u2_eth_hdr_t;
+
+/*
+ * The classic ethernet header + 2 bytes of pad so that our payload
+ * (at least inside the U2) is 32-bit aligned. (The buffer memory
+ * in the U2 is only word addressable...)
+ */
+typedef struct {
+ uint8_t dst_addr[6];
+ uint8_t src_addr[6];
+ uint16_t ethertype;
+ uint16_t _pad; // MBZ. force 32-bit alignment for payload
+} u2_eth_hdr_with_pad_t;
+
+
+/*
+ * The fixed header of a USRP2 ethernet packet...
+ *
+ * Basically there's 1 word of flags and routing info, and 1 word
+ * of timestamp that specifies when the data was received, or
+ * when it should be transmitted. The data samples follow immediately.
+ *
+ * Transmit packets (from host to U2)
+ *
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Chan | mbz |I|S|E|
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Timestamp |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ *
+ * Received packets (from U2 to host)
+ *
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Chan | mbz |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Timestamp |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
+typedef struct {
+ uint32_t word0; // flags etc
+ uint32_t timestamp; // time of rx or tx (100 MHz)
+ uint32_t payload[]; // samples, typically ((I << 16) | Q)
+} u2_eth_fixed_hdr_t;
+
+
+#define U2P_CHAN_MASK 0x1f
+#define U2P_CHAN_SHIFT 27
+
+#define U2P_TX_IMMEDIATE 0x00000004 // send samples NOW, else at
timestamp
+#define U2P_TX_START_OF_BURST 0x00000002 // this frame is the start of a
burst
+#define U2P_TX_END_OF_BURST 0x00000001 // this frame is the end of
a burst
+
+#define U2P_ALL_FLAGS 0x00000007
+
+#define CONTROL_CHAN 0x1f
+
+static inline int
+u2p_chan(u2_eth_fixed_hdr_t *p)
+{
+ return (p->word0 >> U2P_CHAN_SHIFT) & U2P_CHAN_MASK;
+}
+
+inline static void
+u2p_set_word0(u2_eth_fixed_hdr_t *p, int flags, int chan)
+{
+ p->word0 = ((flags & U2P_ALL_FLAGS)
+ | ((chan & U2P_CHAN_MASK) << U2P_CHAN_SHIFT));
+}
+
+/*
+ * consolidated packet: ethernet header + pad + payload
+ */
+typedef struct {
+ u2_eth_hdr_with_pad_t ehdr;
+ u2_eth_fixed_hdr_t fixed;
+} u2_eth_packet_t;
+
+/*
+ * Opcodes for control channel
+ */
+#define OP_ID 0
+#define OP_ID_REPLY 1
+#define OP_PING_FIXED 2
+#define OP_PING_FIXED_REPLY 3
+#define OP_START_RX 4
+#define OP_STOP_RX 5
+#define OP_WRITE_REG 6
+#define OP_WRITE_REG_MASKED 7
+#define OP_READ_REG 8
+#define OP_READ_REG_REPLY 9
+
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint16_t rid_mbz;
+} op_id_t;
+
+
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint16_t rid_mbz;
+ uint8_t mac_addr[6];
+ uint16_t hw_rev;
+ uint8_t serial_no[8];
+ uint8_t fpga_md5sum[16];
+ uint8_t sw_md5sum[16];
+} op_id_reply_t;
+
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint16_t mbz;
+} op_start_rx_t;
+
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint16_t mbz;
+} op_stop_rx_t;
+
+
+typedef union {
+ op_id_t op_id;
+ op_id_reply_t op_id_reply;
+ op_start_rx_t op_start_rx;
+ op_stop_rx_t op_stop_rx;
+} u2_subpkt_t;
+
+__U2_END_DECLS
+
+#endif /* INCLUDED_USRP2_ETH_PACKET_H */
Copied: usrp2/trunk/firmware/include/usrp2_fpga_regs.h (from rev 7122,
usrp2/trunk/firmware/lib/u2_fpga_regs.h)
===================================================================
--- usrp2/trunk/firmware/include/usrp2_fpga_regs.h
(rev 0)
+++ usrp2/trunk/firmware/include/usrp2_fpga_regs.h 2007-12-12 08:33:33 UTC
(rev 7124)
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INCLUDED_USRP2_FPGA_REGS_H
+#define INCLUDED_USSRP2_FPGA_REGS_H
+
+#include "usrp2_cdefs.h"
+
+__U2_BEGIN_DECLS
+
+// ----------------------------------------------------------------
+
+#define DSP_CORE_TX_BASE 128
+
+// DUC center frequency tuning word (phase increment)
+#define FR_TX_FREQ_0 (0 + DSP_CORE_TX_BASE)
+
+// I & Q output scaling, 16.0 format ((I_SCALE << 16) | Q_SCALE)
+#define FR_TX_SCALE_0 (1 + DSP_CORE_TX_BASE)
+
+// Tx interpolation rate (set to 1 less than desired rate)
+#define FR_TX_INTERP_RATE_0 (2 + DSP_CORE_TX_BASE)
+
+// Write 1 (actually anything) to clear tx state
+#define FR_TX_CLEAR_STATE_0 (3 + DSP_CORE_TX_BASE)
+
+// ----------------------------------------------------------------
+
+#define DSP_CORE_RX_BASE 160
+
+// DDC center frequency tuning word (phase increment)
+#define FR_RX_FREQ_0 (0 + DSP_CORE_RX_BASE)
+
+// I & Q input scaling, 16.0 format ((I_SCALE << 16) | Q_SCALE)
+#define FR_RX_SCALE_0 (1 + DSP_CORE_RX_BASE)
+
+// Rx decimation rate (set to 1 less than desired rate)
+#define FR_RX_DECIM_RATE_0 (2 + DSP_CORE_RX_BASE)
+
+// The next two registers concatenated are the Rx command register.
+//
+// Writing FR_RX_TIME_TO_RX_0 writes the concatenated value into the
+// cmd queue. Thus, if you're writing both, be sure to write
+// FR_RX_QTY_0 first.
+//
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | Timestamp |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+#define FR_RX_TIME_TO_RX (3 + DSP_CORE_RX_BASE)
+
+// 23-bits 9-bits
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+// | number_of_lines | lines_per_frame |
+// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+#define FR_RX_QTY_0 (4 + DSP_CORE_RX_BASE)
+
+// write a 1 (anything actually) to clear the overrun
+#define FR_RX_CLR_OVERRUN_0 (5 + DSP_CORE_RX_BASE)
+
+
+__U2_END_DECLS
+
+#endif /* INCLUDED_USRP2_FPGA_REGS_H */
Copied: usrp2/trunk/firmware/include/usrp2_i2c_addr.h (from rev 7122,
usrp2/trunk/firmware/lib/usrp2_i2c_addr.h)
===================================================================
--- usrp2/trunk/firmware/include/usrp2_i2c_addr.h
(rev 0)
+++ usrp2/trunk/firmware/include/usrp2_i2c_addr.h 2007-12-12 08:33:33 UTC
(rev 7124)
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2007 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef INCLUDED_USRP2_I2C_ADDR_H
+#define INCLUDED_USRP2_I2C_ADDR_H
+
+#include "usrp2_cdefs.h"
+
+__U2_BEGIN_DECLS
+
+// I2C addresses
+
+#define I2C_DEV_EEPROM 0x50 // 24LC02[45]: 7-bits 1010xxx
+
+#define I2C_ADDR_BOOT (I2C_DEV_EEPROM | 0x0)
+#define I2C_ADDR_TX_A (I2C_DEV_EEPROM | 0x4)
+#define I2C_ADDR_RX_A (I2C_DEV_EEPROM | 0x5)
+
+// FIXME the BOOT EEPROM is not yet defined for the U2
+
+// format of FX2 BOOT EEPROM
+// 00: 0xC0 code for ``Read IDs from EEPROM''
+// 01: 0xFE USB Vendor ID (LSB)
+// 02: 0xFF USB Vendor ID (MSB)
+// 03: 0x02 USB Product ID (LSB)
+// 04: 0x00 USB Product ID (MSB)
+// 05: 0x01 USB Device ID (LSB) // rev1
+// 06: 0x00 USB Device ID (MSB) // 0 = unconfig'd (no firmware)
+// 07: 0x00 option byte
+
+
+// format of daughterboard EEPROM
+// 00: 0xDB code for ``I'm a daughterboard''
+// 01: .. Daughterboard ID (LSB)
+// 02: .. Daughterboard ID (MSB)
+// 03: .. io bits 7-0 direction (bit set if it's an output from
m'board)
+// 04: .. io bits 15-8 direction (bit set if it's an output from
m'board)
+// 05: .. ADC0 DC offset correction (LSB)
+// 06: .. ADC0 DC offset correction (MSB)
+// 07: .. ADC1 DC offset correction (LSB)
+// 08: .. ADC1 DC offset correction (MSB)
+// ...
+// 1f: .. negative of the sum of bytes [0x00, 0x1e]
+
+#define DB_EEPROM_MAGIC 0x00
+#define DB_EEPROM_MAGIC_VALUE 0xDB
+#define DB_EEPROM_ID_LSB 0x01
+#define DB_EEPROM_ID_MSB 0x02
+#define DB_EEPROM_OE_LSB 0x03
+#define DB_EEPROM_OE_MSB 0x04
+#define DB_EEPROM_OFFSET_0_LSB 0x05 // offset correction
for ADC or DAC 0
+#define DB_EEPROM_OFFSET_0_MSB 0x06
+#define DB_EEPROM_OFFSET_1_LSB 0x07 // offset correction
for ADC or DAC 1
+#define DB_EEPROM_OFFSET_1_MSB 0x08
+#define DB_EEPROM_CHKSUM 0x1f
+
+#define DB_EEPROM_CLEN 0x20 // length of common
portion of eeprom
+
+#define DB_EEPROM_CUSTOM_BASE DB_EEPROM_CLEN // first avail
offset for
+ // daughterboard
specific use
+__U2_END_DECLS
+
+#endif /* INCLUDED_USRP2_I2C_ADDR_H */
+
Deleted: usrp2/trunk/firmware/lib/u2_eth_packet.h
Deleted: usrp2/trunk/firmware/lib/u2_fpga_regs.h
Deleted: usrp2/trunk/firmware/lib/usrp2_i2c_addr.h
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7124 - in usrp2/trunk/firmware: . apps include lib,
eb <=