[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8312 - in usrp2/trunk/firmware: include lib
From: |
eb |
Subject: |
[Commit-gnuradio] r8312 - in usrp2/trunk/firmware: include lib |
Date: |
Wed, 7 May 2008 15:34:38 -0600 (MDT) |
Author: eb
Date: 2008-05-07 15:34:37 -0600 (Wed, 07 May 2008)
New Revision: 8312
Added:
usrp2/trunk/firmware/include/usrp2_types.h
usrp2/trunk/firmware/lib/db_base.h
usrp2/trunk/firmware/lib/db_rfx.c
Modified:
usrp2/trunk/firmware/lib/Makefile.am
usrp2/trunk/firmware/lib/stdint.h
Log:
work-in-progress on u2 d'board code
Added: usrp2/trunk/firmware/include/usrp2_types.h
===================================================================
--- usrp2/trunk/firmware/include/usrp2_types.h (rev 0)
+++ usrp2/trunk/firmware/include/usrp2_types.h 2008-05-07 21:34:37 UTC (rev
8312)
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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_TYPES_H
+#define INCLUDED_USRP2_TYPES_H
+
+#include <usrp2_cdefs.h>
+#include <stdint.h>
+
+__U2_BEGIN_DECLS
+
+/*!
+ * \brief Fixed point representation of a frequency in Hertz (VITA-49
compatible)
+ *
+ * 64-bit two's complement, with the radix point 20 bits up from the bottom.
+ * Q44.20 format (20 bits to the right of the radix point)
+ *
+ * Values range from +/- 8.79 terahertz with a resolution of 0.95 microhertz.
+ */
+typedef int64_t u2_fxpt_freq_t;
+
+// macro so we can init structs at compile time
+#define U2_DOUBLE_TO_FXPT_FREQ(f) (int64_t)((f) * (1 << 20))
+
+static inline u2_fxpt_freq_t
+u2_double_to_fxpt_freq(double f)
+{
+ return U2_DOUBLE_TO_FXPT_FREQ(f);
+}
+
+
+static inline double
+u2_fxpt_freq_to_double(u2_fxpt_freq_t fx)
+{
+ return ((double) fx) * 1.0/(1 << 20);
+}
+
+
+/*!
+ * \brief Fixed point representation of a gain in dB (VITA-49 compatible)
+ *
+ * 16-bit two's complement, with the radix point 7 bits up from the bottom.
+ * Q9.7 format (7 bits to the right of the radix point)
+ */
+typedef int16_t u2_fxpt_gain_t;
+
+// macro so we can init structs at compile time
+#define U2_DOUBLE_TO_FXPT_GAIN(g) (int16_t)((g) * (1 << 7))
+
+static inline u2_fxpt_gain_t
+u2_double_to_fxpt_gain(double g)
+{
+ return U2_DOUBLE_TO_FXPT_GAIN(g);
+}
+
+static inline float
+u2_fxpt_gain_to_double(u2_fxpt_gain_t fx)
+{
+ return ((double) fx) * 1.0/(1 << 7);
+}
+
+
+__U2_END_DECLS
+
+
+#endif /* INCLUDED_USRP2_TYPES_H */
Property changes on: usrp2/trunk/firmware/include/usrp2_types.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: usrp2/trunk/firmware/lib/Makefile.am
===================================================================
--- usrp2/trunk/firmware/lib/Makefile.am 2008-05-06 14:34:15 UTC (rev
8311)
+++ usrp2/trunk/firmware/lib/Makefile.am 2008-05-07 21:34:37 UTC (rev
8312)
@@ -24,6 +24,7 @@
ad9510.c \
ad9777.c \
buffer_pool.c \
+ db_rfx.c \
dbsm.c \
eeprom.c \
ethernet.c \
Added: usrp2/trunk/firmware/lib/db_base.h
===================================================================
--- usrp2/trunk/firmware/lib/db_base.h (rev 0)
+++ usrp2/trunk/firmware/lib/db_base.h 2008-05-07 21:34:37 UTC (rev 8312)
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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_DB_BASE_H
+#define INCLUDED_DB_BASE_H
+
+#include <usrp2_types.h>
+#include <bool.h>
+
+/*!
+ * \brief "base class" for firmware version of daughterboard code
+ */
+struct db_base {
+ uint16_t dbid; // daughterboard ID
+
+ u2_fxpt_freq_t freq_min; // min freq that can be set (Hz)
+ u2_fxpt_freq_t freq_max; // max freq that can be set (Hz)
+ u2_fxpt_freq_t freq_step_size; // (Hz)
+
+ u2_fxpt_gain_t gain_min; // min gain that can be set (dB)
+ u2_fxpt_gain_t gain_max; // max gain that can be set (dB)
+ u2_fxpt_gain_t gain_step_size; // (dB)
+
+ bool is_quadrature;
+ bool i_and_q_swapped;
+ bool spectrum_inverted;
+ u2_fxpt_freq_t lo_offset;
+
+ bool (*set_freq)(struct db_base *, u2_fxpt_freq_t freq);
+ bool (*set_gain)(struct db_base *, u2_fxpt_gain_t gain);
+ bool (*set_tx_enable)(struct db_base *, bool on);
+};
+
+#endif /* INCLUDED_DB_BASE_H */
Property changes on: usrp2/trunk/firmware/lib/db_base.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: usrp2/trunk/firmware/lib/db_rfx.c
===================================================================
--- usrp2/trunk/firmware/lib/db_rfx.c (rev 0)
+++ usrp2/trunk/firmware/lib/db_rfx.c 2008-05-07 21:34:37 UTC (rev 8312)
@@ -0,0 +1,113 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 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/>.
+ */
+
+#include <db_base.h>
+
+bool rfx_set_freq(struct db_base *db, u2_fxpt_freq_t freq);
+bool rfx_set_gain(struct db_base *db, u2_fxpt_gain_t gain);
+bool rfx_set_tx_enable(struct db_base *, bool on);
+
+struct db_rfx_common {
+
+ // RFX common stuff here (if any)
+
+};
+
+struct db_rfx_dummy {
+ struct db_base base;
+ struct db_rfx_common common;
+};
+
+
+struct db_rfx_400_rx {
+ struct db_base base;
+ struct db_rfx_common common;
+
+ // RFX 400 rx stuff goes here
+
+};
+
+
+struct db_rfx_400_tx {
+ struct db_base base;
+ struct db_rfx_common common;
+
+ // RFX 400 tx stuff goes here
+
+};
+
+
+/*
+ * The class instances
+ */
+struct db_rfx_400_rx rfx_400_rx = {
+ .base.dbid = 0x0004,
+ //.base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(xxx),
+ //.base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(xxx),
+ //.base.freq_step_size = U2_DOUBLE_TO_FXPT_FREQ(xxx),
+ //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+ //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+ //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+ .base.is_quadrature = true,
+ .base.i_and_q_swapped = false,
+ .base.spectrum_inverted = false,
+ .base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+};
+
+
+struct db_rfx_400_tx rfx_400_tx = {
+ .base.dbid = 0x0008,
+ //.base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(xxx),
+ //.base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(xxx),
+ //.base.freq_step_size = U2_DOUBLE_TO_FXPT_FREQ(xxx),
+ //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+ //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+ //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+ .base.is_quadrature = true,
+ .base.i_and_q_swapped = false,
+ .base.spectrum_inverted = false,
+ .base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+};
+
+
+
+bool
+rfx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq)
+{
+ struct rfx_dummy *db = (struct rfx_dummy *) dbb;
+
+ return false;
+}
+
+
+bool
+rfx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain)
+{
+ struct rfx_dummy *db = (struct rfx_dummy *) dbb;
+
+ return false;
+}
+
+
+bool
+rfx_set_tx_enable(struct db_base *dbb, bool on)
+{
+ struct rfx_dummy *db = (struct rfx_dummy *) dbb;
+
+ return false;
+}
Property changes on: usrp2/trunk/firmware/lib/db_rfx.c
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: usrp2/trunk/firmware/lib/stdint.h
===================================================================
--- usrp2/trunk/firmware/lib/stdint.h 2008-05-06 14:34:15 UTC (rev 8311)
+++ usrp2/trunk/firmware/lib/stdint.h 2008-05-07 21:34:37 UTC (rev 8312)
@@ -25,6 +25,8 @@
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
typedef int intptr_t;
typedef unsigned int uintptr_t;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8312 - in usrp2/trunk/firmware: include lib,
eb <=