aboutsummaryrefslogtreecommitdiffstats
path: root/host/apps/omap_debug/usrp-e-uart.c
diff options
context:
space:
mode:
authorPhilip Balister <philip@opensdr.com>2010-03-26 15:22:12 +0000
committerPhilip Balister <philip@opensdr.com>2010-03-26 15:22:12 +0000
commit84df070f371b989ef51b6f2d04c131b34308e5e9 (patch)
tree33e1a5ab23504ac8d2f10ea27922aaa5b158e3a5 /host/apps/omap_debug/usrp-e-uart.c
parent717a6acd2b0687348c492cbf2e0813ffd63d847a (diff)
downloaduhd-84df070f371b989ef51b6f2d04c131b34308e5e9.tar.gz
uhd-84df070f371b989ef51b6f2d04c131b34308e5e9.tar.bz2
uhd-84df070f371b989ef51b6f2d04c131b34308e5e9.zip
Add test program to send characters to the wishbone uart.
Diffstat (limited to 'host/apps/omap_debug/usrp-e-uart.c')
-rw-r--r--host/apps/omap_debug/usrp-e-uart.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/host/apps/omap_debug/usrp-e-uart.c b/host/apps/omap_debug/usrp-e-uart.c
new file mode 100644
index 000000000..92f89f45c
--- /dev/null
+++ b/host/apps/omap_debug/usrp-e-uart.c
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/ioctl.h>
+
+#include "usrp_e.h"
+
+// Usage: usrp_e_uart <string>
+
+#define UART_WRITE_ADDR ((1<<6) + 16)
+
+int main(int argc, char *argv[])
+{
+ int fp, i, ret;
+ struct usrp_e_ctl16 d;
+ char *str = argv[1];
+
+ if (argc < 2) {
+ printf("Usage: usrp_e_uart <string>n");
+ exit(-1);
+ }
+
+ fp = open("/dev/usrp_e0", O_RDWR);
+ printf("fp = %d\n", fp);
+
+ for (i=0; i<strlen(str); i++) {
+ d.offset = UART_WRITE_ADDR;
+ d.count = 1;
+ d.buf[0] = str[i];
+ ret = ioctl(fp, USRP_E_WRITE_CTL16, &d);
+ printf("Wrote %X, to %X, ret = %d\n", d.buf[0], d.offset, ret);
+ }
+
+ return 0;
+}