aboutsummaryrefslogtreecommitdiffstats
path: root/host/apps/omap_debug/usrp1-e-spi.c
diff options
context:
space:
mode:
authorroot <root@usrp1-e.(none)>2010-03-23 13:38:46 +0000
committerroot <root@usrp1-e.(none)>2010-03-23 13:38:46 +0000
commit3137e2ca001176c4ffc12e091530fe23c82974b6 (patch)
tree418b1d2cecb2a8ccb0fad89140e13a9d44851196 /host/apps/omap_debug/usrp1-e-spi.c
parentc329da8f953c3981e23791c688f350b27541554a (diff)
downloaduhd-3137e2ca001176c4ffc12e091530fe23c82974b6.tar.gz
uhd-3137e2ca001176c4ffc12e091530fe23c82974b6.tar.bz2
uhd-3137e2ca001176c4ffc12e091530fe23c82974b6.zip
Commit random test code.
Unfiltered commit of test code I am accumlating on my ewewoneee. Most of this should go away before release.
Diffstat (limited to 'host/apps/omap_debug/usrp1-e-spi.c')
-rw-r--r--host/apps/omap_debug/usrp1-e-spi.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/host/apps/omap_debug/usrp1-e-spi.c b/host/apps/omap_debug/usrp1-e-spi.c
new file mode 100644
index 000000000..a79d74b18
--- /dev/null
+++ b/host/apps/omap_debug/usrp1-e-spi.c
@@ -0,0 +1,40 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <linux/ioctl.h>
+
+#include "usrp1_e.h"
+
+// Usage: usrp1_e_spi w|rb slave data
+
+int main(int argc, char *argv[])
+{
+ int fp, slave, data, ret;
+ struct usrp_e_spi spi_dat;
+
+ if (argc < 4) {
+ printf("Usage: usrp1_e_spi w|rb slave data\n");
+ exit(-1);
+ }
+
+ slave = atoi(argv[2]);
+ data = atoi(argv[3]);
+
+ fp = open("/dev/usrp1_e0", O_RDWR);
+ printf("fp = %d\n", fp);
+
+ spi_dat.slave = slave;
+ spi_dat.data = data;
+ spi_dat.length = 2;
+ spi_dat.flags = 0;
+
+ if (*argv[1] == 'r') {
+ spi_dat.readback = 1;
+ ret = ioctl(fp, USRP_E_SPI, &spi_dat);
+ printf("Data returned = %d\n", ret);
+ } else {
+ spi_dat.readback = 0;
+ ioctl(fp, USRP_E_SPI, &spi_dat);
+ }
+}