From 84df070f371b989ef51b6f2d04c131b34308e5e9 Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Fri, 26 Mar 2010 15:22:12 +0000 Subject: Add test program to send characters to the wishbone uart. --- host/apps/omap_debug/usrp-e-uart.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 host/apps/omap_debug/usrp-e-uart.c (limited to 'host/apps/omap_debug/usrp-e-uart.c') 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 +#include +#include +#include +#include +#include + +#include "usrp_e.h" + +// Usage: usrp_e_uart + +#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 n"); + exit(-1); + } + + fp = open("/dev/usrp_e0", O_RDWR); + printf("fp = %d\n", fp); + + for (i=0; i Date: Fri, 26 Mar 2010 19:04:18 +0000 Subject: Working version. --- host/apps/omap_debug/usrp-e-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/apps/omap_debug/usrp-e-uart.c') diff --git a/host/apps/omap_debug/usrp-e-uart.c b/host/apps/omap_debug/usrp-e-uart.c index 92f89f45c..239df9444 100644 --- a/host/apps/omap_debug/usrp-e-uart.c +++ b/host/apps/omap_debug/usrp-e-uart.c @@ -9,7 +9,7 @@ // Usage: usrp_e_uart -#define UART_WRITE_ADDR ((1<<6) + 16) +#define UART_WRITE_ADDR (0x80 + 12) int main(int argc, char *argv[]) { -- cgit v1.2.3 From d4e9f3629021736b1330b4a9f22ee60336a53e0e Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Fri, 2 Apr 2010 21:58:55 +0000 Subject: Update to use register definitions from header file. --- host/apps/omap_debug/usrp-e-button.c | 2 +- host/apps/omap_debug/usrp-e-led.c | 2 +- host/apps/omap_debug/usrp-e-uart.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'host/apps/omap_debug/usrp-e-uart.c') diff --git a/host/apps/omap_debug/usrp-e-button.c b/host/apps/omap_debug/usrp-e-button.c index fca501833..f13291491 100644 --- a/host/apps/omap_debug/usrp-e-button.c +++ b/host/apps/omap_debug/usrp-e-button.c @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) fp = open("/dev/usrp_e0", O_RDWR); printf("fp = %d\n", fp); - d.offset = 6; + d.offset = UE_REG_MISC_SW; d.count = 1; do { diff --git a/host/apps/omap_debug/usrp-e-led.c b/host/apps/omap_debug/usrp-e-led.c index 159251c8a..d1b6c8996 100644 --- a/host/apps/omap_debug/usrp-e-led.c +++ b/host/apps/omap_debug/usrp-e-led.c @@ -20,7 +20,7 @@ int main(int argc, char *argv[]) fp = open("/dev/usrp_e0", O_RDWR); printf("fp = %d\n", fp); - d.offset = 4; + d.offset = UE_REG_MISC_BASE; d.count = 1; while (1) { diff --git a/host/apps/omap_debug/usrp-e-uart.c b/host/apps/omap_debug/usrp-e-uart.c index 239df9444..b0b14626a 100644 --- a/host/apps/omap_debug/usrp-e-uart.c +++ b/host/apps/omap_debug/usrp-e-uart.c @@ -6,10 +6,10 @@ #include #include "usrp_e.h" +#include "usrp_e_regs.hpp" // Usage: usrp_e_uart -#define UART_WRITE_ADDR (0x80 + 12) int main(int argc, char *argv[]) { @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) printf("fp = %d\n", fp); for (i=0; i Date: Sat, 3 Apr 2010 14:55:16 +0000 Subject: Add ability to change uart baud rate. (works) --- host/apps/omap_debug/usrp-e-uart.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'host/apps/omap_debug/usrp-e-uart.c') diff --git a/host/apps/omap_debug/usrp-e-uart.c b/host/apps/omap_debug/usrp-e-uart.c index b0b14626a..2956c407f 100644 --- a/host/apps/omap_debug/usrp-e-uart.c +++ b/host/apps/omap_debug/usrp-e-uart.c @@ -16,15 +16,26 @@ int main(int argc, char *argv[]) int fp, i, ret; struct usrp_e_ctl16 d; char *str = argv[1]; + __u16 clkdiv; if (argc < 2) { - printf("Usage: usrp_e_uart n"); + printf("Usage: usrp_e_uart \n"); + printf("clkdiv = 278 is 230.4k \n"); + printf("clkdiv = 556 is 115.2k \n"); exit(-1); } fp = open("/dev/usrp_e0", O_RDWR); printf("fp = %d\n", fp); + if (argc == 3) { + clkdiv = atoi(argv[2]); + d.offset = UE_REG_UART_CLKDIV; + d.count = 1; + d.buf[0] = clkdiv; + ret = ioctl(fp, USRP_E_WRITE_CTL16, &d); + } + for (i=0; i