jconsole.c (1095B)
1 /* Copyright 2012 Brian Swetland <swetland@frotz.net> 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <stdio.h> 17 #include <stdlib.h> 18 #include <ctype.h> 19 #include "jtag.h" 20 21 #define VIR_CTRL 0x0 22 #define VIR_ADDR 0x1 23 #define VIR_DATA 0x2 24 #define VIR_UART 0x3 25 26 int main(int argc, char **argv) { 27 unsigned bits; 28 29 if (jtag_open_virtual_device(0x00)) 30 return -1; 31 32 jtag_vir(VIR_UART); 33 34 for (;;) { 35 jtag_vdr(9, 0, &bits); 36 if (bits & 0x100) { 37 bits &= 0xFF; 38 if ((bits < ' ') || (bits > 127)) 39 fputc('.', stderr); 40 else 41 fputc(bits, stderr); 42 } 43 } 44 45 return 0; 46 } 47