jtag

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 7f2bdfd0d2565d179bc373474b8fe5ee84bee876
parent bb321970a561074141ef5dc59bdb7a8756e212bc
Author: Brian Swetland <swetland@frotz.net>
Date:   Fri,  2 Mar 2012 22:06:59 -0800

jconsole: simple rx-only uart transport

Diffstat:
MMakefile | 9+++++++--
Ajconsole.c | 34++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -2,10 +2,11 @@ CFLAGS := -g -Wall LIBS := -lusb-1.0 -all: jload jinfo +all: jload jinfo jconsole jinfo.c: jtag.h jload.c: jtag.h +jconsole.c: jtag.h jtag.c: jtag.h jtag-virtual.c: jtag.h @@ -17,5 +18,9 @@ JINFO_OBJS := jinfo.o jtag-virtual.o jtag.o jinfo: $(JINFO_OBJS) $(CC) -o jinfo $(JINFO_OBJS) $(LIBS) +JCONSOLE_OBJS := jconsole.o jtag-virtual.o jtag.o +jconsole: $(JCONSOLE_OBJS) + $(CC) -o jconsole $(JCONSOLE_OBJS) $(LIBS) + clean:: - rm -f jload jinfo *.o + rm -f jload jinfo jconsole *.o diff --git a/jconsole.c b/jconsole.c @@ -0,0 +1,34 @@ +// Copyright 2012, Brian Swetland + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include "jtag.h" + +#define VIR_CTRL 0x0 +#define VIR_ADDR 0x1 +#define VIR_DATA 0x2 +#define VIR_UART 0x3 + +int main(int argc, char **argv) { + unsigned bits; + + if (jtag_open_virtual_device(0x00)) + return -1; + + jtag_vir(VIR_UART); + + for (;;) { + jtag_vdr(9, 0, &bits); + if (bits & 0x100) { + bits &= 0xFF; + if ((bits < ' ') || (bits > 127)) + fputc('.', stderr); + else + fputc(bits, stderr); + } + } + + return 0; +} +