aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/fx3/b200/b200_ad9361.c
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2014-04-07 14:58:25 -0700
committerBen Hilburn <ben.hilburn@ettus.com>2014-04-07 14:58:25 -0700
commit642f3fb5823f292ae29cc38c8897327dfbdc3c15 (patch)
tree3211fe57cbd3d7ee15069dc741f4a65a59b2bb00 /firmware/fx3/b200/b200_ad9361.c
parent937eae5f4831e16993a2f51e9c8e548fd74a3f13 (diff)
downloaduhd-642f3fb5823f292ae29cc38c8897327dfbdc3c15.tar.gz
uhd-642f3fb5823f292ae29cc38c8897327dfbdc3c15.tar.bz2
uhd-642f3fb5823f292ae29cc38c8897327dfbdc3c15.zip
b2xx: Pulling FX3 and AD9361 source code into master.
Diffstat (limited to 'firmware/fx3/b200/b200_ad9361.c')
-rw-r--r--firmware/fx3/b200/b200_ad9361.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/firmware/fx3/b200/b200_ad9361.c b/firmware/fx3/b200/b200_ad9361.c
new file mode 100644
index 000000000..ebb0dda70
--- /dev/null
+++ b/firmware/fx3/b200/b200_ad9361.c
@@ -0,0 +1,57 @@
+//
+// Copyright 2013-2014 Ettus Research LLC
+//
+
+#include "cyu3error.h"
+#include "cyu3i2c.h"
+#include "cyu3spi.h"
+#include "cyu3os.h"
+#include "cyu3pib.h"
+#include "cyu3system.h"
+#include "cyu3usb.h"
+#include "cyu3utils.h"
+#include "pib_regs.h"
+#include "b200_vrq.h"
+#include <stdint.h>
+
+#define true CyTrue
+#define false CyFalse
+
+typedef CyBool_t bool;
+
+/* Fast sqrt() - precision can be improved by increasing
+ * the number of iterations
+ */
+float ad9361_sqrt(const float number)
+{
+ uint32_t i;
+ float x2, y;
+
+ x2 = number * 0.5F;
+ y = number;
+ i = *(uint32_t *) &y;
+ i = 0x5f3759df - ( i >> 1 );
+ y = *(float *) &i;
+ y = y * (1.5F - (x2 * y * y));
+
+ return number * y;
+}
+
+void ad9361_msleep(const unsigned millis)
+{
+ CyU3PThreadSleep(millis);
+}
+
+#define AD9361_MIN(a, b) CY_U3P_MIN(a, b)
+#define AD9361_MAX(a, b) CY_U3P_MAX(a, b)
+
+#define AD9361_CEIL_INT(a) ((int)(a+1))
+#define AD9361_FLOOR_INT(a) ((int)(a))
+
+#define AD9361_CLOCKING_MODE 0
+
+#define AD9361_RX_BAND_EDGE0 2.2e9
+#define AD9361_RX_BAND_EDGE1 4e9
+#define AD9361_TX_BAND_EDGE 2.5e9
+
+#include "../ad9361/lib/ad9361_impl.c"